Bug 1223573 - Part 8. Work around assertions caused by attempting to load the style sheets as author sheets - load them as user sheets for now. r=mikedeboer
authorMark Banner <standard8@mozilla.com>
Sun, 29 Nov 2015 17:08:35 +0000
changeset 274492 ab436aa1b1edb17da9c004063b1101efb97e0fcc
parent 274491 722d3a01dcfcb37f57e9e2a299bef5c0c1a528c9
child 274493 29ce9059dc2c97f2403f4e694eff3bcf611a8fc5
push id16444
push usermbanner@mozilla.com
push dateSun, 29 Nov 2015 17:10:04 +0000
treeherderfx-team@29ce9059dc2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1223573
milestone45.0a1
Bug 1223573 - Part 8. Work around assertions caused by attempting to load the style sheets as author sheets - load them as user sheets for now. r=mikedeboer
browser/extensions/loop/bootstrap.js
browser/extensions/loop/skin/osx/platform.css
browser/extensions/loop/skin/shared/loop.css
browser/extensions/loop/skin/windows/platform.css
--- a/browser/extensions/loop/bootstrap.js
+++ b/browser/extensions/loop/bootstrap.js
@@ -782,18 +782,22 @@ function startup() {
 
   // Load our stylesheets.
   let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
     .getService(Components.interfaces.nsIStyleSheetService);
   let sheets = ["chrome://loop-shared/skin/loop.css",
                 "chrome://loop/skin/platform.css"];
   for (let sheet of sheets) {
     let styleSheetURI = Services.io.newURI(sheet, null, null);
+    // XXX We would love to specify AUTHOR_SHEET here and in shutdown, however
+    // bug 1228542 prevents us from doing that as we'd cause a lot of assertions
+    // in debug mode for tests. Once that is fixed, we should be able to change
+    // this, and remove the !important attributes from our syle sheets.
     styleSheetService.loadAndRegisterSheet(styleSheetURI,
-                                           styleSheetService.AUTHOR_SHEET);
+                                           styleSheetService.USER_SHEET);
   }
 }
 
 /**
  * Called when the add-on is shutting down, could be for re-installation
  * or just uninstall.
  */
 function shutdown() {
--- a/browser/extensions/loop/skin/osx/platform.css
+++ b/browser/extensions/loop/skin/osx/platform.css
@@ -1,39 +1,47 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
-notification[value="loop-sharing-notification"] {
-  background: #00a9dc;
-  padding: 0;
-  border: 0;
-}
+/* Only apply to browser.xul documents */
+@-moz-document url("chrome://browser/content/browser.xul") {
+  /**
+   * XXX Due to bug 1228542, anything in this file that overrides a browser style
+   * must specify !important. Otherwise the style won't get applied correctly
+   * due to the limitations caused by the bug.
+   */
 
-notification[value="loop-sharing-notification"].paused {
-  background: #ebebeb;
-}
+  notification[value="loop-sharing-notification"] {
+    background: #00a9dc !important;
+    padding: 0 !important;
+    border: 0 !important;
+  }
 
-notification[value="loop-sharing-notification"] .notification-button {
-  background: #fff;
-  border-radius: 0;
-}
+  notification[value="loop-sharing-notification"].paused {
+    background: #ebebeb !important;
+  }
 
-notification[value="loop-sharing-notification"].paused .notification-button {
-  background: #57bd35;
-}
+  notification[value="loop-sharing-notification"] .notification-button {
+    background: #fff !important;
+    border-radius: 0 !important;
+  }
 
-notification[value="loop-sharing-notification"].paused .notification-button:hover {
-  background: #39a017;
-}
+  notification[value="loop-sharing-notification"].paused .notification-button {
+    background: #57bd35 !important;
+  }
 
-notification[value="loop-sharing-notification"] .notification-button:hover,
-notification[value="loop-sharing-notification"].paused .notification-button-default:hover {
-  background: #ebebeb;
-}
+  notification[value="loop-sharing-notification"].paused .notification-button:hover {
+    background: #39a017 !important;
+  }
 
-notification[value="loop-sharing-notification"] .notification-button-default,
-notification[value="loop-sharing-notification"].paused .notification-button-default {
-  background: #fff;
+  notification[value="loop-sharing-notification"] .notification-button:hover,
+  notification[value="loop-sharing-notification"].paused .notification-button-default:hover {
+    background: #ebebeb !important;
+  }
+
+  notification[value="loop-sharing-notification"] .notification-button-default,
+  notification[value="loop-sharing-notification"].paused .notification-button-default {
+    background: #fff !important;
+  }
 }
-
--- a/browser/extensions/loop/skin/shared/loop.css
+++ b/browser/extensions/loop/skin/shared/loop.css
@@ -1,24 +1,30 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 /* Only apply to browser.xul documents */
 @-moz-document url("chrome://browser/content/browser.xul") {
+  /**
+   * XXX Due to bug 1228542, anything in this file that overrides a browser style
+   * must specify !important. Otherwise the style won't get applied correctly
+   * due to the limitations caused by the bug.
+   */
+
   /*
      XXX Copied from browser/themes/<platform>/browser.css. Should really be
      changing the sizes of icons in files to 16px x 16px and no borders.
    */
   :-moz-any(toolbar, .widget-overflow-list) #loop-button > .toolbarbutton-icon,
   :-moz-any(toolbar, .widget-overflow-list) #loop-button > :-moz-any(.toolbarbutton-menubutton-button, .toolbarbutton-badge-stack) > .toolbarbutton-icon {
-    max-width: 18px;
-    margin: 0;
+    max-width: 18px !important;
+    margin: 0 !important;
   }
 
   #loop-button {
     list-style-image: url(chrome://loop/skin/toolbar.png);
     -moz-image-region: rect(0, 18px, 18px, 0);
   }
 
   toolbar[brighttext] #loop-button {
@@ -156,125 +162,125 @@
     }
 
     #loop-button[cui-areatype="menu-panel"]:not([disabled="true"])[state="active"]:-moz-any(:hover,:hover:active,[open]) {
       -moz-image-region: rect(0, 224px, 32px, 192px);
     }
   }
 
   notification[value="loop-sharing-notification"] {
-    -moz-appearance: none;
-    height: 40px;
-    background-color: #00a9dc;
-    box-shadow: 0 40px 1px rgba(0,0,0,.5) inset;
+    -moz-appearance: none !important;
+    height: 40px !important;
+    background-color: #00a9dc !important;
+    box-shadow: 0 40px 1px rgba(0,0,0,.5) inset !important;
   }
 
   notification[value="loop-sharing-notification"].paused {
-    background-color: #ebebeb;
+    background-color: #ebebeb !important;
   }
 
   notification[value="loop-sharing-notification"] .notification-inner {
-    color: #fff;
-    padding: 0;
+    color: #fff !important;
+    padding: 0 !important;
   }
 
   notification[value="loop-sharing-notification"].paused .notification-inner {
-    color: #00a9dc;
+    color: #00a9dc !important;
   }
 
   notification[value="loop-sharing-notification"] .notification-button {
-    -moz-appearance: none;
-    background-color: #fff;
-    border: 0;
-    border-right: solid 1px #ebebeb;
-    width: 100px;
-    height: 40px;
-    margin: 0;
-    list-style-image: url(chrome://browser/content/loop/shared/img/pause-12x12.svg);
-    box-shadow: 0 40px 1px rgba(0,0,0,.5) inset;
-    text-shadow: none;
+    -moz-appearance: none !important;
+    background-color: #fff !important;
+    border: 0 !important;
+    border-right: solid 1px #ebebeb !important;
+    width: 100px !important;
+    height: 40px !important;
+    margin: 0 !important;
+    list-style-image: url(chrome://loop/content/shared/img/pause-12x12.svg) !important;
+    box-shadow: 0 40px 1px rgba(0,0,0,.5) inset !important;
+    text-shadow: none !important;
   }
 
   notification[value="loop-sharing-notification"] .notification-button:-moz-locale-dir(rtl) {
-    border-right: 0;
-    border-left: solid 1px #ebebeb;
+    border-right: 0 !important;
+    border-left: solid 1px #ebebeb !important;
   }
 
   notification[value="loop-sharing-notification"].paused .notification-button {
-    background-color: #57bd35;
-    color: #fff;
-    list-style-image: url(chrome://browser/content/loop/shared/img/play-12x12.svg);
+    background-color: #57bd35 !important;
+    color: #fff !important;
+    list-style-image: url(chrome://loop/content/shared/img/play-12x12.svg) !important;
   }
 
   notification[value="loop-sharing-notification"].paused .notification-button:hover {
-    background-color: #39a017;
+    background-color: #39a017 !important;
   }
 
   notification[value="loop-sharing-notification"] .notification-button:hover,
   notification[value="loop-sharing-notification"].paused .notification-button-default:hover {
-    background-color: #ebebeb;
+    background-color: #ebebeb !important;
   }
 
   notification[value="loop-sharing-notification"] .notification-button-default,
   notification[value="loop-sharing-notification"].paused .notification-button-default {
-    color: #d92215;
-    background-color: #fff;
-    border-right: 0;
-    list-style-image: url(chrome://browser/content/loop/shared/img/stop-12x12.svg);
+    color: #d92215 !important;
+    background-color: #fff !important;
+    border-right: 0 !important;
+    list-style-image: url(chrome://loop/content/shared/img/stop-12x12.svg) !important;
   }
 
   notification[value="loop-sharing-notification"] .notification-button .button-icon {
-    display: block;
-    -moz-margin-end: 6px;
+    display: block !important;
+    -moz-margin-end: 6px !important;
   }
 
   notification[value="loop-sharing-notification"] .button-menubutton-button {
-    min-width: 0;
+    min-width: 0 !important;
   }
 
   notification[value="loop-sharing-notification"] .messageImage {
-    list-style-image: url(chrome://browser/content/loop/shared/img/icons-16x16.svg#loop-icon-white);
-    margin-inline-start: 14px;
+    list-style-image: url(chrome://loop/content/shared/img/icons-16x16.svg#loop-icon-white) !important;
+    margin-inline-start: 14px !important;
   }
 
   notification[value="loop-sharing-notification"].paused .messageImage {
-    list-style-image: url(chrome://browser/content/loop/shared/img/icons-16x16.svg#loop-icon-still);
+    list-style-image: url(chrome://loop/content/shared/img/icons-16x16.svg#loop-icon-still) !important;
   }
 
   notification[value="loop-sharing-notification"] .close-icon {
-    display: none;
+    display: none !important;
   }
 
   chatbox[src^="about:loopconversation#"] > .chat-titlebar {
-    background-color: #00a9dc;
-    border-color: #00a9dc;
+    background-color: #00a9dc !important;
+    border-color: #00a9dc !important;
   }
 
   chatbox[src^="about:loopconversation#"] .chat-title {
-    color: white;
+    color: white !important;
   }
 
   chatbox[src^="about:loopconversation#"] .chat-minimize-button {
-    list-style-image: url("chrome://browser/skin/social/chat-icons.svg#minimize-white");
+    list-style-image: url("chrome://browser/skin/social/chat-icons.svg#minimize-white") !important;
   }
 
   chatbox[src^="about:loopconversation#"] .chat-swap-button {
-    list-style-image: url("chrome://browser/skin/social/chat-icons.svg#expand-white");
+    list-style-image: url("chrome://browser/skin/social/chat-icons.svg#expand-white") !important;
   }
 
   .chat-loop-hangup {
-    list-style-image: url("chrome://browser/skin/social/chat-icons.svg#exit-white");
-    background-color: #d13f1a;
-    border: 1px solid #d13f1a;
-    border-top-right-radius: 4px;
-    width: 32px;
-    height: 26px;
-    margin-top: -6px;
-    margin-bottom: -5px;
-    -moz-margin-start: 6px;
-    -moz-margin-end: -5px;
+    list-style-image: url("chrome://browser/skin/social/chat-icons.svg#exit-white") !important;
+    background-color: #d13f1a !important;
+    border: 1px solid #d13f1a !important;
+    border-top-right-radius: 4px !important;
+    width: 32px !important;
+    height: 26px !important;
+    margin-top: -6px !important;
+    margin-bottom: -5px !important;
+    -moz-margin-start: 6px !important;
+    -moz-margin-end: -5px !important;
   }
 
   .chat-toolbarbutton.chat-loop-hangup:-moz-any(:hover,:hover:active) {
-    background-color: #ef6745;
-    border-color: #ef6745;
+    background-color: #ef6745 !important;
+    border-color: #ef6745 !important;
   }
 }
--- a/browser/extensions/loop/skin/windows/platform.css
+++ b/browser/extensions/loop/skin/windows/platform.css
@@ -1,18 +1,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
-@media (-moz-windows-theme: luna-silver) and (max-resolution: 1dppx) {
-  #loop-button {
-    list-style-image: url(chrome://loop/skin/toolbar-lunaSilver.png)
+/* Only apply to browser.xul documents */
+@-moz-document url("chrome://browser/content/browser.xul") {
+  /**
+   * XXX Due to bug 1228542, anything in this file that overrides a browser style
+   * must specify !important. Otherwise the style won't get applied correctly
+   * due to the limitations caused by the bug.
+   */
+
+  @media (-moz-windows-theme: luna-silver) and (max-resolution: 1dppx) {
+    #loop-button {
+      list-style-image: url(chrome://loop/skin/toolbar-lunaSilver.png)
+    }
+  }
+
+  @media (-moz-windows-theme: luna-silver) and (min-resolution: 1.1dppx) {
+    #loop-button {
+      list-style-image: url(chrome://loop/skin/toolbar-lunaSilver@2x.png)
+    }
   }
 }
-
-@media (-moz-windows-theme: luna-silver) and (min-resolution: 1.1dppx) {
-  #loop-button {
-    list-style-image: url(chrome://loop/skin/toolbar-lunaSilver@2x.png)
-  }
-}
-