Bug 848395 - GC: Move Rooted to JS namespace - rename js::Rooted to JS::Rooted inside SpiderMonkey r=terrence

--HG--
extra : rebase_source : ba8202f4e1f7bd5560a57392f800d255e52b4a54
This commit is contained in:
Jon Coppeard 2013-03-06 16:41:42 +00:00
Родитель 6fbb22c50b
Коммит c3e865f5a7
64 изменённых файлов: 295 добавлений и 295 удалений

Просмотреть файл

@ -68,7 +68,7 @@ main (int argc, const char **argv)
JSAutoRequest ar(cx);
/* Create the global object. */
js::RootedObject global(cx, checkPtr(JS_NewGlobalObject(cx, &global_class, NULL)));
RootedObject global(cx, checkPtr(JS_NewGlobalObject(cx, &global_class, NULL)));
JS_SetGlobalObject(cx, global);
JSAutoCompartment ac(cx, global);

Просмотреть файл

@ -26,12 +26,12 @@ class Common(object):
# when the referent is a typedef of an integral type (say, |jsid| in a
# non-|DEBUG| build), the GNU toolchain (at least) loses the typedef name,
# and all we know about the referent is its fundamental integer type ---
# |js::Rooted<jsid>|, for example, appears in GDB as |js::Rooted<long>| ---
# |JS::Rooted<jsid>|, for example, appears in GDB as |JS::Rooted<long>| ---
# and we are left with no way to choose a meaningful pretty-printer based on
# the type of the referent alone. However, because we know that the only
# integer type for which |js::Rooted| is likely to be instantiated is
# integer type for which |JS::Rooted| is likely to be instantiated is
# |jsid|, we *can* register a pretty-printer constructor for the full
# instantiation |js::Rooted<long>|. That constructor creates a |js::Rooted|
# instantiation |JS::Rooted<long>|. That constructor creates a |JS::Rooted|
# pretty-printer, and explicitly specifies the constructor for the referent,
# using this initializer's |content_printer| argument.
def __init__(self, value, cache, content_printer=None):
@ -51,7 +51,7 @@ class Common(object):
# Instead, just invoke GDB's formatter ourselves.
return str(ptr)
@template_pretty_printer("js::Rooted")
@template_pretty_printer("JS::Rooted")
class Rooted(Common):
pass
@ -78,9 +78,9 @@ def deref(root):
raise TypeError, "Can't dereference type with no structure tag: %s" % (root.type,)
elif tag.startswith('js::HeapPtr<'):
return root['value']
elif tag.startswith('js::Rooted<'):
elif tag.startswith('JS::Rooted<'):
return root['ptr']
elif tag.startswith('js::Handle<'):
elif tag.startswith('JS::Handle<'):
return root['ptr']
else:
raise NotImplementedError

Просмотреть файл

@ -56,7 +56,7 @@ class jsid(object):
# Hard-code the referent type pretty-printer for jsid roots and handles.
# See the comment for mozilla.Root.Common.__init__.
@pretty_printer('js::Rooted<long>')
@pretty_printer('JS::Rooted<long>')
def RootedJSID(value, cache):
return mozilla.Root.Rooted(value, cache, jsid)
@pretty_printer('JS::Handle<long>')

Просмотреть файл

@ -1,13 +1,13 @@
#include "gdb-tests.h"
FRAGMENT(JSObject, simple) {
js::Rooted<JSObject *> glob(cx, JS_GetGlobalObject(cx));
js::Rooted<JSObject *> plain(cx, JS_NewObject(cx, 0, 0, 0));
js::Rooted<JSObject *> func(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0,
JS::Rooted<JSObject *> glob(cx, JS_GetGlobalObject(cx));
JS::Rooted<JSObject *> plain(cx, JS_NewObject(cx, 0, 0, 0));
JS::Rooted<JSObject *> func(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0,
JS_GetGlobalObject(cx), "dys"));
js::Rooted<JSObject *> anon(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0,
JS::Rooted<JSObject *> anon(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0,
JS_GetGlobalObject(cx), 0));
js::Rooted<JSFunction *> funcPtr(cx, JS_NewFunction(cx, (JSNative) 1, 0, 0,
JS::Rooted<JSFunction *> funcPtr(cx, JS_NewFunction(cx, (JSNative) 1, 0, 0,
JS_GetGlobalObject(cx), "formFollows"));
JSObject &plainRef = *plain;
@ -29,7 +29,7 @@ FRAGMENT(JSObject, simple) {
}
FRAGMENT(JSObject, null) {
js::Rooted<JSObject *> null(cx, NULL);
JS::Rooted<JSObject *> null(cx, NULL);
js::RawObject nullRaw = null;
breakpoint();

Просмотреть файл

@ -6,22 +6,22 @@
#include "vm/String.h"
FRAGMENT(JSString, simple) {
js::Rooted<JSString *> empty(cx, JS_NewStringCopyN(cx, NULL, 0));
js::Rooted<JSString *> x(cx, JS_NewStringCopyN(cx, "x", 1));
js::Rooted<JSString *> z(cx, JS_NewStringCopyZ(cx, "z"));
JS::Rooted<JSString *> empty(cx, JS_NewStringCopyN(cx, NULL, 0));
JS::Rooted<JSString *> x(cx, JS_NewStringCopyN(cx, "x", 1));
JS::Rooted<JSString *> z(cx, JS_NewStringCopyZ(cx, "z"));
// I expect this will be a non-inlined string.
js::Rooted<JSString *> stars(cx, JS_NewStringCopyZ(cx,
JS::Rooted<JSString *> stars(cx, JS_NewStringCopyZ(cx,
"*************************"
"*************************"
"*************************"
"*************************"));
// This may well be an inlined string.
js::Rooted<JSString *> xz(cx, JS_ConcatStrings(cx, x, z));
JS::Rooted<JSString *> xz(cx, JS_ConcatStrings(cx, x, z));
// This will probably be a rope.
js::Rooted<JSString *> doubleStars(cx, JS_ConcatStrings(cx, stars, stars));
JS::Rooted<JSString *> doubleStars(cx, JS_ConcatStrings(cx, stars, stars));
// Ensure we're not confused by typedefs for pointer types.
js::RawString xRaw = x;
@ -38,7 +38,7 @@ FRAGMENT(JSString, simple) {
}
FRAGMENT(JSString, null) {
js::Rooted<JSString *> null(cx, NULL);
JS::Rooted<JSString *> null(cx, NULL);
js::RawString nullRaw = null;
breakpoint();
@ -48,7 +48,7 @@ FRAGMENT(JSString, null) {
}
FRAGMENT(JSString, subclasses) {
js::Rooted<JSFlatString *> flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!")));
JS::Rooted<JSFlatString *> flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!")));
breakpoint();

Просмотреть файл

@ -5,12 +5,12 @@
# as of 2012-11, GDB suppresses printing pointers in replacement values:
# see: http://sourceware.org/ml/gdb/2012-11/msg00055.html
#
# Thus, if the pretty-printer for js::Rooted simply returns the referent as
# Thus, if the pretty-printer for JS::Rooted simply returns the referent as
# a replacement value (which seems reasonable enough, if you want the
# pretty-printer to be completely transparent), and the referent is a null
# pointer, it prints as nothing at all.
#
# This test ensures that the js::Rooted pretty-printer doesn't make that
# This test ensures that the JS::Rooted pretty-printer doesn't make that
# mistake.
gdb.execute('set print address on')

Просмотреть файл

@ -1,7 +1,7 @@
#include "gdb-tests.h"
FRAGMENT(Root, null) {
js::Rooted<JSObject *> null(cx, NULL);
JS::Rooted<JSObject *> null(cx, NULL);
breakpoint();
@ -17,14 +17,14 @@ void callee(JS::Handle<JSObject *> obj, JS::MutableHandle<JSObject *> mutableObj
}
FRAGMENT(Root, handle) {
js::Rooted<JSObject *> global(cx, JS_GetGlobalObject(cx));
JS::Rooted<JSObject *> global(cx, JS_GetGlobalObject(cx));
callee(global, &global);
(void) global;
}
FRAGMENT(Root, HeapSlot) {
js::Rooted<jsval> plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth")));
js::Rooted<JSObject *> array(cx, JS_NewArrayObject(cx, 1, plinth.address()));
JS::Rooted<jsval> plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth")));
JS::Rooted<JSObject *> array(cx, JS_NewArrayObject(cx, 1, plinth.address()));
breakpoint();

Просмотреть файл

@ -1,6 +1,6 @@
# Test printing Handles.
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-js::Rooted')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::Rooted')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::Handle')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::MutableHandle')
assert_subprinter_registered('SpiderMonkey', 'instantiations-of-js::EncapsulatedPtr')

Просмотреть файл

@ -1,12 +1,12 @@
#include "gdb-tests.h"
FRAGMENT(jsid, simple) {
js::Rooted<JSString *> string(cx, JS_NewStringCopyZ(cx, "moon"));
js::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
js::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
JS::Rooted<JSString *> string(cx, JS_NewStringCopyZ(cx, "moon"));
JS::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
jsid int_id = INT_TO_JSID(1729);
jsid void_id = JSID_VOID;
js::Rooted<jsid> object_id(cx, OBJECT_TO_JSID(JS_GetGlobalObject(cx)));
JS::Rooted<jsid> object_id(cx, OBJECT_TO_JSID(JS_GetGlobalObject(cx)));
breakpoint();
@ -29,8 +29,8 @@ jsid_handles(JS::Handle<jsid> jsid_handle,
}
FRAGMENT(jsid, handles) {
js::Rooted<JSString *> string(cx, JS_NewStringCopyZ(cx, "shovel"));
js::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
js::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
JS::Rooted<JSString *> string(cx, JS_NewStringCopyZ(cx, "shovel"));
JS::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
jsid_handles(string_id, &string_id);
}

Просмотреть файл

@ -1,24 +1,24 @@
#include "gdb-tests.h"
FRAGMENT(jsval, simple) {
js::Rooted<jsval> fortytwo(cx, INT_TO_JSVAL(42));
js::Rooted<jsval> negone(cx, INT_TO_JSVAL(-1));
js::Rooted<jsval> undefined(cx, JSVAL_VOID);
js::Rooted<jsval> null(cx, JSVAL_NULL);
js::Rooted<jsval> js_true(cx, JSVAL_TRUE);
js::Rooted<jsval> js_false(cx, JSVAL_FALSE);
js::Rooted<jsval> elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE));
JS::Rooted<jsval> fortytwo(cx, INT_TO_JSVAL(42));
JS::Rooted<jsval> negone(cx, INT_TO_JSVAL(-1));
JS::Rooted<jsval> undefined(cx, JSVAL_VOID);
JS::Rooted<jsval> null(cx, JSVAL_NULL);
JS::Rooted<jsval> js_true(cx, JSVAL_TRUE);
JS::Rooted<jsval> js_false(cx, JSVAL_FALSE);
JS::Rooted<jsval> elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE));
js::Rooted<jsval> empty_string(cx);
JS::Rooted<jsval> empty_string(cx);
empty_string.setString(JS_NewStringCopyZ(cx, ""));
js::Rooted<jsval> friendly_string(cx);
JS::Rooted<jsval> friendly_string(cx);
friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!"));
js::Rooted<jsval> global(cx);
JS::Rooted<jsval> global(cx);
global.setObject(*JS_GetGlobalObject(cx));
// Some interesting value that floating-point won't munge.
js::Rooted<jsval> onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0));
JS::Rooted<jsval> onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0));
breakpoint();

Просмотреть файл

@ -10,7 +10,7 @@
BEGIN_TEST(selfTest_NaNsAreSame)
{
js::RootedValue v1(cx), v2(cx);
JS::RootedValue v1(cx), v2(cx);
EVAL("0/0", v1.address()); // NaN
CHECK_SAME(v1, v1);

Просмотреть файл

@ -34,15 +34,15 @@ JSClass addPropertyClass = {
BEGIN_TEST(testAddPropertyHook)
{
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
CHECK(obj);
js::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
JS_InitClass(cx, global, obj, &addPropertyClass, NULL, 0, NULL, NULL, NULL,
NULL);
obj = JS_NewArrayObject(cx, 0, NULL);
CHECK(obj);
js::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
JS::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
CHECK(JS_DefineProperty(cx, global, "arr", arr,
JS_PropertyStub, JS_StrictPropertyStub,
@ -51,8 +51,8 @@ BEGIN_TEST(testAddPropertyHook)
for (int i = 0; i < expectedCount; ++i) {
obj = JS_NewObject(cx, &addPropertyClass, NULL, NULL);
CHECK(obj);
js::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
js::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
JS::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
CHECK(JS_DefineElement(cx, arrObj, i, vobj,
JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_ENUMERATE));

Просмотреть файл

@ -11,8 +11,8 @@
BEGIN_TEST(testArrayBuffer_bug720949_steal)
{
js::RootedObject buf_len1(cx), buf_len200(cx);
js::RootedObject tarray_len1(cx), tarray_len200(cx);
JS::RootedObject buf_len1(cx), buf_len200(cx);
JS::RootedObject tarray_len1(cx), tarray_len200(cx);
uint32_t sizes[NUM_TEST_BUFFERS] = { sizeof(uint32_t), 200 * sizeof(uint32_t) };
JS::HandleObject testBuf[NUM_TEST_BUFFERS] = { buf_len1, buf_len200 };
@ -33,7 +33,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
JS::HandleObject obj = testBuf[i];
JS::HandleObject view = testArray[i];
uint32_t size = sizes[i];
js::RootedValue v(cx);
JS::RootedValue v(cx);
// Byte lengths should all agree
CHECK(JS_IsArrayBufferObject(obj));
@ -72,11 +72,11 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
CHECK_SAME(v, JSVAL_VOID);
// Transfer to a new ArrayBuffer
js::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
JS::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
CHECK(JS_IsArrayBufferObject(dst));
data = JS_GetArrayBufferData(obj);
js::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
JS::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
CHECK(dstview != NULL);
CHECK_EQUAL(JS_GetArrayBufferByteLength(dst), size);
@ -100,7 +100,7 @@ static void GC(JSContext *cx)
// Varying number of views of a buffer, to test the neutering weak pointers
BEGIN_TEST(testArrayBuffer_bug720949_viewList)
{
js::RootedObject buffer(cx);
JS::RootedObject buffer(cx);
// No views
buffer = JS_NewArrayBuffer(cx, 2000);
@ -110,7 +110,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
// One view.
{
buffer = JS_NewArrayBuffer(cx, 2000);
js::RootedObject view(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
JS::RootedObject view(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
void *contents;
uint8_t *data;
CHECK(JS_StealArrayBufferContents(cx, buffer, &contents, &data));
@ -130,8 +130,8 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
{
buffer = JS_NewArrayBuffer(cx, 2000);
js::RootedObject view1(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
js::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
JS::RootedObject view1(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
JS::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
// Remove, re-add a view
view2 = NULL;
@ -162,7 +162,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
}
bool isNeutered(JS::HandleObject obj) {
js::RootedValue v(cx);
JS::RootedValue v(cx);
return JS_GetProperty(cx, obj, "byteLength", v.address()) && v.toInt32() == 0;
}

Просмотреть файл

@ -6,20 +6,20 @@
BEGIN_TEST(test_BindCallable)
{
js::RootedValue v(cx);
JS::RootedValue v(cx);
EVAL("({ somename : 1717 })", v.address());
CHECK(v.isObject());
js::RootedValue func(cx);
JS::RootedValue func(cx);
EVAL("(function() { return this.somename; })", func.address());
CHECK(func.isObject());
js::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func));
js::RootedObject vObj(cx, JSVAL_TO_OBJECT(v));
JS::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func));
JS::RootedObject vObj(cx, JSVAL_TO_OBJECT(v));
JSObject* newCallable = JS_BindCallable(cx, funcObj, vObj);
CHECK(newCallable);
js::RootedValue retval(cx);
JS::RootedValue retval(cx);
bool called = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(newCallable), 0, NULL, retval.address());
CHECK(called);

Просмотреть файл

@ -36,7 +36,7 @@ static JSObject *
wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target)
{
JSAutoCompartment ac(cx, target);
js::RootedObject wrapper(cx, toWrap);
JS::RootedObject wrapper(cx, toWrap);
if (!JS_WrapObject(cx, wrapper.address()))
return NULL;
return wrapper;
@ -45,7 +45,7 @@ wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target)
static JSObject *
SameCompartmentWrap(JSContext *cx, JSObject *objArg)
{
js::RootedObject obj(cx, objArg);
JS::RootedObject obj(cx, objArg);
JS_GC(JS_GetRuntime(cx));
return obj;
}
@ -53,8 +53,8 @@ SameCompartmentWrap(JSContext *cx, JSObject *objArg)
static JSObject *
PreWrap(JSContext *cx, JSObject *scopeArg, JSObject *objArg, unsigned flags)
{
js::RootedObject scope(cx, scopeArg);
js::RootedObject obj(cx, objArg);
JS::RootedObject scope(cx, scopeArg);
JS::RootedObject obj(cx, objArg);
JS_GC(JS_GetRuntime(cx));
return obj;
}
@ -63,34 +63,34 @@ static JSObject *
Wrap(JSContext *cx, JSObject *existing, JSObject *objArg,
JSObject *protoArg, JSObject *parentArg, unsigned flags)
{
js::RootedObject obj(cx, objArg);
js::RootedObject proto(cx, protoArg);
js::RootedObject parent(cx, parentArg);
JS::RootedObject obj(cx, objArg);
JS::RootedObject proto(cx, protoArg);
JS::RootedObject parent(cx, parentArg);
return js::Wrapper::New(cx, obj, proto, parent, &js::CrossCompartmentWrapper::singleton);
}
BEGIN_TEST(testBug604087)
{
js::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
JS::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
&OuterWrapper::singleton));
js::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
js::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
js::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
js::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
JS::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
CHECK(c2wrapper);
js::SetProxyExtra(c2wrapper, 0, js::Int32Value(2));
js::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3));
JS::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3));
CHECK(c3wrapper);
js::SetProxyExtra(c3wrapper, 0, js::Int32Value(3));
js::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
JS::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
CHECK(c4wrapper);
js::SetProxyExtra(c4wrapper, 0, js::Int32Value(4));
compartment4 = c4wrapper = NULL;
js::RootedObject next(cx);
JS::RootedObject next(cx);
{
JSAutoCompartment ac(cx, compartment2);
next = js::Wrapper::New(cx, compartment2, compartment2->getProto(), compartment2,

Просмотреть файл

@ -44,42 +44,42 @@ CustomMethod(JSContext *cx, unsigned argc, Value *vp)
BEGIN_TEST(test_CallNonGenericMethodOnProxy)
{
// Create the first global object and compartment
js::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
CHECK(globalA);
js::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
JS::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
CHECK(customA);
JS_SetReservedSlot(customA, CUSTOM_SLOT, Int32Value(17));
JSFunction *customMethodA = JS_NewFunction(cx, CustomMethod, 0, 0, customA, "customMethodA");
CHECK(customMethodA);
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, customA, customMethodA, 0, NULL, rval.address()));
CHECK_SAME(rval, Int32Value(17));
// Now create the second global object and compartment...
{
js::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
CHECK(globalB);
// ...and enter it.
JSAutoCompartment enter(cx, globalB);
js::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
CHECK(customB);
JS_SetReservedSlot(customB, CUSTOM_SLOT, Int32Value(42));
js::RootedFunction customMethodB(cx, JS_NewFunction(cx, CustomMethod, 0, 0, customB, "customMethodB"));
JS::RootedFunction customMethodB(cx, JS_NewFunction(cx, CustomMethod, 0, 0, customB, "customMethodB"));
CHECK(customMethodB);
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, customB, customMethodB, 0, NULL, rval.address()));
CHECK_SAME(rval, Int32Value(42));
js::RootedObject wrappedCustomA(cx, customA);
JS::RootedObject wrappedCustomA(cx, customA);
CHECK(JS_WrapObject(cx, wrappedCustomA.address()));
js::RootedValue rval2(cx);
JS::RootedValue rval2(cx);
CHECK(JS_CallFunction(cx, wrappedCustomA, customMethodB, 0, NULL, rval2.address()));
CHECK_SAME(rval, Int32Value(42));
}

Просмотреть файл

@ -70,7 +70,7 @@ BEGIN_TEST(testChromeBuffer)
trusted_fun = JS_GetFunctionObject(fun);
}
js::RootedValue v(cx, JS::ObjectValue(*trusted_fun));
JS::RootedValue v(cx, JS::ObjectValue(*trusted_fun));
CHECK(JS_WrapValue(cx, v.address()));
const char *paramName = "trusted";
@ -82,7 +82,7 @@ BEGIN_TEST(testChromeBuffer)
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, &paramName,
bytes, strlen(bytes), "", 0));
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), rval.address()));
CHECK(JSVAL_TO_INT(rval) == 100);
}
@ -107,7 +107,7 @@ BEGIN_TEST(testChromeBuffer)
trusted_fun = JS_GetFunctionObject(fun);
}
js::RootedValue v(cx, JS::ObjectValue(*trusted_fun));
JS::RootedValue v(cx, JS::ObjectValue(*trusted_fun));
CHECK(JS_WrapValue(cx, v.address()));
const char *paramName = "trusted";
@ -119,7 +119,7 @@ BEGIN_TEST(testChromeBuffer)
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, &paramName,
bytes, strlen(bytes), "", 0));
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), rval.address()));
JSBool match;
CHECK(JS_StringEqualsAscii(cx, JSVAL_TO_STRING(rval), "From trusted: InternalError: too much recursion", &match));
@ -141,8 +141,8 @@ BEGIN_TEST(testChromeBuffer)
trusted_fun = JS_GetFunctionObject(fun);
}
js::RootedFunction fun(cx, JS_NewFunction(cx, CallTrusted, 0, 0, global, "callTrusted"));
js::RootedObject callTrusted(cx, JS_GetFunctionObject(fun));
JS::RootedFunction fun(cx, JS_NewFunction(cx, CallTrusted, 0, 0, global, "callTrusted"));
JS::RootedObject callTrusted(cx, JS_GetFunctionObject(fun));
const char *paramName = "f";
const char *bytes = "try { "
@ -153,8 +153,8 @@ BEGIN_TEST(testChromeBuffer)
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, &paramName,
bytes, strlen(bytes), "", 0));
js::RootedValue arg(cx, JS::ObjectValue(*callTrusted));
js::RootedValue rval(cx);
JS::RootedValue arg(cx, JS::ObjectValue(*callTrusted));
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, NULL, fun, 1, arg.address(), rval.address()));
CHECK(JSVAL_TO_INT(rval) == 42);
}

Просмотреть файл

@ -63,7 +63,7 @@ BEGIN_TEST(testClassGetter_isCalled)
EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }");
for (int i = 1; i < 9; i++) {
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
CHECK_SAME(INT_TO_JSVAL(called_test_fn), INT_TO_JSVAL(i));
CHECK_SAME(INT_TO_JSVAL(called_test_prop_get), INT_TO_JSVAL(4 * i));

Просмотреть файл

@ -13,8 +13,8 @@
BEGIN_TEST(test_cloneScript)
{
js::RootedObject A(cx, createGlobal());
js::RootedObject B(cx, createGlobal());
JS::RootedObject A(cx, createGlobal());
JS::RootedObject B(cx, createGlobal());
CHECK(A);
CHECK(B);
@ -28,7 +28,7 @@ BEGIN_TEST(test_cloneScript)
"}\n"
"(sum);\n";
js::RootedObject obj(cx);
JS::RootedObject obj(cx);
// compile for A
{
@ -90,8 +90,8 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
JSPrincipals *principalsB = new Principals();
AutoDropPrincipals dropB(rt, principalsB);
js::RootedObject A(cx, createGlobal(principalsA));
js::RootedObject B(cx, createGlobal(principalsB));
JS::RootedObject A(cx, createGlobal(principalsA));
JS::RootedObject B(cx, createGlobal(principalsB));
CHECK(A);
CHECK(B);
@ -99,12 +99,12 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
const char *argnames[] = { "arg" };
const char *source = "return function() { return arg; }";
js::RootedObject obj(cx);
JS::RootedObject obj(cx);
// Compile in A
{
JSAutoCompartment a(cx, A);
js::RootedFunction fun(cx, JS_CompileFunctionForPrincipals(cx, A, principalsA, "f",
JS::RootedFunction fun(cx, JS_CompileFunctionForPrincipals(cx, A, principalsA, "f",
mozilla::ArrayLength(argnames), argnames,
source, strlen(source), __FILE__, 1));
CHECK(fun);
@ -119,7 +119,7 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
// Clone into B
{
JSAutoCompartment b(cx, B);
js::RootedObject cloned(cx);
JS::RootedObject cloned(cx);
CHECK(cloned = JS_CloneFunctionObject(cx, obj, B));
JSFunction *fun;
@ -130,7 +130,7 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
CHECK(JS_GetScriptPrincipals(script) == principalsB);
js::RootedValue v(cx);
JS::RootedValue v(cx);
JS::Value args[] = { JS::Int32Value(1) };
CHECK(JS_CallFunctionValue(cx, B, JS::ObjectValue(*cloned), 1, args, v.address()));
CHECK(v.isObject());

Просмотреть файл

@ -12,28 +12,28 @@
BEGIN_TEST(testConservativeGC)
{
js::RootedValue v2(cx);
JS::RootedValue v2(cx);
EVAL("({foo: 'bar'});", v2.address());
CHECK(v2.isObject());
char objCopy[sizeof(JSObject)];
js_memcpy(&objCopy, JSVAL_TO_OBJECT(v2), sizeof(JSObject));
js::RootedValue v3(cx);
JS::RootedValue v3(cx);
EVAL("String(Math.PI);", v3.address());
CHECK(JSVAL_IS_STRING(v3));
char strCopy[sizeof(JSString)];
js_memcpy(&strCopy, JSVAL_TO_STRING(v3), sizeof(JSString));
js::RootedValue tmp(cx);
JS::RootedValue tmp(cx);
EVAL("({foo2: 'bar2'});", tmp.address());
CHECK(tmp.isObject());
js::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
JS::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
char obj2Copy[sizeof(JSObject)];
js_memcpy(&obj2Copy, obj2, sizeof(JSObject));
EVAL("String(Math.sqrt(3));", tmp.address());
CHECK(JSVAL_IS_STRING(tmp));
js::RootedString str2(cx, JSVAL_TO_STRING(tmp));
JS::RootedString str2(cx, JSVAL_TO_STRING(tmp));
char str2Copy[sizeof(JSString)];
js_memcpy(&str2Copy, str2, sizeof(JSString));

Просмотреть файл

@ -20,7 +20,7 @@ IterNext(JSContext *cx, unsigned argc, jsval *vp)
static JSObject *
IterHook(JSContext *cx, JS::HandleObject obj, JSBool keysonly)
{
js::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
JS::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
if (!iterObj)
return NULL;
if (!JS_DefineFunction(cx, iterObj, "next", IterNext, 0, 0))
@ -67,7 +67,7 @@ BEGIN_TEST(testCustomIterator_bug612523)
CHECK(JS_InitClass(cx, global, NULL, Jsvalify(&HasCustomIterClass),
IterClassConstructor, 0, NULL, NULL, NULL, NULL));
js::RootedValue result(cx);
JS::RootedValue result(cx);
EVAL("var o = new HasCustomIter(); \n"
"var j = 0; \n"
"for (var i in o) { ++j; }; \n"

Просмотреть файл

@ -18,7 +18,7 @@ callCountHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, JSBo
{
callCount[before]++;
js::RootedValue thisv(cx);
JS::RootedValue thisv(cx);
frame.getThisValue(cx, &thisv); // assert if fp is incomplete
return cx; // any non-null value causes the hook to be called again after
@ -44,7 +44,7 @@ nonStrictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
{
if (before) {
bool *allWrapped = (bool *) closure;
js::RootedValue thisv(cx);
JS::RootedValue thisv(cx);
frame.getThisValue(cx, &thisv);
*allWrapped = *allWrapped && !JSVAL_IS_PRIMITIVE(thisv);
}
@ -83,7 +83,7 @@ strictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, JSB
{
if (before) {
bool *anyWrapped = (bool *) closure;
js::RootedValue thisv(cx);
JS::RootedValue thisv(cx);
frame.getThisValue(cx, &thisv);
*anyWrapped = *anyWrapped || !JSVAL_IS_PRIMITIVE(thisv);
}
@ -120,7 +120,7 @@ ThrowHook(JSContext *cx, JSScript *, jsbytecode *, jsval *rval, void *closure)
JS_ASSERT(!closure);
called = true;
js::RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
JS::RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
char text[] = "new Error()";
jsval _;
@ -153,7 +153,7 @@ END_TEST(testDebugger_throwHook)
BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
{
CHECK(JS_DefineDebuggerObject(cx, global));
js::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
CHECK(debuggee);
{
@ -162,9 +162,9 @@ BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
CHECK(JS_InitStandardClasses(cx, debuggee));
}
js::RootedObject debuggeeWrapper(cx, debuggee);
JS::RootedObject debuggeeWrapper(cx, debuggee);
CHECK(JS_WrapObject(cx, debuggeeWrapper.address()));
js::RootedValue v(cx, JS::ObjectValue(*debuggeeWrapper));
JS::RootedValue v(cx, JS::ObjectValue(*debuggeeWrapper));
CHECK(JS_SetProperty(cx, global, "debuggee", v.address()));
EVAL("var dbg = new Debugger(debuggee);\n"
@ -193,16 +193,16 @@ BEGIN_TEST(testDebugger_newScriptHook)
{
// Test that top-level indirect eval fires the newScript hook.
CHECK(JS_DefineDebuggerObject(cx, global));
js::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
CHECK(g);
{
JSAutoCompartment ae(cx, g);
CHECK(JS_InitStandardClasses(cx, g));
}
js::RootedObject gWrapper(cx, g);
JS::RootedObject gWrapper(cx, g);
CHECK(JS_WrapObject(cx, gWrapper.address()));
js::RootedValue v(cx, JS::ObjectValue(*gWrapper));
JS::RootedValue v(cx, JS::ObjectValue(*gWrapper));
CHECK(JS_SetProperty(cx, global, "g", v.address()));
EXEC("var dbg = Debugger(g);\n"
@ -234,7 +234,7 @@ bool testIndirectEval(JS::HandleObject scope, const char *code)
CHECK(JS_CallFunctionName(cx, scope, "eval", 1, argv, &v));
}
js::RootedValue hitsv(cx);
JS::RootedValue hitsv(cx);
EVAL("hits", hitsv.address());
CHECK_SAME(hitsv, INT_TO_JSVAL(1));
return true;

Просмотреть файл

@ -10,9 +10,9 @@
BEGIN_TEST(testDeepFreeze_bug535703)
{
js::RootedValue v(cx);
JS::RootedValue v(cx);
EVAL("var x = {}; x;", v.address());
js::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
CHECK(JS_DeepFreezeObject(cx, obj)); // don't crash
EVAL("Object.isFrozen(x)", v.address());
CHECK_SAME(v, JSVAL_TRUE);
@ -22,17 +22,17 @@ END_TEST(testDeepFreeze_bug535703)
BEGIN_TEST(testDeepFreeze_deep)
{
js::RootedValue a(cx), o(cx);
JS::RootedValue a(cx), o(cx);
EXEC("var a = {}, o = a;\n"
"for (var i = 0; i < 5000; i++)\n"
" a = {x: a, y: a};\n");
EVAL("a", a.address());
EVAL("o", o.address());
js::RootedObject aobj(cx, JSVAL_TO_OBJECT(a));
JS::RootedObject aobj(cx, JSVAL_TO_OBJECT(a));
CHECK(JS_DeepFreezeObject(cx, aobj));
js::RootedValue b(cx);
JS::RootedValue b(cx);
EVAL("Object.isFrozen(a)", b.address());
CHECK_SAME(b, JSVAL_TRUE);
EVAL("Object.isFrozen(o)", b.address());
@ -43,15 +43,15 @@ END_TEST(testDeepFreeze_deep)
BEGIN_TEST(testDeepFreeze_loop)
{
js::RootedValue x(cx), y(cx);
JS::RootedValue x(cx), y(cx);
EXEC("var x = [], y = {x: x}; y.y = y; x.push(x, y);");
EVAL("x", x.address());
EVAL("y", y.address());
js::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
CHECK(JS_DeepFreezeObject(cx, xobj));
js::RootedValue b(cx);
JS::RootedValue b(cx);
EVAL("Object.isFrozen(x)", b.address());
CHECK_SAME(b, JSVAL_TRUE);
EVAL("Object.isFrozen(y)", b.address());

Просмотреть файл

@ -18,22 +18,22 @@ static const char PROPERTY_NAME[] = "foo";
BEGIN_TEST(testDefineGetterSetterNonEnumerable)
{
js::RootedValue vobj(cx);
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
JS::RootedValue vobj(cx);
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
CHECK(obj);
vobj = OBJECT_TO_JSVAL(obj);
JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, NULL, "get");
CHECK(funGet);
js::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
js::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, NULL, "set");
CHECK(funSet);
js::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
js::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
js::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj));
JS::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj));
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
JSVAL_VOID,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, (JSObject*) funGetObj),

Просмотреть файл

@ -10,13 +10,13 @@
BEGIN_TEST(testDefineProperty_bug564344)
{
js::RootedValue x(cx);
JS::RootedValue x(cx);
EVAL("function f() {}\n"
"var x = {p: f};\n"
"x.p(); // brand x's scope\n"
"x;", x.address());
js::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
for (int i = 0; i < 2; i++)
CHECK(JS_DefineProperty(cx, obj, "q", JSVAL_VOID, NULL, NULL, JSPROP_SHARED));
return true;

Просмотреть файл

@ -26,7 +26,7 @@ BEGIN_TEST(testErrorCopying_columnCopied)
//0123456789012345678901234567
EXEC("function check() { Object; foo; }");
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
JS_SetErrorReporter(cx, my_ErrorReporter);
CHECK(!JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
CHECK(column == 27);

Просмотреть файл

@ -10,12 +10,12 @@
BEGIN_TEST(testFunctionProperties)
{
js::RootedValue x(cx);
JS::RootedValue x(cx);
EVAL("(function f() {})", x.address());
js::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
js::RootedValue y(cx);
JS::RootedValue y(cx);
CHECK(JS_GetProperty(cx, obj, "arguments", y.address()));
CHECK_SAME(y, JSVAL_NULL);

Просмотреть файл

@ -47,9 +47,9 @@ BEGIN_TEST(testGCFinalizeCallback)
CHECK(checkFinalizeStatus());
CHECK(checkFinalizeIsCompartmentGC(false));
js::RootedObject global1(cx, createGlobal());
js::RootedObject global2(cx, createGlobal());
js::RootedObject global3(cx, createGlobal());
JS::RootedObject global1(cx, createGlobal());
JS::RootedObject global2(cx, createGlobal());
JS::RootedObject global3(cx, createGlobal());
CHECK(global1);
CHECK(global2);
CHECK(global3);
@ -107,7 +107,7 @@ BEGIN_TEST(testGCFinalizeCallback)
CHECK(rt->gcIncrementalState == js::gc::MARK);
CHECK(rt->gcIsFull);
js::RootedObject global4(cx, createGlobal());
JS::RootedObject global4(cx, createGlobal());
js::GCDebugSlice(rt, true, 1);
CHECK(rt->gcIncrementalState == js::gc::NO_INCREMENTAL);
CHECK(!rt->gcIsFull);

Просмотреть файл

@ -21,7 +21,7 @@ BEGIN_TEST(testGCOutOfMemory)
{
JS_SetErrorReporter(cx, ErrorCounter);
js::RootedValue root(cx);
JS::RootedValue root(cx);
static const char source[] =
"var max = 0; (function() {"

Просмотреть файл

@ -26,17 +26,17 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
{
// Check JS_GetPropertyDefault
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
CHECK(obj);
js::RootedValue v0(cx, JSVAL_TRUE);
JS::RootedValue v0(cx, JSVAL_TRUE);
CHECK(JS_SetProperty(cx, obj, "here", v0.address()));
js::RootedValue v1(cx);
JS::RootedValue v1(cx);
CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, v1.address()));
CHECK(JSVAL_IS_TRUE(v1));
js::RootedValue v2(cx);
JS::RootedValue v2(cx);
CHECK(JS_GetPropertyDefault(cx, obj, "nothere", JSVAL_FALSE, v2.address()));
CHECK(JSVAL_IS_FALSE(v2));
}
@ -44,7 +44,7 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
{
// Check JS_GetPropertyByIdDefault
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
CHECK(obj);
jsid hereid;
@ -53,14 +53,14 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
jsid nothereid;
CHECK(stringToId(cx, "nothere", &nothereid));
js::RootedValue v0(cx, JSVAL_TRUE);
JS::RootedValue v0(cx, JSVAL_TRUE);
CHECK(JS_SetPropertyById(cx, obj, hereid, v0.address()));
js::RootedValue v1(cx);
JS::RootedValue v1(cx);
CHECK(JS_GetPropertyByIdDefault(cx, obj, hereid, JSVAL_FALSE, v1.address()));
CHECK(JSVAL_IS_TRUE(v1));
js::RootedValue v2(cx);
JS::RootedValue v2(cx);
CHECK(JS_GetPropertyByIdDefault(cx, obj, nothereid, JSVAL_FALSE, v2.address()));
CHECK(JSVAL_IS_FALSE(v2));
}

Просмотреть файл

@ -11,7 +11,7 @@
BEGIN_TEST(testIntString_bug515273)
{
js::RootedValue v(cx);
JS::RootedValue v(cx);
EVAL("'1';", v.address());
JSString *str = JSVAL_TO_STRING(v);

Просмотреть файл

@ -13,7 +13,7 @@ BEGIN_TEST(testAtomizedIsNotInterned)
{
/* Try to pick a string that won't be interned by other tests in this runtime. */
static const char someChars[] = "blah blah blah? blah blah blah";
js::Rooted<JSAtom*> atom(cx, js::Atomize(cx, someChars, ArrayLength(someChars)));
JS::Rooted<JSAtom*> atom(cx, js::Atomize(cx, someChars, ArrayLength(someChars)));
CHECK(!JS_StringHasBeenInterned(cx, atom));
CHECK(JS_InternJSString(cx, atom));
CHECK(JS_StringHasBeenInterned(cx, atom));

Просмотреть файл

@ -6,7 +6,7 @@
BEGIN_TEST(testJSEvaluateScript)
{
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, global));
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, global));
CHECK(obj);
uint32_t options = JS_GetOptions(cx);
@ -14,7 +14,7 @@ BEGIN_TEST(testJSEvaluateScript)
static const char src[] = "var x = 5;";
js::RootedValue retval(cx);
JS::RootedValue retval(cx);
CHECK(JS_EvaluateScript(cx, obj, src, sizeof(src) - 1, __FILE__, __LINE__,
retval.address()));

Просмотреть файл

@ -14,7 +14,7 @@
BEGIN_TEST(testLookup_bug522590)
{
// Define a function that makes method-bearing objects.
js::RootedValue x(cx);
JS::RootedValue x(cx);
EXEC("function mkobj() { return {f: function () {return 2;}} }");
// Calling mkobj() multiple times must create multiple functions in ES5.
@ -23,10 +23,10 @@ BEGIN_TEST(testLookup_bug522590)
// Now make x.f a method.
EVAL("mkobj()", x.address());
js::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
// This lookup must not return an internal function object.
js::RootedValue r(cx);
JS::RootedValue r(cx);
CHECK(JS_LookupProperty(cx, xobj, "f", r.address()));
CHECK(r.isObject());
JSObject *funobj = &r.toObject();
@ -54,7 +54,7 @@ document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flag
JSMutableHandleObject objp)
{
// If id is "all", resolve document.all=true.
js::RootedValue v(cx);
JS::RootedValue v(cx);
if (!JS_IdToValue(cx, id, v.address()))
return false;
if (JSVAL_IS_STRING(v)) {
@ -63,10 +63,10 @@ document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flag
if (!flatStr)
return false;
if (JS_FlatStringEqualsAscii(flatStr, "all")) {
js::Rooted<JSObject*> docAll(cx, JS_NewObject(cx, &DocumentAllClass, NULL, NULL));
JS::Rooted<JSObject*> docAll(cx, JS_NewObject(cx, &DocumentAllClass, NULL, NULL));
if (!docAll)
return false;
js::Rooted<JS::Value> allValue(cx, ObjectValue(*docAll));
JS::Rooted<JS::Value> allValue(cx, ObjectValue(*docAll));
JSBool ok = JS_DefinePropertyById(cx, obj, id, allValue, NULL, NULL, 0);
objp.set(ok ? obj.get() : NULL);
return ok;
@ -84,10 +84,10 @@ static JSClass document_class = {
BEGIN_TEST(testLookup_bug570195)
{
js::RootedObject obj(cx, JS_NewObject(cx, &document_class, NULL, NULL));
JS::RootedObject obj(cx, JS_NewObject(cx, &document_class, NULL, NULL));
CHECK(obj);
CHECK(JS_DefineProperty(cx, global, "document", OBJECT_TO_JSVAL(obj), NULL, NULL, 0));
js::RootedValue v(cx);
JS::RootedValue v(cx);
EVAL("document.all ? true : false", v.address());
CHECK_SAME(v, JSVAL_FALSE);
EVAL("document.hasOwnProperty('all')", v.address());

Просмотреть файл

@ -29,15 +29,15 @@ struct LooseEqualityFixture : public JSAPITest
struct LooseEqualityData
{
js::RootedValue qNaN;
js::RootedValue sNaN;
js::RootedValue d42;
js::RootedValue i42;
js::RootedValue undef;
js::RootedValue null;
js::RootedValue obj;
js::RootedValue poszero;
js::RootedValue negzero;
JS::RootedValue qNaN;
JS::RootedValue sNaN;
JS::RootedValue d42;
JS::RootedValue i42;
JS::RootedValue undef;
JS::RootedValue null;
JS::RootedValue obj;
JS::RootedValue poszero;
JS::RootedValue negzero;
LooseEqualityData(JSContext *cx)
: qNaN(cx),

Просмотреть файл

@ -17,9 +17,9 @@ static JSBool
constructHook(JSContext *cx, unsigned argc, jsval *vp)
{
// Check that arguments were passed properly from JS_New.
js::RootedObject callee(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
JS::RootedObject callee(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
js::RootedObject obj(cx, JS_NewObjectForConstructor(cx, js::Jsvalify(&js::ObjectClass), vp));
JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, js::Jsvalify(&js::ObjectClass), vp));
if (!obj) {
JS_ReportError(cx, "test failed, could not construct object");
return false;
@ -57,14 +57,14 @@ BEGIN_TEST(testNewObject_1)
CHECK(JS_AddNamedValueRoot(cx, &argv[0], "argv0"));
CHECK(JS_AddNamedValueRoot(cx, &argv[1], "argv1"));
js::RootedValue v(cx);
JS::RootedValue v(cx);
EVAL("Array", v.address());
js::RootedObject Array(cx, JSVAL_TO_OBJECT(v));
JS::RootedObject Array(cx, JSVAL_TO_OBJECT(v));
// With no arguments.
js::RootedObject obj(cx, JS_New(cx, Array, 0, NULL));
JS::RootedObject obj(cx, JS_New(cx, Array, 0, NULL));
CHECK(obj);
js::RootedValue rt(cx, OBJECT_TO_JSVAL(obj));
JS::RootedValue rt(cx, OBJECT_TO_JSVAL(obj));
CHECK(JS_IsArrayObject(cx, obj));
uint32_t len;
CHECK(JS_GetArrayLength(cx, obj, &len));
@ -99,9 +99,9 @@ BEGIN_TEST(testNewObject_1)
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
NULL, NULL, NULL, constructHook
};
js::RootedObject ctor(cx, JS_NewObject(cx, &cls, NULL, NULL));
JS::RootedObject ctor(cx, JS_NewObject(cx, &cls, NULL, NULL));
CHECK(ctor);
js::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
JS::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
obj = JS_New(cx, ctor, 3, argv);
CHECK(obj);
CHECK(JS_GetElement(cx, ctor, 0, v.address()));

Просмотреть файл

@ -8,7 +8,7 @@
BEGIN_TEST(testOOM)
{
js::RootedString jsstr(cx, JS_ValueToString(cx, INT_TO_JSVAL(9)));
JS::RootedString jsstr(cx, JS_ValueToString(cx, INT_TO_JSVAL(9)));
mozilla::DebugOnly<const jschar *> s = JS_GetStringCharsZ(cx, jsstr);
JS_ASSERT(s[0] == '9' && s[1] == '\0');
return true;

Просмотреть файл

@ -31,7 +31,7 @@ BEGIN_TEST(testObjectEmulatingUndefined_truthy)
CHECK(JS_InitClass(cx, global, NULL, &ObjectEmulatingUndefinedClass,
ObjectEmulatingUndefinedConstructor, 0, NULL, NULL, NULL, NULL));
js::RootedValue result(cx);
JS::RootedValue result(cx);
EVAL("if (new ObjectEmulatingUndefined()) true; else false;", result.address());
CHECK_SAME(result, JSVAL_FALSE);
@ -56,7 +56,7 @@ BEGIN_TEST(testObjectEmulatingUndefined_equal)
CHECK(JS_InitClass(cx, global, NULL, &ObjectEmulatingUndefinedClass,
ObjectEmulatingUndefinedConstructor, 0, NULL, NULL, NULL, NULL));
js::RootedValue result(cx);
JS::RootedValue result(cx);
EVAL("if (new ObjectEmulatingUndefined() == undefined) true; else false;", result.address());
CHECK_SAME(result, JSVAL_TRUE);

Просмотреть файл

@ -55,7 +55,7 @@ BEGIN_TEST(testOps_bug559006)
EXEC("function main() { while(1) return 0 + createMyObject(); }");
for (int i = 0; i < 9; i++) {
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunctionName(cx, global, "main", 0, NULL, rval.address()));
CHECK_SAME(rval, INT_TO_JSVAL(123));
}

Просмотреть файл

@ -61,7 +61,7 @@ eval(const char *asciiChars, JSPrincipals *principals, JSPrincipals *originPrinc
chars[i] = asciiChars[i];
chars[len] = 0;
js::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), principals));
JS::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), principals));
CHECK(global);
JSAutoCompartment ac(cx, global);
CHECK(JS_InitStandardClasses(cx, global));
@ -85,7 +85,7 @@ testOuter(const char *asciiChars)
bool
testInner(const char *asciiChars, JSPrincipals *principal, JSPrincipals *originPrincipal)
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(eval(asciiChars, principal, originPrincipal, rval.address()));
JSScript *script = JS_GetFunctionScript(cx, JSVAL_TO_OBJECT(rval)->toFunction());

Просмотреть файл

@ -57,7 +57,7 @@ BEGIN_TEST(testParseJSON_success)
CHECK(TryParse(cx, "9e9", DOUBLE_TO_JSVAL(9e9)));
CHECK(TryParse(cx, "9e99999", DOUBLE_TO_JSVAL(std::numeric_limits<double>::infinity())));
js::Rooted<JSFlatString*> str(cx);
JS::Rooted<JSFlatString*> str(cx);
const jschar emptystr[] = { '\0' };
str = js_NewStringCopyN<CanGC>(cx, emptystr, 0);
@ -83,8 +83,8 @@ BEGIN_TEST(testParseJSON_success)
// Arrays
js::RootedValue v(cx), v2(cx);
js::RootedObject obj(cx);
JS::RootedValue v(cx), v2(cx);
JS::RootedObject obj(cx);
CHECK(Parse(cx, "[]", v.address()));
CHECK(!JSVAL_IS_PRIMITIVE(v));
@ -132,7 +132,7 @@ template<size_t N> inline bool
TryParse(JSContext *cx, const char (&input)[N], const jsval &expectedArg)
{
AutoInflatedString str(cx);
js::RootedValue expected(cx, expectedArg);
JS::RootedValue expected(cx, expectedArg);
RootedValue v(cx);
str = input;
CHECK(JS_ParseJSON(cx, str.chars(), str.length(), v.address()));
@ -215,7 +215,7 @@ BEGIN_TEST(testParseJSON_reviver)
JSFunction *fun = JS_NewFunction(cx, Censor, 0, 0, global, "censor");
CHECK(fun);
js::RootedValue filter(cx, OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)));
JS::RootedValue filter(cx, OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)));
CHECK(TryParse(cx, "true", filter));
CHECK(TryParse(cx, "false", filter));
@ -232,7 +232,7 @@ template<size_t N> inline bool
TryParse(JSContext *cx, const char (&input)[N], JS::HandleValue filter)
{
AutoInflatedString str(cx);
js::RootedValue v(cx);
JS::RootedValue v(cx);
str = input;
CHECK(JS_ParseJSONWithReviver(cx, str.chars(), str.length(), filter, v.address()));
CHECK_SAME(v, JSVAL_NULL);

Просмотреть файл

@ -42,7 +42,7 @@ static JSBool
test_fn2(JSContext *cx, unsigned argc, jsval *vp)
{
jsval r;
js::RootedObject global(cx, JS_GetGlobalObject(cx));
JS::RootedObject global(cx, JS_GetGlobalObject(cx));
return JS_CallFunctionName(cx, global, "d", 0, NULL, &r);
}
@ -82,7 +82,7 @@ static JSObject*
initialize(JSContext *cx)
{
js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 10);
js::RootedObject global(cx, JS_GetGlobalObject(cx));
JS::RootedObject global(cx, JS_GetGlobalObject(cx));
return JS_InitClass(cx, global, NULL, &ptestClass, Prof, 0,
NULL, ptestFunctions, NULL, NULL);
}
@ -103,7 +103,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
reset(cx);
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
/* Make sure the stack resets and we have an entry for each stack */
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
CHECK(psize == 0);
@ -118,7 +118,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
}
reset(cx);
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
CHECK(JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address()));
CHECK(cx->runtime->spsProfiler.stringsCount() == 5);
CHECK(max_stack >= 6);
@ -128,7 +128,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 3);
reset(cx);
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
pstack[3].setLabel((char*) 1234);
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
CHECK((size_t) pstack[3].label() == 1234);
@ -157,7 +157,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithJIT)
reset(cx);
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
/* Make sure the stack resets and we have an entry for each stack */
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
CHECK(psize == 0);
@ -177,7 +177,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithJIT)
reset(cx);
{
/* Limit the size of the stack and make sure we don't overflow */
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
pstack[3].setLabel((char*) 1234);
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
CHECK(psize == 0);
@ -198,7 +198,7 @@ BEGIN_TEST(testProfileStrings_isCalledWhenError)
reset(cx);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT);
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
/* Make sure the stack resets and we have an entry for each stack */
JSBool ok = JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address());
CHECK(!ok);
@ -222,7 +222,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
js::EnableRuntimeProfilingStack(cx->runtime, false);
{
/* enable it in the middle of JS and make sure things check out */
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
JS_CallFunctionName(cx, global, "a", 0, NULL, rval.address());
CHECK(psize == 0);
CHECK(max_stack >= 1);
@ -234,7 +234,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
reset(cx);
{
/* now disable in the middle of js */
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
JS_CallFunctionName(cx, global, "c", 0, NULL, rval.address());
CHECK(psize == 0);
}
@ -243,7 +243,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
reset(cx);
{
/* now disable in the middle of js, but re-enable before final exit */
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
JS_CallFunctionName(cx, global, "e", 0, NULL, rval.address());
CHECK(psize == 0);
CHECK(max_stack >= 3);
@ -255,7 +255,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
reset(cx);
cx->runtime->spsProfiler.enableSlowAssertions(false);
{
js::RootedValue rval(cx);
JS::RootedValue rval(cx);
/* disable, and make sure that if we try to re-enter the JIT the pop
* will still happen */
JS_CallFunctionName(cx, global, "f", 0, NULL, rval.address());

Просмотреть файл

@ -6,10 +6,10 @@
BEGIN_TEST(testObjectIsRegExp)
{
js::RootedValue val(cx);
JS::RootedValue val(cx);
EVAL("new Object", val.address());
js::RootedObject obj(cx, JSVAL_TO_OBJECT(val));
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(val));
CHECK(!JS_ObjectIsRegExp(cx, obj));
EVAL("/foopy/", val.address());
@ -22,8 +22,8 @@ END_TEST(testObjectIsRegExp)
BEGIN_TEST(testGetRegExpFlags)
{
js::RootedValue val(cx);
js::RootedObject obj(cx);
JS::RootedValue val(cx);
JS::RootedObject obj(cx);
EVAL("/foopy/", val.address());
obj = JSVAL_TO_OBJECT(val);
@ -43,8 +43,8 @@ END_TEST(testGetRegExpFlags)
BEGIN_TEST(testGetRegExpSource)
{
js::RootedValue val(cx);
js::RootedObject obj(cx);
JS::RootedValue val(cx);
JS::RootedObject obj(cx);
EVAL("/foopy/", val.address());
obj = JSVAL_TO_OBJECT(val);

Просмотреть файл

@ -42,7 +42,7 @@ BEGIN_TEST(testResolveRecursion)
resolveExitCount = 0;
/* Start the essence of the test via invoking the first resolve hook. */
js::RootedValue v(cx);
JS::RootedValue v(cx);
EVAL("obj1.x", v.address());
CHECK_SAME(v, JSVAL_FALSE);
CHECK_EQUAL(resolveEntryCount, 4);
@ -79,7 +79,7 @@ doResolve(JSHandleObject obj, JSHandleId id, unsigned flags, JSMutableHandleObje
JSFlatString *str = JS_FlattenString(cx, JSID_TO_STRING(id));
CHECK(str);
js::RootedValue v(cx);
JS::RootedValue v(cx);
if (JS_FlatStringEqualsAscii(str, "x")) {
if (obj == obj1) {
/* First resolve hook invocation. */

Просмотреть файл

@ -38,7 +38,7 @@ BEGIN_TEST(testScriptInfo)
{
unsigned startLine = 1000;
js::RootedScript script(cx, JS_CompileScript(cx, global, code, strlen(code), __FILE__, startLine));
JS::RootedScript script(cx, JS_CompileScript(cx, global, code, strlen(code), __FILE__, startLine));
CHECK(script);

Просмотреть файл

@ -21,7 +21,7 @@ struct ScriptObjectFixture : public JSAPITest {
bool tryScript(JS::HandleObject global, JSScript *scriptArg)
{
js::RootedScript script(cx, scriptArg);
JS::RootedScript script(cx, scriptArg);
CHECK(script);
JS_GC(rt);

Просмотреть файл

@ -17,9 +17,9 @@ nativeGet(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandl
BEGIN_TEST(testSetProperty_NativeGetterStubSetter)
{
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
CHECK(obj);
js::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
CHECK(JS_DefineProperty(cx, global, "globalProp", vobj,
JS_PropertyStub, JS_StrictPropertyStub,

Просмотреть файл

@ -19,7 +19,7 @@ BEGIN_TEST(testStringBuffer_finishString)
JSString *str = JS_NewStringCopyZ(cx, "foopy");
CHECK(str);
js::Rooted<JSAtom*> atom(cx, js::AtomizeString<js::CanGC>(cx, str));
JS::Rooted<JSAtom*> atom(cx, js::AtomizeString<js::CanGC>(cx, str));
CHECK(atom);
js::StringBuffer buffer(cx);

Просмотреть файл

@ -15,7 +15,7 @@ static JSTrapStatus
EmptyTrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
jsval closureArg)
{
js::RootedValue closure(cx, closureArg);
JS::RootedValue closure(cx, closureArg);
JS_GC(JS_GetRuntime(cx));
if (JSVAL_IS_STRING(closure))
++emptyTrapCallCount;
@ -35,11 +35,11 @@ BEGIN_TEST(testTrap_gc)
;
// compile
js::RootedScript script(cx, JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1));
JS::RootedScript script(cx, JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1));
CHECK(script);
// execute
js::RootedValue v2(cx);
JS::RootedValue v2(cx);
CHECK(JS_ExecuteScript(cx, global, script, v2.address()));
CHECK(v2.isObject());
CHECK_EQUAL(emptyTrapCallCount, 0);
@ -51,7 +51,7 @@ BEGIN_TEST(testTrap_gc)
// scope JSScript usage to make sure that it is not used after
// JS_ExecuteScript. This way we avoid using Anchor.
js::RootedString trapClosure(cx);
JS::RootedString trapClosure(cx);
{
jsbytecode *line2 = JS_LineNumberToPC(cx, script, 1);
CHECK(line2);

Просмотреть файл

@ -120,9 +120,9 @@ TestArrayFromBuffer(JSContext *cx)
CHECK_EQUAL(JS_GetTypedArrayByteLength(ofsArray), nbytes / 2);
// Make sure all 3 views reflect the same buffer at the expected locations
js::RootedValue v(cx, INT_TO_JSVAL(39));
JS::RootedValue v(cx, INT_TO_JSVAL(39));
JS_SetElement(cx, array, 0, v.address());
js::RootedValue v2(cx);
JS::RootedValue v2(cx);
CHECK(JS_GetElement(cx, array, 0, v2.address()));
CHECK_SAME(v, v2);
CHECK(JS_GetElement(cx, shortArray, 0, v2.address()));
@ -145,7 +145,7 @@ TestArrayFromBuffer(JSContext *cx)
CHECK_SAME(v, v2);
CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast<Element*>(data)[elts - 1]));
js::RootedObject copy(cx, CreateFromArray(cx, array));
JS::RootedObject copy(cx, CreateFromArray(cx, array));
CHECK(JS_GetElement(cx, array, 0, v.address()));
CHECK(JS_GetElement(cx, copy, 0, v2.address()));
CHECK_SAME(v, v2);

Просмотреть файл

@ -29,7 +29,7 @@ C_jsvalAlignmentTest();
BEGIN_TEST(testValueABI_retparam)
{
js::RootedObject obj(cx, JS_GetGlobalObject(cx));
JS::RootedObject obj(cx, JS_GetGlobalObject(cx));
jsval v = OBJECT_TO_JSVAL(obj);
obj = NULL;
CHECK(C_ValueToObject(cx, v, obj.address()));

Просмотреть файл

@ -36,7 +36,7 @@ struct VersionFixture : public JSAPITest
JS_SetOptions(cx, JS_GetOptions(cx));
callbackData = this;
captured = JSVERSION_UNKNOWN;
js::RootedObject global(cx, JS_GetGlobalObject(cx));
JS::RootedObject global(cx, JS_GetGlobalObject(cx));
return JS_DefineFunction(cx, global, "callSetVersion17", CallSetVersion17, 0, 0) &&
JS_DefineFunction(cx, global, "overrideVersion18", OverrideVersion18, 0, 0) &&
JS_DefineFunction(cx, global, "captureVersion", CaptureVersion, 0, 0) &&
@ -46,7 +46,7 @@ struct VersionFixture : public JSAPITest
}
JSScript *fakeScript(const char *contents, size_t length) {
js::RootedObject global(cx, JS_GetGlobalObject(cx));
JS::RootedObject global(cx, JS_GetGlobalObject(cx));
return JS_CompileScript(cx, global, contents, length, "<test>", 1);
}
@ -64,7 +64,7 @@ struct VersionFixture : public JSAPITest
bool evalVersion(const jschar *chars, size_t len, JSVersion version) {
CHECK(JS_GetVersion(cx) != version);
jsval rval;
js::RootedObject global(cx, JS_GetGlobalObject(cx));
JS::RootedObject global(cx, JS_GetGlobalObject(cx));
CHECK(JS_EvaluateUCScriptForPrincipalsVersion(
cx, global, NULL, chars, len, "<test>", 0, &rval, version));
return true;

Просмотреть файл

@ -122,7 +122,7 @@ JSScript *createScriptViaXDR(JSPrincipals *prin, JSPrincipals *orig, int testCas
"function f() { return 1; }\n"
"f;\n";
js::RootedObject global(cx, JS_GetGlobalObject(cx));
JS::RootedObject global(cx, JS_GetGlobalObject(cx));
JSScript *script = CompileScriptForPrincipalsVersionOrigin(cx, global, prin, orig,
src, strlen(src), "test", 1,
JSVERSION_DEFAULT);
@ -137,11 +137,11 @@ JSScript *createScriptViaXDR(JSPrincipals *prin, JSPrincipals *orig, int testCas
return script;
}
js::RootedValue v(cx);
JS::RootedValue v(cx);
JSBool ok = JS_ExecuteScript(cx, global, script, v.address());
if (!ok || !v.isObject())
return NULL;
js::RootedObject funobj(cx, &v.toObject());
JS::RootedObject funobj(cx, &v.toObject());
if (testCase == TEST_FUNCTION) {
funobj = FreezeThaw(cx, funobj);
if (!funobj)
@ -168,12 +168,12 @@ BEGIN_TEST(testXDR_atline)
CHECK(script = FreezeThaw(cx, script));
CHECK(!strcmp("bar", JS_GetScriptFilename(cx, script)));
js::RootedValue v(cx);
JS::RootedValue v(cx);
JSBool ok = JS_ExecuteScript(cx, global, script, v.address());
CHECK(ok);
CHECK(v.isObject());
js::RootedObject funobj(cx, &v.toObject());
JS::RootedObject funobj(cx, &v.toObject());
script = JS_GetFunctionScript(cx, JS_GetObjectFunction(funobj));
CHECK(!strcmp("foo", JS_GetScriptFilename(cx, script)));
@ -200,7 +200,7 @@ BEGIN_TEST(testXDR_bug506491)
CHECK(script);
// execute
js::RootedValue v2(cx);
JS::RootedValue v2(cx);
CHECK(JS_ExecuteScript(cx, global, script, v2.address()));
// try to break the Block object that is the parent of f
@ -208,7 +208,7 @@ BEGIN_TEST(testXDR_bug506491)
// confirm
EVAL("f() === 'ok';\n", v2.address());
js::RootedValue trueval(cx, JSVAL_TRUE);
JS::RootedValue trueval(cx, JSVAL_TRUE);
CHECK_SAME(v2, trueval);
return true;
}
@ -259,7 +259,7 @@ BEGIN_TEST(testXDR_sourceMap)
"file:///var/source-map.json",
NULL
};
js::RootedScript script(cx);
JS::RootedScript script(cx);
for (const char **sm = sourceMaps; *sm; sm++) {
script = JS_CompileScript(cx, global, "", 0, __FILE__, __LINE__);
CHECK(script);

Просмотреть файл

@ -21,7 +21,7 @@ bool JSAPITest::init()
if (!cx)
return false;
JS_BeginRequest(cx);
js::RootedObject global(cx, createGlobal());
JS::RootedObject global(cx, createGlobal());
if (!global)
return false;
oldCompartment = JS_EnterCompartment(cx, global);
@ -30,7 +30,7 @@ bool JSAPITest::init()
bool JSAPITest::exec(const char *bytes, const char *filename, int lineno)
{
js::RootedValue v(cx);
JS::RootedValue v(cx);
JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global);
return JS_EvaluateScript(cx, global, bytes, strlen(bytes), filename, lineno, v.address()) ||
fail(bytes, filename, lineno);

Просмотреть файл

@ -188,7 +188,7 @@ class JSAPITest
const char *actualExpr, const char *expectedExpr,
const char *filename, int lineno) {
JSBool same;
js::RootedValue actual(cx, actualArg), expected(cx, expectedArg);
JS::RootedValue actual(cx, actualArg), expected(cx, expectedArg);
return (JS_SameValue(cx, actual, expected, &same) && same) ||
fail(JSAPITestString("CHECK_SAME failed: expected JS_SameValue(cx, ") +
actualExpr + ", " + expectedExpr + "), got !JS_SameValue(cx, " +
@ -210,7 +210,7 @@ class JSAPITest
bool fail(JSAPITestString msg = JSAPITestString(), const char *filename = "-", int lineno = 0) {
if (JS_IsExceptionPending(cx)) {
js::gc::AutoSuppressGC gcoff(cx);
js::RootedValue v(cx);
JS::RootedValue v(cx);
JS_GetPendingException(cx, v.address());
JS_ClearPendingException(cx);
JSString *s = JS_ValueToString(cx, v);

Просмотреть файл

@ -91,7 +91,7 @@ struct SCInput {
uint64_t *end;
};
}
} /* namespace js */
struct JSStructuredCloneReader {
public:
@ -196,7 +196,7 @@ struct JSStructuredCloneWriter {
void *closure;
// List of transferable objects
js::RootedValue transferable;
JS::RootedValue transferable;
js::AutoObjectHashSet transferableObjects;
friend JSBool JS_WriteTypedArray(JSStructuredCloneWriter *w, jsval v);

Просмотреть файл

@ -185,7 +185,7 @@ class JSFunction : public JSObject
js::RawScript getOrCreateScript(JSContext *cx) {
JS_ASSERT(isInterpreted());
if (isInterpretedLazy()) {
js::RootedFunction self(cx, this);
JS::RootedFunction self(cx, this);
js::MaybeCheckStackRoots(cx);
if (!self->initializeLazyScript(cx))
return NULL;

Просмотреть файл

@ -534,7 +534,7 @@ GetClassForProtoKey(JSProtoKey key)
inline TypeObject *
GetTypeNewObject(JSContext *cx, JSProtoKey key)
{
js::RootedObject proto(cx);
RootedObject proto(cx);
if (!js_GetClassPrototype(cx, key, &proto))
return NULL;
return proto->getNewType(cx, GetClassForProtoKey(key));
@ -847,7 +847,7 @@ TypeScript::SlotTypes(RawScript script, unsigned slot)
/* static */ inline TypeObject *
TypeScript::StandardType(JSContext *cx, JSProtoKey key)
{
js::RootedObject proto(cx);
RootedObject proto(cx);
if (!js_GetClassPrototype(cx, key, &proto, NULL))
return NULL;
return proto->getNewType(cx, GetClassForProtoKey(key));

Просмотреть файл

@ -773,15 +773,15 @@ class JSObject : public js::ObjectImpl
/* Add a data property whose id is not yet in this scope. */
js::RawShape addDataProperty(JSContext *cx, jsid id_, uint32_t slot, unsigned attrs) {
JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
js::RootedObject self(cx, this);
js::RootedId id(cx, id_);
JS::RootedObject self(cx, this);
JS::RootedId id(cx, id_);
return addProperty(cx, self, id, NULL, NULL, slot, attrs, 0, 0);
}
js::RawShape addDataProperty(JSContext *cx, js::HandlePropertyName name, uint32_t slot, unsigned attrs) {
JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
js::RootedObject self(cx, this);
js::RootedId id(cx, NameToId(name));
JS::RootedObject self(cx, this);
JS::RootedId id(cx, NameToId(name));
return addProperty(cx, self, id, NULL, NULL, slot, attrs, 0, 0);
}
@ -796,7 +796,7 @@ class JSObject : public js::ObjectImpl
uint32_t slot, unsigned attrs,
unsigned flags, int shortid)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return putProperty(cx, obj, id, getter, setter, slot, attrs, flags, shortid);
}

Просмотреть файл

@ -93,7 +93,7 @@ JSObject::setGeneric(JSContext *cx, js::HandleObject obj, js::HandleObject recei
JSObject::setProperty(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::PropertyName *name, js::MutableHandleValue vp, JSBool strict)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return setGeneric(cx, obj, receiver, id, vp, strict);
}
@ -110,7 +110,7 @@ JSObject::setElement(JSContext *cx, js::HandleObject obj, js::HandleObject recei
JSObject::setSpecial(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::SpecialId sid, js::MutableHandleValue vp, JSBool strict)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return setGeneric(cx, obj, receiver, id, vp, strict);
}
@ -127,7 +127,7 @@ JSObject::setGenericAttributes(JSContext *cx, js::HandleObject obj,
JSObject::setPropertyAttributes(JSContext *cx, js::HandleObject obj,
js::PropertyName *name, unsigned *attrsp)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return setGenericAttributes(cx, obj, id, attrsp);
}
@ -143,7 +143,7 @@ JSObject::setElementAttributes(JSContext *cx, js::HandleObject obj,
JSObject::setSpecialAttributes(JSContext *cx, js::HandleObject obj,
js::SpecialId sid, unsigned *attrsp)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return setGenericAttributes(cx, obj, id, attrsp);
}
@ -183,7 +183,7 @@ JSObject::getGenericNoGC(JSContext *cx, JSObject *obj, JSObject *receiver,
JSObject::getProperty(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::PropertyName *name, js::MutableHandleValue vp)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return getGeneric(cx, obj, receiver, id, vp);
}
@ -198,7 +198,7 @@ JSObject::getPropertyNoGC(JSContext *cx, JSObject *obj, JSObject *receiver,
JSObject::deleteProperty(JSContext *cx, js::HandleObject obj,
js::HandlePropertyName name, js::MutableHandleValue rval, bool strict)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
js::types::MarkTypePropertyConfigured(cx, obj, id);
js::DeletePropertyOp op = obj->getOps()->deleteProperty;
@ -209,7 +209,7 @@ JSObject::deleteProperty(JSContext *cx, js::HandleObject obj,
JSObject::deleteElement(JSContext *cx, js::HandleObject obj,
uint32_t index, js::MutableHandleValue rval, bool strict)
{
js::RootedId id(cx);
JS::RootedId id(cx);
if (!js::IndexToId(cx, index, &id))
return false;
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
@ -222,7 +222,7 @@ JSObject::deleteElement(JSContext *cx, js::HandleObject obj,
JSObject::deleteSpecial(JSContext *cx, js::HandleObject obj,
js::HandleSpecialId sid, js::MutableHandleValue rval, bool strict)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
js::types::MarkTypePropertyConfigured(cx, obj, id);
js::DeleteSpecialOp op = obj->getOps()->deleteSpecial;
@ -292,7 +292,7 @@ inline void
JSObject::removeLastProperty(JSContext *cx)
{
JS_ASSERT(canRemoveLastProperty());
js::RootedObject self(cx, this);
JS::RootedObject self(cx, this);
js::RootedShape prev(cx, lastProperty()->previous());
JS_ALWAYS_TRUE(setLastProperty(cx, self, prev));
}
@ -759,7 +759,7 @@ JSObject::getType(JSContext *cx)
{
JS_ASSERT(cx->compartment == compartment());
if (hasLazyType()) {
js::RootedObject self(cx, this);
JS::RootedObject self(cx, this);
return makeLazyType(cx, self);
}
return static_cast<js::types::TypeObject*>(type_);
@ -1014,7 +1014,7 @@ JSObject::finish(js::FreeOp *fop)
JSObject::hasProperty(JSContext *cx, js::HandleObject obj,
js::HandleId id, bool *foundp, unsigned flags)
{
js::RootedObject pobj(cx);
JS::RootedObject pobj(cx);
js::RootedShape prop(cx);
JSAutoResolveFlags rf(cx, flags);
if (!lookupGeneric(cx, obj, id, &pobj, &prop)) {
@ -1124,7 +1124,7 @@ JSObject::lookupGeneric(JSContext *cx, js::HandleObject obj, js::HandleId id,
JSObject::lookupProperty(JSContext *cx, js::HandleObject obj, js::PropertyName *name,
js::MutableHandleObject objp, js::MutableHandleShape propp)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return lookupGeneric(cx, obj, id, objp, propp);
}
@ -1147,7 +1147,7 @@ JSObject::defineProperty(JSContext *cx, js::HandleObject obj,
JSStrictPropertyOp setter /* = JS_StrictPropertyStub */,
unsigned attrs /* = JSPROP_ENUMERATE */)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
@ -1168,7 +1168,7 @@ JSObject::defineSpecial(JSContext *cx, js::HandleObject obj, js::SpecialId sid,
JSStrictPropertyOp setter /* = JS_StrictPropertyStub */,
unsigned attrs /* = JSPROP_ENUMERATE */)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
@ -1184,7 +1184,7 @@ JSObject::lookupElement(JSContext *cx, js::HandleObject obj, uint32_t index,
JSObject::lookupSpecial(JSContext *cx, js::HandleObject obj, js::SpecialId sid,
js::MutableHandleObject objp, js::MutableHandleShape propp)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return lookupGeneric(cx, obj, id, objp, propp);
}
@ -1196,7 +1196,7 @@ JSObject::getElement(JSContext *cx, js::HandleObject obj, js::HandleObject recei
if (op)
return op(cx, obj, receiver, index, vp);
js::RootedId id(cx);
JS::RootedId id(cx);
if (!js::IndexToId(cx, index, &id))
return false;
return getGeneric(cx, obj, receiver, id, vp);
@ -1230,11 +1230,11 @@ JSObject::getElementIfPresent(JSContext *cx, js::HandleObject obj, js::HandleObj
* lookupGeneric/getGeneric. Once lookupElement and getElement stop both
* doing index-to-id conversions, we can use those here.
*/
js::RootedId id(cx);
JS::RootedId id(cx);
if (!js::IndexToId(cx, index, &id))
return false;
js::RootedObject obj2(cx);
JS::RootedObject obj2(cx);
js::RootedShape prop(cx);
if (!lookupGeneric(cx, obj, id, &obj2, &prop))
return false;
@ -1252,7 +1252,7 @@ JSObject::getElementIfPresent(JSContext *cx, js::HandleObject obj, js::HandleObj
JSObject::getSpecial(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::SpecialId sid, js::MutableHandleValue vp)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return getGeneric(cx, obj, receiver, id, vp);
}
@ -1268,7 +1268,7 @@ JSObject::getGenericAttributes(JSContext *cx, js::HandleObject obj,
JSObject::getPropertyAttributes(JSContext *cx, js::HandleObject obj,
js::PropertyName *name, unsigned *attrsp)
{
js::RootedId id(cx, js::NameToId(name));
JS::RootedId id(cx, js::NameToId(name));
return getGenericAttributes(cx, obj, id, attrsp);
}
@ -1276,7 +1276,7 @@ JSObject::getPropertyAttributes(JSContext *cx, js::HandleObject obj,
JSObject::getElementAttributes(JSContext *cx, js::HandleObject obj,
uint32_t index, unsigned *attrsp)
{
js::RootedId id(cx);
JS::RootedId id(cx);
if (!js::IndexToId(cx, index, &id))
return false;
return getGenericAttributes(cx, obj, id, attrsp);
@ -1286,7 +1286,7 @@ JSObject::getElementAttributes(JSContext *cx, js::HandleObject obj,
JSObject::getSpecialAttributes(JSContext *cx, js::HandleObject obj,
js::SpecialId sid, unsigned *attrsp)
{
js::RootedId id(cx, SPECIALID_TO_JSID(sid));
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return getGenericAttributes(cx, obj, id, attrsp);
}
@ -1794,7 +1794,7 @@ IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx)
{
if (!v.isObject())
return false;
js::RootedObject obj(cx, &v.toObject());
RootedObject obj(cx, &v.toObject());
return ObjectClassIs(obj, classValue, cx);
}

Просмотреть файл

@ -196,10 +196,10 @@ typedef JS::Handle<PropertyName*> HandlePropertyName;
typedef JS::MutableHandle<Shape*> MutableHandleShape;
typedef JS::MutableHandle<JSAtom*> MutableHandleAtom;
typedef js::Rooted<Shape*> RootedShape;
typedef js::Rooted<types::TypeObject*> RootedTypeObject;
typedef js::Rooted<JSAtom*> RootedAtom;
typedef js::Rooted<PropertyName*> RootedPropertyName;
typedef JS::Rooted<Shape*> RootedShape;
typedef JS::Rooted<types::TypeObject*> RootedTypeObject;
typedef JS::Rooted<JSAtom*> RootedAtom;
typedef JS::Rooted<PropertyName*> RootedPropertyName;
enum XDRMode {
XDR_ENCODE,

Просмотреть файл

@ -169,7 +169,7 @@ pm_construct(JSContext* cx, unsigned argc, jsval* vp)
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "u", &mask))
return JS_FALSE;
js::RootedObject obj(cx, JS_NewObjectForConstructor(cx, &pm_class, vp));
JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, &pm_class, vp));
if (!obj)
return JS_FALSE;
@ -225,14 +225,14 @@ namespace JS {
JSObject*
RegisterPerfMeasurement(JSContext *cx, JSRawObject global)
{
js::RootedObject prototype(cx);
RootedObject prototype(cx);
prototype = JS_InitClass(cx, global, NULL /* parent */,
&pm_class, pm_construct, 1,
pm_props, pm_fns, 0, 0);
if (!prototype)
return 0;
js::RootedObject ctor(cx);
RootedObject ctor(cx);
ctor = JS_GetConstructor(cx, prototype);
if (!ctor)
return 0;

Просмотреть файл

@ -4576,7 +4576,7 @@ static JSClass *GetDomClass() {
static JSBool
dom_genericGetter(JSContext *cx, unsigned argc, JS::Value *vp)
{
js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
if (!obj)
return false;
@ -4596,7 +4596,7 @@ dom_genericGetter(JSContext *cx, unsigned argc, JS::Value *vp)
static JSBool
dom_genericSetter(JSContext* cx, unsigned argc, JS::Value* vp)
{
js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
if (!obj)
return false;
@ -4622,7 +4622,7 @@ dom_genericSetter(JSContext* cx, unsigned argc, JS::Value* vp)
static JSBool
dom_genericMethod(JSContext* cx, unsigned argc, JS::Value *vp)
{
js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
if (!obj)
return false;

Просмотреть файл

@ -252,7 +252,7 @@ JSDependentString::new_(JSContext *cx, JSLinearString *baseArg, const jschar *ch
return str;
}
js::Rooted<JSLinearString*> base(cx, baseArg);
JS::Rooted<JSLinearString*> base(cx, baseArg);
str = (JSDependentString *)js_NewGCString<js::CanGC>(cx);
if (!str)