mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1023969 - Part 1: Replace AutoPushJSContext in BluetoothAdapter GetDevicesTask::ParseSuccessfulReply. r=bholley
This commit is contained in:
parent
416668b7a1
commit
a39259183d
@ -17,6 +17,7 @@
|
||||
#include "mozilla/dom/BluetoothDiscoveryStateChangedEvent.h"
|
||||
#include "mozilla/dom/BluetoothStatusChangedEvent.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
|
||||
#include "BluetoothAdapter.h"
|
||||
@ -95,18 +96,15 @@ public:
|
||||
devices.AppendElement(d);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptContext* sc = mAdapterPtr->GetContextForEventHandlers(&rv);
|
||||
if (!sc) {
|
||||
BT_WARNING("Cannot create script context!");
|
||||
SetError(NS_LITERAL_STRING("BluetoothScriptContextError"));
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.InitUsingWin(mAdapterPtr->GetOwner())) {
|
||||
BT_WARNING("Failed to initialise AutoJSAPI!");
|
||||
SetError(NS_LITERAL_STRING("BluetoothAutoJSAPIInitError"));
|
||||
return false;
|
||||
}
|
||||
|
||||
AutoPushJSContext cx(sc->GetNativeContext());
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JSObject*> JsDevices(cx);
|
||||
rv = nsTArrayToJSArray(cx, devices, &JsDevices);
|
||||
if (!JsDevices) {
|
||||
if (NS_FAILED(nsTArrayToJSArray(cx, devices, &JsDevices))) {
|
||||
BT_WARNING("Cannot create JS array!");
|
||||
SetError(NS_LITERAL_STRING("BluetoothError"));
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user