Bug 1492613 - Use document.createXULElement in devtools tests that explicitly expect XUL elements to be returned;r=jdescottes
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 10 Oct 2018 15:17:53 +0000
changeset 440541 3ca5afad36517c9cd2ce76a8ebc06c1b65620555
parent 440540 db4990bc9b4cefd8f4e85a17de49796093cf6e90
child 440542 73c8dbc2512cd89f694ca9fb3c9692459a6a1f13
push id34824
push usertoros@mozilla.com
push dateWed, 10 Oct 2018 21:56:50 +0000
treeherdermozilla-central@389e356499df [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1492613
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1492613 - Use document.createXULElement in devtools tests that explicitly expect XUL elements to be returned;r=jdescottes Differential Revision: https://phabricator.services.mozilla.com/D8123
devtools/client/framework/test/browser_toolbox_custom_host.js
devtools/client/framework/test/browser_toolbox_target.js
devtools/client/performance/test/browser_perf-tree-abstract-01.js
devtools/client/performance/test/browser_perf-tree-abstract-02.js
devtools/client/performance/test/browser_perf-tree-abstract-03.js
devtools/client/performance/test/browser_perf-tree-abstract-04.js
devtools/client/performance/test/browser_perf-tree-abstract-05.js
devtools/client/performance/test/browser_perf-tree-view-01.js
devtools/client/performance/test/browser_perf-tree-view-02.js
devtools/client/performance/test/browser_perf-tree-view-03.js
devtools/client/performance/test/browser_perf-tree-view-04.js
devtools/client/performance/test/browser_perf-tree-view-05.js
devtools/client/performance/test/browser_perf-tree-view-06.js
devtools/client/performance/test/browser_perf-tree-view-07.js
devtools/client/performance/test/browser_perf-tree-view-08.js
devtools/client/performance/test/browser_perf-tree-view-09.js
devtools/client/performance/test/browser_perf-tree-view-10.js
devtools/client/performance/test/helpers/synth-utils.js
--- a/devtools/client/framework/test/browser_toolbox_custom_host.js
+++ b/devtools/client/framework/test/browser_toolbox_custom_host.js
@@ -21,17 +21,17 @@ add_task(async function() {
           window.removeEventListener("message", onMessage);
           resolve();
           break;
       }
     }
     window.addEventListener("message", onMessage);
   });
 
-  let iframe = document.createElement("iframe");
+  let iframe = document.createXULElement("iframe");
   document.documentElement.appendChild(iframe);
 
   const tab = await addTab(TEST_URL);
   let target = await TargetFactory.forTab(tab);
   const options = { customIframe: iframe };
   let toolbox = await gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options);
 
   is(toolbox.win.top, window, "Toolbox is included in browser.xul");
--- a/devtools/client/framework/test/browser_toolbox_target.js
+++ b/devtools/client/framework/test/browser_toolbox_target.js
@@ -4,27 +4,27 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test about:devtools-toolbox?target which allows opening a toolbox in an
 // iframe while defining which document to debug by setting a `target`
 // attribute refering to the document to debug.
 
 add_task(async function() {
   // iframe loads the document to debug
-  const iframe = document.createElement("browser");
+  const iframe = document.createXULElement("browser");
   iframe.setAttribute("type", "content");
   document.documentElement.appendChild(iframe);
 
   let onLoad = once(iframe, "load", true);
   iframe.setAttribute("src", "data:text/html,document to debug");
   await onLoad;
   is(iframe.contentWindow.document.body.innerHTML, "document to debug");
 
   // toolbox loads the toolbox document
-  const toolboxIframe = document.createElement("iframe");
+  const toolboxIframe = document.createXULElement("iframe");
   document.documentElement.appendChild(toolboxIframe);
 
   // Important step to define which target to debug
   toolboxIframe.target = iframe;
 
   const onToolboxReady = gDevTools.once("toolbox-ready");
 
   onLoad = once(toolboxIframe, "load", true);
--- a/devtools/client/performance/test/browser_perf-tree-abstract-01.js
+++ b/devtools/client/performance/test/browser_perf-tree-abstract-01.js
@@ -9,17 +9,17 @@
 
 const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
 const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
 const { once } = require("devtools/client/performance/test/helpers/event-utils");
 
 add_task(async function() {
   const { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();
 
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
 
   // Populate the tree and test the root item...
 
   const treeRoot = new MyCustomTreeItem(myDataSrc, { parent: null });
   treeRoot.attachTo(container);
 
   ok(!treeRoot.expanded,
--- a/devtools/client/performance/test/browser_perf-tree-abstract-02.js
+++ b/devtools/client/performance/test/browser_perf-tree-abstract-02.js
@@ -8,17 +8,17 @@
  */
 
 const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
 const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
 
 add_task(async function() {
   const { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();
 
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
 
   // Populate the tree and test the root item...
 
   const treeRoot = new MyCustomTreeItem(myDataSrc, { parent: null });
   treeRoot.autoExpandDepth = 1;
   treeRoot.attachTo(container);
 
--- a/devtools/client/performance/test/browser_perf-tree-abstract-03.js
+++ b/devtools/client/performance/test/browser_perf-tree-abstract-03.js
@@ -8,17 +8,17 @@
  */
 
 const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
 const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
 
 add_task(async function() {
   const { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();
 
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
 
   // Populate the tree by pressing RIGHT...
 
   const treeRoot = new MyCustomTreeItem(myDataSrc, { parent: null });
   treeRoot.attachTo(container);
   treeRoot.focus();
 
--- a/devtools/client/performance/test/browser_perf-tree-abstract-04.js
+++ b/devtools/client/performance/test/browser_perf-tree-abstract-04.js
@@ -8,17 +8,17 @@
 
 const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
 const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
 const { once } = require("devtools/client/performance/test/helpers/event-utils");
 
 add_task(async function() {
   const { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();
 
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
 
   // Populate the tree and test the root item...
 
   const treeRoot = new MyCustomTreeItem(myDataSrc, { parent: null });
   treeRoot.attachTo(container);
 
   const originalTreeRootExpandedState = treeRoot.expanded;
--- a/devtools/client/performance/test/browser_perf-tree-abstract-05.js
+++ b/devtools/client/performance/test/browser_perf-tree-abstract-05.js
@@ -8,17 +8,17 @@
  */
 
 const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
 const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
 
 add_task(async function() {
   const { MyCustomTreeItem } = synthesizeCustomTreeClass();
 
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   container.style.height = "100%";
   container.style.overflow = "scroll";
   await appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
 
   const myDataSrc = {
     label: "root",
     children: []
   };
--- a/devtools/client/performance/test/browser_perf-tree-view-01.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-01.js
@@ -14,17 +14,17 @@ const { synthesizeProfile } = require("d
 add_task(function() {
   const profile = synthesizeProfile();
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.autoExpandDepth = 0;
   treeRoot.attachTo(container);
 
   is(container.childNodes.length, 1,
     "The container node should have one child available.");
   is(container.childNodes[0].className, "call-tree-item",
     "The root node in the tree has the correct class name.");
 
--- a/devtools/client/performance/test/browser_perf-tree-view-02.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-02.js
@@ -23,17 +23,17 @@ add_task(function() {
     profile.threads[0].stringTable[1].replace("A (", `${MANGLED_FN} (`);
 
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.autoExpandDepth = 0;
   treeRoot.attachTo(container);
 
   const $$ = node => container.querySelectorAll(node);
   const $fun = (node, ancestor) => (ancestor || container).querySelector(
     ".call-tree-cell[type=function] > " + node);
   const $$fun = (node, ancestor) => (ancestor || container).querySelectorAll(
     ".call-tree-cell[type=function] > " + node);
--- a/devtools/client/performance/test/browser_perf-tree-view-03.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-03.js
@@ -14,17 +14,17 @@ const { synthesizeProfile } = require("d
 add_task(function() {
   const profile = synthesizeProfile();
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   const $$fun = i => container.querySelectorAll(".call-tree-cell[type=function]")[i];
   const $$nam = i => container.querySelectorAll(
     ".call-tree-cell[type=function] > .call-tree-name")[i];
   const $$dur = i => container.querySelectorAll(".call-tree-cell[type=duration]")[i];
 
   is(container.childNodes.length, 7,
--- a/devtools/client/performance/test/browser_perf-tree-view-04.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-04.js
@@ -14,17 +14,17 @@ const { synthesizeProfile } = require("d
 add_task(function() {
   const profile = synthesizeProfile();
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   is(treeRoot.target.getAttribute("origin"), "chrome",
     "The root node's 'origin' attribute is correct.");
   is(treeRoot.target.getAttribute("category"), "",
     "The root node's 'category' attribute is correct.");
   is(treeRoot.target.getAttribute("tooltiptext"), "",
     "The root node's 'tooltiptext' attribute is correct.");
--- a/devtools/client/performance/test/browser_perf-tree-view-05.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-05.js
@@ -14,17 +14,17 @@ const { synthesizeProfile } = require("d
 add_task(function() {
   const profile = synthesizeProfile();
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   const categories = container.querySelectorAll(".call-tree-category");
   is(categories.length, 6,
     "The call tree displays a correct number of categories.");
   ok(!container.hasAttribute("categories-hidden"),
     "All categories should be visible in the tree.");
 
--- a/devtools/client/performance/test/browser_perf-tree-view-06.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-06.js
@@ -15,17 +15,17 @@ const { idleWait, waitUntil } = require(
 add_task(async function() {
   const profile = synthesizeProfile();
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   const A = treeRoot.getChild();
   const B = A.getChild();
   const D = B.getChild();
 
   let linkEvent = null;
   const handler = (e) => {
--- a/devtools/client/performance/test/browser_perf-tree-view-07.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-07.js
@@ -14,17 +14,17 @@ const { synthesizeProfile } = require("d
 add_task(function() {
   const profile = synthesizeProfile();
   const threadNode = new ThreadNode(profile.threads[0], { startTime: 0, endTime: 20 });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   container.id = "call-tree-container";
   treeRoot.attachTo(container);
 
   const A = treeRoot.getChild();
   const B = A.getChild();
   const D = B.getChild();
 
   is(D.root, treeRoot,
--- a/devtools/client/performance/test/browser_perf-tree-view-08.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-08.js
@@ -15,17 +15,17 @@ const RecordingUtils = require("devtools
 add_task(function() {
   const threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20,
                                                            contentOnly: true });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
   const treeRoot = new CallView({ frame: threadNode, autoExpandDepth: 10 });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   /*
    * (root)
    *   - A
    *     - B
    *       - C
    *       - D
--- a/devtools/client/performance/test/browser_perf-tree-view-09.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-09.js
@@ -10,17 +10,17 @@
 const { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model");
 const { CallView } = require("devtools/client/performance/modules/widgets/tree-view");
 const RecordingUtils = require("devtools/shared/performance/recording-utils");
 
 add_task(function() {
   const threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20,
                                                            invertTree: true });
   const treeRoot = new CallView({ frame: threadNode, inverted: true });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   is(treeRoot.getChild(0).frame.location, "B",
     "The tree root's first child is the `B` function.");
   is(treeRoot.getChild(1).frame.location, "A",
     "The tree root's second child is the `A` function.");
 });
 
--- a/devtools/client/performance/test/browser_perf-tree-view-10.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-10.js
@@ -10,17 +10,17 @@
 const { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model");
 const { CallView } = require("devtools/client/performance/modules/widgets/tree-view");
 const RecordingUtils = require("devtools/shared/performance/recording-utils");
 
 add_task(function() {
   const threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 50,
                                                            invertTree: true });
   const treeRoot = new CallView({ frame: threadNode, inverted: true });
-  const container = document.createElement("vbox");
+  const container = document.createXULElement("vbox");
   treeRoot.attachTo(container);
 
   // Add 1 to each index to skip the hidden root node
   const $$nam = i => container.querySelectorAll(
     ".call-tree-cell[type=function] > .call-tree-name")[i + 1];
   const $$per = i => container.querySelectorAll(
     ".call-tree-cell[type=percentage]")[i + 1];
   const $$selfper = i => container.querySelectorAll(
--- a/devtools/client/performance/test/helpers/synth-utils.js
+++ b/devtools/client/performance/test/helpers/synth-utils.js
@@ -58,17 +58,17 @@ exports.synthesizeCustomTreeClass = () =
 
   function MyCustomTreeItem(dataSrc, properties) {
     AbstractTreeItem.call(this, properties);
     this.itemDataSrc = dataSrc;
   }
 
   MyCustomTreeItem.prototype = extend(AbstractTreeItem.prototype, {
     _displaySelf: function(document, arrowNode) {
-      const node = document.createElement("hbox");
+      const node = document.createXULElement("hbox");
       node.style.marginInlineStart = (this.level * 10) + "px";
       node.appendChild(arrowNode);
       node.appendChild(document.createTextNode(this.itemDataSrc.label));
       return node;
     },
 
     _populateSelf: function(children) {
       for (const childDataSrc of this.itemDataSrc.children) {