js/src/gdb/tests/test-jsval.cpp

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 #include "gdb-tests.h"
michael@0 2 #include "jsapi.h"
michael@0 3
michael@0 4 FRAGMENT(jsval, simple) {
michael@0 5 JS::Rooted<jsval> fortytwo(cx, INT_TO_JSVAL(42));
michael@0 6 JS::Rooted<jsval> negone(cx, INT_TO_JSVAL(-1));
michael@0 7 JS::Rooted<jsval> undefined(cx, JSVAL_VOID);
michael@0 8 JS::Rooted<jsval> null(cx, JSVAL_NULL);
michael@0 9 JS::Rooted<jsval> js_true(cx, JSVAL_TRUE);
michael@0 10 JS::Rooted<jsval> js_false(cx, JSVAL_FALSE);
michael@0 11 JS::Rooted<jsval> elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE));
michael@0 12
michael@0 13 JS::Rooted<jsval> empty_string(cx);
michael@0 14 empty_string.setString(JS_NewStringCopyZ(cx, ""));
michael@0 15 JS::Rooted<jsval> friendly_string(cx);
michael@0 16 friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!"));
michael@0 17
michael@0 18 JS::Rooted<jsval> global(cx);
michael@0 19 global.setObject(*JS::CurrentGlobalOrNull(cx));
michael@0 20
michael@0 21 // Some interesting value that floating-point won't munge.
michael@0 22 JS::Rooted<jsval> onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0));
michael@0 23
michael@0 24 breakpoint();
michael@0 25
michael@0 26 (void) fortytwo;
michael@0 27 (void) negone;
michael@0 28 (void) undefined;
michael@0 29 (void) js_true;
michael@0 30 (void) js_false;
michael@0 31 (void) null;
michael@0 32 (void) elements_hole;
michael@0 33 (void) empty_string;
michael@0 34 (void) friendly_string;
michael@0 35 (void) global;
michael@0 36 }

mercurial