Thu, 22 Jan 2015 13:21:57 +0100
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(jsval, simple) {
5 JS::Rooted<jsval> fortytwo(cx, INT_TO_JSVAL(42));
6 JS::Rooted<jsval> negone(cx, INT_TO_JSVAL(-1));
7 JS::Rooted<jsval> undefined(cx, JSVAL_VOID);
8 JS::Rooted<jsval> null(cx, JSVAL_NULL);
9 JS::Rooted<jsval> js_true(cx, JSVAL_TRUE);
10 JS::Rooted<jsval> js_false(cx, JSVAL_FALSE);
11 JS::Rooted<jsval> elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE));
13 JS::Rooted<jsval> empty_string(cx);
14 empty_string.setString(JS_NewStringCopyZ(cx, ""));
15 JS::Rooted<jsval> friendly_string(cx);
16 friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!"));
18 JS::Rooted<jsval> global(cx);
19 global.setObject(*JS::CurrentGlobalOrNull(cx));
21 // Some interesting value that floating-point won't munge.
22 JS::Rooted<jsval> onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0));
24 breakpoint();
26 (void) fortytwo;
27 (void) negone;
28 (void) undefined;
29 (void) js_true;
30 (void) js_false;
31 (void) null;
32 (void) elements_hole;
33 (void) empty_string;
34 (void) friendly_string;
35 (void) global;
36 }