mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1588855 - Remove browser-instrumentation job r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D49326 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
096272f01a
commit
eab92c4995
@ -123,22 +123,6 @@ mochitest-browser-chrome:
|
||||
instance-size: default
|
||||
allow-software-gl-layers: false
|
||||
|
||||
browser-instrumentation:
|
||||
description: "Extra instrumentation for a browser-chrome run (XUL, XBL, etc)"
|
||||
suite:
|
||||
name: mochitest-browser-chrome-instrumentation
|
||||
treeherder-symbol: M(inst)
|
||||
loopback-video: true
|
||||
tier: 3
|
||||
run-on-projects:
|
||||
by-test-platform:
|
||||
windows.*-(?:nightly|shippable)/.*: ["mozilla-central"]
|
||||
default: []
|
||||
max-run-time: 14400
|
||||
mozharness:
|
||||
mochitest-flavor: browser
|
||||
allow-software-gl-layers: false
|
||||
|
||||
browser-screenshots:
|
||||
description: "Browser Screenshots"
|
||||
suite:
|
||||
|
@ -229,7 +229,6 @@ windows10-64-shippable/opt:
|
||||
test-sets:
|
||||
- awsy
|
||||
- desktop-screenshot-capture
|
||||
- desktop-instrumentation
|
||||
- windows-talos
|
||||
- marionette-gpu-tests
|
||||
- windows-tests
|
||||
|
@ -503,9 +503,6 @@ linux32-tests:
|
||||
desktop-screenshot-capture:
|
||||
- browser-screenshots
|
||||
|
||||
desktop-instrumentation:
|
||||
- browser-instrumentation
|
||||
|
||||
android-x86_64-tests:
|
||||
- cppunit
|
||||
- crashtest
|
||||
|
@ -7,7 +7,6 @@
|
||||
// Test timeout (seconds)
|
||||
var gTimeoutSeconds = 45;
|
||||
var gConfig;
|
||||
var gSaveInstrumentationData = null;
|
||||
|
||||
var { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
@ -145,279 +144,6 @@ function testInit() {
|
||||
// In non-e10s, only run the ShutdownLeaksCollector in the parent process.
|
||||
ChromeUtils.import("chrome://mochikit/content/ShutdownLeaksCollector.jsm");
|
||||
}
|
||||
|
||||
var testSuite = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment)
|
||||
.get("TEST_SUITE");
|
||||
if (testSuite == "browser-chrome-instrumentation") {
|
||||
takeInstrumentation();
|
||||
}
|
||||
}
|
||||
|
||||
function takeInstrumentation() {
|
||||
let instrumentData = {
|
||||
elements: {},
|
||||
};
|
||||
|
||||
function pad(str, length) {
|
||||
if (str.length >= length) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return str + " ".repeat(length - str.length);
|
||||
}
|
||||
|
||||
function byCount(a, b) {
|
||||
return b[1] - a[1];
|
||||
}
|
||||
|
||||
function getSummaryText() {
|
||||
let summary = [];
|
||||
let allData = {};
|
||||
for (let selector of Object.keys(instrumentData.elements)) {
|
||||
allData[selector] = instrumentData.elements[selector];
|
||||
}
|
||||
|
||||
let selectors = Object.keys(allData);
|
||||
let elements = selectors.map(s => allData[s]);
|
||||
|
||||
let namespaceMap = new Map();
|
||||
let bindingMap = new Map();
|
||||
|
||||
for (let element of elements) {
|
||||
if (!bindingMap.has(element.binding)) {
|
||||
bindingMap.set(element.binding, 1);
|
||||
} else {
|
||||
bindingMap.set(element.binding, bindingMap.get(element.binding) + 1);
|
||||
}
|
||||
|
||||
if (!namespaceMap.has(element.namespaceURI)) {
|
||||
namespaceMap.set(element.namespaceURI, new Map());
|
||||
}
|
||||
|
||||
let localNameMap = namespaceMap.get(element.namespaceURI);
|
||||
if (!localNameMap.has(element.localName)) {
|
||||
localNameMap.set(element.localName, 1);
|
||||
} else {
|
||||
localNameMap.set(
|
||||
element.localName,
|
||||
localNameMap.get(element.localName) + 1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (let [namespace, localNameMap] of namespaceMap) {
|
||||
summary.push(`Elements in namespace ${namespace}`);
|
||||
|
||||
let entries = Array.from(localNameMap);
|
||||
entries.sort(byCount);
|
||||
for (let entry of entries) {
|
||||
summary.push(` ${pad(entry[1] + "", 5)} ${entry[0]}`);
|
||||
}
|
||||
}
|
||||
|
||||
summary.push("XBL bindings");
|
||||
let bindings = Array.from(bindingMap);
|
||||
bindings.sort(byCount);
|
||||
let bindingsJSON = {};
|
||||
for (let binding of bindings) {
|
||||
summary.push(` ${pad(binding[1] + "", 5)} ${binding[0]}`);
|
||||
if (binding[0]) {
|
||||
bindingsJSON[binding[0].split("#")[1].split('"')[0]] = binding[1];
|
||||
}
|
||||
}
|
||||
|
||||
summary.push("XBL bindings as JSON");
|
||||
summary.push(JSON.stringify(bindingsJSON, null, 2));
|
||||
|
||||
return summary.join("\n");
|
||||
}
|
||||
|
||||
// Saves instrumantation data
|
||||
function saveData() {
|
||||
let path = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment)
|
||||
.get("MOZ_UPLOAD_DIR");
|
||||
let encoder = new TextEncoder();
|
||||
|
||||
let instrumentPath = OS.Path.join(path, "xulinstrument.txt");
|
||||
OS.File.writeAtomic(
|
||||
instrumentPath,
|
||||
encoder.encode(JSON.stringify(instrumentData, null, 2))
|
||||
);
|
||||
|
||||
let summaryPath = OS.Path.join(path, "xulsummary.txt");
|
||||
OS.File.writeAtomic(summaryPath, encoder.encode(getSummaryText()));
|
||||
}
|
||||
|
||||
// An iterator over an element and its ancestors
|
||||
function* elementPath(element) {
|
||||
yield element;
|
||||
while ((element = element.parentNode) && element instanceof Element) {
|
||||
yield element;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the information we care about for an element
|
||||
function getElementInfo(element) {
|
||||
let style = element.ownerGlobal.getComputedStyle(element);
|
||||
let binding = style && style.getPropertyValue("-moz-binding");
|
||||
|
||||
return {
|
||||
namespaceURI: element.namespaceURI,
|
||||
localName: element.localName,
|
||||
binding: binding && binding != "none" ? binding : null,
|
||||
};
|
||||
}
|
||||
|
||||
// The selector for just this element
|
||||
function immediateSelector(element) {
|
||||
if (
|
||||
element.localName == "notificationbox" &&
|
||||
element.parentNode &&
|
||||
element.parentNode.id == "tabbrowser-tabpanels"
|
||||
) {
|
||||
// Don't do a full selector for a tabpanel's notificationbox
|
||||
return element.localName;
|
||||
}
|
||||
|
||||
if (
|
||||
element.localName == "tab" &&
|
||||
element.classList.contains("tabbrowser-tab")
|
||||
) {
|
||||
// Don't do a full selector for a tab
|
||||
return element.localName;
|
||||
}
|
||||
|
||||
if (element.id) {
|
||||
return `#${element.id}`;
|
||||
}
|
||||
|
||||
let selector = element.localName;
|
||||
|
||||
if (element.classList.length) {
|
||||
selector += `.${Array.from(element.classList).join(".")}`;
|
||||
}
|
||||
|
||||
for (let attr of ["src", "label"]) {
|
||||
if (element.hasAttribute(attr)) {
|
||||
selector += `[${attr}=${JSON.stringify(element.getAttribute(attr))}]`;
|
||||
}
|
||||
}
|
||||
|
||||
return selector;
|
||||
}
|
||||
|
||||
// The selector chain for the element
|
||||
function elementSelector(element) {
|
||||
return Array.from(elementPath(element))
|
||||
.reverse()
|
||||
.map(immediateSelector)
|
||||
.join(" > ");
|
||||
}
|
||||
|
||||
// An iterator over all elements in the window
|
||||
function* windowElements(win) {
|
||||
yield* elementDescendants(win.document.documentElement);
|
||||
}
|
||||
|
||||
// An iterator over an element and all of its descendants
|
||||
function* elementDescendants(element) {
|
||||
let walker = Cc["@mozilla.org/inspector/deep-tree-walker;1"].createInstance(
|
||||
Ci.inIDeepTreeWalker
|
||||
);
|
||||
walker.showAnonymousContent = true;
|
||||
walker.showSubDocuments = false;
|
||||
walker.showDocumentsAsNodes = false;
|
||||
walker.init(element, NodeFilter.SHOW_ELEMENT);
|
||||
|
||||
yield element;
|
||||
while (walker.nextNode()) {
|
||||
if (walker.currentNode instanceof Element) {
|
||||
yield walker.currentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if we've seen an element and if not adds it to the instrumentation data
|
||||
function instrumentElement(element) {
|
||||
if (element.__instrumentSeen) {
|
||||
return;
|
||||
}
|
||||
|
||||
let selector = elementSelector(element);
|
||||
element.__instrumentSeen = true;
|
||||
|
||||
if (selector in instrumentData.elements) {
|
||||
return;
|
||||
}
|
||||
|
||||
instrumentData.elements[selector] = getElementInfo(element);
|
||||
}
|
||||
|
||||
// Instruments every element in a window
|
||||
function scanWindow(win) {
|
||||
Array.from(windowElements(win)).forEach(instrumentElement);
|
||||
}
|
||||
|
||||
// Instruments every element in an element's descendants
|
||||
function scanElement(element) {
|
||||
Array.from(elementDescendants(element)).forEach(instrumentElement);
|
||||
}
|
||||
|
||||
function handleMutation(mutation) {
|
||||
if (mutation.type != "childList") {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let node of mutation.addedNodes) {
|
||||
if (node instanceof Element) {
|
||||
scanElement(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Watches a window for new elements to instrument
|
||||
function observeWindow(win) {
|
||||
let observer = new MutationObserver(mutations => {
|
||||
mutations.forEach(handleMutation);
|
||||
});
|
||||
|
||||
observer.observe(win.document, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
|
||||
win.addEventListener(
|
||||
"unload",
|
||||
() => {
|
||||
observer.takeRecords().forEach(handleMutation);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
}
|
||||
|
||||
scanWindow(window);
|
||||
observeWindow(window);
|
||||
gSaveInstrumentationData = saveData;
|
||||
|
||||
Services.ww.registerNotification((win, topic, data) => {
|
||||
if (topic != "domwindowopened") {
|
||||
return;
|
||||
}
|
||||
|
||||
win.addEventListener(
|
||||
"load",
|
||||
() => {
|
||||
if (win.location.href != AppConstants.BROWSER_CHROME_URL) {
|
||||
return;
|
||||
}
|
||||
|
||||
scanWindow(win);
|
||||
observeWindow(win);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function isGenerator(value) {
|
||||
@ -799,10 +525,6 @@ Tester.prototype = {
|
||||
this.callback(this.tests);
|
||||
this.callback = null;
|
||||
this.tests = null;
|
||||
|
||||
if (gSaveInstrumentationData) {
|
||||
gSaveInstrumentationData();
|
||||
}
|
||||
},
|
||||
|
||||
haltTests: function Tester_haltTests() {
|
||||
|
@ -169,7 +169,6 @@ config = {
|
||||
"mochitest-browser-chrome-chunked": ["--flavor=browser", "--chunk-by-runtime"],
|
||||
"mochitest-browser-chrome-coverage": ["--flavor=browser", "--chunk-by-runtime", "--timeout=1200"],
|
||||
"mochitest-browser-chrome-screenshots": ["--flavor=browser", "--subsuite=screenshots"],
|
||||
"mochitest-browser-chrome-instrumentation": ["--flavor=browser"],
|
||||
"mochitest-webgl1-core": ["--subsuite=webgl1-core"],
|
||||
"mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
|
||||
"mochitest-webgl2-core": ["--subsuite=webgl2-core"],
|
||||
|
@ -136,7 +136,6 @@ config = {
|
||||
"mochitest-browser-chrome": ["--flavor=browser"],
|
||||
"mochitest-browser-chrome-chunked": ["--flavor=browser", "--chunk-by-runtime"],
|
||||
"mochitest-browser-chrome-screenshots": ["--flavor=browser", "--subsuite=screenshots"],
|
||||
"mochitest-browser-chrome-instrumentation": ["--flavor=browser"],
|
||||
"mochitest-webgl1-core": ["--subsuite=webgl1-core"],
|
||||
"mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
|
||||
"mochitest-webgl2-core": ["--subsuite=webgl2-core"],
|
||||
|
@ -159,7 +159,6 @@ config = {
|
||||
"mochitest-browser-chrome": ["--flavor=browser"],
|
||||
"mochitest-browser-chrome-chunked": ["--flavor=browser", "--chunk-by-runtime"],
|
||||
"mochitest-browser-chrome-screenshots": ["--flavor=browser", "--subsuite=screenshots"],
|
||||
"mochitest-browser-chrome-instrumentation": ["--flavor=browser"],
|
||||
"mochitest-webgl1-core": ["--subsuite=webgl1-core"],
|
||||
"mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
|
||||
"mochitest-webgl2-core": ["--subsuite=webgl2-core"],
|
||||
|
@ -42,7 +42,6 @@ MOZHARNESS_SCRIPTS = {
|
||||
'jittest1',
|
||||
'jittest2',
|
||||
'jsreftest',
|
||||
'mochitest-browser-chrome-instrumentation',
|
||||
'mochitest-devtools-chrome-webreplay',
|
||||
'mochitest-valgrind-plain',
|
||||
'reftest-gpu',
|
||||
|
Loading…
Reference in New Issue
Block a user