From c3e865f5a7663cc86cd7fc4222efb7b61bcd1083 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Wed, 6 Mar 2013 16:41:42 +0000 Subject: [PATCH] Bug 848395 - GC: Move Rooted to JS namespace - rename js::Rooted to JS::Rooted inside SpiderMonkey r=terrence --HG-- extra : rebase_source : ba8202f4e1f7bd5560a57392f800d255e52b4a54 --- js/src/gdb/gdb-tests.cpp | 2 +- js/src/gdb/mozilla/Root.py | 12 ++--- js/src/gdb/mozilla/jsid.py | 2 +- js/src/gdb/tests/test-JSObject.cpp | 12 ++--- js/src/gdb/tests/test-JSString.cpp | 16 +++---- js/src/gdb/tests/test-Root-null.py | 4 +- js/src/gdb/tests/test-Root.cpp | 8 ++-- js/src/gdb/tests/test-Root.py | 2 +- js/src/gdb/tests/test-jsid.cpp | 14 +++--- js/src/gdb/tests/test-jsval.cpp | 22 ++++----- js/src/jsapi-tests/selfTest.cpp | 2 +- .../jsapi-tests/testAddPropertyPropcache.cpp | 10 ++-- js/src/jsapi-tests/testArrayBuffer.cpp | 20 ++++---- js/src/jsapi-tests/testBindCallable.cpp | 10 ++-- js/src/jsapi-tests/testBug604087.cpp | 30 ++++++------ .../testCallNonGenericMethodOnProxy.cpp | 18 ++++---- js/src/jsapi-tests/testChromeBuffer.cpp | 16 +++---- js/src/jsapi-tests/testClassGetter.cpp | 2 +- js/src/jsapi-tests/testCloneScript.cpp | 18 ++++---- js/src/jsapi-tests/testConservativeGC.cpp | 10 ++-- js/src/jsapi-tests/testCustomIterator.cpp | 4 +- js/src/jsapi-tests/testDebugger.cpp | 22 ++++----- js/src/jsapi-tests/testDeepFreeze.cpp | 16 +++---- .../testDefineGetterSetterNonEnumerable.cpp | 14 +++--- js/src/jsapi-tests/testDefineProperty.cpp | 4 +- js/src/jsapi-tests/testErrorCopying.cpp | 2 +- js/src/jsapi-tests/testFunctionProperties.cpp | 6 +-- js/src/jsapi-tests/testGCFinalizeCallback.cpp | 8 ++-- js/src/jsapi-tests/testGCOutOfMemory.cpp | 2 +- js/src/jsapi-tests/testGetPropertyDefault.cpp | 16 +++---- js/src/jsapi-tests/testIntString.cpp | 2 +- js/src/jsapi-tests/testIntern.cpp | 2 +- js/src/jsapi-tests/testJSEvaluateScript.cpp | 4 +- js/src/jsapi-tests/testLookup.cpp | 16 +++---- js/src/jsapi-tests/testLooselyEqual.cpp | 18 ++++---- js/src/jsapi-tests/testNewObject.cpp | 16 +++---- js/src/jsapi-tests/testOOM.cpp | 2 +- .../testObjectEmulatingUndefined.cpp | 4 +- js/src/jsapi-tests/testOps.cpp | 2 +- js/src/jsapi-tests/testOriginPrincipals.cpp | 4 +- js/src/jsapi-tests/testParseJSON.cpp | 12 ++--- js/src/jsapi-tests/testProfileStrings.cpp | 24 +++++----- js/src/jsapi-tests/testRegExp.cpp | 12 ++--- js/src/jsapi-tests/testResolveRecursion.cpp | 4 +- js/src/jsapi-tests/testScriptInfo.cpp | 2 +- js/src/jsapi-tests/testScriptObject.cpp | 2 +- js/src/jsapi-tests/testSetProperty.cpp | 4 +- js/src/jsapi-tests/testStringBuffer.cpp | 2 +- js/src/jsapi-tests/testTrap.cpp | 8 ++-- js/src/jsapi-tests/testTypedArrays.cpp | 6 +-- js/src/jsapi-tests/testValueABI.cpp | 2 +- js/src/jsapi-tests/testVersion.cpp | 6 +-- js/src/jsapi-tests/testXDR.cpp | 16 +++---- js/src/jsapi-tests/tests.cpp | 4 +- js/src/jsapi-tests/tests.h | 4 +- js/src/jsclone.h | 4 +- js/src/jsfun.h | 2 +- js/src/jsinferinlines.h | 4 +- js/src/jsobj.h | 10 ++-- js/src/jsobjinlines.h | 46 +++++++++---------- js/src/jsprvtd.h | 8 ++-- js/src/perf/jsperf.cpp | 6 +-- js/src/shell/js.cpp | 6 +-- js/src/vm/String-inl.h | 2 +- 64 files changed, 295 insertions(+), 295 deletions(-) diff --git a/js/src/gdb/gdb-tests.cpp b/js/src/gdb/gdb-tests.cpp index 7da9afee94a1..a19ed1e4d2fd 100644 --- a/js/src/gdb/gdb-tests.cpp +++ b/js/src/gdb/gdb-tests.cpp @@ -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); diff --git a/js/src/gdb/mozilla/Root.py b/js/src/gdb/mozilla/Root.py index e6a43a18a57f..2f0137a6d036 100644 --- a/js/src/gdb/mozilla/Root.py +++ b/js/src/gdb/mozilla/Root.py @@ -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|, for example, appears in GDB as |js::Rooted| --- + # |JS::Rooted|, for example, appears in GDB as |JS::Rooted| --- # 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|. That constructor creates a |js::Rooted| + # instantiation |JS::Rooted|. 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 diff --git a/js/src/gdb/mozilla/jsid.py b/js/src/gdb/mozilla/jsid.py index 709fbdd870bc..aff1eab2c9e5 100644 --- a/js/src/gdb/mozilla/jsid.py +++ b/js/src/gdb/mozilla/jsid.py @@ -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') +@pretty_printer('JS::Rooted') def RootedJSID(value, cache): return mozilla.Root.Rooted(value, cache, jsid) @pretty_printer('JS::Handle') diff --git a/js/src/gdb/tests/test-JSObject.cpp b/js/src/gdb/tests/test-JSObject.cpp index ba17ceb7f29f..bb4773c05daa 100644 --- a/js/src/gdb/tests/test-JSObject.cpp +++ b/js/src/gdb/tests/test-JSObject.cpp @@ -1,13 +1,13 @@ #include "gdb-tests.h" FRAGMENT(JSObject, simple) { - js::Rooted glob(cx, JS_GetGlobalObject(cx)); - js::Rooted plain(cx, JS_NewObject(cx, 0, 0, 0)); - js::Rooted func(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0, + JS::Rooted glob(cx, JS_GetGlobalObject(cx)); + JS::Rooted plain(cx, JS_NewObject(cx, 0, 0, 0)); + JS::Rooted func(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0, JS_GetGlobalObject(cx), "dys")); - js::Rooted anon(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0, + JS::Rooted anon(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0, JS_GetGlobalObject(cx), 0)); - js::Rooted funcPtr(cx, JS_NewFunction(cx, (JSNative) 1, 0, 0, + JS::Rooted 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 null(cx, NULL); + JS::Rooted null(cx, NULL); js::RawObject nullRaw = null; breakpoint(); diff --git a/js/src/gdb/tests/test-JSString.cpp b/js/src/gdb/tests/test-JSString.cpp index 5a1e35a96be7..934fbdd87df5 100644 --- a/js/src/gdb/tests/test-JSString.cpp +++ b/js/src/gdb/tests/test-JSString.cpp @@ -6,22 +6,22 @@ #include "vm/String.h" FRAGMENT(JSString, simple) { - js::Rooted empty(cx, JS_NewStringCopyN(cx, NULL, 0)); - js::Rooted x(cx, JS_NewStringCopyN(cx, "x", 1)); - js::Rooted z(cx, JS_NewStringCopyZ(cx, "z")); + JS::Rooted empty(cx, JS_NewStringCopyN(cx, NULL, 0)); + JS::Rooted x(cx, JS_NewStringCopyN(cx, "x", 1)); + JS::Rooted z(cx, JS_NewStringCopyZ(cx, "z")); // I expect this will be a non-inlined string. - js::Rooted stars(cx, JS_NewStringCopyZ(cx, + JS::Rooted stars(cx, JS_NewStringCopyZ(cx, "*************************" "*************************" "*************************" "*************************")); // This may well be an inlined string. - js::Rooted xz(cx, JS_ConcatStrings(cx, x, z)); + JS::Rooted xz(cx, JS_ConcatStrings(cx, x, z)); // This will probably be a rope. - js::Rooted doubleStars(cx, JS_ConcatStrings(cx, stars, stars)); + JS::Rooted 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 null(cx, NULL); + JS::Rooted null(cx, NULL); js::RawString nullRaw = null; breakpoint(); @@ -48,7 +48,7 @@ FRAGMENT(JSString, null) { } FRAGMENT(JSString, subclasses) { - js::Rooted flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!"))); + JS::Rooted flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!"))); breakpoint(); diff --git a/js/src/gdb/tests/test-Root-null.py b/js/src/gdb/tests/test-Root-null.py index 7e1081955c04..9abf2e801bbe 100644 --- a/js/src/gdb/tests/test-Root-null.py +++ b/js/src/gdb/tests/test-Root-null.py @@ -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') diff --git a/js/src/gdb/tests/test-Root.cpp b/js/src/gdb/tests/test-Root.cpp index a157d0e7fe84..7da96e5285d7 100644 --- a/js/src/gdb/tests/test-Root.cpp +++ b/js/src/gdb/tests/test-Root.cpp @@ -1,7 +1,7 @@ #include "gdb-tests.h" FRAGMENT(Root, null) { - js::Rooted null(cx, NULL); + JS::Rooted null(cx, NULL); breakpoint(); @@ -17,14 +17,14 @@ void callee(JS::Handle obj, JS::MutableHandle mutableObj } FRAGMENT(Root, handle) { - js::Rooted global(cx, JS_GetGlobalObject(cx)); + JS::Rooted global(cx, JS_GetGlobalObject(cx)); callee(global, &global); (void) global; } FRAGMENT(Root, HeapSlot) { - js::Rooted plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth"))); - js::Rooted array(cx, JS_NewArrayObject(cx, 1, plinth.address())); + JS::Rooted plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth"))); + JS::Rooted array(cx, JS_NewArrayObject(cx, 1, plinth.address())); breakpoint(); diff --git a/js/src/gdb/tests/test-Root.py b/js/src/gdb/tests/test-Root.py index e45ee95618b3..0e56c80120de 100644 --- a/js/src/gdb/tests/test-Root.py +++ b/js/src/gdb/tests/test-Root.py @@ -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') diff --git a/js/src/gdb/tests/test-jsid.cpp b/js/src/gdb/tests/test-jsid.cpp index 23ee4299abc3..a807e724d3fa 100644 --- a/js/src/gdb/tests/test-jsid.cpp +++ b/js/src/gdb/tests/test-jsid.cpp @@ -1,12 +1,12 @@ #include "gdb-tests.h" FRAGMENT(jsid, simple) { - js::Rooted string(cx, JS_NewStringCopyZ(cx, "moon")); - js::Rooted interned(cx, JS_InternJSString(cx, string)); - js::Rooted string_id(cx, INTERNED_STRING_TO_JSID(cx, interned)); + JS::Rooted string(cx, JS_NewStringCopyZ(cx, "moon")); + JS::Rooted interned(cx, JS_InternJSString(cx, string)); + JS::Rooted string_id(cx, INTERNED_STRING_TO_JSID(cx, interned)); jsid int_id = INT_TO_JSID(1729); jsid void_id = JSID_VOID; - js::Rooted object_id(cx, OBJECT_TO_JSID(JS_GetGlobalObject(cx))); + JS::Rooted object_id(cx, OBJECT_TO_JSID(JS_GetGlobalObject(cx))); breakpoint(); @@ -29,8 +29,8 @@ jsid_handles(JS::Handle jsid_handle, } FRAGMENT(jsid, handles) { - js::Rooted string(cx, JS_NewStringCopyZ(cx, "shovel")); - js::Rooted interned(cx, JS_InternJSString(cx, string)); - js::Rooted string_id(cx, INTERNED_STRING_TO_JSID(cx, interned)); + JS::Rooted string(cx, JS_NewStringCopyZ(cx, "shovel")); + JS::Rooted interned(cx, JS_InternJSString(cx, string)); + JS::Rooted string_id(cx, INTERNED_STRING_TO_JSID(cx, interned)); jsid_handles(string_id, &string_id); } diff --git a/js/src/gdb/tests/test-jsval.cpp b/js/src/gdb/tests/test-jsval.cpp index 5a3746a9f678..5ddd1b5730d3 100644 --- a/js/src/gdb/tests/test-jsval.cpp +++ b/js/src/gdb/tests/test-jsval.cpp @@ -1,24 +1,24 @@ #include "gdb-tests.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 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); + JS::Rooted empty_string(cx); empty_string.setString(JS_NewStringCopyZ(cx, "")); - js::Rooted friendly_string(cx); + JS::Rooted friendly_string(cx); friendly_string.setString(JS_NewStringCopyZ(cx, "Hello!")); - js::Rooted global(cx); + JS::Rooted global(cx); global.setObject(*JS_GetGlobalObject(cx)); // Some interesting value that floating-point won't munge. - js::Rooted onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0)); + JS::Rooted onehundredthirtysevenonehundredtwentyeighths(cx, DOUBLE_TO_JSVAL(137.0 / 128.0)); breakpoint(); diff --git a/js/src/jsapi-tests/selfTest.cpp b/js/src/jsapi-tests/selfTest.cpp index 70458b27e6ef..91f25ccce612 100644 --- a/js/src/jsapi-tests/selfTest.cpp +++ b/js/src/jsapi-tests/selfTest.cpp @@ -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); diff --git a/js/src/jsapi-tests/testAddPropertyPropcache.cpp b/js/src/jsapi-tests/testAddPropertyPropcache.cpp index 9633199f79bb..be190df1824c 100644 --- a/js/src/jsapi-tests/testAddPropertyPropcache.cpp +++ b/js/src/jsapi-tests/testAddPropertyPropcache.cpp @@ -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)); diff --git a/js/src/jsapi-tests/testArrayBuffer.cpp b/js/src/jsapi-tests/testArrayBuffer.cpp index c176ca371ffb..081146c3d690 100644 --- a/js/src/jsapi-tests/testArrayBuffer.cpp +++ b/js/src/jsapi-tests/testArrayBuffer.cpp @@ -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; } diff --git a/js/src/jsapi-tests/testBindCallable.cpp b/js/src/jsapi-tests/testBindCallable.cpp index 64bc87069266..8a6432f9b73e 100644 --- a/js/src/jsapi-tests/testBindCallable.cpp +++ b/js/src/jsapi-tests/testBindCallable.cpp @@ -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); diff --git a/js/src/jsapi-tests/testBug604087.cpp b/js/src/jsapi-tests/testBug604087.cpp index f57a511bfe0d..b28ab55cbc9b 100644 --- a/js/src/jsapi-tests/testBug604087.cpp +++ b/js/src/jsapi-tests/testBug604087.cpp @@ -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, diff --git a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp index 129b269353eb..1ccc9430b20a 100644 --- a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp +++ b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp @@ -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)); } diff --git a/js/src/jsapi-tests/testChromeBuffer.cpp b/js/src/jsapi-tests/testChromeBuffer.cpp index 52800a078514..d476d797b3d9 100644 --- a/js/src/jsapi-tests/testChromeBuffer.cpp +++ b/js/src/jsapi-tests/testChromeBuffer.cpp @@ -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, ¶mName, 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, ¶mName, 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, ¶mName, 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); } diff --git a/js/src/jsapi-tests/testClassGetter.cpp b/js/src/jsapi-tests/testClassGetter.cpp index 34d1dda59479..420ef24c4346 100644 --- a/js/src/jsapi-tests/testClassGetter.cpp +++ b/js/src/jsapi-tests/testClassGetter.cpp @@ -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)); diff --git a/js/src/jsapi-tests/testCloneScript.cpp b/js/src/jsapi-tests/testCloneScript.cpp index 0d96695dc9b7..14e6882dd431 100644 --- a/js/src/jsapi-tests/testCloneScript.cpp +++ b/js/src/jsapi-tests/testCloneScript.cpp @@ -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()); diff --git a/js/src/jsapi-tests/testConservativeGC.cpp b/js/src/jsapi-tests/testConservativeGC.cpp index fe2e75e1889d..ad340b6d1f97 100644 --- a/js/src/jsapi-tests/testConservativeGC.cpp +++ b/js/src/jsapi-tests/testConservativeGC.cpp @@ -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)); diff --git a/js/src/jsapi-tests/testCustomIterator.cpp b/js/src/jsapi-tests/testCustomIterator.cpp index 494ac8120fcc..e1f628fc86e4 100644 --- a/js/src/jsapi-tests/testCustomIterator.cpp +++ b/js/src/jsapi-tests/testCustomIterator.cpp @@ -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" diff --git a/js/src/jsapi-tests/testDebugger.cpp b/js/src/jsapi-tests/testDebugger.cpp index f13d89ee237c..586a24da62ba 100644 --- a/js/src/jsapi-tests/testDebugger.cpp +++ b/js/src/jsapi-tests/testDebugger.cpp @@ -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; diff --git a/js/src/jsapi-tests/testDeepFreeze.cpp b/js/src/jsapi-tests/testDeepFreeze.cpp index 240b93d6830b..9b95af5b0bbf 100644 --- a/js/src/jsapi-tests/testDeepFreeze.cpp +++ b/js/src/jsapi-tests/testDeepFreeze.cpp @@ -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()); diff --git a/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp b/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp index 28cfa1e84fd8..7f07b640e842 100644 --- a/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp +++ b/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp @@ -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), diff --git a/js/src/jsapi-tests/testDefineProperty.cpp b/js/src/jsapi-tests/testDefineProperty.cpp index 2f58c598c5d5..b5617799adae 100644 --- a/js/src/jsapi-tests/testDefineProperty.cpp +++ b/js/src/jsapi-tests/testDefineProperty.cpp @@ -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; diff --git a/js/src/jsapi-tests/testErrorCopying.cpp b/js/src/jsapi-tests/testErrorCopying.cpp index 8b41a40fd133..1923879d2763 100644 --- a/js/src/jsapi-tests/testErrorCopying.cpp +++ b/js/src/jsapi-tests/testErrorCopying.cpp @@ -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); diff --git a/js/src/jsapi-tests/testFunctionProperties.cpp b/js/src/jsapi-tests/testFunctionProperties.cpp index 9d9cc4ec454e..9fee41561803 100644 --- a/js/src/jsapi-tests/testFunctionProperties.cpp +++ b/js/src/jsapi-tests/testFunctionProperties.cpp @@ -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); diff --git a/js/src/jsapi-tests/testGCFinalizeCallback.cpp b/js/src/jsapi-tests/testGCFinalizeCallback.cpp index 3a32431c4445..615c6d5316ef 100644 --- a/js/src/jsapi-tests/testGCFinalizeCallback.cpp +++ b/js/src/jsapi-tests/testGCFinalizeCallback.cpp @@ -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); diff --git a/js/src/jsapi-tests/testGCOutOfMemory.cpp b/js/src/jsapi-tests/testGCOutOfMemory.cpp index ee45f385d90e..83f0f3c377de 100644 --- a/js/src/jsapi-tests/testGCOutOfMemory.cpp +++ b/js/src/jsapi-tests/testGCOutOfMemory.cpp @@ -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() {" diff --git a/js/src/jsapi-tests/testGetPropertyDefault.cpp b/js/src/jsapi-tests/testGetPropertyDefault.cpp index 8c6e76cb413f..2cda9a214a1e 100644 --- a/js/src/jsapi-tests/testGetPropertyDefault.cpp +++ b/js/src/jsapi-tests/testGetPropertyDefault.cpp @@ -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", ¬hereid)); - 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)); } diff --git a/js/src/jsapi-tests/testIntString.cpp b/js/src/jsapi-tests/testIntString.cpp index 915e59cd6bca..18b3d53371e5 100644 --- a/js/src/jsapi-tests/testIntString.cpp +++ b/js/src/jsapi-tests/testIntString.cpp @@ -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); diff --git a/js/src/jsapi-tests/testIntern.cpp b/js/src/jsapi-tests/testIntern.cpp index 0c398f0ccdb5..5d60cbdc0b75 100644 --- a/js/src/jsapi-tests/testIntern.cpp +++ b/js/src/jsapi-tests/testIntern.cpp @@ -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 atom(cx, js::Atomize(cx, someChars, ArrayLength(someChars))); + JS::Rooted atom(cx, js::Atomize(cx, someChars, ArrayLength(someChars))); CHECK(!JS_StringHasBeenInterned(cx, atom)); CHECK(JS_InternJSString(cx, atom)); CHECK(JS_StringHasBeenInterned(cx, atom)); diff --git a/js/src/jsapi-tests/testJSEvaluateScript.cpp b/js/src/jsapi-tests/testJSEvaluateScript.cpp index 6e5df4c93317..875ae83094be 100644 --- a/js/src/jsapi-tests/testJSEvaluateScript.cpp +++ b/js/src/jsapi-tests/testJSEvaluateScript.cpp @@ -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())); diff --git a/js/src/jsapi-tests/testLookup.cpp b/js/src/jsapi-tests/testLookup.cpp index 380d63a18e12..692ca846d5b1 100644 --- a/js/src/jsapi-tests/testLookup.cpp +++ b/js/src/jsapi-tests/testLookup.cpp @@ -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 docAll(cx, JS_NewObject(cx, &DocumentAllClass, NULL, NULL)); + JS::Rooted docAll(cx, JS_NewObject(cx, &DocumentAllClass, NULL, NULL)); if (!docAll) return false; - js::Rooted allValue(cx, ObjectValue(*docAll)); + JS::Rooted 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()); diff --git a/js/src/jsapi-tests/testLooselyEqual.cpp b/js/src/jsapi-tests/testLooselyEqual.cpp index 23a04af46821..52615ea3a25a 100644 --- a/js/src/jsapi-tests/testLooselyEqual.cpp +++ b/js/src/jsapi-tests/testLooselyEqual.cpp @@ -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), diff --git a/js/src/jsapi-tests/testNewObject.cpp b/js/src/jsapi-tests/testNewObject.cpp index 60c914698a6b..94b8607bb1db 100644 --- a/js/src/jsapi-tests/testNewObject.cpp +++ b/js/src/jsapi-tests/testNewObject.cpp @@ -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())); diff --git a/js/src/jsapi-tests/testOOM.cpp b/js/src/jsapi-tests/testOOM.cpp index 39216f593780..7f130d9c102d 100644 --- a/js/src/jsapi-tests/testOOM.cpp +++ b/js/src/jsapi-tests/testOOM.cpp @@ -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 s = JS_GetStringCharsZ(cx, jsstr); JS_ASSERT(s[0] == '9' && s[1] == '\0'); return true; diff --git a/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp b/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp index 4e1a3f23e735..0ac5243a4b50 100644 --- a/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp +++ b/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp @@ -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); diff --git a/js/src/jsapi-tests/testOps.cpp b/js/src/jsapi-tests/testOps.cpp index e753b6e39e39..648493be1df0 100644 --- a/js/src/jsapi-tests/testOps.cpp +++ b/js/src/jsapi-tests/testOps.cpp @@ -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)); } diff --git a/js/src/jsapi-tests/testOriginPrincipals.cpp b/js/src/jsapi-tests/testOriginPrincipals.cpp index 691c581faa78..4e0419e79d6a 100644 --- a/js/src/jsapi-tests/testOriginPrincipals.cpp +++ b/js/src/jsapi-tests/testOriginPrincipals.cpp @@ -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()); diff --git a/js/src/jsapi-tests/testParseJSON.cpp b/js/src/jsapi-tests/testParseJSON.cpp index df4211dde673..abfe849ec214 100644 --- a/js/src/jsapi-tests/testParseJSON.cpp +++ b/js/src/jsapi-tests/testParseJSON.cpp @@ -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::infinity()))); - js::Rooted str(cx); + JS::Rooted str(cx); const jschar emptystr[] = { '\0' }; str = js_NewStringCopyN(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 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 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); diff --git a/js/src/jsapi-tests/testProfileStrings.cpp b/js/src/jsapi-tests/testProfileStrings.cpp index 86cfa55bfae2..bf6a82ca5e85 100644 --- a/js/src/jsapi-tests/testProfileStrings.cpp +++ b/js/src/jsapi-tests/testProfileStrings.cpp @@ -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()); diff --git a/js/src/jsapi-tests/testRegExp.cpp b/js/src/jsapi-tests/testRegExp.cpp index 4bec934f4014..7811dd65c8d4 100644 --- a/js/src/jsapi-tests/testRegExp.cpp +++ b/js/src/jsapi-tests/testRegExp.cpp @@ -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); diff --git a/js/src/jsapi-tests/testResolveRecursion.cpp b/js/src/jsapi-tests/testResolveRecursion.cpp index 57919d1ff1c6..43d7b2d2be99 100644 --- a/js/src/jsapi-tests/testResolveRecursion.cpp +++ b/js/src/jsapi-tests/testResolveRecursion.cpp @@ -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. */ diff --git a/js/src/jsapi-tests/testScriptInfo.cpp b/js/src/jsapi-tests/testScriptInfo.cpp index 41a74329ba83..3265ed9fc430 100644 --- a/js/src/jsapi-tests/testScriptInfo.cpp +++ b/js/src/jsapi-tests/testScriptInfo.cpp @@ -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); diff --git a/js/src/jsapi-tests/testScriptObject.cpp b/js/src/jsapi-tests/testScriptObject.cpp index 78045957d664..4075976864c7 100644 --- a/js/src/jsapi-tests/testScriptObject.cpp +++ b/js/src/jsapi-tests/testScriptObject.cpp @@ -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); diff --git a/js/src/jsapi-tests/testSetProperty.cpp b/js/src/jsapi-tests/testSetProperty.cpp index f07c58b8acab..598d5d24d8fa 100644 --- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -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, diff --git a/js/src/jsapi-tests/testStringBuffer.cpp b/js/src/jsapi-tests/testStringBuffer.cpp index 2ae51c169724..51c232381d27 100644 --- a/js/src/jsapi-tests/testStringBuffer.cpp +++ b/js/src/jsapi-tests/testStringBuffer.cpp @@ -19,7 +19,7 @@ BEGIN_TEST(testStringBuffer_finishString) JSString *str = JS_NewStringCopyZ(cx, "foopy"); CHECK(str); - js::Rooted atom(cx, js::AtomizeString(cx, str)); + JS::Rooted atom(cx, js::AtomizeString(cx, str)); CHECK(atom); js::StringBuffer buffer(cx); diff --git a/js/src/jsapi-tests/testTrap.cpp b/js/src/jsapi-tests/testTrap.cpp index 13ed06181184..3e66a388ec06 100644 --- a/js/src/jsapi-tests/testTrap.cpp +++ b/js/src/jsapi-tests/testTrap.cpp @@ -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); diff --git a/js/src/jsapi-tests/testTypedArrays.cpp b/js/src/jsapi-tests/testTypedArrays.cpp index 948874a365d3..00ec3704e356 100644 --- a/js/src/jsapi-tests/testTypedArrays.cpp +++ b/js/src/jsapi-tests/testTypedArrays.cpp @@ -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(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); diff --git a/js/src/jsapi-tests/testValueABI.cpp b/js/src/jsapi-tests/testValueABI.cpp index 794c73d1094b..6a0923e5bafa 100644 --- a/js/src/jsapi-tests/testValueABI.cpp +++ b/js/src/jsapi-tests/testValueABI.cpp @@ -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())); diff --git a/js/src/jsapi-tests/testVersion.cpp b/js/src/jsapi-tests/testVersion.cpp index 11e7c2a76de0..11da5ef870f7 100644 --- a/js/src/jsapi-tests/testVersion.cpp +++ b/js/src/jsapi-tests/testVersion.cpp @@ -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, "", 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, "", 0, &rval, version)); return true; diff --git a/js/src/jsapi-tests/testXDR.cpp b/js/src/jsapi-tests/testXDR.cpp index 094ad92424d3..442c3af6ba6e 100644 --- a/js/src/jsapi-tests/testXDR.cpp +++ b/js/src/jsapi-tests/testXDR.cpp @@ -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); diff --git a/js/src/jsapi-tests/tests.cpp b/js/src/jsapi-tests/tests.cpp index 9eb55d72d58a..11fcdfd255ad 100644 --- a/js/src/jsapi-tests/tests.cpp +++ b/js/src/jsapi-tests/tests.cpp @@ -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); diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 403071387b1e..e251ca981a23 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -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); diff --git a/js/src/jsclone.h b/js/src/jsclone.h index e1bb48c4f8ed..de15308db593 100644 --- a/js/src/jsclone.h +++ b/js/src/jsclone.h @@ -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); diff --git a/js/src/jsfun.h b/js/src/jsfun.h index 5e66d19bd9d2..fe73b0273ed9 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -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; diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index fa314b18f4d2..5f3551d0d82e 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -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)); diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 3477e899083c..e93dc5bd4ecc 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -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); } diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 29dac1606a9f..3fb1a838086f 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -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(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); } diff --git a/js/src/jsprvtd.h b/js/src/jsprvtd.h index f15b1cf13947..7d151e1a6670 100644 --- a/js/src/jsprvtd.h +++ b/js/src/jsprvtd.h @@ -196,10 +196,10 @@ typedef JS::Handle HandlePropertyName; typedef JS::MutableHandle MutableHandleShape; typedef JS::MutableHandle MutableHandleAtom; -typedef js::Rooted RootedShape; -typedef js::Rooted RootedTypeObject; -typedef js::Rooted RootedAtom; -typedef js::Rooted RootedPropertyName; +typedef JS::Rooted RootedShape; +typedef JS::Rooted RootedTypeObject; +typedef JS::Rooted RootedAtom; +typedef JS::Rooted RootedPropertyName; enum XDRMode { XDR_ENCODE, diff --git a/js/src/perf/jsperf.cpp b/js/src/perf/jsperf.cpp index a8964f31fccc..098361a964a4 100644 --- a/js/src/perf/jsperf.cpp +++ b/js/src/perf/jsperf.cpp @@ -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; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index afef70c4dfb0..b90fc9be4140 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -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; diff --git a/js/src/vm/String-inl.h b/js/src/vm/String-inl.h index 79f0171b6a34..89d8eef27a94 100644 --- a/js/src/vm/String-inl.h +++ b/js/src/vm/String-inl.h @@ -252,7 +252,7 @@ JSDependentString::new_(JSContext *cx, JSLinearString *baseArg, const jschar *ch return str; } - js::Rooted base(cx, baseArg); + JS::Rooted base(cx, baseArg); str = (JSDependentString *)js_NewGCString(cx); if (!str)