js/src/tests/ecma_5/strict/10.4.2.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2
michael@0 3 /*
michael@0 4 * Any copyright is dedicated to the Public Domain.
michael@0 5 * http://creativecommons.org/licenses/publicdomain/
michael@0 6 */
michael@0 7
michael@0 8 /* Direct calls to eval should inherit the strictness of the calling code. */
michael@0 9 assertEq(testLenientAndStrict("eval('010')",
michael@0 10 completesNormally,
michael@0 11 raisesException(SyntaxError)),
michael@0 12 true);
michael@0 13
michael@0 14 /*
michael@0 15 * Directives in the eval code itself should always override a direct
michael@0 16 * caller's strictness.
michael@0 17 */
michael@0 18 assertEq(testLenientAndStrict("eval('\"use strict\"; 010')",
michael@0 19 raisesException(SyntaxError),
michael@0 20 raisesException(SyntaxError)),
michael@0 21 true);
michael@0 22
michael@0 23 /* Code passed to indirect calls to eval should never be strict. */
michael@0 24 assertEq(testLenientAndStrict("var evil=eval; evil('010')",
michael@0 25 completesNormally,
michael@0 26 completesNormally),
michael@0 27 true);
michael@0 28
michael@0 29 /*
michael@0 30 * Code passed to the Function constructor never inherits the caller's
michael@0 31 * strictness.
michael@0 32 */
michael@0 33 assertEq(completesNormally("Function('010')"),
michael@0 34 true);
michael@0 35 assertEq(raisesException(SyntaxError)("Function('\"use strict\"; 010')"),
michael@0 36 true);
michael@0 37
michael@0 38 /*
michael@0 39 * If 'eval' causes a frame's primitive |this| to become wrapped, the frame should see the same
michael@0 40 * wrapper object as the eval code.
michael@0 41 */
michael@0 42 var call_this, eval_this;
michael@0 43 function f(code) {
michael@0 44 /*
michael@0 45 * At this point, a primitive |this| has not yet been wrapped. A
michael@0 46 * reference to |this| from the eval call should wrap it, and the wrapper
michael@0 47 * should be stored where the call frame can see it.
michael@0 48 */
michael@0 49 eval(code);
michael@0 50 call_this = this;
michael@0 51 }
michael@0 52 f.call(true, 'eval_this = this');
michael@0 53 assertEq(call_this, eval_this);
michael@0 54
michael@0 55 reportCompare(true, true);

mercurial