js/src/tests/js1_5/extensions/regress-50447.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 // |reftest| skip -- obsolete test
michael@0 2 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7
michael@0 8 /*
michael@0 9 * SUMMARY: New properties fileName, lineNumber have been added to Error objects
michael@0 10 * in SpiderMonkey. These are non-ECMA extensions and do not exist in Rhino.
michael@0 11 *
michael@0 12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=50447
michael@0 13 */
michael@0 14
michael@0 15 //-----------------------------------------------------------------------------
michael@0 16 var BUGNUMBER = 50447;
michael@0 17 var summary = 'Test (non-ECMA) Error object properties fileName, lineNumber';
michael@0 18
michael@0 19
michael@0 20 //-----------------------------------------------------------------------------
michael@0 21 test();
michael@0 22 //-----------------------------------------------------------------------------
michael@0 23
michael@0 24
michael@0 25 function test()
michael@0 26 {
michael@0 27 enterFunc ('test');
michael@0 28 printBugNumber(BUGNUMBER);
michael@0 29 printStatus (summary);
michael@0 30
michael@0 31 testRealError();
michael@0 32 test1();
michael@0 33 test2();
michael@0 34 test3();
michael@0 35 test4();
michael@0 36
michael@0 37 exitFunc('test');
michael@0 38 }
michael@0 39
michael@0 40
michael@0 41 function testRealError()
michael@0 42 {
michael@0 43 /* throw a real error, and see what it looks like */
michael@0 44 enterFunc ("testRealError");
michael@0 45
michael@0 46 try
michael@0 47 {
michael@0 48 blabla;
michael@0 49 }
michael@0 50 catch (e)
michael@0 51 {
michael@0 52 if (e.fileName.search (/-50447\.js$/i) == -1)
michael@0 53 reportCompare('PASS', 'FAIL',
michael@0 54 "expected fileName to end with '-50447.js'");
michael@0 55
michael@0 56 reportCompare (83, e.lineNumber,
michael@0 57 "lineNumber property returned unexpected value.");
michael@0 58 }
michael@0 59
michael@0 60 exitFunc ("testRealError");
michael@0 61 }
michael@0 62
michael@0 63
michael@0 64 function test1()
michael@0 65 {
michael@0 66 /* generate an error with msg, file, and lineno properties */
michael@0 67 enterFunc ("test1");
michael@0 68
michael@0 69 var e = new InternalError ("msg", "file", 2);
michael@0 70 reportCompare ("(new InternalError(\"msg\", \"file\", 2))",
michael@0 71 e.toSource(),
michael@0 72 "toSource() returned unexpected result.");
michael@0 73 reportCompare ("file", e.fileName,
michael@0 74 "fileName property returned unexpected value.");
michael@0 75 reportCompare (2, e.lineNumber,
michael@0 76 "lineNumber property returned unexpected value.");
michael@0 77
michael@0 78 exitFunc ("test1");
michael@0 79 }
michael@0 80
michael@0 81
michael@0 82 function test2()
michael@0 83 {
michael@0 84 /* generate an error with only msg property */
michael@0 85 enterFunc ("test2");
michael@0 86
michael@0 87 var e = new InternalError ("msg");
michael@0 88 reportCompare ("(new InternalError(\"msg\", \"\"))",
michael@0 89 e.toSource(),
michael@0 90 "toSource() returned unexpected result.");
michael@0 91 reportCompare ("", e.fileName,
michael@0 92 "fileName property returned unexpected value.");
michael@0 93 reportCompare (0, e.lineNumber,
michael@0 94 "lineNumber property returned unexpected value.");
michael@0 95
michael@0 96 exitFunc ("test2");
michael@0 97 }
michael@0 98
michael@0 99
michael@0 100 function test3()
michael@0 101 {
michael@0 102 /* generate an error with only msg and lineNo properties */
michael@0 103 enterFunc ("test3");
michael@0 104
michael@0 105 var e = new InternalError ("msg");
michael@0 106 e.lineNumber = 10;
michael@0 107 reportCompare ("(new InternalError(\"msg\", \"\", 10))",
michael@0 108 e.toSource(),
michael@0 109 "toSource() returned unexpected result.");
michael@0 110 reportCompare ("", e.fileName,
michael@0 111 "fileName property returned unexpected value.");
michael@0 112 reportCompare (10, e.lineNumber,
michael@0 113 "lineNumber property returned unexpected value.");
michael@0 114
michael@0 115 exitFunc ("test3");
michael@0 116 }
michael@0 117
michael@0 118
michael@0 119 function test4()
michael@0 120 {
michael@0 121 /* generate an error with only msg and filename properties */
michael@0 122 enterFunc ("test4");
michael@0 123
michael@0 124 var e = new InternalError ("msg", "file");
michael@0 125 reportCompare ("(new InternalError(\"msg\", \"file\"))",
michael@0 126 e.toSource(),
michael@0 127 "toSource() returned unexpected result.");
michael@0 128 reportCompare ("file", e.fileName,
michael@0 129 "fileName property returned unexpected value.");
michael@0 130 reportCompare (0, e.lineNumber,
michael@0 131 "lineNumber property returned unexpected value.");
michael@0 132
michael@0 133 exitFunc ("test4");
michael@0 134 }

mercurial