|
1 | 1 | <?xml version="1.0"?>
|
2 | 2 | <overlay id="tabutils-unknownContentType" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
3 |
| - <script type="application/javascript" src="tulib.js"/> |
4 | 3 | <script type="application/javascript">
|
5 | 4 | <![CDATA[
|
6 | 5 | var win = window.opener;
|
7 | 6 | if (win && win._closeTimer) {
|
8 | 7 | win.clearTimeout(win._closeTimer);
|
9 |
| -
|
10 |
| - function isUsableDirectory(aDirectory) |
11 |
| - { |
12 |
| - return aDirectory.exists() && aDirectory.isDirectory() && |
13 |
| - aDirectory.isWritable(); |
14 |
| - } |
15 |
| -
|
16 |
| - const PREF_BD_USEDOWNLOADDIR = "browser.download.useDownloadDir"; |
17 |
| - const nsITimer = Components.interfaces.nsITimer; |
18 |
| -
|
19 |
| - try { |
20 |
| - var downloadModule = {}; |
21 |
| - Components.utils.import("resource://gre/modules/DownloadLastDir.jsm", downloadModule); // Bug 722995 [Fx19] |
22 |
| - Components.utils.import("resource://gre/modules/DownloadLastDir.jsm"); |
23 |
| - Components.utils.import("resource://gre/modules/Downloads.jsm"); |
24 |
| - Components.utils.import("resource://gre/modules/FileUtils.jsm"); |
25 |
| - Components.utils.import("resource://gre/modules/Services.jsm"); |
26 |
| - Components.utils.import("resource://gre/modules/Task.jsm"); |
27 |
| - } catch (e) {} |
28 |
| -
|
29 |
| - if ("promptForSaveToFileAsync" in dialog) // Bug 854299 [Fx23] |
30 |
| - TU_hookCode("dialog.promptForSaveToFileAsync", /.*saveDestinationAvailable.*/g, function(s) (function() { |
31 |
| - { |
32 |
| - $0; |
33 |
| - aContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
34 |
| - .getInterface(Components.interfaces.nsIDOMWindow) |
35 |
| - .close(); |
36 |
| - } |
37 |
| - }).toString().replace(/^.*{|}$/g, "").replace("$0", s)); |
38 |
| -
|
39 |
| - TU_hookCode("dialog.promptForSaveToFile", /(return;|return null;|return result;)/g, function(s) (function() { |
40 |
| - { |
41 |
| - aContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
42 |
| - .getInterface(Components.interfaces.nsIDOMWindow) |
43 |
| - .close(); |
44 |
| - $0; |
45 |
| - } |
46 |
| - }).toString().replace(/^.*{|}$/g, "").replace("$0", s)); |
47 |
| -
|
48 |
| - TU_hookCode("dialog.onOK", /(?=return true;)/, function() { |
49 |
| - if (!this._saveToDiskTimer) |
50 |
| - this.mContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
51 |
| - .getInterface(Components.interfaces.nsIDOMWindow) |
52 |
| - .close(); |
53 |
| - }); |
54 |
| -
|
55 |
| - TU_hookCode("dialog.onCancel", /(?=return true;)/, function() { |
56 |
| - this.mContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
57 |
| - .getInterface(Components.interfaces.nsIDOMWindow) |
58 |
| - .close(); |
59 |
| - }); |
| 8 | + window.addEventListener("unload", function() { |
| 9 | + win && win.setTimeout(function() {this.close();}, 250); |
| 10 | + }, false); |
60 | 11 | }
|
61 | 12 | ]]>
|
62 | 13 | </script>
|
|
0 commit comments