Bug 925916 - Random minor code cleanups, r=smaug

This commit is contained in:
Steve Fink 2013-10-15 15:34:13 -07:00
parent 159ed3c77f
commit 1b7c5fcec0
5 changed files with 15 additions and 16 deletions

View File

@ -3365,7 +3365,7 @@ static bool
LocationSetterUnwrapper(JSContext *cx, JS::Handle<JSObject*> obj_, JS::Handle<jsid> id,
bool strict, JS::MutableHandle<JS::Value> vp)
{
JS::RootedObject obj(cx, obj_);
JS::Rooted<JSObject*> obj(cx, obj_);
JSObject *wrapped = XPCWrapper::UnsafeUnwrapSecurityWrapper(obj);
if (wrapped) {
@ -3410,7 +3410,7 @@ const InterfaceShimEntry kInterfaceShimMap[] =
{ "nsIDOMXPathResult", "XPathResult" } };
static nsresult
DefineComponentsShim(JSContext *cx, JS::HandleObject global, nsPIDOMWindow *win)
DefineComponentsShim(JSContext *cx, JS::Handle<JSObject*> global, nsPIDOMWindow *win)
{
// Keep track of how often this happens.
Telemetry::Accumulate(Telemetry::COMPONENTS_SHIM_ACCESSED_BY_CONTENT, true);
@ -3468,7 +3468,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj_, jsid id_, uint32_t flags,
JSObject **objp, bool *_retval)
{
JS::RootedObject obj(cx, obj_);
JS::Rooted<JSObject*> obj(cx, obj_);
JS::RootedId id(cx, id_);
if (!JSID_IS_STRING(id)) {
@ -3606,7 +3606,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
// Handle resolving if id refers to a name resolved by DOM worker code.
JS::RootedObject tmp(cx, NULL);
JS::Rooted<JSObject*> tmp(cx, NULL);
if (!ResolveWorkerClasses(cx, obj, id, flags, &tmp)) {
return NS_ERROR_FAILURE;
}
@ -4209,7 +4209,7 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj
JS::Handle<jsid> id, unsigned flags,
JS::MutableHandle<JSObject*> objp)
{
JS::RootedValue v(cx);
JS::Rooted<JS::Value> v(cx);
if (nsDOMClassInfo::sItem_id == id || nsDOMClassInfo::sNamedItem_id == id) {
// Define the item() or namedItem() method.

View File

@ -6811,7 +6811,7 @@ PostMessageReadStructuredClone(JSContext* cx,
if (NS_SUCCEEDED(nsContentUtils::WrapNative(cx, global, supports,
&val,
getter_AddRefs(wrapper)))) {
return JSVAL_TO_OBJECT(val);
return val.toObjectOrNull();
}
}
}

View File

@ -320,7 +320,7 @@ enum {
TOSTRING_NAME_RESERVED_SLOT = 1
};
bool
static bool
InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -334,7 +334,7 @@ InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
JS::Value v = js::GetFunctionNativeReserved(callee,
TOSTRING_CLASS_RESERVED_SLOT);
const JSClass* clasp = static_cast<const JSClass*>(JSVAL_TO_PRIVATE(v));
const JSClass* clasp = static_cast<const JSClass*>(v.toPrivate());
v = js::GetFunctionNativeReserved(callee, TOSTRING_NAME_RESERVED_SLOT);
JSString* jsname = static_cast<JSString*>(JSVAL_TO_STRING(v));
@ -684,7 +684,7 @@ NativeInterface2JSObjectAndThrowIfFailed(JSContext* aCx,
nsWrapperCache *cache = aHelper.GetWrapperCache();
if (cache && cache->IsDOMBinding()) {
JS::RootedObject obj(aCx, cache->GetWrapper());
JS::Rooted<JSObject*> obj(aCx, cache->GetWrapper());
if (!obj) {
obj = cache->WrapObject(aCx, aScope);
}
@ -759,7 +759,7 @@ XPCOMObjectToJsval(JSContext* cx, JS::Handle<JSObject*> scope,
}
#ifdef DEBUG
JSObject* jsobj = JSVAL_TO_OBJECT(*rval);
JSObject* jsobj = rval.toObjectOrNull();
if (jsobj && !js::GetObjectParent(jsobj))
NS_ASSERTION(js::GetObjectClass(jsobj)->flags & JSCLASS_IS_GLOBAL,
"Why did we recreate this wrapper?");
@ -810,8 +810,7 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
return Throw(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
}
JS::Value* argv = JS_ARGV(cx, vp);
if (!argv[0].isObject()) {
if (!args[0].isObject()) {
return Throw(cx, NS_ERROR_XPC_BAD_CONVERT_JS);
}
@ -1649,10 +1648,10 @@ private:
};
nsresult
ReparentWrapper(JSContext* aCx, JS::HandleObject aObjArg)
ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg)
{
// aObj is assigned to below, so needs to be re-rooted.
JS::RootedObject aObj(aCx, aObjArg);
JS::Rooted<JSObject*> aObj(aCx, aObjArg);
const DOMClass* domClass = GetDOMClass(aObj);
JS::Rooted<JSObject*> oldParent(aCx, JS_GetParent(aObj));

View File

@ -2005,7 +2005,7 @@ const T& NonNullHelper(const OwningNonNull<T>& aArg)
// Reparent the wrapper of aObj to whatever its native now thinks its
// parent should be.
nsresult
ReparentWrapper(JSContext* aCx, JS::HandleObject aObj);
ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObj);
/**
* Used to implement the hasInstance hook of an interface object.

View File

@ -1368,7 +1368,7 @@ InterfaceToJsval(nsPIDOMWindow* aWindow,
return JSVAL_NULL;
}
JS::RootedObject scopeObj(cx, sgo->GetGlobalJSObject());
JS::Rooted<JSObject*> scopeObj(cx, sgo->GetGlobalJSObject());
NS_ENSURE_TRUE(scopeObj, JSVAL_NULL);
JSAutoCompartment ac(cx, scopeObj);