Bug 986499 - Make the calls to import Deprecated.jsm lazy. r=yoric

This commit is contained in:
Abhishek Potnis 2014-03-28 10:36:48 -04:00
parent 0c67224bf9
commit 18ecb43dde
5 changed files with 12 additions and 5 deletions

View File

@ -1239,7 +1239,7 @@ ContentPrefService.prototype = {
}; };
function warnDeprecated() { function warnDeprecated() {
Cu.import("resource://gre/modules/Deprecated.jsm"); let Deprecated = Cu.import("resource://gre/modules/Deprecated.jsm", {}).Deprecated;
Deprecated.warning("nsIContentPrefService is deprecated. Please use nsIContentPrefService2 instead.", Deprecated.warning("nsIContentPrefService is deprecated. Please use nsIContentPrefService2 instead.",
"https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIContentPrefService2", "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIContentPrefService2",
Components.stack.caller); Components.stack.caller);

View File

@ -26,9 +26,12 @@ const Ci = Components.interfaces;
let SharedAll = {}; let SharedAll = {};
Cu.import("resource://gre/modules/osfile/osfile_shared_allthreads.jsm", SharedAll); Cu.import("resource://gre/modules/osfile/osfile_shared_allthreads.jsm", SharedAll);
Cu.import("resource://gre/modules/Deprecated.jsm", this); Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this); Cu.import("resource://gre/modules/Timer.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, 'Deprecated',
'resource://gre/modules/Deprecated.jsm');
// Boilerplate, to simplify the transition to require() // Boilerplate, to simplify the transition to require()
let LOG = SharedAll.LOG.bind(SharedAll, "Controller"); let LOG = SharedAll.LOG.bind(SharedAll, "Controller");
let isTypedArray = SharedAll.isTypedArray; let isTypedArray = SharedAll.isTypedArray;

View File

@ -16,9 +16,10 @@ Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm"); Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Deprecated.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS", XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm"); "resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Sqlite", XPCOMUtils.defineLazyModuleGetter(this, "Sqlite",

View File

@ -13,11 +13,14 @@ const Cr = Components.results;
const Cu = Components.utils; const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm", this); Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/Deprecated.jsm", this); Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/osfile.jsm", this); Cu.import("resource://gre/modules/osfile.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this); Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm", this); Cu.import("resource://gre/modules/Promise.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, 'Deprecated',
'resource://gre/modules/Deprecated.jsm');
const Telemetry = Services.telemetry; const Telemetry = Services.telemetry;
// Files that have been lying around for longer than MAX_PING_FILE_AGE are // Files that have been lying around for longer than MAX_PING_FILE_AGE are

View File

@ -104,7 +104,7 @@ DownloadLastDir.prototype = {
// This function is now deprecated as it uses the sync nsIContentPrefService // This function is now deprecated as it uses the sync nsIContentPrefService
// interface. New consumers should use the getFileAsync function. // interface. New consumers should use the getFileAsync function.
getFile: function (aURI) { getFile: function (aURI) {
Components.utils.import("resource://gre/modules/Deprecated.jsm"); let Deprecated = Components.utils.import("resource://gre/modules/Deprecated.jsm", {}).Deprecated;
Deprecated.warning("DownloadLastDir.getFile is deprecated. Please use getFileAsync instead.", Deprecated.warning("DownloadLastDir.getFile is deprecated. Please use getFileAsync instead.",
"https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/DownloadLastDir.jsm", "https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/DownloadLastDir.jsm",
Components.stack.caller); Components.stack.caller);