Bug 1181262 - Disabling more code under --disable-webrtc, r=dholbert,bwc

--HG--
rename : dom/media/RTCIdentityProviderRegistrar.cpp => dom/media/webrtc/RTCIdentityProviderRegistrar.cpp
rename : dom/media/RTCIdentityProviderRegistrar.h => dom/media/webrtc/RTCIdentityProviderRegistrar.h
extra : commitid : 1wyjSLjnSs8
extra : rebase_source : b7777f20ed69324e8572f34f4cb1246d704b2c65
This commit is contained in:
Martin Thomson 2015-07-08 12:27:45 -07:00
parent e740633931
commit 30fc9b669e
7 changed files with 36 additions and 16 deletions

View File

@ -60,8 +60,10 @@
#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"
@ -2549,6 +2551,7 @@ NS_DOMReadStructuredClone(JSContext* cx,
}
if (tag == SCTAG_DOM_RTC_CERTIFICATE) {
#ifdef MOZ_WEBRTC
nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(cx));
if (!global) {
return nullptr;
@ -2565,6 +2568,9 @@ NS_DOMReadStructuredClone(JSContext* cx,
}
}
return result;
#else
return nullptr;
#endif
}
// Don't know what this is. Bail.
@ -2591,12 +2597,14 @@ NS_DOMWriteStructuredClone(JSContext* cx,
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);

View File

@ -182,7 +182,6 @@ EXPORTS.mozilla.dom += [
'MediaDevices.h',
'MediaStreamError.h',
'MediaStreamTrack.h',
'RTCIdentityProviderRegistrar.h',
'TextTrack.h',
'TextTrackCue.h',
'TextTrackCueList.h',
@ -235,7 +234,6 @@ UNIFIED_SOURCES += [
'MP3Decoder.cpp',
'MP3Demuxer.cpp',
'MP3FrameParser.cpp',
'RTCIdentityProviderRegistrar.cpp',
'RtspMediaResource.cpp',
'SharedThreadPool.cpp',
'StreamBuffer.cpp',

View File

@ -22,12 +22,15 @@ EXPORTS += [
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 += [
@ -59,7 +62,6 @@ XPIDL_SOURCES += [
UNIFIED_SOURCES += [
'MediaEngineDefault.cpp',
'PeerIdentity.cpp',
'RTCCertificate.cpp',
]
EXPORTS.mozilla += [

View File

@ -374,16 +374,6 @@ WEBIDL_FILES = [
'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',
@ -602,6 +592,16 @@ if CONFIG['MOZ_WEBRTC']:
'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',
]
@ -754,7 +754,6 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'IccChangeEvent.webidl',
'ImageCaptureErrorEvent.webidl',
'MediaStreamEvent.webidl',
'MediaStreamTrackEvent.webidl',
'MozApplicationEvent.webidl',
'MozCellBroadcastEvent.webidl',
'MozClirModeEvent.webidl',
@ -775,8 +774,6 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'PopupBlockedEvent.webidl',
'ProgressEvent.webidl',
'RecordErrorEvent.webidl',
'RTCDataChannelEvent.webidl',
'RTCPeerConnectionIceEvent.webidl',
'ScrollViewChangeEvent.webidl',
'SelectionStateChangedEvent.webidl',
'StyleRuleChangeEvent.webidl',
@ -792,6 +789,13 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'USSDReceivedEvent.webidl',
]
if CONFIG['MOZ_WEBRTC']:
GENERATED_EVENTS_WEBIDL_FILES += [
'MediaStreamTrackEvent.webidl',
'RTCDataChannelEvent.webidl',
'RTCPeerConnectionIceEvent.webidl',
]
if CONFIG['MOZ_WEBSPEECH']:
GENERATED_EVENTS_WEBIDL_FILES += [
'SpeechRecognitionEvent.webidl',

View File

@ -37,7 +37,9 @@
#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"
@ -226,6 +228,7 @@ SandboxCreateCrypto(JSContext* cx, JS::HandleObject obj)
return JS_DefineProperty(cx, obj, "crypto", wrapped, JSPROP_ENUMERATE);
}
#ifdef MOZ_WEBRTC
static bool
SandboxCreateRTCIdentityProvider(JSContext* cx, JS::HandleObject obj)
{
@ -239,6 +242,7 @@ SandboxCreateRTCIdentityProvider(JSContext* cx, JS::HandleObject obj)
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,
@ -898,8 +902,10 @@ xpc::GlobalProperties::Parse(JSContext* cx, JS::HandleObject obj)
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 {
@ -959,8 +965,10 @@ xpc::GlobalProperties::Define(JSContext* cx, JS::HandleObject obj)
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;