michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function run_test() { michael@0: const time = (new Date("Jan 1, 2030")).getTime() / 1000; michael@0: var cookie = { michael@0: name: "foo", michael@0: value: "bar", michael@0: isDomain: true, michael@0: host: "example.com", michael@0: path: "/baz", michael@0: isSecure: false, michael@0: expires: time, michael@0: status: 0, michael@0: policy: 0, michael@0: isSession: false, michael@0: expiry: time, michael@0: isHttpOnly: true, michael@0: QueryInterface: function(iid) { michael@0: const validIIDs = [Components.interfaces.nsISupports, michael@0: Components.interfaces.nsICookie, michael@0: Components.interfaces.nsICookie2]; michael@0: for (var i = 0; i < validIIDs.length; ++i) michael@0: if (iid == validIIDs[i]) michael@0: return this; michael@0: throw Components.results.NS_ERROR_NO_INTERFACE; michael@0: } michael@0: }; michael@0: var cm = Components.classes["@mozilla.org/cookiemanager;1"]. michael@0: getService(Components.interfaces.nsICookieManager2); michael@0: do_check_false(cm.cookieExists(cookie)); michael@0: // if the above line does not crash, the test was successful michael@0: do_test_finished(); michael@0: }