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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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