Bug 575094 - Modify how prefservice is accessed so that it's from the parent process and not from the child process. Also re-enable test_bug528292_wrap.js. r=jdm
authorConnor <cojojennings@gmail.com>
Wed, 29 Oct 2014 23:58:03 -0400
changeset 226132 e021487d1297f81b1fa8dfd49e5af483ba12e7fa
parent 226131 dac60d6bef5642cff46a24d339bfe4237175b1fb
child 226133 41536afea9b39595727186826e89032292dec5b7
push id36
push userdburns@mozilla.com
push dateMon, 10 Nov 2014 15:14:02 +0000
reviewersjdm
bugs575094
milestone36.0a1
Bug 575094 - Modify how prefservice is accessed so that it's from the parent process and not from the child process. Also re-enable test_bug528292_wrap.js. r=jdm
netwerk/test/unit/test_bug528292.js
netwerk/test/unit_ipc/disabled_test_bug528292_wrap.js
netwerk/test/unit_ipc/test_bug528292_wrap.js
netwerk/test/unit_ipc/xpcshell.ini
--- a/netwerk/test/unit/test_bug528292.js
+++ b/netwerk/test/unit/test_bug528292.js
@@ -31,27 +31,35 @@ function preRedirectHandler(metadata, re
 
 function postRedirectHandler(metadata, response)
 {
   receivedCookieVal = metadata.getHeader("Cookie");
   response.setHeader("Content-Type", "text/plain");
   response.bodyOutputStream.write(responseBody, responseBody.length);
 }
 
+function inChildProcess() {
+  return Cc["@mozilla.org/xre/app-info;1"]
+  .getService(Ci.nsIXULRuntime)
+  .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
+}
+
 function run_test()
 {
   // Start the HTTP server.
   httpServer = new HttpServer();
   httpServer.registerPathHandler(preRedirectPath, preRedirectHandler);
   httpServer.registerPathHandler(postRedirectPath, postRedirectHandler);
   httpServer.start(-1);
 
-  // Disable third-party cookies in general.
-  Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch).
-    setIntPref("network.cookie.cookieBehavior", 1);
+  if (!inChildProcess()) {
+    // Disable third-party cookies in general.
+    Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch).
+      setIntPref("network.cookie.cookieBehavior", 1);
+  }
 
   var ioService = Cc["@mozilla.org/network/io-service;1"].
                   getService(Ci.nsIIOService);
 
   // Set up a channel with forceAllowThirdPartyCookie set to true.  We'll use
   // the channel both to set a cookie (since nsICookieService::setCookieString
   // requires such a channel in order to successfully set a cookie) and then
   // to load the pre-redirect URI.
rename from netwerk/test/unit_ipc/disabled_test_bug528292_wrap.js
rename to netwerk/test/unit_ipc/test_bug528292_wrap.js
--- a/netwerk/test/unit_ipc/disabled_test_bug528292_wrap.js
+++ b/netwerk/test/unit_ipc/test_bug528292_wrap.js
@@ -1,3 +1,6 @@
+Cu.import("resource://gre/modules/Services.jsm");
+
 function run_test() {
+  Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
   run_test_in_child("../unit/test_bug528292.js");
-}
+}
\ No newline at end of file
--- a/netwerk/test/unit_ipc/xpcshell.ini
+++ b/netwerk/test/unit_ipc/xpcshell.ini
@@ -1,15 +1,15 @@
 [DEFAULT]
 head = head_channels_clone.js head_cc.js
 tail =
 skip-if = toolkit == 'android' || toolkit == 'gonk'
-support-files = disabled_test_bug528292_wrap.js
-	child_app_offline.js
+support-files = child_app_offline.js
 
+[test_bug528292_wrap.js]
 [test_bug248970_cookie_wrap.js]
 [test_cacheflags_wrap.js]
 [test_cache_jar_wrap.js]
 [test_channel_close_wrap.js]
 [test_cookie_header_wrap.js]
 [test_cookiejars_wrap.js]
 [test_dns_cancel_wrap.js]
 [test_dns_service_wrap.js]