Sat, 03 Jan 2015 20:18:00 +0100
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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
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 | File Name: tostring-1.js |
michael@0 | 10 | Section: Function.toString |
michael@0 | 11 | Description: |
michael@0 | 12 | |
michael@0 | 13 | Since the behavior of Function.toString() is implementation-dependent, |
michael@0 | 14 | toString tests for function are not in the ECMA suite. |
michael@0 | 15 | |
michael@0 | 16 | Currently, an attempt to parse the toString output for some functions |
michael@0 | 17 | and verify that the result is something reasonable. |
michael@0 | 18 | |
michael@0 | 19 | Author: christine@netscape.com |
michael@0 | 20 | Date: 12 november 1997 |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | var SECTION = "tostring-1"; |
michael@0 | 24 | var VERSION = "JS1_2"; |
michael@0 | 25 | startTest(); |
michael@0 | 26 | var TITLE = "Function.toString()"; |
michael@0 | 27 | |
michael@0 | 28 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 29 | |
michael@0 | 30 | var tab = " "; |
michael@0 | 31 | |
michael@0 | 32 | t1 = new TestFunction( "stub", "value", tab + "return value;" ); |
michael@0 | 33 | |
michael@0 | 34 | t2 = new TestFunction( "ToString", "object", tab+"return object + \"\";" ); |
michael@0 | 35 | |
michael@0 | 36 | t3 = new TestFunction( "Add", "a, b, c, d, e", tab +"var s = a + b + c + d + e;\n" + |
michael@0 | 37 | tab + "return s;" ); |
michael@0 | 38 | |
michael@0 | 39 | t4 = new TestFunction( "noop", "value" ); |
michael@0 | 40 | |
michael@0 | 41 | t5 = new TestFunction( "anonymous", "", tab+"return \"hello!\";" ); |
michael@0 | 42 | |
michael@0 | 43 | var f = new Function( "return \"hello!\""); |
michael@0 | 44 | |
michael@0 | 45 | new TestCase( SECTION, |
michael@0 | 46 | "stub.toString()", |
michael@0 | 47 | t1.valueOf(), |
michael@0 | 48 | stub.toString() ); |
michael@0 | 49 | |
michael@0 | 50 | new TestCase( SECTION, |
michael@0 | 51 | "ToString.toString()", |
michael@0 | 52 | t2.valueOf(), |
michael@0 | 53 | ToString.toString() ); |
michael@0 | 54 | |
michael@0 | 55 | new TestCase( SECTION, |
michael@0 | 56 | "Add.toString()", |
michael@0 | 57 | t3.valueOf(), |
michael@0 | 58 | Add.toString() ); |
michael@0 | 59 | |
michael@0 | 60 | new TestCase( SECTION, |
michael@0 | 61 | "noop.toString()", |
michael@0 | 62 | t4.toString(), |
michael@0 | 63 | noop.toString() ); |
michael@0 | 64 | |
michael@0 | 65 | new TestCase( SECTION, |
michael@0 | 66 | "f.toString()", |
michael@0 | 67 | t5.toString(), |
michael@0 | 68 | f.toString() ); |
michael@0 | 69 | test(); |
michael@0 | 70 | |
michael@0 | 71 | function noop( value ) { |
michael@0 | 72 | } |
michael@0 | 73 | function Add( a, b, c, d, e ) { |
michael@0 | 74 | var s = a + b + c + d + e; |
michael@0 | 75 | return s; |
michael@0 | 76 | } |
michael@0 | 77 | function stub( value ) { |
michael@0 | 78 | return value; |
michael@0 | 79 | } |
michael@0 | 80 | function ToString( object ) { |
michael@0 | 81 | return object + ""; |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | function ToBoolean( value ) { |
michael@0 | 85 | if ( value == 0 || value == NaN || value == false ) { |
michael@0 | 86 | return false; |
michael@0 | 87 | } else { |
michael@0 | 88 | return true; |
michael@0 | 89 | } |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | function TestFunction( name, args, body ) { |
michael@0 | 93 | if ( name == "anonymous" && version() == 120 ) { |
michael@0 | 94 | name = ""; |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | this.name = name; |
michael@0 | 98 | this.arguments = args.toString(); |
michael@0 | 99 | this.body = body; |
michael@0 | 100 | |
michael@0 | 101 | /* the format of Function.toString() in JavaScript 1.2 is: |
michael@0 | 102 | function name ( arguments ) { |
michael@0 | 103 | body |
michael@0 | 104 | } |
michael@0 | 105 | */ |
michael@0 | 106 | this.value = "function " + (name ? name : "" )+ |
michael@0 | 107 | "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}"; |
michael@0 | 108 | |
michael@0 | 109 | this.toString = new Function( "return this.value" ); |
michael@0 | 110 | this.valueOf = new Function( "return this.value" ); |
michael@0 | 111 | return this; |
michael@0 | 112 | } |