--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -55,18 +55,20 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/dom/CryptoKey.h"
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/ImageDataBinding.h"
#include "mozilla/dom/ImageData.h"
#ifdef MOZ_NFC
#include "mozilla/dom/MozNDEFRecord.h"
#endif // MOZ_NFC
+#ifdef MOZ_WEBRTC
#include "mozilla/dom/RTCCertificate.h"
#include "mozilla/dom/RTCCertificateBinding.h"
+#endif
#include "mozilla/dom/StructuredClone.h"
#include "mozilla/dom/SubtleCryptoBinding.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "nsAXPCNativeCallContext.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "nsJSPrincipals.h"
@@ -2544,32 +2546,36 @@ NS_DOMReadStructuredClone(JSContext* cx,
}
return result;
#else
return nullptr;
#endif
}
if (tag == SCTAG_DOM_RTC_CERTIFICATE) {
+#ifdef MOZ_WEBRTC
nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(cx));
if (!global) {
return nullptr;
}
// Prevent the return value from being trashed by a GC during ~nsRefPtr.
JS::Rooted<JSObject*> result(cx);
{
nsRefPtr<RTCCertificate> cert = new RTCCertificate(global);
if (!cert->ReadStructuredClone(reader)) {
result = nullptr;
} else {
result = cert->WrapObject(cx, nullptr);
}
}
return result;
+#else
+ return nullptr;
+#endif
}
// Don't know what this is. Bail.
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
return nullptr;
}
bool
@@ -2586,22 +2592,24 @@ NS_DOMWriteStructuredClone(JSContext* cx
// Handle Key cloning
CryptoKey* key;
if (NS_SUCCEEDED(UNWRAP_OBJECT(CryptoKey, obj, key))) {
return JS_WriteUint32Pair(writer, SCTAG_DOM_WEBCRYPTO_KEY, 0) &&
key->WriteStructuredClone(writer);
}
+#ifdef MOZ_WEBRTC
// Handle WebRTC Certificate cloning
RTCCertificate* cert;
if (NS_SUCCEEDED(UNWRAP_OBJECT(RTCCertificate, obj, cert))) {
return JS_WriteUint32Pair(writer, SCTAG_DOM_RTC_CERTIFICATE, 0) &&
cert->WriteStructuredClone(writer);
}
+#endif
if (xpc::IsReflector(obj)) {
nsCOMPtr<nsISupports> base = xpc::UnwrapReflectorToISupports(obj);
nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(base);
if (principal) {
mozilla::ipc::PrincipalInfo info;
if (NS_WARN_IF(NS_FAILED(PrincipalToPrincipalInfo(principal, &info)))) {
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
deleted file mode 100644
--- a/dom/media/RTCIdentityProviderRegistrar.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "RTCIdentityProviderRegistrar.h"
-#include "mozilla/Attributes.h"
-#include "mozilla/dom/RTCIdentityProviderBinding.h"
-#include "nsCycleCollectionParticipant.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RTCIdentityProviderRegistrar)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
- NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(RTCIdentityProviderRegistrar)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(RTCIdentityProviderRegistrar)
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(RTCIdentityProviderRegistrar,
- mGlobal, mIdp)
-
-RTCIdentityProviderRegistrar::RTCIdentityProviderRegistrar(
- nsIGlobalObject* aGlobal)
- : mGlobal(aGlobal)
- , mIdp(nullptr)
-{
- MOZ_COUNT_CTOR(RTCIdentityProviderRegistrar);
-}
-
-RTCIdentityProviderRegistrar::~RTCIdentityProviderRegistrar()
-{
- MOZ_COUNT_DTOR(RTCIdentityProviderRegistrar);
-}
-
-nsIGlobalObject*
-RTCIdentityProviderRegistrar::GetParentObject() const
-{
- return mGlobal;
-}
-
-JSObject*
-RTCIdentityProviderRegistrar::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return RTCIdentityProviderRegistrarBinding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-RTCIdentityProviderRegistrar::Register(RTCIdentityProvider& aIdp)
-{
- mIdp = &aIdp;
-}
-
-already_AddRefed<RTCIdentityProvider>
-RTCIdentityProviderRegistrar::GetIdp()
-{
- nsRefPtr<RTCIdentityProvider> idp = mIdp;
- return idp.forget();
-}
-
-already_AddRefed<Promise>
-RTCIdentityProviderRegistrar::GenerateAssertion(
- const nsAString& aContents, const nsAString& aOrigin,
- const Optional<nsAString>& aUsernameHint, ErrorResult& aRv)
-{
- if (!mIdp) {
- aRv.Throw(NS_ERROR_NOT_INITIALIZED);
- return nullptr;
- }
- return mIdp->GenerateAssertion(aContents, aOrigin, aUsernameHint, aRv);
-}
-already_AddRefed<Promise>
-RTCIdentityProviderRegistrar::ValidateAssertion(
- const nsAString& aAssertion, const nsAString& aOrigin, ErrorResult& aRv)
-{
- if (!mIdp) {
- aRv.Throw(NS_ERROR_NOT_INITIALIZED);
- return nullptr;
- }
- return mIdp->ValidateAssertion(aAssertion, aOrigin, aRv);
-}
-
-
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/RTCIdentityProviderRegistrar.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef RTCIDENTITYPROVIDER_H_
-#define RTCIDENTITYPROVIDER_H_
-
-#include "nsRefPtr.h"
-#include "nsCOMPtr.h"
-#include "nsISupportsImpl.h"
-#include "nsIGlobalObject.h"
-#include "nsWrapperCache.h"
-#include "mozilla/Attributes.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/BindingDeclarations.h"
-
-namespace mozilla {
-namespace dom {
-
-class RTCIdentityProvider;
-
-class RTCIdentityProviderRegistrar final : public nsISupports,
- public nsWrapperCache
-{
-public:
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCIdentityProviderRegistrar)
-
- explicit RTCIdentityProviderRegistrar(nsIGlobalObject* aGlobal);
-
- // As required
- nsIGlobalObject* GetParentObject() const;
- virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // setter and getter
- void Register(RTCIdentityProvider& aIdp);
- already_AddRefed<RTCIdentityProvider> GetIdp();
-
- already_AddRefed<Promise>
- GenerateAssertion(const nsAString& aContents, const nsAString& aOrigin,
- const Optional<nsAString>& aUsernameHint, ErrorResult& aRv);
- already_AddRefed<Promise>
- ValidateAssertion(const nsAString& assertion, const nsAString& origin,
- ErrorResult& aRv);
-
-private:
- ~RTCIdentityProviderRegistrar();
-
- nsCOMPtr<nsIGlobalObject> mGlobal;
- nsRefPtr<RTCIdentityProvider> mIdp;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif /* RTCIDENTITYPROVIDER_H_ */
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -177,17 +177,16 @@ EXPORTS.mozilla.dom += [
'AudioTrack.h',
'AudioTrackList.h',
'CanvasCaptureMediaStream.h',
'GetUserMediaRequest.h',
'MediaDeviceInfo.h',
'MediaDevices.h',
'MediaStreamError.h',
'MediaStreamTrack.h',
- 'RTCIdentityProviderRegistrar.h',
'TextTrack.h',
'TextTrackCue.h',
'TextTrackCueList.h',
'TextTrackList.h',
'TextTrackRegion.h',
'VideoPlaybackQuality.h',
'VideoStreamTrack.h',
'VideoTrack.h',
@@ -230,17 +229,16 @@ UNIFIED_SOURCES += [
'MediaStreamTrack.cpp',
'MediaTaskQueue.cpp',
'MediaTimer.cpp',
'MediaTrack.cpp',
'MediaTrackList.cpp',
'MP3Decoder.cpp',
'MP3Demuxer.cpp',
'MP3FrameParser.cpp',
- 'RTCIdentityProviderRegistrar.cpp',
'RtspMediaResource.cpp',
'SharedThreadPool.cpp',
'StreamBuffer.cpp',
'TextTrack.cpp',
'TextTrackCue.cpp',
'TextTrackCueList.cpp',
'TextTrackList.cpp',
'TextTrackRegion.cpp',
new file mode 100644
--- /dev/null
+++ b/dom/media/webrtc/RTCIdentityProviderRegistrar.cpp
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "RTCIdentityProviderRegistrar.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/dom/RTCIdentityProviderBinding.h"
+#include "nsCycleCollectionParticipant.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RTCIdentityProviderRegistrar)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(RTCIdentityProviderRegistrar)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(RTCIdentityProviderRegistrar)
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(RTCIdentityProviderRegistrar,
+ mGlobal, mIdp)
+
+RTCIdentityProviderRegistrar::RTCIdentityProviderRegistrar(
+ nsIGlobalObject* aGlobal)
+ : mGlobal(aGlobal)
+ , mIdp(nullptr)
+{
+ MOZ_COUNT_CTOR(RTCIdentityProviderRegistrar);
+}
+
+RTCIdentityProviderRegistrar::~RTCIdentityProviderRegistrar()
+{
+ MOZ_COUNT_DTOR(RTCIdentityProviderRegistrar);
+}
+
+nsIGlobalObject*
+RTCIdentityProviderRegistrar::GetParentObject() const
+{
+ return mGlobal;
+}
+
+JSObject*
+RTCIdentityProviderRegistrar::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+{
+ return RTCIdentityProviderRegistrarBinding::Wrap(aCx, this, aGivenProto);
+}
+
+void
+RTCIdentityProviderRegistrar::Register(RTCIdentityProvider& aIdp)
+{
+ mIdp = &aIdp;
+}
+
+already_AddRefed<RTCIdentityProvider>
+RTCIdentityProviderRegistrar::GetIdp()
+{
+ nsRefPtr<RTCIdentityProvider> idp = mIdp;
+ return idp.forget();
+}
+
+already_AddRefed<Promise>
+RTCIdentityProviderRegistrar::GenerateAssertion(
+ const nsAString& aContents, const nsAString& aOrigin,
+ const Optional<nsAString>& aUsernameHint, ErrorResult& aRv)
+{
+ if (!mIdp) {
+ aRv.Throw(NS_ERROR_NOT_INITIALIZED);
+ return nullptr;
+ }
+ return mIdp->GenerateAssertion(aContents, aOrigin, aUsernameHint, aRv);
+}
+already_AddRefed<Promise>
+RTCIdentityProviderRegistrar::ValidateAssertion(
+ const nsAString& aAssertion, const nsAString& aOrigin, ErrorResult& aRv)
+{
+ if (!mIdp) {
+ aRv.Throw(NS_ERROR_NOT_INITIALIZED);
+ return nullptr;
+ }
+ return mIdp->ValidateAssertion(aAssertion, aOrigin, aRv);
+}
+
+
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/media/webrtc/RTCIdentityProviderRegistrar.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef RTCIDENTITYPROVIDER_H_
+#define RTCIDENTITYPROVIDER_H_
+
+#include "nsRefPtr.h"
+#include "nsCOMPtr.h"
+#include "nsISupportsImpl.h"
+#include "nsIGlobalObject.h"
+#include "nsWrapperCache.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/dom/Promise.h"
+#include "mozilla/dom/BindingDeclarations.h"
+
+namespace mozilla {
+namespace dom {
+
+class RTCIdentityProvider;
+
+class RTCIdentityProviderRegistrar final : public nsISupports,
+ public nsWrapperCache
+{
+public:
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCIdentityProviderRegistrar)
+
+ explicit RTCIdentityProviderRegistrar(nsIGlobalObject* aGlobal);
+
+ // As required
+ nsIGlobalObject* GetParentObject() const;
+ virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
+ // setter and getter
+ void Register(RTCIdentityProvider& aIdp);
+ already_AddRefed<RTCIdentityProvider> GetIdp();
+
+ already_AddRefed<Promise>
+ GenerateAssertion(const nsAString& aContents, const nsAString& aOrigin,
+ const Optional<nsAString>& aUsernameHint, ErrorResult& aRv);
+ already_AddRefed<Promise>
+ ValidateAssertion(const nsAString& assertion, const nsAString& origin,
+ ErrorResult& aRv);
+
+private:
+ ~RTCIdentityProviderRegistrar();
+
+ nsCOMPtr<nsIGlobalObject> mGlobal;
+ nsRefPtr<RTCIdentityProvider> mIdp;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif /* RTCIDENTITYPROVIDER_H_ */
--- a/dom/media/webrtc/moz.build
+++ b/dom/media/webrtc/moz.build
@@ -17,22 +17,25 @@ EXPORTS += [
'MediaEngineCameraVideoSource.h',
'MediaEngineDefault.h',
'MediaTrackConstraints.h',
]
if CONFIG['MOZ_WEBRTC']:
EXPORTS += ['AudioOutputObserver.h',
'MediaEngineWebRTC.h']
+ EXPORTS.mozilla.dom += [ 'RTCIdentityProviderRegistrar.h' ]
UNIFIED_SOURCES += [
'MediaEngineCameraVideoSource.cpp',
'MediaEngineTabVideoSource.cpp',
'MediaEngineWebRTCAudio.cpp',
'MediaEngineWebRTCVideo.cpp',
'MediaTrackConstraints.cpp',
+ 'RTCCertificate.cpp',
+ 'RTCIdentityProviderRegistrar.cpp',
]
# MediaEngineWebRTC.cpp needs to be built separately.
SOURCES += [
'MediaEngineWebRTC.cpp',
]
LOCAL_INCLUDES += [
'/dom/base',
'/dom/camera',
@@ -54,17 +57,16 @@ if CONFIG['MOZ_WEBRTC']:
XPIDL_SOURCES += [
'nsITabSource.idl'
]
UNIFIED_SOURCES += [
'MediaEngineDefault.cpp',
'PeerIdentity.cpp',
- 'RTCCertificate.cpp',
]
EXPORTS.mozilla += [
'PeerIdentity.h',
]
EXPORTS.mozilla.dom += [
'RTCCertificate.h',
]
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -369,26 +369,16 @@ WEBIDL_FILES = [
'Rect.webidl',
'Request.webidl',
'RequestSyncManager.webidl',
'RequestSyncScheduler.webidl',
'ResourceStats.webidl',
'ResourceStatsManager.webidl',
'Response.webidl',
'RGBColor.webidl',
- 'RTCCertificate.webidl',
- 'RTCConfiguration.webidl',
- 'RTCIceCandidate.webidl',
- 'RTCIdentityAssertion.webidl',
- 'RTCIdentityProvider.webidl',
- 'RTCPeerConnection.webidl',
- 'RTCPeerConnectionStatic.webidl',
- 'RTCRtpReceiver.webidl',
- 'RTCRtpSender.webidl',
- 'RTCSessionDescription.webidl',
'RTCStatsReport.webidl',
'Screen.webidl',
'ScriptProcessorNode.webidl',
'ScrollAreaEvent.webidl',
'ScrollBoxObject.webidl',
'Selection.webidl',
'ServiceWorker.webidl',
'ServiceWorkerContainer.webidl',
@@ -597,19 +587,35 @@ if CONFIG['MOZ_AUDIO_CHANNEL_MANAGER']:
if CONFIG['MOZ_WEBRTC']:
WEBIDL_FILES += [
'DataChannel.webidl',
'MediaStreamList.webidl',
'PeerConnectionImpl.webidl',
'PeerConnectionImplEnums.webidl',
'PeerConnectionObserver.webidl',
'PeerConnectionObserverEnums.webidl',
+ 'RTCCertificate.webidl',
+ 'RTCConfiguration.webidl',
+ 'RTCIceCandidate.webidl',
+ 'RTCIdentityAssertion.webidl',
+ 'RTCIdentityProvider.webidl',
+ 'RTCPeerConnection.webidl',
+ 'RTCPeerConnectionStatic.webidl',
+ 'RTCRtpReceiver.webidl',
+ 'RTCRtpSender.webidl',
+ 'RTCSessionDescription.webidl',
'WebrtcGlobalInformation.webidl',
]
+ GENERATED_EVENTS_WEBIDL_FILES += [
+ 'MediaStreamTrackEvent.webidl',
+ 'RTCDataChannelEvent.webidl',
+ 'RTCPeerConnectionIceEvent.webidl',
+ ]
+
if CONFIG['MOZ_WEBSPEECH']:
WEBIDL_FILES += [
'SpeechGrammar.webidl',
'SpeechGrammarList.webidl',
'SpeechRecognition.webidl',
'SpeechRecognitionAlternative.webidl',
'SpeechRecognitionError.webidl',
'SpeechRecognitionEvent.webidl',
@@ -749,17 +755,16 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'DOMTransactionEvent.webidl',
'DownloadEvent.webidl',
'ErrorEvent.webidl',
'ExternalAppEvent.webidl',
'HashChangeEvent.webidl',
'IccChangeEvent.webidl',
'ImageCaptureErrorEvent.webidl',
'MediaStreamEvent.webidl',
- 'MediaStreamTrackEvent.webidl',
'MozApplicationEvent.webidl',
'MozCellBroadcastEvent.webidl',
'MozClirModeEvent.webidl',
'MozContactChangeEvent.webidl',
'MozEmergencyCbModeEvent.webidl',
'MozInterAppMessageEvent.webidl',
'MozMessageDeletedEvent.webidl',
'MozMmsEvent.webidl',
@@ -770,18 +775,16 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'MozStkCommandEvent.webidl',
'MozVoicemailEvent.webidl',
'PageTransitionEvent.webidl',
'PluginCrashedEvent.webidl',
'PopStateEvent.webidl',
'PopupBlockedEvent.webidl',
'ProgressEvent.webidl',
'RecordErrorEvent.webidl',
- 'RTCDataChannelEvent.webidl',
- 'RTCPeerConnectionIceEvent.webidl',
'ScrollViewChangeEvent.webidl',
'SelectionStateChangedEvent.webidl',
'StyleRuleChangeEvent.webidl',
'StyleSheetApplicableStateChangeEvent.webidl',
'StyleSheetChangeEvent.webidl',
'TrackEvent.webidl',
'TVCurrentChannelChangedEvent.webidl',
'TVCurrentSourceChangedEvent.webidl',
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -32,17 +32,19 @@
#include "mozilla/dom/BlobBinding.h"
#include "mozilla/dom/CSSBinding.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
#include "mozilla/dom/Fetch.h"
#include "mozilla/dom/FileBinding.h"
#include "mozilla/dom/PromiseBinding.h"
#include "mozilla/dom/RequestBinding.h"
#include "mozilla/dom/ResponseBinding.h"
+#ifdef MOZ_WEBRTC
#include "mozilla/dom/RTCIdentityProviderRegistrar.h"
+#endif
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TextDecoderBinding.h"
#include "mozilla/dom/TextEncoderBinding.h"
#include "mozilla/dom/UnionConversions.h"
#include "mozilla/dom/URLBinding.h"
#include "mozilla/dom/URLSearchParamsBinding.h"
using namespace mozilla;
@@ -221,29 +223,31 @@ SandboxCreateCrypto(JSContext* cx, JS::H
MOZ_ASSERT(native);
dom::Crypto* crypto = new dom::Crypto();
crypto->Init(native);
JS::RootedObject wrapped(cx, crypto->WrapObject(cx, nullptr));
return JS_DefineProperty(cx, obj, "crypto", wrapped, JSPROP_ENUMERATE);
}
+#ifdef MOZ_WEBRTC
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, nullptr));
return JS_DefineProperty(cx, obj, "rtcIdentityProvider", wrapped, JSPROP_ENUMERATE);
}
+#endif
static bool
SetFetchRequestFromValue(JSContext *cx, RequestOrUSVString& request,
const MutableHandleValue& requestOrUrl)
{
RequestOrUSVStringArgument requestHolder(request);
bool noMatch = true;
if (requestOrUrl.isObject() &&
@@ -893,18 +897,20 @@ xpc::GlobalProperties::Parse(JSContext*
} else if (!strcmp(name.ptr(), "btoa")) {
btoa = true;
} else if (!strcmp(name.ptr(), "Blob")) {
Blob = true;
} else if (!strcmp(name.ptr(), "File")) {
File = true;
} else if (!strcmp(name.ptr(), "crypto")) {
crypto = true;
+#ifdef MOZ_WEBRTC
} else if (!strcmp(name.ptr(), "rtcIdentityProvider")) {
rtcIdentityProvider = true;
+#endif
} else if (!strcmp(name.ptr(), "fetch")) {
fetch = true;
} else {
JS_ReportError(cx, "Unknown property name: %s", name.ptr());
return false;
}
}
return true;
@@ -954,18 +960,20 @@ xpc::GlobalProperties::Define(JSContext*
if (File &&
!dom::FileBinding::GetConstructorObject(cx, obj))
return false;
if (crypto && !SandboxCreateCrypto(cx, obj))
return false;
+#ifdef MOZ_WEBRTC
if (rtcIdentityProvider && !SandboxCreateRTCIdentityProvider(cx, obj))
return false;
+#endif
if (fetch && !SandboxCreateFetch(cx, obj))
return false;
return true;
}
nsresult