diff -r 000000000000 -r 6474c204b198 js/src/gdb/tests/test-jsval.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/gdb/tests/test-jsval.cpp Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,36 @@ +#include "gdb-tests.h" +#include "jsapi.h" + +FRAGMENT(jsval, simple) { + JS::Rooted fortytwo(cx, INT_TO_JSVAL(42)); + JS::Rooted negone(cx, INT_TO_JSVAL(-1)); + JS::Rooted undefined(cx, JSVAL_VOID); + JS::Rooted null(cx, JSVAL_NULL); + JS::Rooted js_true(cx, JSVAL_TRUE); + JS::Rooted js_false(cx, JSVAL_FALSE); + JS::Rooted elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE)); + + JS::Rooted empty_string(cx); + empty_string.setString(JS_NewStringCopyZ(cx, "")); + JS::Rooted friendly_string(cx); + friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!")); + + JS::Rooted global(cx); + global.setObject(*JS::CurrentGlobalOrNull(cx)); + + // Some interesting value that floating-point won't munge. + JS::Rooted onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0)); + + breakpoint(); + + (void) fortytwo; + (void) negone; + (void) undefined; + (void) js_true; + (void) js_false; + (void) null; + (void) elements_hole; + (void) empty_string; + (void) friendly_string; + (void) global; +}