mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 1447354 - Remove talos XUL overlays. r=jmaher
Move the scripts and bootstrapping code that was in the overlay into a file loaded by bootstrap file. MozReview-Commit-ID: EIqQnU7rCbq --HG-- extra : rebase_source : 502e0fbe8d5b17af0fb4c4507dae50ae65dedd2e
This commit is contained in:
parent
59e8fa7fa3
commit
c7f490fc62
40
testing/talos/talos/bootstrap.js
vendored
40
testing/talos/talos/bootstrap.js
vendored
@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
/* globals initializeBrowser */
|
||||
|
||||
// PLEASE NOTE:
|
||||
//
|
||||
// The canonical version of this file lives in testing/talos/talos, and
|
||||
@ -12,33 +14,11 @@
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["TextDecoder"]);
|
||||
|
||||
class DefaultMap extends Map {
|
||||
constructor(defaultConstructor = undefined, init = undefined) {
|
||||
super(init);
|
||||
if (defaultConstructor) {
|
||||
this.defaultConstructor = defaultConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
get(key) {
|
||||
let value = super.get(key);
|
||||
if (value === undefined && !this.has(key)) {
|
||||
value = this.defaultConstructor(key);
|
||||
this.set(key, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const windowTracker = {
|
||||
init() {
|
||||
Services.ww.registerNotification(this);
|
||||
},
|
||||
|
||||
overlays: new DefaultMap(() => new Set()),
|
||||
|
||||
async observe(window, topic, data) {
|
||||
if (topic === "domwindowopened") {
|
||||
await new Promise(resolve =>
|
||||
@ -47,11 +27,10 @@ const windowTracker = {
|
||||
let {document} = window;
|
||||
let {documentURI} = document;
|
||||
|
||||
if (this.overlays.has(documentURI)) {
|
||||
for (let overlay of this.overlays.get(documentURI)) {
|
||||
document.loadOverlay(overlay, null);
|
||||
}
|
||||
if (documentURI !== "chrome://browser/content/browser.xul") {
|
||||
return;
|
||||
}
|
||||
initializeBrowser(window);
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -63,15 +42,8 @@ function readSync(uri) {
|
||||
}
|
||||
|
||||
function startup(data, reason) {
|
||||
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
|
||||
windowTracker.init();
|
||||
|
||||
for (let line of readSync(data.resourceURI.resolve("chrome.manifest")).split("\n")) {
|
||||
let [directive, ...args] = line.trim().split(/\s+/);
|
||||
if (directive === "overlay") {
|
||||
let [url, overlay] = args;
|
||||
windowTracker.overlays.get(url).add(overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {}
|
||||
|
@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
/* globals initializeBrowser */
|
||||
|
||||
// PLEASE NOTE:
|
||||
//
|
||||
// The canonical version of this file lives in testing/talos/talos, and
|
||||
@ -12,33 +14,11 @@
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["TextDecoder"]);
|
||||
|
||||
class DefaultMap extends Map {
|
||||
constructor(defaultConstructor = undefined, init = undefined) {
|
||||
super(init);
|
||||
if (defaultConstructor) {
|
||||
this.defaultConstructor = defaultConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
get(key) {
|
||||
let value = super.get(key);
|
||||
if (value === undefined && !this.has(key)) {
|
||||
value = this.defaultConstructor(key);
|
||||
this.set(key, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const windowTracker = {
|
||||
init() {
|
||||
Services.ww.registerNotification(this);
|
||||
},
|
||||
|
||||
overlays: new DefaultMap(() => new Set()),
|
||||
|
||||
async observe(window, topic, data) {
|
||||
if (topic === "domwindowopened") {
|
||||
await new Promise(resolve =>
|
||||
@ -47,11 +27,10 @@ const windowTracker = {
|
||||
let {document} = window;
|
||||
let {documentURI} = document;
|
||||
|
||||
if (this.overlays.has(documentURI)) {
|
||||
for (let overlay of this.overlays.get(documentURI)) {
|
||||
document.loadOverlay(overlay, null);
|
||||
}
|
||||
if (documentURI !== "chrome://browser/content/browser.xul") {
|
||||
return;
|
||||
}
|
||||
initializeBrowser(window);
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -63,15 +42,8 @@ function readSync(uri) {
|
||||
}
|
||||
|
||||
function startup(data, reason) {
|
||||
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
|
||||
windowTracker.init();
|
||||
|
||||
for (let line of readSync(data.resourceURI.resolve("chrome.manifest")).split("\n")) {
|
||||
let [directive, ...args] = line.trim().split(/\s+/);
|
||||
if (directive === "overlay") {
|
||||
let [url, overlay] = args;
|
||||
windowTracker.overlays.get(url).add(overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {}
|
||||
|
@ -1,2 +1 @@
|
||||
content tresize content/
|
||||
overlay chrome://browser/content/browser.xul chrome://tresize/content/tresize.overlay.xul
|
||||
|
@ -0,0 +1,19 @@
|
||||
function initializeBrowser(win) {
|
||||
Services.scriptloader.loadSubScript("chrome://tresize/content/Profiler.js", win);
|
||||
Services.scriptloader.loadSubScript("chrome://tresize/content/tresize.js", win);
|
||||
const TRESIZE_PREFIX = "tresize@mozilla.org:";
|
||||
|
||||
var groupMM = win.getGroupMessageManager("browsers");
|
||||
groupMM.loadFrameScript("chrome://tresize/content/framescript.js", true);
|
||||
|
||||
// listener/executor on the chrome process for tresize.html
|
||||
groupMM.addMessageListener(TRESIZE_PREFIX + "chrome-run-message", function listener(m) {
|
||||
function sendResult(result) {
|
||||
groupMM.broadcastAsyncMessage(TRESIZE_PREFIX + "chrome-run-reply", {
|
||||
id: m.data.id,
|
||||
result
|
||||
});
|
||||
}
|
||||
win.runTest(sendResult, m.data.locationSearch);
|
||||
});
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<overlay id="Scrapper-Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="Profiler.js" />
|
||||
<script type="application/x-javascript" src="tresize.js" />
|
||||
<script type="application/x-javascript">
|
||||
(function(){
|
||||
const TRESIZE_PREFIX = "tresize@mozilla.org:";
|
||||
|
||||
var groupMM = window.getGroupMessageManager("browsers");
|
||||
groupMM.loadFrameScript("chrome://tresize/content/framescript.js", true);
|
||||
|
||||
// listener/executor on the chrome process for tresize.html
|
||||
groupMM.addMessageListener(TRESIZE_PREFIX + "chrome-run-message", function listener(m) {
|
||||
function sendResult(result) {
|
||||
groupMM.broadcastAsyncMessage(TRESIZE_PREFIX + "chrome-run-reply", {
|
||||
id: m.data.id,
|
||||
result: result
|
||||
});
|
||||
}
|
||||
runTest(sendResult, m.data.locationSearch);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</overlay>
|
@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
/* globals initializeBrowser */
|
||||
|
||||
// PLEASE NOTE:
|
||||
//
|
||||
// The canonical version of this file lives in testing/talos/talos, and
|
||||
@ -12,33 +14,11 @@
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["TextDecoder"]);
|
||||
|
||||
class DefaultMap extends Map {
|
||||
constructor(defaultConstructor = undefined, init = undefined) {
|
||||
super(init);
|
||||
if (defaultConstructor) {
|
||||
this.defaultConstructor = defaultConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
get(key) {
|
||||
let value = super.get(key);
|
||||
if (value === undefined && !this.has(key)) {
|
||||
value = this.defaultConstructor(key);
|
||||
this.set(key, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const windowTracker = {
|
||||
init() {
|
||||
Services.ww.registerNotification(this);
|
||||
},
|
||||
|
||||
overlays: new DefaultMap(() => new Set()),
|
||||
|
||||
async observe(window, topic, data) {
|
||||
if (topic === "domwindowopened") {
|
||||
await new Promise(resolve =>
|
||||
@ -47,11 +27,10 @@ const windowTracker = {
|
||||
let {document} = window;
|
||||
let {documentURI} = document;
|
||||
|
||||
if (this.overlays.has(documentURI)) {
|
||||
for (let overlay of this.overlays.get(documentURI)) {
|
||||
document.loadOverlay(overlay, null);
|
||||
}
|
||||
if (documentURI !== "chrome://browser/content/browser.xul") {
|
||||
return;
|
||||
}
|
||||
initializeBrowser(window);
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -63,15 +42,8 @@ function readSync(uri) {
|
||||
}
|
||||
|
||||
function startup(data, reason) {
|
||||
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
|
||||
windowTracker.init();
|
||||
|
||||
for (let line of readSync(data.resourceURI.resolve("chrome.manifest")).split("\n")) {
|
||||
let [directive, ...args] = line.trim().split(/\s+/);
|
||||
if (directive === "overlay") {
|
||||
let [url, overlay] = args;
|
||||
windowTracker.overlays.get(url).add(overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {}
|
||||
|
@ -1,2 +1 @@
|
||||
content damp content/
|
||||
overlay chrome://browser/content/browser.xul chrome://damp/content/damp.overlay.xul
|
||||
|
@ -1,29 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<overlay id="Scrapper-Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://talos-powers-content/content/TalosParentProfiler.js" />
|
||||
<script type="application/x-javascript" src="damp.js" />
|
||||
<script type="application/x-javascript">
|
||||
|
||||
(function(){
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
function initializeBrowser(win) {
|
||||
Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosParentProfiler.js", win);
|
||||
Services.scriptloader.loadSubScript("chrome://damp/content/damp.js", win);
|
||||
|
||||
const PREFIX = "damp@mozilla.org:";
|
||||
|
||||
// "services" which the framescript can execute at the chrome process
|
||||
var proxiedServices = {
|
||||
runTest: function(config, callback) {
|
||||
(new Damp()).startTest(callback, config);
|
||||
runTest(config, callback) {
|
||||
(new win.Damp()).startTest(callback, config);
|
||||
},
|
||||
|
||||
toClipboard: function(text) {
|
||||
toClipboard(text) {
|
||||
const gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"]
|
||||
.getService(Ci.nsIClipboardHelper);
|
||||
.getService(Ci.nsIClipboardHelper);
|
||||
gClipboardHelper.copyString(text);
|
||||
}
|
||||
};
|
||||
|
||||
var groupMM = window.getGroupMessageManager("browsers");
|
||||
var groupMM = win.getGroupMessageManager("browsers");
|
||||
groupMM.loadFrameScript("chrome://damp/content/framescript.js", true);
|
||||
|
||||
// listener/executor on the chrome process for damp.html
|
||||
@ -31,7 +25,7 @@
|
||||
function sendResult(result) {
|
||||
groupMM.broadcastAsyncMessage(PREFIX + "chrome-exec-reply", {
|
||||
id: m.data.id,
|
||||
result: result
|
||||
result
|
||||
});
|
||||
}
|
||||
|
||||
@ -46,7 +40,4 @@
|
||||
sendResult(service(command.data));
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
</script>
|
||||
</overlay>
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
/* globals initializeBrowser */
|
||||
|
||||
// PLEASE NOTE:
|
||||
//
|
||||
// The canonical version of this file lives in testing/talos/talos, and
|
||||
@ -12,33 +14,11 @@
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["TextDecoder"]);
|
||||
|
||||
class DefaultMap extends Map {
|
||||
constructor(defaultConstructor = undefined, init = undefined) {
|
||||
super(init);
|
||||
if (defaultConstructor) {
|
||||
this.defaultConstructor = defaultConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
get(key) {
|
||||
let value = super.get(key);
|
||||
if (value === undefined && !this.has(key)) {
|
||||
value = this.defaultConstructor(key);
|
||||
this.set(key, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const windowTracker = {
|
||||
init() {
|
||||
Services.ww.registerNotification(this);
|
||||
},
|
||||
|
||||
overlays: new DefaultMap(() => new Set()),
|
||||
|
||||
async observe(window, topic, data) {
|
||||
if (topic === "domwindowopened") {
|
||||
await new Promise(resolve =>
|
||||
@ -47,11 +27,10 @@ const windowTracker = {
|
||||
let {document} = window;
|
||||
let {documentURI} = document;
|
||||
|
||||
if (this.overlays.has(documentURI)) {
|
||||
for (let overlay of this.overlays.get(documentURI)) {
|
||||
document.loadOverlay(overlay, null);
|
||||
}
|
||||
if (documentURI !== "chrome://browser/content/browser.xul") {
|
||||
return;
|
||||
}
|
||||
initializeBrowser(window);
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -63,15 +42,8 @@ function readSync(uri) {
|
||||
}
|
||||
|
||||
function startup(data, reason) {
|
||||
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
|
||||
windowTracker.init();
|
||||
|
||||
for (let line of readSync(data.resourceURI.resolve("chrome.manifest")).split("\n")) {
|
||||
let [directive, ...args] = line.trim().split(/\s+/);
|
||||
if (directive === "overlay") {
|
||||
let [url, overlay] = args;
|
||||
windowTracker.overlays.get(url).add(overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shutdown(data, reason) {}
|
||||
|
@ -1,2 +1 @@
|
||||
content tart content/
|
||||
overlay chrome://browser/content/browser.xul chrome://tart/content/tart.overlay.xul
|
||||
|
@ -1,39 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<overlay id="Scrapper-Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="Profiler.js" />
|
||||
<script type="application/x-javascript" src="tart.js" />
|
||||
<script type="application/x-javascript">
|
||||
|
||||
(function(){
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
function initializeBrowser(win) {
|
||||
Services.scriptloader.loadSubScript("chrome://tart/content/Profiler.js", win);
|
||||
Services.scriptloader.loadSubScript("chrome://tart/content/tart.js", win);
|
||||
var prefs = Services.prefs;
|
||||
|
||||
const TART_PREFIX = "tart@mozilla.org:";
|
||||
|
||||
// "services" which the framescript can execute at the chrome process
|
||||
var proxiedServices = {
|
||||
runTest: function(config, callback) {
|
||||
(new Tart()).startTest(callback, config);
|
||||
runTest(config, callback) {
|
||||
(new win.Tart()).startTest(callback, config);
|
||||
},
|
||||
|
||||
setASAP: function() {
|
||||
setASAP() {
|
||||
prefs.setIntPref("layout.frame_rate", 0);
|
||||
prefs.setIntPref("docshell.event_starvation_delay_hint", 1);
|
||||
},
|
||||
|
||||
unsetASAP: function() {
|
||||
unsetASAP() {
|
||||
prefs.clearUserPref("layout.frame_rate");
|
||||
prefs.clearUserPref("docshell.event_starvation_delay_hint");
|
||||
},
|
||||
|
||||
toClipboard: function(text) {
|
||||
toClipboard(text) {
|
||||
const gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"]
|
||||
.getService(Ci.nsIClipboardHelper);
|
||||
gClipboardHelper.copyString(text);
|
||||
}
|
||||
};
|
||||
|
||||
var groupMM = window.getGroupMessageManager("browsers");
|
||||
var groupMM = win.getGroupMessageManager("browsers");
|
||||
groupMM.loadFrameScript("chrome://tart/content/framescript.js", true);
|
||||
|
||||
// listener/executor on the chrome process for tart.html
|
||||
@ -41,7 +36,7 @@
|
||||
function sendResult(result) {
|
||||
groupMM.broadcastAsyncMessage(TART_PREFIX + "chrome-exec-reply", {
|
||||
id: m.data.id,
|
||||
result: result
|
||||
result
|
||||
});
|
||||
}
|
||||
|
||||
@ -56,7 +51,4 @@
|
||||
sendResult(service(command.data));
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
</script>
|
||||
</overlay>
|
||||
}
|
Loading…
Reference in New Issue
Block a user