зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset db40c6473346 (bug 1500198) for mochitest failures on /mochitest/test_ext_protocolHandlers.html. CLOSED TREE
--HG-- rename : testing/talos/talos/tests/devtools/addon/api.js => testing/talos/talos/tests/devtools/addon/bootstrap.js rename : testing/talos/talos/tests/devtools/addon/damp.html => testing/talos/talos/tests/devtools/addon/content/damp.html rename : testing/talos/talos/tests/devtools/addon/manifest.json => testing/talos/talos/tests/devtools/addon/install.rdf
This commit is contained in:
Родитель
ae4719559e
Коммит
8493aae42d
|
@ -17,9 +17,9 @@ function setIdleCallback() {
|
|||
function contentLoadHandlerCallback(cb) {
|
||||
function _handler(e) {
|
||||
if (e.originalTarget.defaultView == content) {
|
||||
content.wrappedJSObject.tpRecordTime = Cu.exportFunction((t, s, n) => {
|
||||
content.wrappedJSObject.tpRecordTime = function(t, s, n) {
|
||||
sendAsyncMessage("PageLoader:RecordTime", {time: t, startTime: s, testName: n});
|
||||
}, content);
|
||||
};
|
||||
content.setTimeout(cb, 0);
|
||||
content.setTimeout(setIdleCallback, 0);
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
||||
/* globals ExtensionAPI */
|
||||
this.damp = class extends ExtensionAPI {
|
||||
getAPI(context) {
|
||||
return {
|
||||
damp: {
|
||||
startTest() {
|
||||
let {rootURI} = context.extension;
|
||||
let window = context.xulWindow;
|
||||
if (!("Damp" in window)) {
|
||||
let script = rootURI.resolve("content/damp.js");
|
||||
Services.scriptloader.loadSubScript(script, window);
|
||||
}
|
||||
|
||||
let damp = new window.Damp();
|
||||
return damp.startTest(rootURI);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
|
||||
/* globals initializeBrowser */
|
||||
|
||||
// PLEASE NOTE:
|
||||
//
|
||||
// The canonical version of this file lives in testing/talos/talos, and
|
||||
// is duplicated in a number of test add-ons in directories below it.
|
||||
// Please do not update one withput updating all.
|
||||
|
||||
// Reads the chrome.manifest from a legacy non-restartless extension and loads
|
||||
// its overlays into the appropriate top-level windows.
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const windowTracker = {
|
||||
init() {
|
||||
Services.ww.registerNotification(this);
|
||||
},
|
||||
|
||||
async observe(window, topic, data) {
|
||||
if (topic === "domwindowopened") {
|
||||
await new Promise(resolve =>
|
||||
window.addEventListener("DOMWindowCreated", resolve, {once: true}));
|
||||
|
||||
let {document} = window;
|
||||
let {documentURI} = document;
|
||||
|
||||
if (documentURI !== AppConstants.BROWSER_CHROME_URL) {
|
||||
return;
|
||||
}
|
||||
initializeBrowser(window);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function startup(data, reason) {
|
||||
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
|
||||
windowTracker.init();
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {}
|
||||
function install(data, reason) {}
|
||||
function uninstall(data, reason) {}
|
|
@ -0,0 +1 @@
|
|||
content damp content/
|
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>DAMP - Devtools At Maximum Performance</title>
|
||||
</head>
|
||||
<body style="font-family:sans-serif;">
|
||||
<h4>DAMP - Devtools At Maximum Performance</h4>
|
||||
</body>
|
||||
</html>
|
|
@ -258,7 +258,7 @@ Damp.prototype = {
|
|||
this._currentTest = test;
|
||||
|
||||
dump(`Loading test '${test}'\n`);
|
||||
let testMethod = require(this.rootURI.resolve(`content/tests/${test}`));
|
||||
let testMethod = require("chrome://damp/content/tests/" + test);
|
||||
|
||||
this._timeout = window.setTimeout(() => {
|
||||
this.error("Test timed out");
|
||||
|
@ -312,8 +312,8 @@ Damp.prototype = {
|
|||
}
|
||||
this._log("\n" + out);
|
||||
|
||||
if (this.testDone) {
|
||||
this.testDone({testResults, testNames});
|
||||
if (content && content.tpRecordTime) {
|
||||
content.tpRecordTime(testResults.join(","), 0, testNames.join(","));
|
||||
} else {
|
||||
// alert(out);
|
||||
}
|
||||
|
@ -404,12 +404,10 @@ Damp.prototype = {
|
|||
await this.garbageCollect();
|
||||
},
|
||||
|
||||
startTest(rootURI) {
|
||||
let promise = new Promise(resolve => { this.testDone = resolve; });
|
||||
this.rootURI = rootURI;
|
||||
startTest() {
|
||||
try {
|
||||
dump("Initialize the head file with a reference to this DAMP instance\n");
|
||||
let head = require(rootURI.resolve("content/tests/head.js"));
|
||||
let head = require("chrome://damp/content/tests/head.js");
|
||||
head.initialize(this);
|
||||
|
||||
this._win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
@ -419,7 +417,7 @@ Damp.prototype = {
|
|||
// Filter tests via `./mach --subtests filter` command line argument
|
||||
let filter = Services.prefs.getCharPref("talos.subtests", "");
|
||||
|
||||
let DAMP_TESTS = require(rootURI.resolve("content/damp-tests.js"));
|
||||
let DAMP_TESTS = require("chrome://damp/content/damp-tests.js");
|
||||
let tests = DAMP_TESTS.filter(test => !test.disabled)
|
||||
.filter(test => test.name.includes(filter));
|
||||
|
||||
|
@ -450,7 +448,5 @@ Damp.prototype = {
|
|||
} catch (e) {
|
||||
this.exception(e);
|
||||
}
|
||||
|
||||
return promise;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
(function() {
|
||||
const MESSAGE = "damp@mozilla.org:html-loaded";
|
||||
|
||||
addEventListener("load", function onload(e) {
|
||||
if (e.target.documentURI.indexOf("chrome://damp/content/damp.html")) {
|
||||
return;
|
||||
}
|
||||
removeEventListener("load", onload);
|
||||
|
||||
sendAsyncMessage(MESSAGE);
|
||||
}, true);
|
||||
})();
|
|
@ -0,0 +1,14 @@
|
|||
function initializeBrowser(win) {
|
||||
Services.scriptloader.loadSubScript("chrome://damp/content/damp.js", win);
|
||||
|
||||
const MESSAGE = "damp@mozilla.org:html-loaded";
|
||||
|
||||
const groupMM = win.getGroupMessageManager("browsers");
|
||||
groupMM.loadFrameScript("chrome://damp/content/framescript.js", true);
|
||||
|
||||
// Listen for damp.html load event before starting tests.
|
||||
// Each tppagecycles is going to reload damp.html and re-run DAMP entirely.
|
||||
groupMM.addMessageListener(MESSAGE, function onMessage(m) {
|
||||
(new win.Damp()).startTest();
|
||||
});
|
||||
}
|
|
@ -29,15 +29,13 @@ module.exports = async function() {
|
|||
let tab = await testSetup(SIMPLE_URL);
|
||||
let messageManager = tab.linkedBrowser.messageManager;
|
||||
|
||||
let url = module.uri.replace(/protocol\.js$/, "actor.js");
|
||||
|
||||
// Register a test actor within the content process
|
||||
messageManager.loadFrameScript("data:,(" + encodeURIComponent(
|
||||
`function () {
|
||||
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
|
||||
const { ActorRegistry } = require("devtools/server/actors/utils/actor-registry");
|
||||
ActorRegistry.registerModule("${url}", {
|
||||
ActorRegistry.registerModule("chrome://damp/content/tests/server/actor.js", {
|
||||
prefix: "dampTest",
|
||||
constructor: "DampTestActor",
|
||||
type: { target: true }
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>DAMP - Devtools At Maximum Performance</title>
|
||||
|
||||
<script src="driver.js"></script>
|
||||
</head>
|
||||
|
||||
<body style="font-family:sans-serif;">
|
||||
<h4>DAMP - Devtools At Maximum Performance</h4>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
/* eslint-env webextensions */
|
||||
addEventListener("load", () => {
|
||||
browser.damp.startTest().then(results => {
|
||||
window.tpRecordTime(results.testResults.join(","), 0, results.testNames.join(","));
|
||||
});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
<?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>bug1150215@mozilla.org</em:id>
|
||||
<em:name>DAMP - Devtools At Maximum Performance</em:name>
|
||||
<em:version>0.0.16</em:version>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:multiprocessCompatible>true</em:multiprocessCompatible>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>44.0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Optional Items -->
|
||||
<em:description>Bug 1150215. To run: navigate to chrome://damp/content/damp.html</em:description>
|
||||
<em:homepageURL>https://bugzilla.mozilla.org/show_bug.cgi?id=1150215</em:homepageURL>
|
||||
</Description></RDF>
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "DAMP - Devtools At Maximum Performance",
|
||||
"version": "0.1",
|
||||
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "bug1150215@mozilla.org"
|
||||
}
|
||||
},
|
||||
|
||||
"protocol_handlers": [
|
||||
{
|
||||
"protocol": "ext+damp",
|
||||
"name": "damp protocol",
|
||||
"uriTemplate": "/damp.html"
|
||||
}
|
||||
],
|
||||
|
||||
"experiment_apis": {
|
||||
"damp": {
|
||||
"schema": "schema.json",
|
||||
"parent": {
|
||||
"scopes": ["addon_parent"],
|
||||
"script": "api.js",
|
||||
"paths": [["damp"]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
[
|
||||
{
|
||||
"namespace": "damp",
|
||||
"functions": [
|
||||
{
|
||||
"name": "startTest",
|
||||
"type": "function",
|
||||
"async": true,
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -1 +1 @@
|
|||
% ext+damp:damp.html
|
||||
% chrome://damp/content/damp.html
|
||||
|
|
|
@ -196,18 +196,6 @@ var E10SUtils = {
|
|||
return WebExtensionPolicy.useRemoteWebExtensions ? EXTENSION_REMOTE_TYPE : NOT_REMOTE;
|
||||
|
||||
default:
|
||||
// WebExtensions may set up protocol handlers for protocol names
|
||||
// beginning with ext+. These may redirect to http(s) pages or to
|
||||
// moz-extension pages. We can't actually tell here where one of
|
||||
// these pages will end up loading but Talos tests use protocol
|
||||
// handlers that redirect to extension pages that rely on this
|
||||
// behavior so a pageloader frame script is injected correctly.
|
||||
// Protocols that redirect to http(s) will just flip back to a
|
||||
// regular content process after the redirect.
|
||||
if (aURI.scheme.startsWith("ext+")) {
|
||||
return WebExtensionPolicy.useRemoteWebExtensions ? EXTENSION_REMOTE_TYPE : NOT_REMOTE;
|
||||
}
|
||||
|
||||
// For any other nested URIs, we use the innerURI to determine the
|
||||
// remote type. In theory we should use the innermost URI, but some URIs
|
||||
// have fake inner URIs (e.g. about URIs with inner moz-safe-about) and
|
||||
|
|
Загрузка…
Ссылка в новой задаче