Bug 1496649 Make tresize a webextension r=mconley

This is a pretty straightforward conversion.  We deliberately continue
to use chrome: urls in this test since those are loaded in the parent
process so test measurements will not include additional noise from
IPC to a content process.

--HG--
rename : testing/talos/talos/tests/tresize/addon/bootstrap.js => testing/talos/talos/tests/tresize/addon/api.js
rename : testing/talos/talos/tests/tresize/tresize-test.html => testing/talos/talos/tests/tresize/addon/chrome/tresize-test.html
rename : testing/talos/talos/tests/tresize/addon/install.rdf => testing/talos/talos/tests/tresize/addon/manifest.json
extra : rebase_source : d5449086194225b737c70885881ac297d3c4ecb6
This commit is contained in:
Andrew Swan 2018-10-05 21:30:08 -07:00
parent d3d1bdee59
commit e27aba6a15
8 changed files with 74 additions and 52 deletions

View File

@ -0,0 +1,48 @@
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",
});
XPCOMUtils.defineLazyServiceGetter(this, "aomStartup",
"@mozilla.org/addons/addon-manager-startup;1",
"amIAddonManagerStartup");
/* globals ExtensionAPI */
const PREFIX = "tresize@mozilla.org";
this.tresize = class extends ExtensionAPI {
onStartup() {
const manifestURI = Services.io.newURI("manifest.json", null, this.extension.rootURI);
this.chromeHandle = aomStartup.registerChrome(manifestURI, [
["content", "tresize", "chrome/"],
]);
let {baseURI} = this.extension;
this.listener = function listener({target, data}) {
let win = target.ownerGlobal;
Services.scriptloader.loadSubScript(baseURI.resolve("/content/Profiler.js"), win);
Services.scriptloader.loadSubScript(baseURI.resolve("/content/tresize.js"), win);
function sendResult(result) {
target.messageManager.sendAsyncMessage(`${PREFIX}:chrome-run-reply`, {id: data.id, result});
}
win.runTest(sendResult, data.locationSearch);
};
Services.mm.addMessageListener(`${PREFIX}:chrome-run-message`, this.listener);
this.framescriptURL = baseURI.resolve("/content/framescript.js");
Services.mm.loadFrameScript(this.framescriptURL, true);
}
onShutdown() {
Services.mm.removeDelayedFrameScript(this.framescriptURL);
Services.mm.removeMessageListener(`${PREFIX}:chrome-run-message`, this.listener);
this.chromeHandle.destruct();
}
};

View File

@ -1,26 +0,0 @@
"use strict";
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const PREFIX = "tresize@mozilla.org";
function listener({target, data}) {
let win = target.ownerGlobal;
Services.scriptloader.loadSubScript("chrome://tresize/content/Profiler.js", win);
Services.scriptloader.loadSubScript("chrome://tresize/content/tresize.js", win);
function sendResult(result) {
target.messageManager.sendAsyncMessage(`${PREFIX}:chrome-run-reply`, {id: data.id, result});
}
win.runTest(sendResult, data.locationSearch);
}
function startup(data, reason) {
Services.mm.addMessageListener(`${PREFIX}:chrome-run-message`, listener);
Services.mm.loadFrameScript("chrome://tresize/content/framescript.js", true);
}
function shutdown(data, reason) {}
function install(data, reason) {}
function uninstall(data, reason) {}

View File

@ -1 +0,0 @@
content tresize content/

View File

@ -5,8 +5,6 @@
<head>
<script language="javascript" type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
function runTest() {
dispatchEvent(
new CustomEvent("tresize@mozilla.org:chrome-run-event",

View File

@ -1,22 +0,0 @@
<?xml version="1.0"?><RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"><Description about="urn:mozilla:install-manifest">
<!-- Required Items -->
<em:id>tresize@mozilla.org</em:id>
<em:name>TResize - Firefox Window Resize Test</em:name>
<em:version>1.0.3</em:version>
<em:bootstrap>true</em:bootstrap>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.5</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Optional Items -->
<em:creator>Joel Maher</em:creator>
<em:description>https://wiki.mozilla.org/Buildbot/Talos/Tests</em:description>
<em:homepageURL>https://wiki.mozilla.org/Buildbot/Talos/Tests</em:homepageURL>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
</Description></RDF>

View File

@ -0,0 +1,23 @@
{
"manifest_version": 2,
"name": "TResize - Firefox Window Resize Test",
"description": "https://wiki.mozilla.org/Buildbot/Talos/Tests",
"version": "1.1",
"applications": {
"gecko": {
"id": "tresize@mozilla.org"
}
},
"experiment_apis": {
"tresize": {
"schema": "schema.json",
"parent": {
"scopes": ["addon_parent"],
"script": "api.js",
"events": ["startup"]
}
}
}
}

View File

@ -0,0 +1 @@
[]

View File

@ -1 +1,2 @@
% http://localhost/tests/tresize/tresize-test.html
% chrome://tresize/content/tresize-test.html