Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit a0a3f88

Browse files
committed
Bug 848395 - GC: Move Rooted to JS namespace - rename js::Rooted to JS::Rooted outside SpiderMonkey r=terrence
--HG-- extra : rebase_source : 35cbf3cc4da4598c2e9e6975028ef397718849db
1 parent c3e865f commit a0a3f88

33 files changed

Lines changed: 71 additions & 71 deletions

content/base/src/nsFrameMessageManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
10841084
options.setNoScriptRval(true)
10851085
.setFileAndLine(url.get(), 1)
10861086
.setPrincipals(nsJSPrincipals::get(mPrincipal));
1087-
js::RootedObject empty(mCx, NULL);
1087+
JS::RootedObject empty(mCx, NULL);
10881088
JSScript* script = JS::Compile(mCx, empty, options,
10891089
dataString.get(), dataString.Length());
10901090

content/events/src/nsEventListenerManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
840840
options.setFileAndLine(url.get(), lineNo)
841841
.setVersion(SCRIPTVERSION_DEFAULT);
842842

843-
js::RootedObject rootedNull(cx, nullptr); // See bug 781070.
843+
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
844844
JSObject *handlerFun = nullptr;
845845
result = nsJSUtils::CompileFunction(cx, rootedNull, options,
846846
nsAtomCString(aListenerStruct->mTypeAtom),

content/xbl/src/nsXBLBinding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
14371437
// Enter the xbl scope and invoke the internal version.
14381438
{
14391439
JSAutoCompartment ac(aCx, xblScope);
1440-
js::RootedId id(aCx, aId);
1440+
JS::RootedId id(aCx, aId);
14411441
if (!JS_WrapId(aCx, id.address()) ||
14421442
!LookupMemberInternal(aCx, name, id, aDesc, xblScope))
14431443
{
@@ -1467,7 +1467,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
14671467

14681468
// Find our class object. It's in a protected scope and permanent just in case,
14691469
// so should be there no matter what.
1470-
js::RootedValue classObject(aCx);
1470+
JS::RootedValue classObject(aCx);
14711471
if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, classObject.address())) {
14721472
return false;
14731473
}

content/xbl/src/nsXBLProtoImplField.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ InstallXBLField(JSContext* cx,
170170
{
171171
JSAutoCompartment ac(cx, callee);
172172

173-
js::Rooted<JSObject*> xblProto(cx);
173+
JS::Rooted<JSObject*> xblProto(cx);
174174
xblProto = &js::GetFunctionNativeReserved(callee, XBLPROTO_SLOT).toObject();
175175

176176
JS::Value name = js::GetFunctionNativeReserved(callee, FIELD_SLOT);
@@ -220,16 +220,16 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
220220
const JS::Value &thisv = args.thisv();
221221
MOZ_ASSERT(ValueHasISupportsPrivate(thisv));
222222

223-
js::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
223+
JS::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
224224

225225
// We should be in the compartment of |this|. If we got here via nativeCall,
226226
// |this| is not same-compartment with |callee|, and it's possible via
227227
// asymmetric security semantics that |args.calleev()| is actually a security
228228
// wrapper. In this case, we know we want to do an unsafe unwrap, and
229229
// InstallXBLField knows how to handle cross-compartment pointers.
230230
bool installed = false;
231-
js::Rooted<JSObject*> callee(cx, js::UnwrapObject(&args.calleev().toObject()));
232-
js::Rooted<jsid> id(cx);
231+
JS::Rooted<JSObject*> callee(cx, js::UnwrapObject(&args.calleev().toObject()));
232+
JS::Rooted<jsid> id(cx);
233233
if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
234234
return false;
235235
}
@@ -239,7 +239,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
239239
return true;
240240
}
241241

242-
js::Rooted<JS::Value> v(cx);
242+
JS::Rooted<JS::Value> v(cx);
243243
if (!JS_GetPropertyById(cx, thisObj, id, v.address())) {
244244
return false;
245245
}
@@ -261,22 +261,22 @@ FieldSetterImpl(JSContext *cx, JS::CallArgs args)
261261
const JS::Value &thisv = args.thisv();
262262
MOZ_ASSERT(ValueHasISupportsPrivate(thisv));
263263

264-
js::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
264+
JS::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
265265

266266
// We should be in the compartment of |this|. If we got here via nativeCall,
267267
// |this| is not same-compartment with |callee|, and it's possible via
268268
// asymmetric security semantics that |args.calleev()| is actually a security
269269
// wrapper. In this case, we know we want to do an unsafe unwrap, and
270270
// InstallXBLField knows how to handle cross-compartment pointers.
271271
bool installed = false;
272-
js::Rooted<JSObject*> callee(cx, js::UnwrapObject(&args.calleev().toObject()));
273-
js::Rooted<jsid> id(cx);
272+
JS::Rooted<JSObject*> callee(cx, js::UnwrapObject(&args.calleev().toObject()));
273+
JS::Rooted<jsid> id(cx);
274274
if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
275275
return false;
276276
}
277277

278278
if (installed) {
279-
js::Rooted<JS::Value> v(cx,
279+
JS::Rooted<JS::Value> v(cx,
280280
args.length() > 0 ? args[0] : JS::UndefinedValue());
281281
if (!::JS_SetPropertyById(cx, thisObj, id, v.address())) {
282282
return false;

content/xbl/src/nsXBLProtoImplMethod.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
202202
uncompiledMethod->mBodyText.GetLineNumber())
203203
.setVersion(JSVERSION_LATEST)
204204
.setUserBit(true); // Flag us as XBL
205-
js::RootedObject rootedNull(cx, nullptr); // See bug 781070.
205+
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
206206
nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options, cname,
207207
paramCount,
208208
const_cast<const char**>(args),

content/xbl/src/nsXBLProtoImplProperty.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
218218
.setVersion(JSVERSION_LATEST)
219219
.setUserBit(true); // Flag us as XBL
220220
nsCString name = NS_LITERAL_CSTRING("get_") + NS_ConvertUTF16toUTF8(mName);
221-
js::RootedObject rootedNull(cx, nullptr); // See bug 781070.
221+
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
222222
rv = nsJSUtils::CompileFunction(cx, rootedNull, options, name, 0, nullptr,
223223
getter, &getterObject);
224224

@@ -268,7 +268,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
268268
.setVersion(JSVERSION_LATEST)
269269
.setUserBit(true); // Flag us as XBL
270270
nsCString name = NS_LITERAL_CSTRING("set_") + NS_ConvertUTF16toUTF8(mName);
271-
js::RootedObject rootedNull(cx, nullptr); // See bug 781070.
271+
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
272272
rv = nsJSUtils::CompileFunction(cx, rootedNull, options, name, 1,
273273
gPropertyArgs, setter, &setterObject);
274274

content/xbl/src/nsXBLPrototypeHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
390390
.setVersion(JSVERSION_LATEST)
391391
.setUserBit(true); // Flag us as XBL
392392

393-
js::RootedObject rootedNull(cx, nullptr); // See bug 781070.
393+
JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
394394
JSObject* handlerFun = nullptr;
395395
nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options,
396396
nsAtomCString(aName), argCount,

dom/base/nsDOMClassInfo.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5352,7 +5352,7 @@ static JSBool
53525352
LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict,
53535353
JSMutableHandleValue vp)
53545354
{
5355-
js::RootedObject obj(cx, obj_);
5355+
JS::RootedObject obj(cx, obj_);
53565356

53575357
JSObject *wrapped = XPCWrapper::UnsafeUnwrapSecurityWrapper(obj);
53585358
if (wrapped) {
@@ -5367,8 +5367,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
53675367
JSObject *obj_, jsid id_, uint32_t flags,
53685368
JSObject **objp, bool *_retval)
53695369
{
5370-
js::RootedObject obj(cx, obj_);
5371-
js::RootedId id(cx, id_);
5370+
JS::RootedObject obj(cx, obj_);
5371+
JS::RootedId id(cx, id_);
53725372

53735373
if (!JSID_IS_STRING(id)) {
53745374
return NS_OK;
@@ -5562,7 +5562,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
55625562
}
55635563

55645564
// Handle resolving if id refers to a name resolved by DOM worker code.
5565-
js::RootedObject tmp(cx, NULL);
5565+
JS::RootedObject tmp(cx, NULL);
55665566
if (!ResolveWorkerClasses(cx, obj, id, flags, &tmp)) {
55675567
return NS_ERROR_FAILURE;
55685568
}
@@ -5753,7 +5753,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
57535753
// Since we always create the undeclared property here, shortcutting the
57545754
// normal process, we go out of our way to tell the JS engine to report
57555755
// strict warnings/errors using js::ReportIfUndeclaredVarAssignment.
5756-
js::Rooted<JSString*> str(cx, JSID_TO_STRING(id));
5756+
JS::Rooted<JSString*> str(cx, JSID_TO_STRING(id));
57575757
if (!js::ReportIfUndeclaredVarAssignment(cx, str) ||
57585758
!::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, JS_PropertyStub,
57595759
JS_StrictPropertyStub, JSPROP_ENUMERATE)) {
@@ -7034,7 +7034,7 @@ JSBool
70347034
nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id,
70357035
unsigned flags, JSMutableHandleObject objp)
70367036
{
7037-
js::RootedValue v(cx);
7037+
JS::RootedValue v(cx);
70387038

70397039
if (sItem_id == id || sNamedItem_id == id) {
70407040
// Define the item() or namedItem() method.
@@ -7171,7 +7171,7 @@ nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj
71717171
return JS_FALSE;
71727172
}
71737173

7174-
js::Rooted<JSObject*> all(cx);
7174+
JS::Rooted<JSObject*> all(cx);
71757175
all = ::JS_NewObject(cx, &sHTMLDocumentAllClass, nullptr,
71767176
::JS_GetGlobalForObject(cx, obj));
71777177
if (!all) {

dom/base/nsDOMWindowUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2100,7 +2100,7 @@ nsDOMWindowUtils::GetParent(const JS::Value& aObject,
21002100
return NS_ERROR_XPC_BAD_CONVERT_JS;
21012101
}
21022102

2103-
js::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
2103+
JS::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
21042104
*aParent = OBJECT_TO_JSVAL(parent);
21052105

21062106
// Outerize if necessary.

dom/base/nsJSEnvironment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ nsJSContext::EvaluateString(const nsAString& aScript,
12831283

12841284
++mExecuteDepth;
12851285

1286-
js::RootedObject rootedScope(mContext, &aScopeObject);
1286+
JS::RootedObject rootedScope(mContext, &aScopeObject);
12871287
ok = JS::Evaluate(mContext, rootedScope, aOptions,
12881288
PromiseFlatString(aScript).get(),
12891289
aScript.Length(), aRetValue);
@@ -1366,7 +1366,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
13661366
.setFileAndLine(aURL, aLineNo)
13671367
.setVersion(JSVersion(aVersion))
13681368
.setSourcePolicy(sp);
1369-
js::RootedObject rootedScope(mContext, scopeObject);
1369+
JS::RootedObject rootedScope(mContext, scopeObject);
13701370
JSScript* script = JS::Compile(mContext,
13711371
rootedScope,
13721372
options,

0 commit comments

Comments
 (0)