Bug 989307 - Make FUEL warn deprecation to the console on first usage. r=jaws

This commit is contained in:
Sushrut Girdhari 2015-04-03 15:42:04 -04:00
parent 72b88789d0
commit bf8036ff6d
4 changed files with 24 additions and 4 deletions

View File

@ -258,7 +258,7 @@ const gXPInstallObserver = {
label: gNavigatorBundle.getString("addonInstallRestartButton"), label: gNavigatorBundle.getString("addonInstallRestartButton"),
accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"), accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"),
callback: function() { callback: function() {
Application.restart(); BrowserUtils.restartApplication();
} }
}; };
} }
@ -374,7 +374,7 @@ var LightWeightThemeWebInstaller = {
label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"), label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"),
accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"), accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"),
callback: function () { callback: function () {
Application.restart(); BrowserUtils.restartApplication();
} }
}; };

View File

@ -3924,8 +3924,8 @@
<!-- Deprecated stuff, implemented for backwards compatibility. --> <!-- Deprecated stuff, implemented for backwards compatibility. -->
<method name="enterTabbedMode"> <method name="enterTabbedMode">
<body> <body>
Application.console.log("enterTabbedMode is an obsolete method and " + Services.console.logStringMessage("enterTabbedMode is an obsolete method and " +
"will be removed in a future release."); "will be removed in a future release.");
</body> </body>
</method> </method>
<field name="mTabbedMode" readonly="true">true</field> <field name="mTabbedMode" readonly="true">true</field>

View File

@ -6,6 +6,8 @@ const Ci = Components.interfaces;
const Cc = Components.classes; const Cc = Components.classes;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"); const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66");
const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1"; const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1";
@ -734,6 +736,9 @@ var ApplicationFactory = {
//================================================= //=================================================
// Application constructor // Application constructor
function Application() { function Application() {
Deprecated.warning("FUEL is deprecated, you should use the add-on SDK instead.",
"https://developer.mozilla.org/Add-ons/SDK/");
this.initToolkitHelpers(); this.initToolkitHelpers();
} }

View File

@ -22,6 +22,21 @@ this.BrowserUtils = {
dump("\n"); dump("\n");
}, },
/**
* restartApplication: Restarts the application, keeping it in
* safe mode if it is already in safe mode.
*/
restartApplication: function() {
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
//if already in safe mode restart in safe mode
if (Services.appinfo.inSafeMode) {
appStartup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
return;
}
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
},
/** /**
* urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal * urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal
* and checkLoadURIStrWithPrincipal. * and checkLoadURIStrWithPrincipal.