js/src/jit-test/tests/debug/Object-defineProperties-02.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 // Exceptions thrown by obj.defineProperties are copied into the debugger compartment.
michael@0 2
michael@0 3 var g = newGlobal();
michael@0 4 var dbg = new Debugger;
michael@0 5 var gw = dbg.addDebuggee(g);
michael@0 6
michael@0 7 function test(objexpr, descs) {
michael@0 8 var exca, excb;
michael@0 9
michael@0 10 g.eval("obj = (" + objexpr + ");");
michael@0 11 var gobjw = gw.getOwnPropertyDescriptor("obj").value;
michael@0 12 try {
michael@0 13 gobjw.defineProperties(descs);
michael@0 14 } catch (exc) {
michael@0 15 exca = exc;
michael@0 16 }
michael@0 17
michael@0 18 var indirectEval = eval;
michael@0 19 var obj = indirectEval("(" + objexpr + ");");
michael@0 20 try {
michael@0 21 Object.defineProperties(obj, descs);
michael@0 22 } catch (exc) {
michael@0 23 excb = exc;
michael@0 24 }
michael@0 25
michael@0 26 assertEq(Object.getPrototypeOf(exca), Object.getPrototypeOf(excb));
michael@0 27 assertEq(exca.message, excb.message);
michael@0 28 assertEq(typeof exca.fileName, "string");
michael@0 29 assertEq(typeof exca.stack, "string");
michael@0 30 }
michael@0 31
michael@0 32 test("Object.create(null, {p: {value: 1}})", {p: {value: 2}});
michael@0 33 test("({})", {x: {get: 'bad'}});

mercurial