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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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