mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987112. Remove the redundant and somewhat annoying parentObject argument to dictionary ToObject() methods. r=bholley
This commit is contained in:
parent
192bc01f54
commit
d4a40b2bea
@ -67,7 +67,7 @@ Activity::Initialize(nsPIDOMWindow* aWindow,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JS::Value> optionsValue(aCx);
|
||||
if (!aOptions.ToObject(aCx, JS::NullPtr(), &optionsValue)) {
|
||||
if (!aOptions.ToObject(aCx, &optionsValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ Console::ProfileMethod(JSContext* aCx, const nsAString& aAction,
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> eventValue(aCx);
|
||||
if (!event.ToObject(aCx, JS::NullPtr(), &eventValue)) {
|
||||
if (!event.ToObject(aCx, &eventValue)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ Console::ProcessCallData(ConsoleCallData* aData)
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> eventValue(cx);
|
||||
if (!event.ToObject(cx, JS::NullPtr(), &eventValue)) {
|
||||
if (!event.ToObject(cx, &eventValue)) {
|
||||
Throw(cx, NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ Console::StartTimer(JSContext* aCx, const JS::Value& aName,
|
||||
RootedDictionary<ConsoleTimerError> error(aCx);
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!error.ToObject(aCx, JS::NullPtr(), &value)) {
|
||||
if (!error.ToObject(aCx, &value)) {
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
@ -1332,7 +1332,7 @@ Console::StartTimer(JSContext* aCx, const JS::Value& aName,
|
||||
timer.mStarted = aTimestamp;
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!timer.ToObject(aCx, JS::NullPtr(), &value)) {
|
||||
if (!timer.ToObject(aCx, &value)) {
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
@ -1366,7 +1366,7 @@ Console::StopTimer(JSContext* aCx, const JS::Value& aName,
|
||||
timer.mDuration = aTimestamp - entry;
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!timer.ToObject(aCx, JS::NullPtr(), &value)) {
|
||||
if (!timer.ToObject(aCx, &value)) {
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
@ -1414,7 +1414,7 @@ Console::IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame,
|
||||
RootedDictionary<ConsoleCounterError> error(aCx);
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!error.ToObject(aCx, JS::NullPtr(), &value)) {
|
||||
if (!error.ToObject(aCx, &value)) {
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
@ -1430,7 +1430,7 @@ Console::IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame,
|
||||
data.mCount = count;
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!data.ToObject(aCx, JS::NullPtr(), &value)) {
|
||||
if (!data.ToObject(aCx, &value)) {
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
|
@ -5678,7 +5678,7 @@ nsGlobalWindow::DispatchResizeEvent(const nsIntSize& aSize)
|
||||
detail.mWidth = aSize.width;
|
||||
detail.mHeight = aSize.height;
|
||||
JS::Rooted<JS::Value> detailValue(cx);
|
||||
if (!detail.ToObject(cx, JS::NullPtr(), &detailValue)) {
|
||||
if (!detail.ToObject(cx, &detailValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4672,7 +4672,7 @@ if (!returnArray) {
|
||||
False)
|
||||
|
||||
if type.isDictionary():
|
||||
return (wrapAndSetPtr("%s.ToObject(cx, ${obj}, ${jsvalHandle})" % result),
|
||||
return (wrapAndSetPtr("%s.ToObject(cx, ${jsvalHandle})" % result),
|
||||
False)
|
||||
|
||||
if type.isDate():
|
||||
@ -9319,7 +9319,7 @@ if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
|
||||
if self.dictionary.parent:
|
||||
body += (
|
||||
"// Per spec, we define the parent's members first\n"
|
||||
"if (!%s::ToObject(cx, parentObject, rval)) {\n"
|
||||
"if (!%s::ToObject(cx, rval)) {\n"
|
||||
" return false;\n"
|
||||
"}\n"
|
||||
"JS::Rooted<JSObject*> obj(cx, &rval.toObject());\n"
|
||||
@ -9339,7 +9339,6 @@ if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
|
||||
|
||||
return ClassMethod("ToObject", "bool", [
|
||||
Argument('JSContext*', 'cx'),
|
||||
Argument('JS::Handle<JSObject*>', 'parentObject'),
|
||||
Argument('JS::MutableHandle<JS::Value>', 'rval'),
|
||||
], const=True, body=body)
|
||||
|
||||
@ -9598,7 +9597,9 @@ if (""",
|
||||
'jsvalRef': "temp",
|
||||
'jsvalHandle': "&temp",
|
||||
'returnsNewObject': False,
|
||||
'obj': "parentObject",
|
||||
# 'obj' can just be allowed to be the string "obj", since that
|
||||
# will be our dictionary object, which is presumably itself in
|
||||
# the right scope.
|
||||
'typedArraysAreStructs': True
|
||||
})
|
||||
conversion = CGGeneric(innerTemplate)
|
||||
|
@ -160,7 +160,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
||||
|
||||
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
|
||||
JSAutoCompartment ac(cx, global);
|
||||
if (!detail.ToObject(cx, global, &val)) {
|
||||
if (!detail.ToObject(cx, &val)) {
|
||||
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
|
||||
return BrowserElementParent::OPEN_WINDOW_IGNORED;
|
||||
}
|
||||
@ -332,9 +332,7 @@ NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
|
||||
JSAutoCompartment ac(cx, globalJSObject);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
|
||||
// We can get away with a null global here because
|
||||
// AsyncScrollEventDetail only contains numeric values.
|
||||
if (!detail.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!detail.ToObject(cx, &val)) {
|
||||
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ static nsresult CompareDictionaries(JSContext* aCx, JSObject *aA,
|
||||
JS::Rooted<JSObject*> a(aCx, aA);
|
||||
JSAutoCompartment ac(aCx, aA);
|
||||
JS::Rooted<JS::Value> bval(aCx);
|
||||
aB.ToObject(aCx, JS::NullPtr(), &bval);
|
||||
aB.ToObject(aCx, &bval);
|
||||
JS::Rooted<JSObject*> b(aCx, &bval.toObject());
|
||||
|
||||
// Iterate over each property in A, and check if it is in B
|
||||
|
@ -101,7 +101,7 @@ DesktopNotification::PostDesktopNotification()
|
||||
ops.mTextClickable = true;
|
||||
ops.mManifestURL = manifestUrl;
|
||||
|
||||
if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!ops.ToObject(cx, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -583,7 +583,7 @@ Notification::ShowInternal()
|
||||
ops.mLang = mLang;
|
||||
ops.mTag = mTag;
|
||||
|
||||
if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!ops.ToObject(cx, &val)) {
|
||||
NS_WARNING("Converting dict to object failed!");
|
||||
return;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ NetworkWorker::DispatchNetworkResult(const NetworkResultOptions& aOptions)
|
||||
mozilla::AutoSafeJSContext cx;
|
||||
JS::RootedValue val(cx);
|
||||
|
||||
if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!aOptions.ToObject(cx, &val)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ WifiProxyService::DispatchWifiResult(const WifiResultOptions& aOptions, const ns
|
||||
mozilla::AutoSafeJSContext cx;
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
|
||||
if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!aOptions.ToObject(cx, &val)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -641,7 +641,7 @@ inDOMUtils::ColorNameToRGB(const nsAString& aColorName, JSContext* aCx,
|
||||
triple.mG = NS_GET_G(color);
|
||||
triple.mB = NS_GET_B(color);
|
||||
|
||||
if (!triple.ToObject(aCx, JS::NullPtr(), aValue)) {
|
||||
if (!triple.ToObject(aCx, aValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ LookupHelper::ConstructAnswer(LookupArgument *aArgument)
|
||||
}
|
||||
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!dict.ToObject(cx, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ Dashboard::GetSockets(SocketData *aSocketData)
|
||||
dict.mSent += socketData->mTotalSent;
|
||||
dict.mReceived += socketData->mTotalRecv;
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val))
|
||||
if (!dict.ToObject(cx, &val))
|
||||
return NS_ERROR_FAILURE;
|
||||
socketData->mCallback->OnDashboardDataAvailable(val);
|
||||
|
||||
@ -503,7 +503,7 @@ Dashboard::GetHttpConnections(HttpData *aHttpData)
|
||||
}
|
||||
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!dict.ToObject(cx, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ Dashboard::GetWebSocketConnections(WebSocketRequest *aWsRequest)
|
||||
}
|
||||
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!dict.ToObject(cx, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
wsRequest->mCallback->OnDashboardDataAvailable(val);
|
||||
@ -717,7 +717,7 @@ Dashboard::GetDNSCacheEntries(DnsData *dnsData)
|
||||
}
|
||||
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
if (!dict.ToObject(cx, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
dnsData->mCallback->OnDashboardDataAvailable(val);
|
||||
@ -819,7 +819,7 @@ Dashboard::GetConnectionStatus(ConnectionData *aConnectionData)
|
||||
dict.mStatus = connectionData->mStatus;
|
||||
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val))
|
||||
if (!dict.ToObject(cx, &val))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
connectionData->mCallback->OnDashboardDataAvailable(val);
|
||||
|
Loading…
Reference in New Issue
Block a user