|
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/. */ |
|
4 |
|
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 } |