|
1 #include "gdb-tests.h" |
|
2 #include "jsapi.h" |
|
3 |
|
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))); |
|
11 |
|
12 breakpoint(); |
|
13 |
|
14 (void) string; |
|
15 (void) interned; |
|
16 (void) string_id; |
|
17 (void) int_id; |
|
18 (void) void_id; |
|
19 (void) object_id; |
|
20 } |
|
21 |
|
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 } |
|
31 |
|
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 } |