netwerk/test/unit/test_bug455598.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/test/unit/test_bug455598.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +function run_test() {
     1.9 +  const time = (new Date("Jan 1, 2030")).getTime() / 1000;
    1.10 +  var cookie = {
    1.11 +    name: "foo",
    1.12 +    value: "bar",
    1.13 +    isDomain: true,
    1.14 +    host: "example.com",
    1.15 +    path: "/baz",
    1.16 +    isSecure: false,
    1.17 +    expires: time,
    1.18 +    status: 0,
    1.19 +    policy: 0,
    1.20 +    isSession: false,
    1.21 +    expiry: time,
    1.22 +    isHttpOnly: true,
    1.23 +    QueryInterface: function(iid) {
    1.24 +      const validIIDs = [Components.interfaces.nsISupports,
    1.25 +                         Components.interfaces.nsICookie,
    1.26 +                         Components.interfaces.nsICookie2];
    1.27 +      for (var i = 0; i < validIIDs.length; ++i)
    1.28 +        if (iid == validIIDs[i])
    1.29 +          return this;
    1.30 +      throw Components.results.NS_ERROR_NO_INTERFACE;
    1.31 +    }
    1.32 +  };
    1.33 +  var cm = Components.classes["@mozilla.org/cookiemanager;1"].
    1.34 +           getService(Components.interfaces.nsICookieManager2);
    1.35 +  do_check_false(cm.cookieExists(cookie));
    1.36 +  // if the above line does not crash, the test was successful
    1.37 +  do_test_finished();
    1.38 +}

mercurial