1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/gdb/tests/test-jsval.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +#include "gdb-tests.h" 1.5 +#include "jsapi.h" 1.6 + 1.7 +FRAGMENT(jsval, simple) { 1.8 + JS::Rooted<jsval> fortytwo(cx, INT_TO_JSVAL(42)); 1.9 + JS::Rooted<jsval> negone(cx, INT_TO_JSVAL(-1)); 1.10 + JS::Rooted<jsval> undefined(cx, JSVAL_VOID); 1.11 + JS::Rooted<jsval> null(cx, JSVAL_NULL); 1.12 + JS::Rooted<jsval> js_true(cx, JSVAL_TRUE); 1.13 + JS::Rooted<jsval> js_false(cx, JSVAL_FALSE); 1.14 + JS::Rooted<jsval> elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE)); 1.15 + 1.16 + JS::Rooted<jsval> empty_string(cx); 1.17 + empty_string.setString(JS_NewStringCopyZ(cx, "")); 1.18 + JS::Rooted<jsval> friendly_string(cx); 1.19 + friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!")); 1.20 + 1.21 + JS::Rooted<jsval> global(cx); 1.22 + global.setObject(*JS::CurrentGlobalOrNull(cx)); 1.23 + 1.24 + // Some interesting value that floating-point won't munge. 1.25 + JS::Rooted<jsval> onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0)); 1.26 + 1.27 + breakpoint(); 1.28 + 1.29 + (void) fortytwo; 1.30 + (void) negone; 1.31 + (void) undefined; 1.32 + (void) js_true; 1.33 + (void) js_false; 1.34 + (void) null; 1.35 + (void) elements_hole; 1.36 + (void) empty_string; 1.37 + (void) friendly_string; 1.38 + (void) global; 1.39 +}