Skip to content

Commit

Permalink
Merge branch 'nightly' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ithinc committed Mar 20, 2014
2 parents 2cee663 + 62c0cf6 commit 37c0fd4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 54 deletions.
4 changes: 2 additions & 2 deletions chrome/content/tabutils-pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ tabutils._phantomTabs = function() {
}

if (!aRestoring) {
tabutils._ss.setTabValue(aTab, "pinned", true);
tabutils._ss.setTabValue(aTab, "bookmarkId", aTab.bookmarkId);
tabutils._ss.setTabValue(aTab, "pinned", "true");
tabutils._ss.setTabValue(aTab, "bookmarkId", String(aTab.bookmarkId || "")); // Bug 961646
}
aTab.dispatchEvent(new CustomEvent("TabPinning", {bubbles: true}));

Expand Down
28 changes: 28 additions & 0 deletions chrome/content/tabutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,34 @@ tabutils._tabOpeningOptions = function() {
}
});

let tmp = {};
Cu.import("resource://gre/modules/DownloadLastDir.jsm", tmp);

if (tmp.DownloadLastDir && // Bug 722995 [Fx19]
tmp.DownloadLastDir.prototype.getFileAsync && // Bug 854299 [Fx23]
tmp.DownloadLastDir.prototype.getFileAsync.name != "TU_getFileAsync")
tmp.DownloadLastDir.prototype.getFileAsync = (function() {
let getFileAsync = tmp.DownloadLastDir.prototype.getFileAsync;
return function TU_getFileAsync(aURI, aCallback) {
let win = this.window;
if (win._closeTimer) {
win.clearTimeout(win._closeTimer);
win._closeTimer = null;

aCallback = (function() {
let lastDirCallback = aCallback;
return function TU_LastDirCallback(lastDir) {
lastDirCallback(lastDir);
if (!win.closed) {
win.setTimeout(win.close, 250);
}
};
})();
}
getFileAsync.apply(this, arguments);
};
})();

//在当前标签页的右侧打开新标签页
//连续打开后台标签时保持原有顺序
TU_hookCode("gBrowser.addTab",
Expand Down
56 changes: 4 additions & 52 deletions chrome/content/unknownContentType.xul
Original file line number Diff line number Diff line change
@@ -1,62 +1,14 @@
<?xml version="1.0"?>
<overlay id="tabutils-unknownContentType" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="tulib.js"/>
<script type="application/javascript">
<![CDATA[
var win = window.opener;
if (win && win._closeTimer) {
win.clearTimeout(win._closeTimer);
function isUsableDirectory(aDirectory)
{
return aDirectory.exists() && aDirectory.isDirectory() &&
aDirectory.isWritable();
}
const PREF_BD_USEDOWNLOADDIR = "browser.download.useDownloadDir";
const nsITimer = Components.interfaces.nsITimer;
try {
var downloadModule = {};
Components.utils.import("resource://gre/modules/DownloadLastDir.jsm", downloadModule); // Bug 722995 [Fx19]
Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
Components.utils.import("resource://gre/modules/Downloads.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/Task.jsm");
} catch (e) {}
if ("promptForSaveToFileAsync" in dialog) // Bug 854299 [Fx23]
TU_hookCode("dialog.promptForSaveToFileAsync", /.*saveDestinationAvailable.*/g, function(s) (function() {
{
$0;
aContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
.close();
}
}).toString().replace(/^.*{|}$/g, "").replace("$0", s));
TU_hookCode("dialog.promptForSaveToFile", /(return;|return null;|return result;)/g, function(s) (function() {
{
aContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
.close();
$0;
}
}).toString().replace(/^.*{|}$/g, "").replace("$0", s));
TU_hookCode("dialog.onOK", /(?=return true;)/, function() {
if (!this._saveToDiskTimer)
this.mContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
.close();
});
TU_hookCode("dialog.onCancel", /(?=return true;)/, function() {
this.mContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow)
.close();
});
window.addEventListener("unload", function() {
if (win._closeTimer && !win.closed)
win._closeTimer = win.setTimeout(win.close, 250);
}, false);
}
]]>
</script>
Expand Down

0 comments on commit 37c0fd4

Please sign in to comment.