mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1036232 - Remove redundant code of entering compartment in BT manager and adapter. r=btian
This commit is contained in:
parent
1d79be8a88
commit
eeed6bee33
@ -911,21 +911,11 @@ BluetoothAdapter::DispatchAttributeEvent(const nsTArray<nsString>& aTypes)
|
||||
NS_ENSURE_TRUE_VOID(aTypes.Length());
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.Init(GetOwner())) {
|
||||
BT_WARNING("Failed to initialise AutoJSAPI!");
|
||||
return;
|
||||
}
|
||||
NS_ENSURE_TRUE_VOID(jsapi.Init(GetOwner()));
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
|
||||
NS_ENSURE_TRUE_VOID(global);
|
||||
|
||||
JS::Rooted<JSObject*> scope(cx, global->GetGlobalJSObject());
|
||||
NS_ENSURE_TRUE_VOID(scope);
|
||||
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
|
||||
if(!ToJSValue(cx, aTypes, &value)) {
|
||||
if (!ToJSValue(cx, aTypes, &value)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return;
|
||||
}
|
||||
|
@ -246,17 +246,10 @@ BluetoothManager::DispatchAttributeEvent()
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
BT_API2_LOGR();
|
||||
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> value(cx, JS::NullValue());
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global =
|
||||
do_QueryInterface(GetOwner());
|
||||
NS_ENSURE_TRUE_VOID(global);
|
||||
|
||||
JS::Rooted<JSObject*> scope(cx, global->GetGlobalJSObject());
|
||||
NS_ENSURE_TRUE_VOID(scope);
|
||||
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
AutoJSAPI jsapi;
|
||||
NS_ENSURE_TRUE_VOID(jsapi.Init(GetOwner()));
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
|
||||
nsTArray<nsString> types;
|
||||
BT_APPEND_ENUM_STRING(types,
|
||||
|
Loading…
Reference in New Issue
Block a user