js/src/gdb/tests/test-jsid.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.

     1 #include "gdb-tests.h"
     2 #include "jsapi.h"
     4 FRAGMENT(jsid, simple) {
     5   JS::Rooted<JSString *> string(cx, JS_NewStringCopyZ(cx, "moon"));
     6   JS::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
     7   JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
     8   jsid int_id = INT_TO_JSID(1729);
     9   jsid void_id = JSID_VOID;
    10   JS::Rooted<jsid> object_id(cx, OBJECT_TO_JSID(JS::CurrentGlobalOrNull(cx)));
    12   breakpoint();
    14   (void) string;
    15   (void) interned;
    16   (void) string_id;
    17   (void) int_id;
    18   (void) void_id;
    19   (void) object_id;
    20 }
    22 void
    23 jsid_handles(JS::Handle<jsid> jsid_handle,
    24              JS::MutableHandle<jsid> mutable_jsid_handle)
    25 {
    26   // Prevent the linker from unifying this function with others that are
    27   // equivalent in machine code but not type.
    28   fprintf(stderr, "Called " __FILE__ ":jsid_handles\n");
    29   breakpoint();
    30 }
    32 FRAGMENT(jsid, handles) {
    33   JS::Rooted<JSString *> string(cx, JS_NewStringCopyZ(cx, "shovel"));
    34   JS::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
    35   JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
    36   jsid_handles(string_id, &string_id);
    37 }

mercurial