Bug 1632850 - Port bug 1631289: Stop including preferences.css twice in preferences dialogs. r=mkmelin DONTBUILD
authorRichard Marti <richard.marti@gmail.com>
Sat, 25 Apr 2020 13:55:33 +0300
changeset 38042 96658057d800c7cae75607dd70525f489302a44c
parent 38041 274dd8d1e772b19acd32ff1d575a1c5939a0dd5b
child 38043 cb1266d16fcfdfc2a971656d32e2d3b7b7ab4741
push id2595
push userclokep@gmail.com
push dateMon, 04 May 2020 19:02:04 +0000
treeherdercomm-beta@f53913797371 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1632850, 1631289
Bug 1632850 - Port bug 1631289: Stop including preferences.css twice in preferences dialogs. r=mkmelin DONTBUILD Port of https://hg.mozilla.org/mozilla-central/rev/fbce36fb761f
mail/components/preferences/subdialogs.js
--- a/mail/components/preferences/subdialogs.js
+++ b/mail/components/preferences/subdialogs.js
@@ -61,24 +61,25 @@ SubDialog.prototype = {
   updateTitle(aEvent) {
     if (aEvent.target != this._frame.contentDocument) {
       return;
     }
     this._titleElement.textContent = this._frame.contentDocument.title;
   },
 
   injectXMLStylesheet(aStylesheetURL) {
-    let contentStylesheet = this._frame.contentDocument.createProcessingInstruction(
+    const doc = this._frame.contentDocument;
+    if ([...doc.styleSheets].find(s => s.href === aStylesheetURL)) {
+      return;
+    }
+    let contentStylesheet = doc.createProcessingInstruction(
       "xml-stylesheet",
       'href="' + aStylesheetURL + '" type="text/css"'
     );
-    this._frame.contentDocument.insertBefore(
-      contentStylesheet,
-      this._frame.contentDocument.documentElement
-    );
+    doc.insertBefore(contentStylesheet, doc.documentElement);
     let dialog = this._frame.contentDocument.documentElement.querySelector(
       "dialog"
     );
     if (dialog) {
       let link = document.createElementNS(
         "http://www.w3.org/1999/xhtml",
         "link"
       );