js/xpconnect/tests/unit/test_bug_442086.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 // Bug 442086 - XPConnect creates doubles without checking for
michael@0 6 // the INT_FITS_IN_JSVAL case
michael@0 7
michael@0 8 var types = [
michael@0 9 'PRUint8',
michael@0 10 'PRUint16',
michael@0 11 'PRUint32',
michael@0 12 'PRUint64',
michael@0 13 'PRInt16',
michael@0 14 'PRInt32',
michael@0 15 'PRInt64',
michael@0 16 'float',
michael@0 17 'double'
michael@0 18 ];
michael@0 19
michael@0 20 function run_test()
michael@0 21 {
michael@0 22 var i;
michael@0 23 for (i = 0; i < types.length; i++) {
michael@0 24 var name = types[i];
michael@0 25 var cls = Components.classes["@mozilla.org/supports-" + name + ";1"];
michael@0 26 var ifname = ("nsISupports" + name.charAt(0).toUpperCase() +
michael@0 27 name.substring(1));
michael@0 28 var f = cls.createInstance(Components.interfaces[ifname]);
michael@0 29
michael@0 30 f.data = 0;
michael@0 31 switch (f.data) {
michael@0 32 case 0: /*ok*/ break;
michael@0 33 default: do_throw("FAILED - bug 442086 (type=" + name + ")");
michael@0 34 }
michael@0 35 }
michael@0 36 }

mercurial