Bug 1162487 - Enable the dom.caches.enabled pref in test_chrome_constructor.html; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 07 May 2015 23:04:00 -0400
changeset 274391 842dcf5aa1c13be3f64ef12555a87cfdcb36de8c
parent 274390 8f67276f2c37895a4569f16b44d0a4e79604b2c8
child 274392 574db34c205c49aea4513aa6382147567b642ffb
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1162487
milestone40.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 1162487 - Enable the dom.caches.enabled pref in test_chrome_constructor.html; r=baku
dom/cache/test/mochitest/test_chrome_constructor.html
--- a/dom/cache/test/mochitest/test_chrome_constructor.html
+++ b/dom/cache/test/mochitest/test_chrome_constructor.html
@@ -8,36 +8,40 @@
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
 <script class="testbody" type="text/javascript">
   var Cu = Components.utils;
   Cu.import('resource://gre/modules/Services.jsm');
   SimpleTest.waitForExplicitFinish();
 
-  // attach to a different origin's CacheStorage
-  var url = 'http://example.com/';
-  var uri = Services.io.newURI(url, null, null);
-  var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
-  var storage = new CacheStorage('content', principal);
+  SpecialPowers.pushPrefEnv({
+    "set": [["dom.caches.enabled", true]],
+  }, function() {
+    // attach to a different origin's CacheStorage
+    var url = 'http://example.com/';
+    var uri = Services.io.newURI(url, null, null);
+    var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
+    var storage = new CacheStorage('content', principal);
 
-  // verify we can use the other origin's CacheStorage as normal
-  var req = new Request('http://example.com/index.html');
-  var res = new Response('hello world');
-  var cache;
-  storage.open('foo').then(function(c) {
-    cache = c;
-    ok(cache, 'storage should create cache');
-    return cache.put(req, res.clone());
-  }).then(function() {
-    return cache.match(req);
-  }).then(function(foundResponse) {
-    return Promise.all([res.text(), foundResponse.text()]);
-  }).then(function(results) {
-    is(results[0], results[1], 'cache should contain response');
-    return storage.delete('foo');
-  }).then(function(deleted) {
-    ok(deleted, 'storage should delete cache');
-    SimpleTest.finish();
+    // verify we can use the other origin's CacheStorage as normal
+    var req = new Request('http://example.com/index.html');
+    var res = new Response('hello world');
+    var cache;
+    storage.open('foo').then(function(c) {
+      cache = c;
+      ok(cache, 'storage should create cache');
+      return cache.put(req, res.clone());
+    }).then(function() {
+      return cache.match(req);
+    }).then(function(foundResponse) {
+      return Promise.all([res.text(), foundResponse.text()]);
+    }).then(function(results) {
+      is(results[0], results[1], 'cache should contain response');
+      return storage.delete('foo');
+    }).then(function(deleted) {
+      ok(deleted, 'storage should delete cache');
+      SimpleTest.finish();
+    });
   });
 </script>
 </body>
 </html>