Bug 720984 - contentAreaUtils.js: getTargetFile leaks gDownloadLastDir into the global scope. r=gavin

This commit is contained in:
Dão Gottwald 2012-01-26 13:09:45 +01:00
parent a8611d3d04
commit 3216b07af4
2 changed files with 4 additions and 2 deletions

View File

@ -563,8 +563,9 @@ function initFileInfo(aFI, aURL, aURLCharset, aDocument,
*/
function getTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRelatedURI)
{
if (typeof gDownloadLastDir != "object")
Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
if (!getTargetFile.gDownloadLastDir)
Components.utils.import("resource://gre/modules/DownloadLastDir.jsm", getTargetFile);
var gDownloadLastDir = getTargetFile.gDownloadLastDir;
var prefs = getPrefsBrowserDownload("browser.download.");
var useDownloadDir = prefs.getBoolPref("useDownloadDir");

View File

@ -43,6 +43,7 @@ function loadUtilsScript() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://global/content/contentAreaUtils.js");
Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
}
do_get_profile();