зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1446676: Part 2 - Update non-overlay automation extensions to be bootstrapped. r=Mossop
In order to remove support for non-bootstrapped extensions, the remaining test automation extensions need to be migrated to bootstrapped extensions. These extensions all work by loading a single component, either with a profile-after-change or command line handler. This is a straightforward conversion of those components to bootstrap.js scripts. MozReview-Commit-ID: 5uyNSqRPIVR --HG-- rename : services/sync/tps/extensions/tps/components/tps-cmdline.js => services/sync/tps/extensions/tps/bootstrap.js rename : testing/talos/talos/pageloader/components/tp-cmdline.js => testing/talos/talos/pageloader/bootstrap.js rename : testing/talos/talos/startup_test/sessionrestore/addon/SessionRestoreTalosTest.js => testing/talos/talos/startup_test/sessionrestore/addon/bootstrap.js rename : testing/talos/talos/talos-powers/components/TalosPowersService.js => testing/talos/talos/talos-powers/bootstrap.js rename : tools/quitter/QuitterObserver.js => tools/quitter/bootstrap.js extra : rebase_source : 738264d0ec8701aa5cf93c6dac958d88756c1e55 extra : source : 71d65d6b64997bc608a1cb3c924be35bbd460b39
This commit is contained in:
Родитель
d73b8f03d4
Коммит
946e1ef0b5
|
@ -0,0 +1,99 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "categoryManager",
|
||||
"@mozilla.org/categorymanager;1",
|
||||
"nsICategoryManager");
|
||||
|
||||
const Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
|
||||
const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
|
||||
|
||||
const CATEGORY_NAME = "command-line-handler";
|
||||
const CATEGORY_ENTRY = "m-tps";
|
||||
|
||||
function TPSCmdLine() {}
|
||||
|
||||
TPSCmdLine.prototype = {
|
||||
factory: XPCOMUtils._getFactory(TPSCmdLine),
|
||||
classDescription: "TPSCmdLine",
|
||||
classID: Components.ID("{4e5bd3f0-41d3-11df-9879-0800200c9a66}"),
|
||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=tps",
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||
|
||||
register() {
|
||||
Cm.registerFactory(this.classID, this.classDescription,
|
||||
this.contractID, this.factory);
|
||||
|
||||
categoryManager.addCategoryEntry(CATEGORY_NAME, CATEGORY_ENTRY,
|
||||
this.contractID, false, true);
|
||||
},
|
||||
|
||||
unregister() {
|
||||
categoryManager.deleteCategoryEntry(CATEGORY_NAME, CATEGORY_ENTRY,
|
||||
this.contractID, false);
|
||||
|
||||
Cm.unregisterFactory(this.classID, this.factory);
|
||||
},
|
||||
|
||||
/* nsICmdLineHandler */
|
||||
commandLineArgument: "-tps",
|
||||
prefNameForStartup: "general.startup.tps",
|
||||
helpText: "Run TPS tests with the given test file.",
|
||||
handlesArgs: true,
|
||||
defaultArgs: "",
|
||||
openWindowWithArgs: true,
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
handle: function handler_handle(cmdLine) {
|
||||
let options = {};
|
||||
|
||||
let uristr = cmdLine.handleFlagWithParam("tps", false);
|
||||
if (uristr == null)
|
||||
return;
|
||||
let phase = cmdLine.handleFlagWithParam("tpsphase", false);
|
||||
if (phase == null)
|
||||
throw Error("must specify --tpsphase with --tps");
|
||||
let logfile = cmdLine.handleFlagWithParam("tpslogfile", false);
|
||||
if (logfile == null)
|
||||
logfile = "";
|
||||
|
||||
options.ignoreUnusedEngines = cmdLine.handleFlag("ignore-unused-engines",
|
||||
false);
|
||||
let uri = cmdLine.resolveURI(OS.Path.normalize(uristr)).spec;
|
||||
|
||||
const onStartupFinished = () => {
|
||||
Services.obs.removeObserver(onStartupFinished, "browser-delayed-startup-finished");
|
||||
/* Ignore the platform's online/offline status while running tests. */
|
||||
Services.io.manageOfflineStatus = false;
|
||||
Services.io.offline = false;
|
||||
ChromeUtils.import("resource://tps/tps.jsm");
|
||||
ChromeUtils.import("resource://tps/quit.js", TPS);
|
||||
TPS.RunTestPhase(uri, phase, logfile, options).catch(err => TPS.DumpError("TestPhase failed", err));
|
||||
};
|
||||
Services.obs.addObserver(onStartupFinished, "browser-delayed-startup-finished");
|
||||
},
|
||||
|
||||
helpInfo: " --tps <file> Run TPS tests with the given test file.\n" +
|
||||
" --tpsphase <phase> Run the specified phase in the TPS test.\n" +
|
||||
" --tpslogfile <file> Logfile for TPS output.\n" +
|
||||
" --ignore-unused-engines Don't load engines not used in tests.\n",
|
||||
};
|
||||
|
||||
function startup(data, reason) {
|
||||
TPSCmdLine.prototype.register();
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {
|
||||
TPSCmdLine.prototype.unregister();
|
||||
}
|
||||
|
||||
function install(data, reason) {}
|
||||
function uninstall(data, reason) {}
|
|
@ -1,5 +1 @@
|
|||
resource tps resource/
|
||||
|
||||
component {4e5bd3f0-41d3-11df-9879-0800200c9a66} components/tps-cmdline.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=tps {4e5bd3f0-41d3-11df-9879-0800200c9a66}
|
||||
category command-line-handler m-tps @mozilla.org/commandlinehandler/general-startup;1?type=tps
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const TPS_ID = "tps@mozilla.org";
|
||||
const TPS_CMDLINE_CONTRACTID = "@mozilla.org/commandlinehandler/general-startup;1?type=tps";
|
||||
const TPS_CMDLINE_CLSID = Components.ID("{4e5bd3f0-41d3-11df-9879-0800200c9a66}");
|
||||
const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
|
||||
const nsISupports = Ci.nsISupports;
|
||||
|
||||
const nsICategoryManager = Ci.nsICategoryManager;
|
||||
const nsICmdLineHandler = Ci.nsICmdLineHandler;
|
||||
const nsICommandLine = Ci.nsICommandLine;
|
||||
const nsICommandLineHandler = Ci.nsICommandLineHandler;
|
||||
const nsIComponentRegistrar = Ci.nsIComponentRegistrar;
|
||||
const nsISupportsString = Ci.nsISupportsString;
|
||||
const nsIWindowWatcher = Ci.nsIWindowWatcher;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
function TPSCmdLineHandler() {}
|
||||
|
||||
TPSCmdLineHandler.prototype = {
|
||||
classDescription: "TPSCmdLineHandler",
|
||||
classID: TPS_CMDLINE_CLSID,
|
||||
contractID: TPS_CMDLINE_CONTRACTID,
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([nsISupports,
|
||||
nsICommandLineHandler,
|
||||
nsICmdLineHandler]), /* nsISupports */
|
||||
|
||||
/* nsICmdLineHandler */
|
||||
commandLineArgument: "-tps",
|
||||
prefNameForStartup: "general.startup.tps",
|
||||
helpText: "Run TPS tests with the given test file.",
|
||||
handlesArgs: true,
|
||||
defaultArgs: "",
|
||||
openWindowWithArgs: true,
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
handle: function handler_handle(cmdLine) {
|
||||
let options = {};
|
||||
|
||||
let uristr = cmdLine.handleFlagWithParam("tps", false);
|
||||
if (uristr == null)
|
||||
return;
|
||||
let phase = cmdLine.handleFlagWithParam("tpsphase", false);
|
||||
if (phase == null)
|
||||
throw Error("must specify --tpsphase with --tps");
|
||||
let logfile = cmdLine.handleFlagWithParam("tpslogfile", false);
|
||||
if (logfile == null)
|
||||
logfile = "";
|
||||
|
||||
options.ignoreUnusedEngines = cmdLine.handleFlag("ignore-unused-engines",
|
||||
false);
|
||||
let uri = cmdLine.resolveURI(OS.Path.normalize(uristr)).spec;
|
||||
|
||||
const onStartupFinished = () => {
|
||||
Services.obs.removeObserver(onStartupFinished, "browser-delayed-startup-finished");
|
||||
/* Ignore the platform's online/offline status while running tests. */
|
||||
Services.io.manageOfflineStatus = false;
|
||||
Services.io.offline = false;
|
||||
ChromeUtils.import("resource://tps/tps.jsm");
|
||||
ChromeUtils.import("resource://tps/quit.js", TPS);
|
||||
TPS.RunTestPhase(uri, phase, logfile, options).catch(err => TPS.DumpError("TestPhase failed", err));
|
||||
};
|
||||
Services.obs.addObserver(onStartupFinished, "browser-delayed-startup-finished");
|
||||
},
|
||||
|
||||
helpInfo: " --tps <file> Run TPS tests with the given test file.\n" +
|
||||
" --tpsphase <phase> Run the specified phase in the TPS test.\n" +
|
||||
" --tpslogfile <file> Logfile for TPS output.\n" +
|
||||
" --ignore-unused-engines Don't load engines not used in tests.\n",
|
||||
};
|
||||
|
||||
|
||||
var TPSCmdLineFactory = {
|
||||
createInstance(outer, iid) {
|
||||
if (outer != null) {
|
||||
throw new Error(Cr.NS_ERROR_NO_AGGREGATION);
|
||||
}
|
||||
|
||||
return new TPSCmdLineHandler().QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var TPSCmdLineModule = {
|
||||
registerSelf(compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(TPS_CMDLINE_CLSID,
|
||||
"TPS CommandLine Service",
|
||||
TPS_CMDLINE_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
||||
var catman = Cc[CATMAN_CONTRACTID].getService(nsICategoryManager);
|
||||
catman.addCategoryEntry("command-line-argument-handlers",
|
||||
"TPS command line handler",
|
||||
TPS_CMDLINE_CONTRACTID, true, true);
|
||||
catman.addCategoryEntry("command-line-handler",
|
||||
"m-tps",
|
||||
TPS_CMDLINE_CONTRACTID, true, true);
|
||||
},
|
||||
|
||||
unregisterSelf(compMgr, fileSpec, location) {
|
||||
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
||||
|
||||
compMgr.unregisterFactoryLocation(TPS_CMDLINE_CLSID, fileSpec);
|
||||
let catman = Cc[CATMAN_CONTRACTID].getService(nsICategoryManager);
|
||||
catman.deleteCategoryEntry("command-line-argument-handlers",
|
||||
"TPS command line handler", true);
|
||||
catman.deleteCategoryEntry("command-line-handler",
|
||||
"m-tps", true);
|
||||
},
|
||||
|
||||
getClassObject(compMgr, cid, iid) {
|
||||
if (cid.equals(TPS_CMDLINE_CLSID)) {
|
||||
return TPSCmdLineFactory;
|
||||
}
|
||||
|
||||
if (!iid.equals(Ci.nsIFactory)) {
|
||||
throw new Error(Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
throw new Error(Cr.NS_ERROR_NO_INTERFACE);
|
||||
},
|
||||
|
||||
canUnload(compMgr) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
|
||||
* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
|
||||
*/
|
||||
if (XPCOMUtils.generateNSGetFactory)
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([TPSCmdLineHandler]);
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return TPSCmdLineModule;
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>tps@mozilla.org</em:id>
|
||||
<em:version>0.5</em:version>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
|
||||
<em:targetApplication>
|
||||
<!-- Firefox -->
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
"{profile}\\extensions\\pageloader@mozilla.org\\plugins": {},
|
||||
"{profile}\\extensions\\pageloader@mozilla.org\\searchplugins": {},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org": {},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org\\bootstrap.js": {},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org\\chrome.manifest": {},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org\\chrome\\talos-powers-content.js": {},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org\\components\\talospowersservice.js": {},
|
||||
|
|
|
@ -40,32 +40,42 @@
|
|||
// This only implements nsICommandLineHandler, since it needs
|
||||
// to handle multiple arguments.
|
||||
|
||||
const TP_CMDLINE_CONTRACTID = "@mozilla.org/commandlinehandler/general-startup;1?type=tp";
|
||||
const TP_CMDLINE_CLSID = Components.ID("{8AF052F5-8EFE-4359-8266-E16498A82E8B}");
|
||||
const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
|
||||
const nsISupports = Ci.nsISupports;
|
||||
|
||||
const nsICategoryManager = Ci.nsICategoryManager;
|
||||
const nsICommandLine = Ci.nsICommandLine;
|
||||
const nsICommandLineHandler = Ci.nsICommandLineHandler;
|
||||
const nsIComponentRegistrar = Ci.nsIComponentRegistrar;
|
||||
const nsISupportsString = Ci.nsISupportsString;
|
||||
const nsIWindowWatcher = Ci.nsIWindowWatcher;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
function PageLoaderCmdLineHandler() {}
|
||||
PageLoaderCmdLineHandler.prototype =
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "categoryManager",
|
||||
"@mozilla.org/categorymanager;1",
|
||||
"nsICategoryManager");
|
||||
|
||||
const Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
|
||||
const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
|
||||
|
||||
const CATEGORY_NAME = "command-line-handler";
|
||||
const CATEGORY_ENTRY = "m-tp";
|
||||
|
||||
function PageLoaderCmdLine() {}
|
||||
PageLoaderCmdLine.prototype =
|
||||
{
|
||||
/* nsISupports */
|
||||
QueryInterface: function handler_QI(iid) {
|
||||
if (iid.equals(nsISupports))
|
||||
return this;
|
||||
factory: XPCOMUtils._getFactory(PageLoaderCmdLine),
|
||||
classDescription: "Loads pages. Tests them.",
|
||||
classID: Components.ID("{8AF052F5-8EFE-4359-8266-E16498A82E8B}"),
|
||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=tp",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||
|
||||
if (nsICommandLineHandler && iid.equals(nsICommandLineHandler))
|
||||
return this;
|
||||
register() {
|
||||
Cm.registerFactory(this.classID, this.classDescription,
|
||||
this.contractID, this.factory);
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
categoryManager.addCategoryEntry(CATEGORY_NAME, CATEGORY_ENTRY,
|
||||
this.contractID, false, true);
|
||||
},
|
||||
|
||||
unregister() {
|
||||
categoryManager.deleteCategoryEntry(CATEGORY_NAME, CATEGORY_ENTRY,
|
||||
this.contractID, false);
|
||||
|
||||
Cm.unregisterFactory(this.classID, this.factory);
|
||||
},
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
|
@ -93,62 +103,13 @@ PageLoaderCmdLineHandler.prototype =
|
|||
},
|
||||
};
|
||||
|
||||
|
||||
var PageLoaderCmdLineFactory =
|
||||
{
|
||||
createInstance(outer, iid) {
|
||||
if (outer != null) {
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
return new PageLoaderCmdLineHandler().QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
function NSGetFactory(cid) {
|
||||
if (!cid.equals(TP_CMDLINE_CLSID))
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return PageLoaderCmdLineFactory;
|
||||
function startup(data, reason) {
|
||||
PageLoaderCmdLine.prototype.register();
|
||||
}
|
||||
|
||||
var PageLoaderCmdLineModule =
|
||||
{
|
||||
registerSelf(compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(TP_CMDLINE_CLSID,
|
||||
"PageLoader CommandLine Service",
|
||||
TP_CMDLINE_CONTRACTID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
||||
var catman = Cc[CATMAN_CONTRACTID].getService(nsICategoryManager);
|
||||
catman.addCategoryEntry("command-line-handler",
|
||||
"m-tp",
|
||||
TP_CMDLINE_CONTRACTID, true, true);
|
||||
},
|
||||
|
||||
unregisterSelf(compMgr, fileSpec, location) {
|
||||
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
||||
|
||||
compMgr.unregisterFactoryLocation(TP_CMDLINE_CLSID, fileSpec);
|
||||
var catman = Cc[CATMAN_CONTRACTID].getService(nsICategoryManager);
|
||||
catman.deleteCategoryEntry("command-line-handler",
|
||||
"m-tp", true);
|
||||
},
|
||||
|
||||
getClassObject(compMgr, cid, iid) {
|
||||
return NSGetFactory(cid);
|
||||
},
|
||||
|
||||
canUnload(compMgr) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return PageLoaderCmdLineModule;
|
||||
function shutdown(data, reason) {
|
||||
PageLoaderCmdLine.prototype.unregister();
|
||||
}
|
||||
|
||||
function install(data, reason) {}
|
||||
function uninstall(data, reason) {}
|
|
@ -1,4 +1 @@
|
|||
content pageloader chrome/
|
||||
component {8AF052F5-8EFE-4359-8266-E16498A82E8B} components/tp-cmdline.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=tp {8AF052F5-8EFE-4359-8266-E16498A82E8B}
|
||||
category command-line-handler m-tp @mozilla.org/commandlinehandler/general-startup;1?type=tp
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>pageloader@mozilla.org</em:id>
|
||||
<em:version>1.0.32</em:version>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
|
|
|
@ -16,23 +16,13 @@ ChromeUtils.defineModuleGetter(this, "StartupPerformance",
|
|||
"resource:///modules/sessionstore/StartupPerformance.jsm");
|
||||
|
||||
// Observer Service topics.
|
||||
const STARTUP_TOPIC = "profile-after-change";
|
||||
const WINDOW_READY_TOPIC = "browser-delayed-startup-finished";
|
||||
|
||||
// Process Message Manager topics.
|
||||
const MSG_REQUEST = "session-restore-test?duration";
|
||||
const MSG_PROVIDE = "session-restore-test:duration";
|
||||
|
||||
function nsSessionRestoreTalosTest() { }
|
||||
|
||||
nsSessionRestoreTalosTest.prototype = {
|
||||
classID: Components.ID("{716346e5-0c45-4aa2-b601-da36f3c74bd8}"),
|
||||
|
||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(nsSessionRestoreTalosTest),
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// // nsISupports
|
||||
|
||||
const sessionRestoreTest = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,9 +30,6 @@ nsSessionRestoreTalosTest.prototype = {
|
|||
|
||||
observe: function DS_observe(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case STARTUP_TOPIC:
|
||||
this.init();
|
||||
break;
|
||||
case StartupPerformance.RESTORED_TOPIC:
|
||||
this.onReady(true);
|
||||
break;
|
||||
|
@ -147,7 +134,11 @@ nsSessionRestoreTalosTest.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// // Module
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSessionRestoreTalosTest]);
|
||||
function startup(data, reason) {
|
||||
sessionRestoreTest.init();
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {}
|
||||
function install(data, reason) {}
|
||||
function uninstall(data, reason) {}
|
|
@ -1,8 +1 @@
|
|||
# Register a component to be informed of startup. This component can then register
|
||||
# itself to watch sessionstore-windows-restored. Once it has observed
|
||||
# sessionstore-windows-restored, it will open the webpage with the harness.
|
||||
component {716346e5-0c45-4aa2-b601-da36f3c74bd8} SessionRestoreTalosTest.js
|
||||
contract @mozilla.org/talos/session-restore-test;1 {716346e5-0c45-4aa2-b601-da36f3c74bd8}
|
||||
category profile-after-change nsSessionRestoreTalosTest @mozilla.org/talos/session-restore-test;1
|
||||
|
||||
content session-restore-test content/
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<em:id>session-restore-test-2@mozilla.org</em:id>
|
||||
<em:name>Session Restore Startup Performance Test</em:name>
|
||||
<em:version>2.0.11</em:version>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
|
|
|
@ -8,29 +8,34 @@ ChromeUtils.defineModuleGetter(this, "Services",
|
|||
ChromeUtils.defineModuleGetter(this, "OS",
|
||||
"resource://gre/modules/osfile.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["TextEncoder"]);
|
||||
|
||||
const Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
|
||||
const FRAME_SCRIPT = "chrome://talos-powers/content/talos-powers-content.js";
|
||||
|
||||
function TalosPowersService() {
|
||||
this.wrappedJSObject = this;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
TalosPowersService.prototype = {
|
||||
factory: XPCOMUtils._getFactory(TalosPowersService),
|
||||
classDescription: "Talos Powers",
|
||||
classID: Components.ID("{f5d53443-d58d-4a2f-8df0-98525d4f91ad}"),
|
||||
contractID: "@mozilla.org/talos/talos-powers-service;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
|
||||
observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "profile-after-change":
|
||||
// Note that this observation is registered in the chrome.manifest
|
||||
// for this add-on.
|
||||
this.init();
|
||||
break;
|
||||
case "xpcom-shutdown":
|
||||
this.uninit();
|
||||
break;
|
||||
}
|
||||
register() {
|
||||
Cm.registerFactory(this.classID, this.classDescription,
|
||||
this.contractID, this.factory);
|
||||
|
||||
void Cc[this.contractID].getService();
|
||||
},
|
||||
|
||||
unregister() {
|
||||
Cm.unregisterFactory(this.classID, this.factory);
|
||||
},
|
||||
|
||||
init() {
|
||||
|
@ -40,11 +45,6 @@ TalosPowersService.prototype = {
|
|||
Services.mm.addMessageListener("TalosPowersContent:ForceCCAndGC", this);
|
||||
Services.mm.addMessageListener("TalosPowersContent:GetStartupInfo", this);
|
||||
Services.mm.addMessageListener("TalosPowers:ParentExec:QueryMsg", this);
|
||||
Services.obs.addObserver(this, "xpcom-shutdown");
|
||||
},
|
||||
|
||||
uninit() {
|
||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||
},
|
||||
|
||||
receiveMessage(message) {
|
||||
|
@ -327,4 +327,12 @@ TalosPowersService.prototype = {
|
|||
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TalosPowersService]);
|
||||
function startup(data, reason) {
|
||||
TalosPowersService.prototype.register();
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {
|
||||
TalosPowersService.prototype.unregister();
|
||||
}
|
||||
function install(data, reason) {}
|
||||
function uninstall(data, reason) {}
|
|
@ -1,5 +1,2 @@
|
|||
content talos-powers chrome/
|
||||
content talos-powers-content content/ contentaccessible=yes
|
||||
component {f5d53443-d58d-4a2f-8df0-98525d4f91ad} components/TalosPowersService.js
|
||||
contract @mozilla.org/talos/talos-powers-service;1 {f5d53443-d58d-4a2f-8df0-98525d4f91ad}
|
||||
category profile-after-change TalosPowersService @mozilla.org/talos/talos-powers-service;1
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>talos-powers@mozilla.org</em:id>
|
||||
<em:version>1.0.14</em:version>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
|
|
|
@ -275,6 +275,12 @@
|
|||
"minbytes": 0,
|
||||
"maxbytes": 512
|
||||
},
|
||||
"{profile}\\extensions\\pageloader@mozilla.org\\bootstrap.js": {
|
||||
"mincount": 0,
|
||||
"maxcount": 6,
|
||||
"minbytes": 0,
|
||||
"maxbytes": 30000
|
||||
},
|
||||
"{profile}\\extensions\\pageloader@mozilla.org\\chrome.manifest": {
|
||||
"mincount": 2,
|
||||
"maxcount": 2,
|
||||
|
@ -329,6 +335,12 @@
|
|||
"minbytes": 0,
|
||||
"maxbytes": 8192
|
||||
},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org\\bootstrap.js": {
|
||||
"mincount": 0,
|
||||
"maxcount": 6,
|
||||
"minbytes": 0,
|
||||
"maxbytes": 30000
|
||||
},
|
||||
"{profile}\\extensions\\talos-powers@mozilla.org\\chrome.manifest": {
|
||||
"mincount": 2,
|
||||
"maxcount": 2,
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const CHILD_SCRIPT = "chrome://quitter/content/contentscript.js";
|
||||
|
||||
/* XPCOM gunk */
|
||||
function QuitterObserver() {}
|
||||
|
||||
QuitterObserver.prototype = {
|
||||
classDescription: "Quitter Observer for use in testing.",
|
||||
classID: Components.ID("{c235a986-5ac1-4f28-ad73-825dae9bad90}"),
|
||||
contractID: "@mozilla.org/quitter-observer;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
_xpcom_categories: [{category: "profile-after-change", service: true }],
|
||||
isFrameScriptLoaded: false,
|
||||
|
||||
observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "profile-after-change") {
|
||||
this.init();
|
||||
} else if (!this.isFrameScriptLoaded &&
|
||||
aTopic == "chrome-document-global-created") {
|
||||
|
||||
var messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIMessageBroadcaster);
|
||||
// Register for any messages our API needs us to handle
|
||||
messageManager.addMessageListener("Quitter.Quit", this);
|
||||
|
||||
messageManager.loadFrameScript(CHILD_SCRIPT, true);
|
||||
this.isFrameScriptLoaded = true;
|
||||
} else if (aTopic == "xpcom-shutdown") {
|
||||
this.uninit();
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
var obs = Services.obs;
|
||||
obs.addObserver(this, "xpcom-shutdown");
|
||||
obs.addObserver(this, "chrome-document-global-created");
|
||||
},
|
||||
|
||||
uninit() {
|
||||
var obs = Services.obs;
|
||||
obs.removeObserver(this, "chrome-document-global-created");
|
||||
},
|
||||
|
||||
/**
|
||||
* messageManager callback function
|
||||
* This will get requests from our API in the window and process them in chrome for it
|
||||
**/
|
||||
receiveMessage(aMessage) {
|
||||
switch (aMessage.name) {
|
||||
case "Quitter.Quit":
|
||||
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([QuitterObserver]);
|
|
@ -0,0 +1,43 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const CHILD_SCRIPT = "chrome://quitter/content/contentscript.js";
|
||||
|
||||
const quitterObserver = {
|
||||
init() {
|
||||
Services.mm.addMessageListener("Quitter.Quit", this);
|
||||
Services.mm.loadFrameScript(CHILD_SCRIPT, true);
|
||||
},
|
||||
|
||||
uninit() {
|
||||
Services.obs.removeObserver(this, "chrome-document-global-created");
|
||||
Services.mm.removeMessageListener("Quitter.Quit", this);
|
||||
Services.mm.removeDelayedFrameScript(CHILD_SCRIPT, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* messageManager callback function
|
||||
* This will get requests from our API in the window and process them in chrome for it
|
||||
**/
|
||||
receiveMessage(aMessage) {
|
||||
switch (aMessage.name) {
|
||||
case "Quitter.Quit":
|
||||
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function startup(data, reason) {
|
||||
quitterObserver.init();
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {
|
||||
quitterObserver.uninit();
|
||||
}
|
||||
|
||||
function install(data, reason) {}
|
||||
function uninstall(data, reason) {}
|
|
@ -1,4 +1 @@
|
|||
category profile-after-change @mozilla.org/quitter-observer;1 @mozilla.org/quitter-observer;1
|
||||
component {c235a986-5ac1-4f28-ad73-825dae9bad90} components/QuitterObserver.js
|
||||
content quitter chrome/quitter/content/
|
||||
contract @mozilla.org/quitter-observer;1 {c235a986-5ac1-4f28-ad73-825dae9bad90}
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>quitter@mozilla.org</em:id>
|
||||
<em:version>2016.03.10</em:version>
|
||||
<em:version>2018.03.19</em:version>
|
||||
<em:type>2</em:type>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
|
||||
<!-- Target Application this extension can install into,
|
||||
with minimum and maximum supported versions. -->
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'QuitterObserver.js',
|
||||
]
|
||||
|
||||
XPI_NAME = 'quitter'
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
@ -16,6 +12,7 @@ USE_EXTENSION_MANIFEST = True
|
|||
NO_JS_MANIFEST = True
|
||||
|
||||
FINAL_TARGET_FILES += [
|
||||
'bootstrap.js',
|
||||
'chrome.manifest',
|
||||
'install.rdf',
|
||||
]
|
||||
|
|
Двоичные данные
tools/quitter/quitter@mozilla.org.xpi
Двоичные данные
tools/quitter/quitter@mozilla.org.xpi
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче