Bug 1481949 - Don't load Custom Element script files for dummy.xul windows;r=kmag
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 01 Oct 2018 18:01:00 +0000
changeset 494786 96cb7281e630428a8d2b6128813615ae694b868d
parent 494785 a1cfc8fd44eefa562343373b6175902774a5ca31
child 494787 b82060ff3299da0ac4bd497251c0f995ef857f12
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1481949
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 1481949 - Don't load Custom Element script files for dummy.xul windows;r=kmag They are unnecessary for most every element, and we load multiple dummy.xul documents even in clean profiles. Differential Revision: https://phabricator.services.mozilla.com/D7112
toolkit/content/customElements.js
--- a/toolkit/content/customElements.js
+++ b/toolkit/content/customElements.js
@@ -154,28 +154,35 @@ function getInterfaceProxy(obj) {
   }
 
   return obj._customInterfaceProxy;
 }
 
 // Attach the base class to the window so other scripts can use it:
 window.MozXULElement = MozXULElement;
 
-for (let script of [
-  "chrome://global/content/elements/general.js",
-  "chrome://global/content/elements/textbox.js",
-  "chrome://global/content/elements/tabbox.js",
-]) {
-  Services.scriptloader.loadSubScript(script, window);
-}
+// For now, don't load any elements in the extension dummy document.
+// We will want to load <browser> when that's migrated (bug 1441935).
+const isDummyDocument = document.documentURI == "chrome://extensions/content/dummy.xul";
+if (!isDummyDocument) {
 
-for (let [tag, script] of [
-  ["findbar", "chrome://global/content/elements/findbar.js"],
-  ["stringbundle", "chrome://global/content/elements/stringbundle.js"],
-  ["printpreview-toolbar", "chrome://global/content/printPreviewToolbar.js"],
-  ["editor", "chrome://global/content/elements/editor.js"],
-]) {
-  customElements.setElementCreationCallback(tag, () => {
+  for (let script of [
+    "chrome://global/content/elements/general.js",
+    "chrome://global/content/elements/textbox.js",
+    "chrome://global/content/elements/tabbox.js",
+  ]) {
     Services.scriptloader.loadSubScript(script, window);
-  });
+  }
+
+  for (let [tag, script] of [
+    ["findbar", "chrome://global/content/elements/findbar.js"],
+    ["stringbundle", "chrome://global/content/elements/stringbundle.js"],
+    ["printpreview-toolbar", "chrome://global/content/printPreviewToolbar.js"],
+    ["editor", "chrome://global/content/elements/editor.js"],
+  ]) {
+    customElements.setElementCreationCallback(tag, () => {
+      Services.scriptloader.loadSubScript(script, window);
+    });
+  }
+
 }
 
 }