Backed out 2 changesets (bug 1423839) for xpcshell failures on netwerk/test/unit/test_NetUtil.js
authorDorel Luca <dluca@mozilla.com>
Tue, 23 Oct 2018 00:49:18 +0300
changeset 442473 bb628db881452e7a667b1961af9eef2fcb5b4fd2
parent 442472 2d51f2e8955bb87cedf26a3c6d474735d31757cd
child 442474 0a73fd515a35eb7337d4c8d91aa70275c542efa4
push id34907
push userebalazs@mozilla.com
push dateTue, 23 Oct 2018 09:23:56 +0000
treeherdermozilla-central@dfa1eb1d036f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1423839
milestone65.0a1
backs out501fffbf872d0a320069448010aa0706d3b81409
406ca9722ffaa14caf02923c541942725f835d32
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
Backed out 2 changesets (bug 1423839) for xpcshell failures on netwerk/test/unit/test_NetUtil.js Backed out changeset 501fffbf872d (bug 1423839) Backed out changeset 406ca9722ffa (bug 1423839)
.eslintignore
netwerk/base/NetUtil.jsm
netwerk/cookie/test/unit/test_bug1155169.js
netwerk/cookie/test/unit/test_bug1321912.js
netwerk/cookie/test/unit/test_eviction.js
netwerk/cookie/test/unit/test_parser_0001.js
netwerk/cookie/test/unit/test_parser_0019.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -21,17 +21,19 @@ extensions/universalchardet/**
 gfx/layers/**
 gfx/tests/browser/**
 gfx/tests/chrome/**
 gfx/tests/mochitest/**
 image/**
 layout/**
 memory/replace/dmd/test/**
 modules/**
+netwerk/base/NetUtil.jsm
 netwerk/cookie/test/browser/**
+netwerk/cookie/test/unit/**
 netwerk/protocol/**
 netwerk/dns/**
 netwerk/test/browser/**
 netwerk/test/httpserver/**
 netwerk/test/mochitests/**
 netwerk/test/unit*/**
 netwerk/wifi/**
 parser/**
--- a/netwerk/base/NetUtil.jsm
+++ b/netwerk/base/NetUtil.jsm
@@ -7,28 +7,29 @@
 var EXPORTED_SYMBOLS = [
   "NetUtil",
 ];
 
 /**
  * Necko utilities
  */
 
-// //////////////////////////////////////////////////////////////////////////////
-// // Constants
+////////////////////////////////////////////////////////////////////////////////
+//// Constants
 
 const PR_UINT32_MAX = 0xffffffff;
 
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
                                                  "nsIBinaryInputStream", "setInputStream");
 
-// //////////////////////////////////////////////////////////////////////////////
-// // NetUtil Object
+////////////////////////////////////////////////////////////////////////////////
+//// NetUtil Object
 
 var NetUtil = {
     /**
      * Function to perform simple async copying from aSource (an input stream)
      * to aSink (an output stream).  The copy will happen on some background
      * thread.  Both streams will be closed when the copy completes.
      *
      * @param aSource
@@ -39,17 +40,18 @@ var NetUtil = {
      *        A function that will be called at copy completion with a single
      *        argument: the nsresult status code for the copy operation.
      *
      * @return An nsIRequest representing the copy operation (for example, this
      *         can be used to cancel the copying).  The consumer can ignore the
      *         return value if desired.
      */
     asyncCopy: function NetUtil_asyncCopy(aSource, aSink,
-                                          aCallback = null) {
+                                          aCallback = null)
+    {
         if (!aSource || !aSink) {
             let exception = new Components.Exception(
                 "Must have a source and a sink",
                 Cr.NS_ERROR_INVALID_ARG,
                 Components.stack.caller
             );
             throw exception;
         }
@@ -60,21 +62,21 @@ var NetUtil = {
         copier.init(aSource, aSink,
                     null /* Default event target */,
                     0 /* Default length */,
                     true, true /* Auto-close */);
 
         var observer;
         if (aCallback) {
             observer = {
-                onStartRequest(aRequest, aContext) {},
-                onStopRequest(aRequest, aContext, aStatusCode) {
+                onStartRequest: function(aRequest, aContext) {},
+                onStopRequest: function(aRequest, aContext, aStatusCode) {
                     aCallback(aStatusCode);
-                },
-            };
+                }
+            }
         } else {
             observer = null;
         }
 
         // start the copying
         copier.QueryInterface(Ci.nsIAsyncStreamCopier).asyncCopy(observer, null);
         return copier;
     },
@@ -92,17 +94,18 @@ var NetUtil = {
      *        Using an nsIURI, nsIFile, or string spec directly is deprecated.
      * @param aCallback
      *        The callback function that will be notified upon completion.  It
      *        will get these arguments:
      *        1) An nsIInputStream containing the data from aSource, if any.
      *        2) The status code from opening the source.
      *        3) Reference to the nsIRequest.
      */
-    asyncFetch: function NetUtil_asyncFetch(aSource, aCallback) {
+    asyncFetch: function NetUtil_asyncFetch(aSource, aCallback)
+    {
         if (!aSource || !aCallback) {
             let exception = new Components.Exception(
                 "Must have a source and a callback",
                 Cr.NS_ERROR_INVALID_ARG,
                 Components.stack.caller
             );
             throw exception;
         }
@@ -112,21 +115,21 @@ var NetUtil = {
         let pipe = Cc["@mozilla.org/pipe;1"].
                    createInstance(Ci.nsIPipe);
         pipe.init(true, true, 0, PR_UINT32_MAX, null);
 
         // Create a listener that will give data to the pipe's output stream.
         let listener = Cc["@mozilla.org/network/simple-stream-listener;1"].
                        createInstance(Ci.nsISimpleStreamListener);
         listener.init(pipe.outputStream, {
-            onStartRequest(aRequest, aContext) {},
-            onStopRequest(aRequest, aContext, aStatusCode) {
+            onStartRequest: function(aRequest, aContext) {},
+            onStopRequest: function(aRequest, aContext, aStatusCode) {
                 pipe.outputStream.close();
                 aCallback(pipe.inputStream, aStatusCode, aRequest);
-            },
+            }
         });
 
         // Input streams are handled slightly differently from everything else.
         if (aSource instanceof Ci.nsIInputStream) {
             let pump = Cc["@mozilla.org/network/input-stream-pump;1"].
                        createInstance(Ci.nsIInputStreamPump);
             pump.init(aSource, 0, 0, true);
             pump.asyncRead(listener, null);
@@ -139,27 +142,29 @@ var NetUtil = {
         }
 
         try {
             // Open the channel using asyncOpen2() if the loadinfo contains one
             // of the security mode flags, otherwise fall back to use asyncOpen().
             if (channel.loadInfo &&
                 channel.loadInfo.securityMode != 0) {
                 channel.asyncOpen2(listener);
-            } else {
+            }
+            else {
                 // Log deprecation warning to console to make sure all channels
                 // are created providing the correct security flags in the loadinfo.
                 // See nsILoadInfo for all available security flags and also the API
                 // of NetUtil.newChannel() for details above.
                 Cu.reportError("NetUtil.jsm: asyncFetch() requires the channel to have " +
                     "one of the security flags set in the loadinfo (see nsILoadInfo). " +
                     "Please create channel using NetUtil.newChannel()");
                 channel.asyncOpen(listener, null);
             }
-        } catch (e) {
+        }
+        catch (e) {
             let exception = new Components.Exception(
                 "Failed to open input source '" + channel.originalURI.spec + "'",
                 e.result,
                 Components.stack.caller,
                 aSource,
                 e
             );
             throw exception;
@@ -176,31 +181,32 @@ var NetUtil = {
      *        The character set for the URI.  Only used if aTarget is not an
      *        nsIFile.
      * @param aBaseURI [optional]
      *        The base URI for the spec.  Only used if aTarget is not an
      *        nsIFile.
      *
      * @return an nsIURI object.
      */
-    newURI: function NetUtil_newURI(aTarget, aOriginCharset, aBaseURI) {
+    newURI: function NetUtil_newURI(aTarget, aOriginCharset, aBaseURI)
+    {
         if (!aTarget) {
             let exception = new Components.Exception(
                 "Must have a non-null string spec or nsIFile object",
                 Cr.NS_ERROR_INVALID_ARG,
                 Components.stack.caller
             );
             throw exception;
         }
 
         if (aTarget instanceof Ci.nsIFile) {
-            return Services.io.newFileURI(aTarget);
+            return this.ioService.newFileURI(aTarget);
         }
 
-        return Services.io.newURI(aTarget, aOriginCharset, aBaseURI);
+        return this.ioService.newURI(aTarget, aOriginCharset, aBaseURI);
     },
 
     /**
      * Constructs a new channel for the given source.
      *
      * Keep in mind that URIs coming from a webpage should *never* use the
      * systemPrincipal as the loadingPrincipal.
      *
@@ -225,17 +231,18 @@ var NetUtil = {
      *          loadUsingSystemPrincipal:
      *            Set this to true to use the system principal as
      *            loadingPrincipal.  This must be omitted if loadingPrincipal or
      *            loadingNode are present.
      *            This should be used with care as it skips security checks.
      *        }
      * @return an nsIChannel object.
      */
-    newChannel: function NetUtil_newChannel(aWhatToLoad) {
+    newChannel: function NetUtil_newChannel(aWhatToLoad)
+    {
         // Make sure the API is called using only the options object.
         if (typeof aWhatToLoad != "object" || arguments.length != 1) {
             throw new Components.Exception(
                 "newChannel requires a single object argument",
                 Cr.NS_ERROR_INVALID_ARG,
                 Components.stack.caller
             );
         }
@@ -310,22 +317,22 @@ var NetUtil = {
                     " the options object unless loading from system principal.",
                     Cr.NS_ERROR_INVALID_ARG,
                     Components.stack.caller
                 );
             }
             contentPolicyType = Ci.nsIContentPolicy.TYPE_OTHER;
         }
 
-        return Services.io.newChannelFromURI2(uri,
-                                              loadingNode || null,
-                                              loadingPrincipal || null,
-                                              triggeringPrincipal || null,
-                                              securityFlags,
-                                              contentPolicyType);
+        return this.ioService.newChannelFromURI2(uri,
+                                                 loadingNode || null,
+                                                 loadingPrincipal || null,
+                                                 triggeringPrincipal || null,
+                                                 securityFlags,
+                                                 contentPolicyType);
     },
 
     /**
      * Reads aCount bytes from aInputStream into a string.
      *
      * @param aInputStream
      *        The input stream to read from.
      * @param aCount
@@ -343,17 +350,18 @@ var NetUtil = {
      * @throws NS_BASE_STREAM_WOULD_BLOCK if reading from aInputStream would
      *         block the calling thread (non-blocking mode only).
      * @throws NS_ERROR_FAILURE if there are not enough bytes available to read
      *         aCount amount of data.
      * @throws NS_ERROR_ILLEGAL_INPUT if aInputStream has invalid sequences
      */
     readInputStreamToString: function NetUtil_readInputStreamToString(aInputStream,
                                                                       aCount,
-                                                                      aOptions) {
+                                                                      aOptions)
+    {
         if (!(aInputStream instanceof Ci.nsIInputStream)) {
             let exception = new Components.Exception(
                 "First argument should be an nsIInputStream",
                 Cr.NS_ERROR_INVALID_ARG,
                 Components.stack.caller
             );
             throw exception;
         }
@@ -381,29 +389,31 @@ var NetUtil = {
             }
 
             cis.init(aInputStream, aOptions.charset, aCount,
                      aOptions.replacement);
             let str = {};
             cis.readString(-1, str);
             cis.close();
             return str.value;
-          } catch (e) {
+          }
+          catch (e) {
             // Adjust the stack so it throws at the caller's location.
             throw new Components.Exception(e.message, e.result,
                                            Components.stack.caller, e.data);
           }
         }
 
         let sis = Cc["@mozilla.org/scriptableinputstream;1"].
                   createInstance(Ci.nsIScriptableInputStream);
         sis.init(aInputStream);
         try {
             return sis.readBytes(aCount);
-        } catch (e) {
+        }
+        catch (e) {
             // Adjust the stack so it throws at the caller's location.
             throw new Components.Exception(e.message, e.result,
                                            Components.stack.caller, e.data);
         }
     },
 
     /**
      * Reads aCount bytes from aInputStream into a string.
@@ -416,17 +426,18 @@ var NetUtil = {
      * @return the bytes from the input stream in string form.
      *
      * @throws NS_ERROR_INVALID_ARG if aInputStream is not an nsIInputStream.
      * @throws NS_BASE_STREAM_WOULD_BLOCK if reading from aInputStream would
      *         block the calling thread (non-blocking mode only).
      * @throws NS_ERROR_FAILURE if there are not enough bytes available to read
      *         aCount amount of data.
      */
-    readInputStream(aInputStream, aCount) {
+    readInputStream(aInputStream, aCount)
+    {
         if (!(aInputStream instanceof Ci.nsIInputStream)) {
             let exception = new Components.Exception(
                 "First argument should be an nsIInputStream",
                 Cr.NS_ERROR_INVALID_ARG,
                 Components.stack.caller
             );
             throw exception;
         }
@@ -435,9 +446,21 @@ var NetUtil = {
             aCount = aInputStream.available();
         }
 
         let stream = new BinaryInputStream(aInputStream);
         let result = new ArrayBuffer(aCount);
         stream.readArrayBuffer(result.byteLength, result);
         return result;
     },
+
+    /**
+     * Returns a reference to nsIIOService.
+     *
+     * @return a reference to nsIIOService.
+     */
+    get ioService()
+    {
+        delete this.ioService;
+        return this.ioService = Cc["@mozilla.org/network/io-service;1"].
+                                getService(Ci.nsIIOService);
+    },
 };
--- a/netwerk/cookie/test/unit/test_bug1155169.js
+++ b/netwerk/cookie/test/unit/test_bug1155169.js
@@ -9,62 +9,62 @@ function run_test() {
   // Allow all cookies.
   Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
 
   // Clear cookies.
   Services.cookies.removeAll();
 
   // Add a new cookie.
   setCookie("foo=bar", {
-    type: "added", isSession: true, isSecure: false, isHttpOnly: false,
+    type: "added", isSession: true, isSecure: false, isHttpOnly: false
   });
 
   // Update cookie with isHttpOnly=true.
   setCookie("foo=bar; HttpOnly", {
-    type: "changed", isSession: true, isSecure: false, isHttpOnly: true,
+    type: "changed", isSession: true, isSecure: false, isHttpOnly: true
   });
 
   // Update cookie with isSecure=true.
   setCookie("foo=bar; Secure", {
-    type: "changed", isSession: true, isSecure: true, isHttpOnly: false,
+    type: "changed", isSession: true, isSecure: true, isHttpOnly: false
   });
 
   // Update cookie with isSession=false.
   let expiry = new Date();
   expiry.setUTCFullYear(expiry.getUTCFullYear() + 2);
   setCookie(`foo=bar; Expires=${expiry.toGMTString()}`, {
-    type: "changed", isSession: false, isSecure: false, isHttpOnly: false,
+    type: "changed", isSession: false, isSecure: false, isHttpOnly: false
   });
 
   // Reset cookie.
   setCookie("foo=bar", {
-    type: "changed", isSession: true, isSecure: false, isHttpOnly: false,
+    type: "changed", isSession: true, isSecure: false, isHttpOnly: false
   });
 }
 
 function setCookie(value, expected) {
-  function setCookieInternal(valueInternal, expectedInternal = null) {
+  function setCookieInternal(value, expected = null) {
     function observer(subject, topic, data) {
-      if (!expectedInternal) {
+      if (!expected) {
         do_throw("no notification expected");
         return;
       }
 
       // Check we saw the right notification.
-      Assert.equal(data, expectedInternal.type);
+      Assert.equal(data, expected.type);
 
       // Check cookie details.
       let cookie = subject.QueryInterface(Ci.nsICookie2);
-      Assert.equal(cookie.isSession, expectedInternal.isSession);
-      Assert.equal(cookie.isSecure, expectedInternal.isSecure);
-      Assert.equal(cookie.isHttpOnly, expectedInternal.isHttpOnly);
+      Assert.equal(cookie.isSession, expected.isSession);
+      Assert.equal(cookie.isSecure, expected.isSecure);
+      Assert.equal(cookie.isHttpOnly, expected.isHttpOnly);
     }
 
     Services.obs.addObserver(observer, "cookie-changed");
-    cs.setCookieStringFromHttp(URI, null, null, valueInternal, null, null);
+    cs.setCookieStringFromHttp(URI, null, null, value, null, null);
     Services.obs.removeObserver(observer, "cookie-changed");
   }
 
   // Check that updating/inserting the cookie works.
   setCookieInternal(value, expected);
 
   // Check that we ignore identical cookies.
   setCookieInternal(value);
--- a/netwerk/cookie/test/unit/test_bug1321912.js
+++ b/netwerk/cookie/test/unit/test_bug1321912.js
@@ -1,17 +1,19 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 do_get_profile();
-const dirSvc = Services.dirsvc;
+const dirSvc = Cc["@mozilla.org/file/directory_service;1"].
+               getService(Ci.nsIProperties);
 
 let dbFile = dirSvc.get("ProfD", Ci.nsIFile);
 dbFile.append("cookies.sqlite");
 
-let storage = Services.storage;
+let storage = Cc["@mozilla.org/storage/service;1"].
+              getService(Ci.mozIStorageService);
 let properties = Cc["@mozilla.org/hash-property-bag;1"].
                  createInstance(Ci.nsIWritablePropertyBag);
 properties.setProperty("shared", true);
 let conn = storage.openDatabase(dbFile);
 
 // Write the schema v7 to the database.
 conn.schemaVersion = 7;
 conn.executeSimpleSQL("CREATE TABLE moz_cookies (" +
@@ -42,17 +44,18 @@ let now = Date.now();
 conn.executeSimpleSQL("INSERT INTO moz_cookies(" +
   "baseDomain, host, name, value, path, expiry, " +
   "lastAccessed, creationTime, isSecure, isHttpOnly) VALUES (" +
   "'foo.com', '.foo.com', 'foo', 'bar=baz', '/', " +
   now + ", " + now + ", " + now + ", 1, 1)");
 
 // Now start the cookie service, and then check the fields in the table.
 // Get sessionEnumerator to wait for the initialization in cookie thread
-const enumerator = Services.cookies.sessionEnumerator;
+const enumerator = Cc["@mozilla.org/cookieService;1"].
+                   getService(Ci.nsICookieManager).sessionEnumerator;
 
 Assert.equal(conn.schemaVersion, 9);
 let stmt = conn.createStatement("SELECT sql FROM sqlite_master " +
                                   "WHERE type = 'table' AND " +
                                   "      name = 'moz_cookies'");
 try {
   Assert.ok(stmt.executeStep());
   let sql = stmt.getString(0);
--- a/netwerk/cookie/test/unit/test_eviction.js
+++ b/netwerk/cookie/test/unit/test_eviction.js
@@ -2,16 +2,17 @@ ChromeUtils.import("resource://gre/modul
 
 const BASE_HOSTNAMES = ["example.org", "example.co.uk"];
 const SUBDOMAINS = ["", "pub.", "www.", "other."];
 
 const cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
 const cm = cs.QueryInterface(Ci.nsICookieManager);
 
 function run_test() {
+    var tests = [];
     Services.prefs.setIntPref("network.cookie.staleThreshold", 0);
     add_task(async function() {
         await test_basic_eviction("example.org");
         cm.removeAll();
     });
 
     run_next_test();
 }
@@ -24,60 +25,60 @@ async function test_basic_eviction(base_
     const FOO_PATH = Services.io.newURI("http://" + base_host + "/foo/");
     const BAR_PATH = Services.io.newURI("http://" + base_host + "/bar/");
 
     await setCookie("session_foo_path_1", null, "/foo", null, FOO_PATH);
     await setCookie("session_foo_path_2", null, "/foo", null, FOO_PATH);
     await setCookie("session_foo_path_3", null, "/foo", null, FOO_PATH);
     await setCookie("session_foo_path_4", null, "/foo", null, FOO_PATH);
     await setCookie("session_foo_path_5", null, "/foo", null, FOO_PATH);
-    verifyCookies(["session_foo_path_1",
-                   "session_foo_path_2",
-                   "session_foo_path_3",
-                   "session_foo_path_4",
-                   "session_foo_path_5"], BASE_URI);
+    verifyCookies(['session_foo_path_1',
+                   'session_foo_path_2',
+                   'session_foo_path_3',
+                   'session_foo_path_4',
+                   'session_foo_path_5'], BASE_URI);
 
     // Check if cookies are evicted by creation time.
     await setCookie("session_foo_path_6", null, "/foo", null, FOO_PATH);
-    verifyCookies(["session_foo_path_4",
-                   "session_foo_path_5",
-                   "session_foo_path_6"], BASE_URI);
+    verifyCookies(['session_foo_path_4',
+                   'session_foo_path_5',
+                   'session_foo_path_6'], BASE_URI);
 
     await setCookie("session_bar_path_1", null, "/bar", null, BAR_PATH);
     await setCookie("session_bar_path_2", null, "/bar", null, BAR_PATH);
 
-    verifyCookies(["session_foo_path_4",
-                   "session_foo_path_5",
-                   "session_foo_path_6",
-                   "session_bar_path_1",
-                   "session_bar_path_2"], BASE_URI);
+    verifyCookies(['session_foo_path_4',
+                   'session_foo_path_5',
+                   'session_foo_path_6',
+                   'session_bar_path_1',
+                   'session_bar_path_2'], BASE_URI);
 
     // Check if cookies are evicted by last accessed time.
     cs.getCookieString(FOO_PATH, null);
     await setCookie("session_foo_path_7", null, "/foo", null, FOO_PATH);
-    verifyCookies(["session_foo_path_5",
-                   "session_foo_path_6",
-                   "session_foo_path_7"], BASE_URI);
+    verifyCookies(['session_foo_path_5',
+                   'session_foo_path_6',
+                   'session_foo_path_7'], BASE_URI);
 
     const EXPIRED_TIME = 3;
 
     await setCookie("non_session_expired_foo_path_1", null, "/foo", EXPIRED_TIME, FOO_PATH);
     await setCookie("non_session_expired_foo_path_2", null, "/foo", EXPIRED_TIME, FOO_PATH);
-    verifyCookies(["session_foo_path_5",
-                   "session_foo_path_6",
-                   "session_foo_path_7",
-                   "non_session_expired_foo_path_1",
-                   "non_session_expired_foo_path_2"], BASE_URI);
+    verifyCookies(['session_foo_path_5',
+                   'session_foo_path_6',
+                   'session_foo_path_7',
+                   'non_session_expired_foo_path_1',
+                   'non_session_expired_foo_path_2'], BASE_URI);
 
     // Check if expired cookies are evicted first.
     await new Promise(resolve => do_timeout(EXPIRED_TIME * 1000, resolve));
     await setCookie("session_foo_path_8", null, "/foo", null, FOO_PATH);
-    verifyCookies(["session_foo_path_6",
-                   "session_foo_path_7",
-                   "session_foo_path_8"], BASE_URI);
+    verifyCookies(['session_foo_path_6',
+                   'session_foo_path_7',
+                   'session_foo_path_8'], BASE_URI);
 }
 
 // Verify that the given cookie names exist, and are ordered from least to most recently accessed
 function verifyCookies(names, uri) {
     Assert.equal(cm.countCookiesFromHost(uri.host), names.length);
     let actual_cookies = [];
     for (let cookie of cm.getCookiesFromHost(uri.host, {})) {
         actual_cookies.push(cookie);
@@ -87,17 +88,17 @@ function verifyCookies(names, uri) {
             return actual_cookies.findIndex(function(c) {
                 return c.name == n;
             }) == -1;
         });
         let right = actual_cookies.filter(function(c) {
             return names.findIndex(function(n) {
                 return c.name == n;
             }) == -1;
-        }).map(function(c) { return c.name; });
+        }).map(function(c) { return c.name });
         if (left.length) {
             info("unexpected cookies: " + left);
         }
         if (right.length) {
             info("expected cookies: " + right);
         }
     }
     Assert.equal(names.length, actual_cookies.length);
@@ -105,40 +106,40 @@ function verifyCookies(names, uri) {
         if (a.lastAccessed < b.lastAccessed)
             return -1;
         if (a.lastAccessed > b.lastAccessed)
             return 1;
         return 0;
     });
     for (var i = 0; i < names.length; i++) {
         Assert.equal(names[i], actual_cookies[i].name);
-        Assert.equal(names[i].startsWith("session"), actual_cookies[i].isSession);
+        Assert.equal(names[i].startsWith('session'), actual_cookies[i].isSession);
     }
 }
 
-var lastValue = 0;
+var lastValue = 0
 function setCookie(name, domain, path, maxAge, url) {
     let value = name + "=" + ++lastValue;
-    var s = "setting cookie " + value;
+    var s = 'setting cookie ' + value;
     if (domain) {
         value += "; Domain=" + domain;
-        s += " (d=" + domain + ")";
+        s += ' (d=' + domain + ')';
     }
     if (path) {
         value += "; Path=" + path;
-        s += " (p=" + path + ")";
+        s += ' (p=' + path + ')';
     }
     if (maxAge) {
         value += "; Max-Age=" + maxAge;
-        s += " (non-session)";
+        s += ' (non-session)';
     } else {
-        s += " (session)";
+        s += ' (session)';
     }
-    s += " for " + url.spec;
+    s += ' for ' + url.spec;
     info(s);
     cs.setCookieStringFromHttp(url, null, null, value, null, null);
     return new Promise(function(resolve) {
         // Windows XP has low precision timestamps that cause our cookie eviction
         // algorithm to produce different results from other platforms. We work around
         // this by ensuring that there's a clear gap between each cookie update.
         do_timeout(10, resolve);
-    });
+    })
 }
--- a/netwerk/cookie/test/unit/test_parser_0001.js
+++ b/netwerk/cookie/test/unit/test_parser_0001.js
@@ -1,13 +1,15 @@
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function inChildProcess() {
-  return Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
+  return Cc["@mozilla.org/xre/app-info;1"]
+           .getService(Ci.nsIXULRuntime)
+           .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
 }
 
 function run_test() {
   // Allow all cookies if the pref service is available in this process.
   if (!inChildProcess())
     Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
 
   let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
--- a/netwerk/cookie/test/unit/test_parser_0019.js
+++ b/netwerk/cookie/test/unit/test_parser_0019.js
@@ -1,13 +1,15 @@
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function inChildProcess() {
-  return Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
+  return Cc["@mozilla.org/xre/app-info;1"]
+           .getService(Ci.nsIXULRuntime)
+           .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
 }
 
 function run_test() {
   // Allow all cookies if the pref service is available in this process.
   if (!inChildProcess())
     Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
 
   let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);