Bug 1256210 - Part 1: Factor out getting of services in test_additional_sheets.html. r=dbaron
authorCameron McCormack <cam@mcc.id.au>
Tue, 15 Mar 2016 18:38:07 +1100
changeset 312887 81cc69f9295fbdcdcee1f07f30ceac4c694d6e2f
parent 312886 85f0d8ad266f3132aa4d5ff7cd23cab41b128af2
child 312888 5d01a67037fbb2b1dfec6f8388bedcfc5b429410
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1256210
milestone48.0a1
Bug 1256210 - Part 1: Factor out getting of services in test_additional_sheets.html. r=dbaron MozReview-Commit-ID: GuODc7fnYVj
layout/style/test/chrome/test_additional_sheets.html
--- a/layout/style/test/chrome/test_additional_sheets.html
+++ b/layout/style/test/chrome/test_additional_sheets.html
@@ -12,16 +12,19 @@
 <pre id="test">
 <script type="application/javascript; version=1.8">
 
 
 
 var gIOService = Components.classes["@mozilla.org/network/io-service;1"]
   .getService(Components.interfaces.nsIIOService)
 
+var gSSService = Components.classes["@mozilla.org/content/style-sheet-service;1"]
+    .getService(Components.interfaces.nsIStyleSheetService);
+
 function getUri(style)
 {
   return "data:text/css," + style;
 }
 
 function getStyle(color, swapped)
 {
   return "body {color: " + color +  (swapped ? " !important" : "") +
@@ -101,34 +104,26 @@ function unregisterAgentSheet(win, style
 
 function unregisterAuthorSheet(win, style)
 {
   unregisterSheet(win, style, "AUTHOR_SHEET");
 }
 
 function loadAndRegisterSheet(win, style, type)
 {
-  var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"]
-    .getService(Components.interfaces.nsIStyleSheetService);
-  var ios = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService);
-  uri = ios.newURI(getUri(style), null, null);
-  sss.loadAndRegisterSheet(uri, sss[type]);
-  is (sss.sheetRegistered(uri, sss[type]), true);
+  uri = gIOService.newURI(getUri(style), null, null);
+  gSSService.loadAndRegisterSheet(uri, gSSService[type]);
+  is(gSSService.sheetRegistered(uri, gSSService[type]), true);
 }
 
 function unregisterSheet(win, style, type)
 {
-  var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"]
-    .getService(Components.interfaces.nsIStyleSheetService);
-  var ios = Components.classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService);
-  var uri = ios.newURI(getUri(style), null, null);
-  sss.unregisterSheet(uri, sss[type]);
-  is (sss.sheetRegistered(uri, sss[type]), false);
+  var uri = gIOService.newURI(getUri(style), null, null);
+  gSSService.unregisterSheet(uri, gSSService[type]);
+  is(gSSService.sheetRegistered(uri, gSSService[type]), false);
 }
 
 function setDocSheet(win, style)
 {
   var subdoc = win.document;
   var headID = subdoc.getElementsByTagName("head")[0];
   var cssNode = subdoc.createElement('style');
   cssNode.type = 'text/css';