netwerk/test/unit/test_bug455598.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 function run_test() {
     6   const time = (new Date("Jan 1, 2030")).getTime() / 1000;
     7   var cookie = {
     8     name: "foo",
     9     value: "bar",
    10     isDomain: true,
    11     host: "example.com",
    12     path: "/baz",
    13     isSecure: false,
    14     expires: time,
    15     status: 0,
    16     policy: 0,
    17     isSession: false,
    18     expiry: time,
    19     isHttpOnly: true,
    20     QueryInterface: function(iid) {
    21       const validIIDs = [Components.interfaces.nsISupports,
    22                          Components.interfaces.nsICookie,
    23                          Components.interfaces.nsICookie2];
    24       for (var i = 0; i < validIIDs.length; ++i)
    25         if (iid == validIIDs[i])
    26           return this;
    27       throw Components.results.NS_ERROR_NO_INTERFACE;
    28     }
    29   };
    30   var cm = Components.classes["@mozilla.org/cookiemanager;1"].
    31            getService(Components.interfaces.nsICookieManager2);
    32   do_check_false(cm.cookieExists(cookie));
    33   // if the above line does not crash, the test was successful
    34   do_test_finished();
    35 }

mercurial