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.

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

mercurial