mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 975144 - Adding rtcIdentityProvider to sandbox global scope, r=gabor
This commit is contained in:
parent
a2154ee959
commit
806e4e2764
@ -30,11 +30,11 @@
|
||||
#include "Crypto.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/CryptoBinding.h"
|
||||
#include "mozilla/dom/CSSBinding.h"
|
||||
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
|
||||
#include "mozilla/dom/FileBinding.h"
|
||||
#include "mozilla/dom/PromiseBinding.h"
|
||||
#include "mozilla/dom/RTCIdentityProviderRegistrar.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/TextDecoderBinding.h"
|
||||
#include "mozilla/dom/TextEncoderBinding.h"
|
||||
@ -229,10 +229,24 @@ SandboxCreateCrypto(JSContext *cx, JS::HandleObject obj)
|
||||
|
||||
dom::Crypto* crypto = new dom::Crypto();
|
||||
crypto->Init(native);
|
||||
JS::RootedObject wrapped(cx, dom::CryptoBinding::Wrap(cx, crypto));
|
||||
JS::RootedObject wrapped(cx, crypto->WrapObject(cx));
|
||||
return JS_DefineProperty(cx, obj, "crypto", wrapped, JSPROP_ENUMERATE);
|
||||
}
|
||||
|
||||
static bool
|
||||
SandboxCreateRTCIdentityProvider(JSContext *cx, JS::HandleObject obj)
|
||||
{
|
||||
MOZ_ASSERT(JS_IsGlobalObject(obj));
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> nativeGlobal = xpc::NativeGlobal(obj);
|
||||
MOZ_ASSERT(nativeGlobal);
|
||||
|
||||
dom::RTCIdentityProviderRegistrar* registrar =
|
||||
new dom::RTCIdentityProviderRegistrar(nativeGlobal);
|
||||
JS::RootedObject wrapped(cx, registrar->WrapObject(cx));
|
||||
return JS_DefineProperty(cx, obj, "rtcIdentityProvider", wrapped, JSPROP_ENUMERATE);
|
||||
}
|
||||
|
||||
static bool
|
||||
SandboxIsProxy(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -802,6 +816,8 @@ xpc::GlobalProperties::Parse(JSContext *cx, JS::HandleObject obj)
|
||||
File = true;
|
||||
} else if (!strcmp(name.ptr(), "crypto")) {
|
||||
crypto = true;
|
||||
} else if (!strcmp(name.ptr(), "rtcIdentityProvider")) {
|
||||
rtcIdentityProvider = true;
|
||||
} else {
|
||||
JS_ReportError(cx, "Unknown property name: %s", name.ptr());
|
||||
return false;
|
||||
@ -859,6 +875,9 @@ xpc::GlobalProperties::Define(JSContext *cx, JS::HandleObject obj)
|
||||
if (crypto && !SandboxCreateCrypto(cx, obj))
|
||||
return false;
|
||||
|
||||
if (rtcIdentityProvider && !SandboxCreateRTCIdentityProvider(cx, obj))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3370,6 +3370,7 @@ struct GlobalProperties {
|
||||
bool Blob : 1;
|
||||
bool File : 1;
|
||||
bool crypto : 1;
|
||||
bool rtcIdentityProvider : 1;
|
||||
};
|
||||
|
||||
// Infallible.
|
||||
|
Loading…
Reference in New Issue
Block a user