From 6bd59d4de4335b1c01a9a16e6a872be06926b676 Mon Sep 17 00:00:00 2001 From: Fedor Date: Tue, 12 Mar 2019 19:36:48 +0300 Subject: [PATCH] Option disable GMP --- .../basilisk/installer/package-manifest.in | 2 + .../basilisk/modules/ContentCrashHandlers.jsm | 6 + .../basilisk/modules/PluginContent.jsm | 5 +- application/basilisk/modules/moz.build | 8 +- dom/ipc/ContentChild.cpp | 8 +- dom/ipc/ContentChild.h | 3 +- dom/ipc/ContentParent.cpp | 12 +- dom/ipc/ContentParent.h | 6 +- dom/ipc/{ => gmp}/PContent.ipdl | 0 dom/ipc/moz.build | 6 +- dom/ipc/nogmp/PContent.ipdl | 1012 +++++++++++++++++ dom/media/AbstractMediaDecoder.h | 6 + dom/media/DecoderDoctorDiagnostics.cpp | 2 + dom/media/DecoderDoctorDiagnostics.h | 6 + dom/media/MediaDecoder.cpp | 10 + dom/media/MediaDecoder.h | 8 + dom/media/MediaDecoderReader.h | 4 + dom/media/MediaDecoderReaderWrapper.h | 2 + dom/media/MediaDecoderStateMachine.cpp | 26 +- dom/media/MediaDecoderStateMachine.h | 2 + dom/media/MediaFormatReader.cpp | 11 +- dom/media/MediaFormatReader.h | 9 +- dom/media/MediaPrefs.h | 8 + dom/media/eme/MediaKeySystemAccess.cpp | 16 +- dom/media/fmp4/MP4Decoder.cpp | 2 + dom/media/gmp/GMPChild.cpp | 1 + dom/media/gmp/GMPParent.cpp | 1 + dom/media/gmp/GMPUtils.cpp | 14 +- dom/media/gmp/GMPUtils.h | 5 - dom/media/moz.build | 14 +- dom/media/platforms/PDMFactory.cpp | 17 +- dom/media/platforms/PDMFactory.h | 6 + dom/media/platforms/PlatformDecoderModule.h | 8 + dom/media/platforms/moz.build | 12 +- .../platforms/wmf/WMFVideoMFTManager.cpp | 2 +- .../platforms/wrappers/H264Converter.cpp | 8 +- dom/media/platforms/wrappers/H264Converter.h | 2 + dom/media/utils.cpp | 27 + dom/media/utils.h | 23 + dom/media/webaudio/BufferDecoder.cpp | 13 +- dom/media/webaudio/BufferDecoder.h | 10 +- dom/media/webaudio/MediaBufferDecoder.cpp | 11 +- dom/webidl/moz.build | 19 +- gfx/layers/ipc/PAPZCTreeManager.ipdl | 1 + ipc/app/moz.build | 2 +- ipc/contentproc/plugin-container.cpp | 4 +- layout/build/nsLayoutModule.cpp | 11 +- layout/reftests/reftest.list | 2 - mobile/android/app/mobile.js | 2 + mobile/android/base/moz.build | 11 +- .../android/components/AddonUpdateService.js | 4 + modules/libpref/init/all.js | 6 + toolkit/content/jar.mn | 4 +- toolkit/content/process-content.js | 4 + toolkit/forgetaboutsite/ForgetAboutSite.jsm | 2 + toolkit/forgetaboutsite/moz.build | 2 +- toolkit/moz.configure | 13 + .../mozapps/extensions/extensions.manifest | 2 + toolkit/mozapps/extensions/internal/moz.build | 9 +- toolkit/mozapps/extensions/jar.mn | 2 + toolkit/mozapps/extensions/moz.build | 7 +- .../mozapps/webextensions/extensions.manifest | 2 + toolkit/mozapps/webextensions/jar.mn | 2 + toolkit/mozapps/webextensions/moz.build | 7 +- toolkit/xre/nsEmbedFunctions.cpp | 10 + xpcom/build/XREChildData.h | 5 +- xpcom/build/nsXULAppAPI.h | 2 + 67 files changed, 1400 insertions(+), 89 deletions(-) rename dom/ipc/{ => gmp}/PContent.ipdl (100%) create mode 100644 dom/ipc/nogmp/PContent.ipdl create mode 100644 dom/media/utils.cpp create mode 100644 dom/media/utils.h diff --git a/application/basilisk/installer/package-manifest.in b/application/basilisk/installer/package-manifest.in index 7e6443bb5..e2920bf12 100644 --- a/application/basilisk/installer/package-manifest.in +++ b/application/basilisk/installer/package-manifest.in @@ -172,7 +172,9 @@ @RESPATH@/components/composer.xpt @RESPATH@/components/content_events.xpt @RESPATH@/components/content_html.xpt +#ifdef THE_GMP @RESPATH@/components/content_geckomediaplugins.xpt +#endif #ifdef MOZ_WEBRTC @RESPATH@/components/content_webrtc.xpt #endif diff --git a/application/basilisk/modules/ContentCrashHandlers.jsm b/application/basilisk/modules/ContentCrashHandlers.jsm index 488cc4f26..f9a895712 100644 --- a/application/basilisk/modules/ContentCrashHandlers.jsm +++ b/application/basilisk/modules/ContentCrashHandlers.jsm @@ -798,13 +798,17 @@ this.PluginCrashReporter = { this.crashReports = new Map(); Services.obs.addObserver(this, "plugin-crashed", false); +#ifdef THE_GMP Services.obs.addObserver(this, "gmp-plugin-crash", false); +#endif Services.obs.addObserver(this, "profile-after-change", false); }, uninit() { Services.obs.removeObserver(this, "plugin-crashed", false); +#ifdef THE_GMP Services.obs.removeObserver(this, "gmp-plugin-crash", false); +#endif Services.obs.removeObserver(this, "profile-after-change", false); this.initialized = false; }, @@ -829,6 +833,7 @@ this.PluginCrashReporter = { } break; } +#ifdef THE_GMP case "gmp-plugin-crash": { let propertyBag = subject; if (!(propertyBag instanceof Ci.nsIWritablePropertyBag2) || @@ -857,6 +862,7 @@ this.PluginCrashReporter = { } break; } +#endif case "profile-after-change": this.uninit(); break; diff --git a/application/basilisk/modules/PluginContent.jsm b/application/basilisk/modules/PluginContent.jsm index 622d608bc..db9ab60a0 100644 --- a/application/basilisk/modules/PluginContent.jsm +++ b/application/basilisk/modules/PluginContent.jsm @@ -953,11 +953,12 @@ PluginContent.prototype = { if (!(aEvent instanceof this.content.PluginCrashedEvent)) return; +#ifdef THE_GMP if (aEvent.gmpPlugin) { this.GMPCrashed(aEvent); return; } - +#endif if (!(target instanceof Ci.nsIObjectLoadingContent)) return; @@ -1105,6 +1106,7 @@ PluginContent.prototype = { } }, +#ifdef THE_GMP GMPCrashed: function(aEvent) { let target = aEvent.target; let pluginName = aEvent.pluginName; @@ -1116,6 +1118,7 @@ PluginContent.prototype = { // TODO: Throw exception? How did we get here? return; } +#endif let messageString = gNavigatorBundle.formatStringFromName("crashedpluginsMessage.title", diff --git a/application/basilisk/modules/moz.build b/application/basilisk/modules/moz.build index cd8f2ce62..171ff783b 100644 --- a/application/basilisk/modules/moz.build +++ b/application/basilisk/modules/moz.build @@ -11,7 +11,6 @@ EXTRA_JS_MODULES += [ 'BrowserUsageTelemetry.jsm', 'CastingApps.jsm', 'ContentClick.jsm', - 'ContentCrashHandlers.jsm', 'ContentLinkHandler.jsm', 'ContentObservers.jsm', 'ContentSearch.jsm', @@ -25,7 +24,6 @@ EXTRA_JS_MODULES += [ 'NetworkPrioritizer.jsm', 'offlineAppCache.jsm', 'PermissionUI.jsm', - 'PluginContent.jsm', 'ProcessHangMonitor.jsm', 'ReaderParent.jsm', 'RecentWindow.jsm', @@ -37,6 +35,12 @@ EXTRA_JS_MODULES += [ 'webrtcUI.jsm', ] +EXTRA_PP_JS_MODULES += [ + 'ContentCrashHandlers.jsm', + 'PluginContent.jsm', +] + + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': EXTRA_JS_MODULES += [ 'Windows8WindowFrameColor.jsm', diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index df771a2318..1df7ee57b 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -60,7 +60,9 @@ #include "mozilla/BasePrincipal.h" #include "mozilla/WebBrowserPersistDocumentChild.h" #include "imgLoader.h" +#ifdef THE_GMP #include "GMPServiceChild.h" +#endif #include "mozilla/Unused.h" @@ -167,7 +169,6 @@ #include "mozilla/net/NeckoMessageUtils.h" #include "mozilla/widget/PuppetBidiKeyboard.h" #include "mozilla/RemoteSpellCheckEngineChild.h" -#include "GMPServiceChild.h" #include "gfxPlatform.h" #include "nscore.h" // for NS_FREE_PERMANENT_DATA @@ -177,7 +178,9 @@ using namespace mozilla::dom::ipc; using namespace mozilla::dom::workers; using namespace mozilla::media; using namespace mozilla::embedding; +#ifdef THE_GMP using namespace mozilla::gmp; +#endif using namespace mozilla::hal_sandbox; using namespace mozilla::ipc; using namespace mozilla::layers; @@ -1126,7 +1129,7 @@ ContentChild::AllocPContentBridgeParent(mozilla::ipc::Transport* aTransport, ContentBridgeParent::Create(aTransport, aOtherProcess)); return mLastBridge; } - +#ifdef THE_GMP PGMPServiceChild* ContentChild::AllocPGMPServiceChild(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) @@ -1140,6 +1143,7 @@ ContentChild::RecvGMPsChanged(nsTArray&& capabilities) GeckoMediaPluginServiceChild::UpdateGMPCapabilities(Move(capabilities)); return true; } +#endif bool ContentChild::RecvInitRendering(Endpoint&& aCompositor, diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index f8ac9c14a..6467397cb 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -140,13 +140,14 @@ public: PContentBridgeChild* AllocPContentBridgeChild(mozilla::ipc::Transport* transport, base::ProcessId otherProcess) override; - +#ifdef THE_GMP PGMPServiceChild* AllocPGMPServiceChild(mozilla::ipc::Transport* transport, base::ProcessId otherProcess) override; bool RecvGMPsChanged(nsTArray&& capabilities) override; +#endif bool RecvInitRendering( diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a87e8eb14..b08ac04af 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -22,7 +22,9 @@ #include "AppProcessChecker.h" #include "AudioChannelService.h" #include "BlobParent.h" +#ifdef THE_GMP #include "GMPServiceParent.h" +#endif #include "HandlerServiceParent.h" #include "IHistory.h" #include "imgIContainer.h" @@ -240,7 +242,9 @@ using namespace mozilla::dom::power; using namespace mozilla::media; using namespace mozilla::embedding; using namespace mozilla::gfx; +#ifdef THE_GMP using namespace mozilla::gmp; +#endif using namespace mozilla::hal; using namespace mozilla::ipc; using namespace mozilla::layers; @@ -875,11 +879,13 @@ static nsIDocShell* GetOpenerDocShellHelper(Element* aFrameElement) return docShell; } +#ifdef THE_GMP bool ContentParent::RecvCreateGMPService() { return PGMPService::Open(this); } +#endif bool ContentParent::RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID) @@ -1282,9 +1288,10 @@ ContentParent::Init() #endif } #endif - +#ifdef THE_GMP RefPtr gmps(GeckoMediaPluginServiceParent::GetSingleton()); gmps->UpdateContentProcessGMPCapabilities(); +#endif } void @@ -2580,13 +2587,14 @@ ContentParent::Observe(nsISupports* aSubject, return NS_OK; } +#ifdef THE_GMP PGMPServiceParent* ContentParent::AllocPGMPServiceParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { return GMPServiceParent::Create(aTransport, aOtherProcess); } - +#endif PBackgroundParent* ContentParent::AllocPBackgroundParent(Transport* aTransport, ProcessId aOtherProcess) diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index e6bd13d2a..86cc902ab 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -238,7 +238,9 @@ public: virtual bool RecvBridgeToChildProcess(const ContentParentId& aCpId) override; +#ifdef THE_GMP virtual bool RecvCreateGMPService() override; +#endif virtual bool RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID) override; @@ -670,11 +672,11 @@ private: static bool AllocateLayerTreeId(ContentParent* aContent, TabParent* aTopLevel, const TabId& aTabId, uint64_t* aId); - +#ifdef THE_GMP PGMPServiceParent* AllocPGMPServiceParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) override; - +#endif PBackgroundParent* AllocPBackgroundParent(Transport* aTransport, ProcessId aOtherProcess) override; diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/gmp/PContent.ipdl similarity index 100% rename from dom/ipc/PContent.ipdl rename to dom/ipc/gmp/PContent.ipdl diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 5629ab2c6..47a7b9f6e 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -82,7 +82,6 @@ IPDL_SOURCES += [ 'PBrowser.ipdl', 'PBrowserOrId.ipdlh', 'PColorPicker.ipdl', - 'PContent.ipdl', 'PContentBridge.ipdl', 'PContentPermission.ipdlh', 'PContentPermissionRequest.ipdl', @@ -96,6 +95,11 @@ IPDL_SOURCES += [ 'ServiceWorkerConfiguration.ipdlh', ] +if CONFIG['THE_GMP']: + IPDL_SOURCES += ['gmp/PContent.ipdl',] +else: + IPDL_SOURCES += ['nogmp/PContent.ipdl',] + include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/dom/ipc/nogmp/PContent.ipdl b/dom/ipc/nogmp/PContent.ipdl new file mode 100644 index 000000000..0a9d50568 --- /dev/null +++ b/dom/ipc/nogmp/PContent.ipdl @@ -0,0 +1,1012 @@ +/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ +/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */ +/* 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 protocol PBackground; +include protocol PBlob; +include protocol PBrowser; +include protocol PCompositorBridge; +include protocol PContentBridge; +include protocol PContentPermissionRequest; +include protocol PCycleCollectWithLogs; +include protocol PPSMContentDownloader; +include protocol PExternalHelperApp; +include protocol PHandlerService; +include protocol PFileDescriptorSet; +include protocol PHal; +include protocol PHeapSnapshotTempFileHelper; +include protocol PProcessHangMonitor; +include protocol PImageBridge; +include protocol PMedia; +include protocol PMemoryReportRequest; +include protocol PNecko; +// FIXME This is pretty ridiculous, but we have to keep the order of the +// following 4 includes, or the parser is confused about PGMPContent +// bridging PContent and PGMP. As soon as it registers the bridge between +// PContent and PPluginModule it seems to think that PContent's parent and +// child live in the same process! +include protocol PPluginModule; +include protocol PPrinting; +include protocol PSendStream; +include protocol POfflineCacheUpdate; +include protocol PRenderFrame; +include protocol PScreenManager; +include protocol PSpeechSynthesis; +include protocol PStorage; +include protocol PTestShell; +include protocol PJavaScript; +include protocol PRemoteSpellcheckEngine; +include protocol PWebBrowserPersistDocument; +include protocol PWebrtcGlobal; +include protocol PPresentation; +include protocol PVideoDecoderManager; +include protocol PFlyWebPublishedServer; +include DOMTypes; +include JavaScriptTypes; +include InputStreamParams; +include PTabContext; +include URIParams; +include PluginTypes; +include ProtocolTypes; +include PBackgroundSharedTypes; +include PContentPermission; +include ServiceWorkerConfiguration; +include GraphicsMessages; +include ProfilerTypes; + +// Workaround to prevent error if PContentChild.cpp & PContentBridgeParent.cpp +// are put into different UnifiedProtocolsXX.cpp files. +// XXX Remove this once bug 1069073 is fixed +include "mozilla/dom/PContentBridgeParent.h"; + +using GeoPosition from "nsGeoPositionIPCSerialiser.h"; +using AlertNotificationType from "mozilla/AlertNotificationIPCSerializer.h"; + +using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h"; +using struct SubstitutionMapping from "mozilla/chrome/RegistryMessageUtils.h"; +using struct OverrideMapping from "mozilla/chrome/RegistryMessageUtils.h"; +using base::ChildPrivileges from "base/process_util.h"; +using base::ProcessId from "base/process.h"; +using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h"; +using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h"; +using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; +using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; +using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h"; +using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h"; +using mozilla::gfx::IntSize from "mozilla/gfx/2D.h"; +using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h"; +using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h"; +using mozilla::LayoutDeviceIntPoint from "Units.h"; +using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h"; +using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h"; +using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h"; +using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h"; +using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h"; +using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; +using struct mozilla::dom::FlyWebPublishOptions from "mozilla/dom/FlyWebPublishOptionsIPCSerializer.h"; + +union ChromeRegistryItem +{ + ChromePackage; + OverrideMapping; + SubstitutionMapping; +}; + +namespace mozilla { +namespace dom { + +struct FontListEntry { + nsString familyName; + nsString faceName; + nsCString filepath; + uint16_t weight; + int16_t stretch; + uint8_t italic; + uint8_t index; + bool isHidden; +}; + +union PrefValue { + nsCString; + int32_t; + bool; +}; + +union MaybePrefValue { + PrefValue; + null_t; +}; + +struct PrefSetting { + nsCString name; + MaybePrefValue defaultValue; + MaybePrefValue userValue; +}; + +struct DataStorageItem { + nsCString key; + nsCString value; + DataStorageType type; +}; + +// Note: Any changes to this structure should also be changed in +// FileSystemUpdate below. +struct VolumeInfo { + nsString name; + nsString mountPoint; + int32_t volState; + int32_t mountGeneration; + bool isMediaPresent; + bool isSharing; + bool isFormatting; + bool isFake; + bool isUnmounting; + bool isRemovable; + bool isHotSwappable; +}; + +struct ClipboardCapabilities { + bool supportsSelectionClipboard; + bool supportsFindClipboard; +}; + +union MaybeFileDesc { + FileDescriptor; + void_t; +}; + +union FileDescOrError { + FileDescriptor; + nsresult; +}; + +struct DomainPolicyClone +{ + bool active; + URIParams[] blacklist; + URIParams[] whitelist; + URIParams[] superBlacklist; + URIParams[] superWhitelist; +}; + + + +struct FrameScriptInfo +{ + nsString url; + bool runInGlobalScope; +}; + +struct AndroidSystemInfo +{ + nsString device; + nsString manufacturer; + nsString release_version; + nsString hardware; + uint32_t sdk_version; + bool isTablet; +}; + +struct GetFilesResponseSuccess +{ + PBlob[] blobs; +}; + +struct GetFilesResponseFailure +{ + nsresult errorCode; +}; + +union GetFilesResponseResult +{ + GetFilesResponseSuccess; + GetFilesResponseFailure; +}; + +struct BlobURLRegistrationData +{ + nsCString url; + PBlob blob; + Principal principal; +}; + +nested(upto inside_cpow) sync protocol PContent +{ + parent spawns PPluginModule; + + parent opens PProcessHangMonitor; + child opens PBackground; + + manages PBlob; + manages PBrowser; + manages PContentPermissionRequest; + manages PCycleCollectWithLogs; + manages PPSMContentDownloader; + manages PExternalHelperApp; + manages PFileDescriptorSet; + manages PHal; + manages PHandlerService; + manages PHeapSnapshotTempFileHelper; + manages PMedia; + manages PMemoryReportRequest; + manages PNecko; + manages POfflineCacheUpdate; + manages PPrinting; + manages PSendStream; + manages PScreenManager; + manages PSpeechSynthesis; + manages PStorage; + manages PTestShell; + manages PJavaScript; + manages PRemoteSpellcheckEngine; + manages PWebBrowserPersistDocument; + manages PWebrtcGlobal; + manages PPresentation; + manages PFlyWebPublishedServer; + +both: + // Depending on exactly how the new browser is being created, it might be + // created from either the child or parent process! + // + // The child creates the PBrowser as part of + // TabChild::BrowserFrameProvideWindow (which happens when the child's + // content calls window.open()), and the parent creates the PBrowser as part + // of ContentParent::CreateBrowserOrApp. + // + // When the parent constructs a PBrowser, the child trusts the app token and + // other attributes it receives from the parent. In that case, the + // context should be FrameIPCTabContext. + // + // When the child constructs a PBrowser, the parent doesn't trust the app + // token it receives from the child. In this case, context must have type + // PopupIPCTabContext. The browser created using a PopupIPCTabContext has + // the opener PBrowser's app-id and containing-app-id. The parent checks + // that if the opener is a browser element, the context is also for a + // browser element. + // + // This allows the parent to prevent a malicious child from escalating its + // privileges by requesting a PBrowser corresponding to a highly-privileged + // app; the child can only request privileges for an app which the child has + // access to (in the form of a TabChild). + // + // Keep the last 3 attributes in sync with GetProcessAttributes! + async PBrowser(TabId tabId, IPCTabContext context, uint32_t chromeFlags, + ContentParentId cpId, bool isForApp, bool isForBrowser); + + async PBlob(BlobConstructorParams params); + + async PFileDescriptorSet(FileDescriptor fd); + + // For parent->child, aBrowser must be non-null; aOuterWindowID can + // be 0 to indicate the browser's current root document, or nonzero + // to persist a subdocument. For child->parent, arguments are + // ignored and should be null/zero. + async PWebBrowserPersistDocument(nullable PBrowser aBrowser, + uint64_t aOuterWindowID); + +child: + // Give the content process its endpoints to the compositor. + async InitRendering( + Endpoint compositor, + Endpoint imageBridge, + Endpoint video); + + // Re-create the rendering stack using the given endpoints. This is sent + // after the compositor process has crashed. The new endpoints may be to a + // newly launched GPU process, or the compositor thread of the UI process. + async ReinitRendering( + Endpoint compositor, + Endpoint bridge, + Endpoint video); + + /** + * Enable system-level sandboxing features, if available. Can + * usually only be performed zero or one times. The child may + * abnormally exit if this fails; the details are OS-specific. + */ + async SetProcessSandbox(MaybeFileDesc aBroker); + + async PMemoryReportRequest(uint32_t generation, bool anonymize, + bool minimizeMemoryUsage, MaybeFileDesc DMDFile); + + /** + * Sent to notify that aTabId has been allocated aLayersId + */ + async NotifyLayerAllocated(TabId aTabId, uint64_t aLayersId); + + async SpeakerManagerNotify(); + + /** + * Communication between the PuppetBidiKeyboard and the actual + * BidiKeyboard hosted by the parent + */ + async BidiKeyboardNotify(bool isLangRTL, bool haveBidiKeyboards); + + /** + * Dump this process's GC and CC logs to the provided files. + * + * For documentation on the other args, see dumpGCAndCCLogsToFile in + * nsIMemoryInfoDumper.idl + */ + async PCycleCollectWithLogs(bool dumpAllTraces, + FileDescriptor gcLog, + FileDescriptor ccLog); + + async PTestShell(); + + async RegisterChrome(ChromePackage[] packages, SubstitutionMapping[] substitutions, + OverrideMapping[] overrides, nsCString locale, bool reset); + async RegisterChromeItem(ChromeRegistryItem item); + + async ClearImageCache(bool privateLoader, bool chrome); + + async SetOffline(bool offline); + async SetConnectivity(bool connectivity); + + async NotifyVisited(URIParams uri); + + async PreferenceUpdate(PrefSetting pref); + async VarUpdate(GfxVarUpdate var); + + async DataStoragePut(nsString aFilename, DataStorageItem aItem); + async DataStorageRemove(nsString aFilename, nsCString aKey, DataStorageType aType); + async DataStorageClear(nsString aFilename); + + async NotifyAlertsObserver(nsCString topic, nsString data); + + async GeolocationUpdate(GeoPosition somewhere); + + async GeolocationError(uint16_t errorCode); + + async UpdateDictionaryList(nsString[] dictionaries); + + // nsIPermissionManager messages + async AddPermission(Permission permission); + + async Volumes(VolumeInfo[] volumes); + + async FlushMemory(nsString reason); + + async GarbageCollect(); + async CycleCollect(); + + /** + * Start accessibility engine in content process. + * @param aMsaaID is an a11y-specific unique id for the content process + * that is generated by the chrome process. Only used on + * Windows; pass 0 on other platforms. + */ + async ActivateA11y(uint32_t aMsaaID); + + /** + * Shutdown accessibility engine in content process (if not in use). + */ + async ShutdownA11y(); + + async AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName, + nsCString ID, nsCString vendor); + async AppInit(); + + /** + * Send ServiceWorkerRegistrationData to child process. + */ + async InitServiceWorkers(ServiceWorkerConfiguration aConfig); + + /** + * Send BlobURLRegistrationData to child process. + */ + async InitBlobURLs(BlobURLRegistrationData[] registrations); + + // Notify child that last-pb-context-exited notification was observed + async LastPrivateDocShellDestroyed(); + + // Note: Any changes to this structure should also be changed in + // VolumeInfo above. + async FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState, + int32_t mountGeneration, bool isMediaPresent, + bool isSharing, bool isFormatting, bool isFake, + bool isUnmounting, bool isRemovable, bool isHotSwappable); + + // Notify volume is removed. + async VolumeRemoved(nsString fsName); + + async NotifyProcessPriorityChanged(ProcessPriority priority); + async MinimizeMemoryUsage(); + + /** + * Used to manage nsIStyleSheetService across processes. + */ + async LoadAndRegisterSheet(URIParams uri, uint32_t type); + async UnregisterSheet(URIParams uri, uint32_t type); + + async NotifyPhoneStateChange(nsString newState); + + /** + * Notify idle observers in the child + */ + async NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str); + + /** + * Called during plugin initialization to map a plugin id to a child process + * id. + */ + async AssociatePluginId(uint32_t aPluginId, ProcessId aProcessId); + + /** + * This call is used by async plugin initialization to notify the + * PluginModuleContentParent that the PluginModuleChromeParent's async + * init has completed. + */ + async LoadPluginResult(uint32_t aPluginId, bool aResult); + + async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action); + + async EndDragSession(bool aDoneDrag, bool aUserCancelled, + LayoutDeviceIntPoint aDragEndPoint); + + async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, OptionalURIParams aDomain); + + /** + * Notify the child to shutdown. The child will in turn call FinishShutdown + * and let the parent close the channel. + */ + async Shutdown(); + + async LoadProcessScript(nsString url); + + /** + * Requests a full native update of a native plugin child window. This is + * a Windows specific call. + */ + async UpdateWindow(uintptr_t aChildId); + + /** + * Notify the child that presentation receiver has been launched with the + * correspondent iframe. + */ + async NotifyPresentationReceiverLaunched(PBrowser aIframe, nsString aSessionId); + + /** + * Notify the child that the info about a presentation receiver needs to be + * cleaned up. + */ + async NotifyPresentationReceiverCleanUp(nsString aSessionId); + + /** + * Notify the child that cache is emptied. + */ + async NotifyEmptyHTTPCache(); + + /** + * Send a `push` event without data to a service worker in the child. + */ + async Push(nsCString scope, Principal principal, nsString messageId); + + /** + * Send a `push` event with data to a service worker in the child. + */ + async PushWithData(nsCString scope, Principal principal, + nsString messageId, uint8_t[] data); + + /** + * Send a `pushsubscriptionchange` event to a service worker in the child. + */ + async PushSubscriptionChange(nsCString scope, Principal principal); + + /** + * Send a Push error message to all service worker clients in the child. + */ + async PushError(nsCString scope, Principal principal, nsString message, + uint32_t flags); + + /** + * Windows specific: associate this content process with the browsers + * audio session. + */ + async SetAudioSessionData(nsID aID, + nsString aDisplayName, + nsString aIconPath); + + async GetFilesResponse(nsID aID, GetFilesResponseResult aResult); + + async BlobURLRegistration(nsCString aURI, PBlob aBlob, + Principal aPrincipal); + + async BlobURLUnregistration(nsCString aURI); + +parent: + /** + * Tell the content process some attributes of itself. This is + * among the first information queried by content processes after + * startup. (The message is sync to allow the content process to + * control when it receives the information.) + * + * |id| is a unique ID among all subprocesses. When |isForApp && + * isForBrowser|, we're loading for an app. When + * |isForBrowser|, we're loading . When |!isForApp && + * !isForBrowser|, we're probably loading . + * + * Keep the return values in sync with PBrowser()! + */ + sync GetProcessAttributes() + returns (ContentParentId cpId, bool isForApp, bool isForBrowser); + sync GetXPCOMProcessAttributes() + returns (bool isOffline, bool isConnected, + bool isLangRTL, + bool haveBidiKeyboards, nsString[] dictionaries, + ClipboardCapabilities clipboardCaps, + DomainPolicyClone domainPolicy, + StructuredCloneData initialData, + OptionalURIParams userContentSheetURL); + + sync CreateChildProcess(IPCTabContext context, + ProcessPriority priority, + TabId openerTabId) + returns (ContentParentId cpId, bool isForApp, bool isForBrowser, TabId tabId); + sync BridgeToChildProcess(ContentParentId cpId); + + /** + * This call connects the content process to a plugin process. While this + * call runs, a new PluginModuleParent will be created in the ContentChild + * via bridging. The corresponding PluginModuleChild will live in the plugin + * process. + */ + sync LoadPlugin(uint32_t aPluginId) returns (nsresult aResult, uint32_t aRunID); + + /** + * This call is used by asynchronous plugin instantiation to notify the + * content parent that it is now safe to initiate the plugin bridge for + * the specified plugin id. When this call returns, the requested bridge + * connection has been made. + */ + sync ConnectPluginBridge(uint32_t aPluginId) returns (nsresult rv); + + /** + * Return the current blocklist state for a particular plugin. + */ + sync GetBlocklistState(uint32_t aPluginId) returns (uint32_t aState); + + /** + * This call returns the set of plugins loaded in the chrome + * process. However, in many cases this set will not have changed since the + * last FindPlugins message. Consequently, the chrome process increments an + * epoch number every time the set of plugins changes. The content process + * sends up the last epoch it observed. If the epochs are the same, the + * chrome process returns no plugins. Otherwise it returns a complete list. + * + * |pluginEpoch| is the epoch last observed by the content + * process. |newPluginEpoch| is the current epoch in the chrome process. If + * |pluginEpoch == newPluginEpoch|, then |plugins| will be left empty. + */ + sync FindPlugins(uint32_t pluginEpoch) returns (nsresult aResult, PluginTag[] plugins, uint32_t newPluginEpoch); + + async PJavaScript(); + + async PRemoteSpellcheckEngine(); + + /** + * Is this token compatible with the provided version? + * + * |version| The offered version to test + * Returns |True| if the offered version is compatible + */ + sync NSSU2FTokenIsCompatibleVersion(nsString version) + returns (bool result); + + /** + * Return whether the provided KeyHandle belongs to this Token + * + * |keyHandle| Key Handle to evaluate. + * Returns |True| if the Key Handle is ours. + */ + sync NSSU2FTokenIsRegistered(uint8_t[] keyHandle) + returns (bool isValidKeyHandle); + + /** + * Generates a public/private keypair for the provided application + * and challenge, returning the pubkey, challenge response, and + * key handle in the registration data. + * + * |application| The FIDO Application data to associate with the key. + * |challenge| The Challenge to satisfy in the response. + * |registration| An array containing the pubkey, challenge response, + * and key handle. + */ + sync NSSU2FTokenRegister(uint8_t[] application, uint8_t[] challenge) + returns (uint8_t[] registration); + + /** + * Creates a signature over the "param" arguments using the private key + * provided in the key handle argument. + * + * |application| The FIDO Application data to associate with the key. + * |challenge| The Challenge to satisfy in the response. + * |keyHandle| The Key Handle opaque object to use. + * |signature| The resulting signature. + */ + sync NSSU2FTokenSign(uint8_t[] application, uint8_t[] challenge, + uint8_t[] keyHandle) + returns (uint8_t[] signature); + + sync IsSecureURI(uint32_t type, URIParams uri, uint32_t flags) + returns (bool isSecureURI); + + sync GetLookAndFeelCache() + returns (LookAndFeelInt[] lookAndFeelIntCache); + + nested(inside_cpow) async PHal(); + + async PHeapSnapshotTempFileHelper(); + + async PNecko(); + + async PPrinting(); + + async PSendStream(); + + nested(inside_sync) sync PScreenManager() + returns (uint32_t numberOfScreens, + float systemDefaultScale, + bool success); + + async PSpeechSynthesis(); + + nested(inside_cpow) async PStorage(); + + async PMedia(); + + async PWebrtcGlobal(); + + async PPresentation(); + + async PFlyWebPublishedServer(nsString name, FlyWebPublishOptions params); + + // Services remoting + + async StartVisitedQuery(URIParams uri); + async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags); + async SetURITitle(URIParams uri, nsString title); + + async LoadURIExternal(URIParams uri, PBrowser windowContext); + async ExtProtocolChannelConnectParent(uint32_t registrarId); + + // PrefService message + sync ReadPrefsArray() returns (PrefSetting[] prefs) verify; + sync GetGfxVars() returns (GfxVarUpdate[] vars); + + sync ReadFontList() returns (FontListEntry[] retValue); + + sync ReadDataStorageArray(nsString aFilename) + returns (DataStorageItem[] retValue); + + sync SyncMessage(nsString aMessage, ClonedMessageData aData, + CpowEntry[] aCpows, Principal aPrincipal) + returns (StructuredCloneData[] retval); + + nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData, + CpowEntry[] aCpows, Principal aPrincipal) + returns (StructuredCloneData[] retval); + + async ShowAlert(AlertNotificationType alert); + + async CloseAlert(nsString name, Principal principal); + + async DisableNotifications(Principal principal); + + async OpenNotificationSettings(Principal principal); + + async PPSMContentDownloader(uint32_t aCertType); + + async PExternalHelperApp(OptionalURIParams uri, + nsCString aMimeContentType, + nsCString aContentDisposition, + uint32_t aContentDispositionHint, + nsString aContentDispositionFilename, + bool aForceSave, + int64_t aContentLength, + bool aWasFileChannel, + OptionalURIParams aReferrer, + nullable PBrowser aBrowser); + + async PHandlerService(); + + async AddGeolocationListener(Principal principal, bool highAccuracy); + async RemoveGeolocationListener(); + async SetGeolocationHigherAccuracy(bool enable); + + async ConsoleMessage(nsString message); + async ScriptError(nsString message, nsString sourceName, nsString sourceLine, + uint32_t lineNumber, uint32_t colNumber, uint32_t flags, + nsCString category); + + // nsIPermissionManager messages + sync ReadPermissions() returns (Permission[] permissions); + + // Places the items within dataTransfer on the clipboard. + async SetClipboard(IPCDataTransfer aDataTransfer, + bool aIsPrivateData, + Principal aRequestingPrincipal, + int32_t aWhichClipboard); + + // Given a list of supported types, returns the clipboard data for the + // first type that matches. + sync GetClipboard(nsCString[] aTypes, int32_t aWhichClipboard) + returns (IPCDataTransfer dataTransfer); + + // Clears the clipboard. + async EmptyClipboard(int32_t aWhichClipboard); + + // Returns true if data of one of the specified types is on the clipboard. + sync ClipboardHasType(nsCString[] aTypes, int32_t aWhichClipboard) + returns (bool hasType); + + sync GetSystemColors(uint32_t colorsCount) + returns (uint32_t[] colors); + + sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize) + returns (uint8_t[] bits); + + sync GetShowPasswordSetting() + returns (bool showPassword); + + // Notify the parent of the presence or absence of private docshells + async PrivateDocShellsExist(bool aExist); + + // Tell the parent that the child has gone idle for the first time + async FirstIdle(); + + async AudioChannelServiceStatus(bool aActiveTelephonyChannel, + bool aContentOrNormalChannel, + bool aAnyActiveChannel); + + async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden); + + // called by the child (test code only) to propagate volume changes to the parent + async CreateFakeVolume(nsString fsName, nsString mountPoint); + async SetFakeVolumeState(nsString fsName, int32_t fsState); + async RemoveFakeVolume(nsString fsName); + + sync KeywordToURI(nsCString keyword) + returns (nsString providerName, OptionalInputStreamParams postData, OptionalURIParams uri); + + sync NotifyKeywordSearchLoading(nsString providerName, nsString keyword); + + async CopyFavicon(URIParams oldURI, URIParams newURI, Principal aLoadingPrincipal, bool isPrivate); + + // Tell the compositor to allocate a layer tree id for nested remote mozbrowsers. + sync AllocateLayerTreeId(ContentParentId cpId, TabId tabId) + returns (uint64_t id); + async DeallocateLayerTreeId(uint64_t id); + + sync SpeakerManagerForceSpeaker(bool aEnable); + + sync SpeakerManagerGetSpeakerStatus() + returns (bool value); + + /** + * Notifies the parent about a recording device is starting or shutdown. + * @param recordingStatus starting or shutdown + * @param pageURL URL that request that changing the recording status + * @param isAudio recording start with microphone + * @param isVideo recording start with camera + */ + async RecordingDeviceEvents(nsString recordingStatus, + nsString pageURL, + bool isAudio, + bool isVideo); + + sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, nsCString aFailureCode, + bool aSuccess); + + // Graphics errors + async GraphicsError(nsCString aError); + + // Driver crash guards. aGuardType must be a member of CrashGuardType. + sync BeginDriverCrashGuard(uint32_t aGuardType) returns (bool crashDetected); + sync EndDriverCrashGuard(uint32_t aGuardType); + + async AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS); + async RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS); + + /** + * This message is only used on X11 platforms. + * + * Send a dup of the plugin process's X socket to the parent + * process. In theory, this scheme keeps the plugin's X resources + * around until after both the plugin process shuts down *and* the + * parent process closes the dup fd. This is used to prevent the + * parent process from crashing on X errors if, e.g., the plugin + * crashes *just before* a repaint and the parent process tries to + * use the newly-invalid surface. + */ + async BackUpXResources(FileDescriptor aXSocketFd); + + sync OpenAnonymousTemporaryFile() returns (FileDescOrError aFD); + + /** + * Keygen requires us to call it after a element is parsed and + * before one is submitted. This is urgent because an extension might use + * a CPOW to synchronously submit a keygen element. + */ + nested(inside_cpow) sync KeygenProcessValue(nsString oldValue, + nsString challenge, + nsString keytype, + nsString keyparams) + returns (nsString newValue); + + /** + * Called to provide the options for elements. + */ + sync KeygenProvideContent() + returns (nsString aAttribute, nsString[] aContent); + + /** + * Tell the chrome process there is an creation of PBrowser. + * return a system-wise unique Id. + */ + sync AllocateTabId(TabId openerTabId, IPCTabContext context, ContentParentId cpId) + returns (TabId tabId); + async DeallocateTabId(TabId tabId, + ContentParentId cpId, + bool aMarkedDestroying); + + /** + * Tell the chrome process there is a destruction of PBrowser(Tab) + */ + async NotifyTabDestroying(TabId tabId, + ContentParentId cpId); + /** + * Starts an offline application cache update. + * @param manifestURI + * URI of the manifest to fetch, the application cache group ID + * @param documentURI + * URI of the document that referred the manifest + * @param loadingPrincipal + * Principal of the document that referred the manifest + * @param stickDocument + * True if the update was initiated by a document load that referred + * a manifest. + * False if the update was initiated by applicationCache.update() call. + * + * Tells the update to carry the documentURI to a potential separate + * update of implicit (master) items. + * + * Why this argument? If the document was not found in an offline cache + * before load and refers a manifest and this manifest itself has not + * been changed since the last fetch, we will not do the application + * cache group update. But we must cache the document (identified by the + * documentURI). This argument will ensure that a previously uncached + * document will get cached and that we don't re-cache a document that + * has already been cached (stickDocument=false). + * @param tabId + * To identify which tab owns the app. + */ + async POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI, + PrincipalInfo loadingPrincipal, bool stickDocument); + + /** + * Sets "offline-app" permission for the principal. Called when we hit + * a web app with the manifest attribute in and + * offline-apps.allow_by_default is set to true. + */ + async SetOfflinePermission(Principal principal); + + /** + * Notifies the parent to continue shutting down after the child performs + * its shutdown tasks. + */ + async FinishShutdown(); + + async UpdateDropEffect(uint32_t aDragAction, uint32_t aDropEffect); + + /** + * Initiates an asynchronous request for permission for the + * provided principal. + * + * @param aRequests + * The array of permissions to request. + * @param aPrincipal + * The principal of the request. + * @param tabId + * To identify which tab issues this request. + * + * NOTE: The principal is untrusted in the parent process. Only + * principals that can live in the content process should + * provided. + */ + async PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal, + TabId tabId); + + /** + * Request graphics initialization information from the parent. + */ + sync GetGraphicsDeviceInitData() + returns (ContentDeviceData aData); + + sync CreateWindow(nullable PBrowser aThisTab, + PBrowser aNewTab, + PRenderFrame aRenderFrame, + uint32_t aChromeFlags, + bool aCalledFromJS, + bool aPositionSpecified, + bool aSizeSpecified, + nsCString aFeatures, + nsCString aBaseURI, + DocShellOriginAttributes aOpenerOriginAttributes, + float aFullZoom) + returns (nsresult rv, + bool windowOpened, + FrameScriptInfo[] frameScripts, + nsCString urlToLoad, + TextureFactoryIdentifier textureFactoryIdentifier, + uint64_t layersId); + + sync GetAndroidSystemInfo() + returns (AndroidSystemInfo info); + + /** + * Tells the parent to ungrab the pointer on the default display. + * + * This is for GTK platforms where we have to ensure the pointer ungrab happens in the + * chrome process as that's the process that receives the pointer event. + */ + sync UngrabPointer(uint32_t time); + + sync RemovePermission(Principal principal, nsCString permissionType) returns (nsresult rv); + + /** + * Tell the parent that a decoder's' benchmark has been completed. + * The result can then be stored in permanent storage. + */ + async NotifyBenchmarkResult(nsString aCodecName, uint32_t aDecodeFPS); + + /** + * Notify `push-message` observers without data in the parent. + */ + async NotifyPushObservers(nsCString scope, Principal principal, + nsString messageId); + + /** + * Notify `push-message` observers with data in the parent. + */ + async NotifyPushObserversWithData(nsCString scope, Principal principal, + nsString messageId, uint8_t[] data); + + /** + * Notify `push-subscription-change` observers in the parent. + */ + async NotifyPushSubscriptionChangeObservers(nsCString scope, + Principal principal); + + /** + * Tell the parent process that the child process is low on memory. This + * allows the parent process to save a memory report that can potentially be + * sent with a crash report from the content process. + */ + async NotifyLowMemory(); + + async GetFilesRequest(nsID aID, nsString aDirectory, bool aRecursiveFlag); + async DeleteGetFilesRequest(nsID aID); + + async StoreAndBroadcastBlobURLRegistration(nsCString url, PBlob blob, + Principal principal); + + async UnstoreAndBroadcastBlobURLUnregistration(nsCString url); + + sync GetA11yContentId() returns (uint32_t aContentId); + +both: + async AsyncMessage(nsString aMessage, CpowEntry[] aCpows, + Principal aPrincipal, ClonedMessageData aData); + + /** + * Notify `push-subscription-modified` observers in the parent and child. + */ + async NotifyPushSubscriptionModifiedObservers(nsCString scope, + Principal principal); +}; + +} +} diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h index a0f04ec98..c83333d5b 100644 --- a/dom/media/AbstractMediaDecoder.h +++ b/dom/media/AbstractMediaDecoder.h @@ -17,7 +17,9 @@ #include "nsDataHashtable.h" #include "nsThreadUtils.h" +#ifdef THE_GMP class GMPCrashHelper; +#endif namespace mozilla { @@ -31,7 +33,9 @@ class MediaResource; class ReentrantMonitor; class VideoFrameContainer; class MediaDecoderOwner; +#ifdef MOZ_EME class CDMProxy; +#endif typedef nsDataHashtable MetadataTags; @@ -111,7 +115,9 @@ public: // Set by Reader if the current audio track can be offloaded virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio) {} +#ifdef THE_GMP virtual already_AddRefed GetCrashHelper() { return nullptr; } +#endif // Stack based class to assist in notifying the frame statistics of // parsed and decoded frames. Use inside video demux & decode functions diff --git a/dom/media/DecoderDoctorDiagnostics.cpp b/dom/media/DecoderDoctorDiagnostics.cpp index 91c2d8dfb..0452c4859 100644 --- a/dom/media/DecoderDoctorDiagnostics.cpp +++ b/dom/media/DecoderDoctorDiagnostics.cpp @@ -846,6 +846,7 @@ DecoderDoctorDiagnostics::GetDescription() const if (mFFmpegFailedToLoad) { s += ", Linux platform decoder failed to load"; } +#ifdef THE_GMP if (mGMPPDMFailedToStartup) { s += ", GMP PDM failed to startup"; } else if (!mGMP.IsEmpty()) { @@ -853,6 +854,7 @@ DecoderDoctorDiagnostics::GetDescription() const s += mGMP; s += "'"; } +#endif break; case eMediaKeySystemAccessRequest: s = "key system='"; diff --git a/dom/media/DecoderDoctorDiagnostics.h b/dom/media/DecoderDoctorDiagnostics.h index 6ed04cfe3..1ae29f5b5 100644 --- a/dom/media/DecoderDoctorDiagnostics.h +++ b/dom/media/DecoderDoctorDiagnostics.h @@ -79,14 +79,18 @@ public: void SetFFmpegFailedToLoad() { mFFmpegFailedToLoad = true; } bool DidFFmpegFailToLoad() const { return mFFmpegFailedToLoad; } +#ifdef THE_GMP void SetGMPPDMFailedToStartup() { mGMPPDMFailedToStartup = true; } bool DidGMPPDMFailToStartup() const { return mGMPPDMFailedToStartup; } +#endif void SetVideoNotSupported() { mVideoNotSupported = true; } void SetAudioNotSupported() { mAudioNotSupported = true; } +#ifdef THE_GMP void SetGMP(const nsACString& aGMP) { mGMP = aGMP; } const nsACString& GMP() const { return mGMP; } +#endif const nsAString& KeySystem() const { return mKeySystem; } bool IsKeySystemSupported() const { return mIsKeySystemSupported; } @@ -120,7 +124,9 @@ private: bool mWMFFailedToLoad = false; bool mFFmpegFailedToLoad = false; +#ifdef THE_GMP bool mGMPPDMFailedToStartup = false; +#endif bool mVideoNotSupported = false; bool mAudioNotSupported = false; nsCString mGMP; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 223c59c3b..bb232a6ac 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -30,7 +30,9 @@ #include "mozilla/dom/VideoTrack.h" #include "mozilla/dom/VideoTrackList.h" #include "nsPrintfCString.h" +#ifdef THE_GMP #include "GMPService.h" +#endif #include "Layers.h" #include "mozilla/layers/ShadowLayers.h" @@ -387,7 +389,9 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner) , mLogicalPosition(0.0) , mDuration(std::numeric_limits::quiet_NaN()) , mResourceCallback(new ResourceCallback()) +#ifdef MOZ_EME , mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__)) +#endif , mIgnoreProgressData(false) , mInfiniteStream(false) , mOwner(aOwner) @@ -472,7 +476,9 @@ MediaDecoder::Shutdown() mResourceCallback->Disconnect(); +#ifdef MOZ_EME mCDMProxyPromiseHolder.RejectIfExists(true, __func__); +#endif DiscardOngoingSeekIfExists(); @@ -923,6 +929,7 @@ MediaDecoder::OwnerHasError() const return mOwner->HasError(); } +#ifdef THE_GMP class MediaElementGMPCrashHelper : public GMPCrashHelper { public: @@ -950,6 +957,7 @@ MediaDecoder::GetCrashHelper() return mOwner->GetMediaElement() ? MakeAndAddRef(mOwner->GetMediaElement()) : nullptr; } +#endif bool MediaDecoder::IsEnded() const @@ -1537,6 +1545,7 @@ MediaDecoder::CanPlayThrough() return GetStatistics().CanPlayThrough(); } +#ifdef MOZ_EME RefPtr MediaDecoder::RequestCDMProxy() const { @@ -1551,6 +1560,7 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy) mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__); } +#endif bool MediaDecoder::IsOpusEnabled() diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 05e88db8b..59096615f 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -8,7 +8,9 @@ #define MediaDecoder_h_ #include "mozilla/Atomics.h" +#ifdef MOZ_EME #include "mozilla/CDMProxy.h" +#endif #include "mozilla/MozPromise.h" #include "mozilla/ReentrantMonitor.h" #include "mozilla/StateMirroring.h" @@ -243,7 +245,9 @@ public: // Must be called before Shutdown(). bool OwnerHasError() const; +#ifdef THE_GMP already_AddRefed GetCrashHelper() override; +#endif protected: // Updates the media duration. This is called while the media is being @@ -432,6 +436,7 @@ private: MediaDecoderOwner* GetOwner() const override; +#ifdef MOZ_EME typedef MozPromise, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise; // Resolved when a CDMProxy is available and the capabilities are known or @@ -439,6 +444,7 @@ private: RefPtr RequestCDMProxy() const; void SetCDMProxy(CDMProxy* aProxy); +#endif static bool IsOggEnabled(); static bool IsOpusEnabled(); @@ -589,8 +595,10 @@ private: RefPtr mResourceCallback; +#ifdef MOZ_EME MozPromiseHolder mCDMProxyPromiseHolder; RefPtr mCDMProxyPromise; +#endif protected: // The promise resolving/rejection is queued as a "micro-task" which will be diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index 8a6997826..f53c74689 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -24,7 +24,9 @@ namespace mozilla { +#ifdef MOZ_EME class CDMProxy; +#endif class MediaDecoderReader; struct WaitForDataRejectValue @@ -186,7 +188,9 @@ public: // when to call SetIdle(). virtual void SetIdle() {} +#ifdef MOZ_EME virtual void SetCDMProxy(CDMProxy* aProxy) {} +#endif // Tell the reader that the data decoded are not for direct playback, so it // can accept more files, in particular those which have more channels than diff --git a/dom/media/MediaDecoderReaderWrapper.h b/dom/media/MediaDecoderReaderWrapper.h index 92001ca33..1a8d3a68c 100644 --- a/dom/media/MediaDecoderReaderWrapper.h +++ b/dom/media/MediaDecoderReaderWrapper.h @@ -113,7 +113,9 @@ public: return mReader->CanonicalBuffered(); } +#ifdef MOZ_EME void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); } +#endif void SetVideoBlankDecode(bool aIsBlankDecode); diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 2ed1956c9..5c4172803 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -193,7 +193,9 @@ public: virtual State GetState() const = 0; // Event handlers for various events. +#ifdef MOZ_EME virtual void HandleCDMProxyReady() {} +#endif virtual void HandleAudioDecoded(MediaData* aAudio) {} virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) {} virtual void HandleEndOfStream() {} @@ -371,7 +373,9 @@ public: return DECODER_STATE_WAIT_FOR_CDM; } +#ifdef MOZ_EME void HandleCDMProxyReady() override; +#endif RefPtr HandleSeek(SeekTarget aTarget) override { @@ -1238,7 +1242,11 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata) // feeding in the CDM, which we need to decode the first frame (and // thus get the metadata). We could fix this if we could compute the start // time by demuxing without necessaring decoding. - bool waitingForCDM = Info().IsEncrypted() && !mMaster->mCDMProxy; + bool waitingForCDM = Info().IsEncrypted() +#ifdef MOZ_EME +&& !mMaster->mCDMProxy +#endif +; mMaster->mNotifyMetadataBeforeFirstFrame = mMaster->mDuration.Ref().isSome() || waitingForCDM; @@ -1262,19 +1270,24 @@ DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState) { if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) { // Exit dormant when the user wants to play. - MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy); + MOZ_ASSERT(!Info().IsEncrypted() +#ifdef MOZ_EME + || mMaster->mCDMProxy +#endif +); MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent); SetState(Move(mPendingSeek), EventVisibility::Suppressed); } } +#ifdef MOZ_EME void MediaDecoderStateMachine:: WaitForCDMState::HandleCDMProxyReady() { SetState(Move(mPendingSeek)); } - +#endif void MediaDecoderStateMachine:: DecodingFirstFrameState::Enter(SeekJob aPendingSeek) @@ -1575,7 +1588,9 @@ ShutdownState::Enter() // dispose of the timer. master->mVideoDecodeSuspendTimer.Reset(); +#ifdef MOZ_EME master->mCDMProxyPromise.DisconnectIfExists(); +#endif if (master->IsPlaying()) { master->StopPlayback(); @@ -2129,10 +2144,12 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder) mMediaSink = CreateMediaSink(mAudioCaptured); +#ifdef MOZ_EME mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then( OwnerThread(), __func__, this, &MediaDecoderStateMachine::OnCDMProxyReady, &MediaDecoderStateMachine::OnCDMProxyNotReady)); +#endif nsresult rv = mReader->Init(); NS_ENSURE_SUCCESS(rv, rv); @@ -3108,6 +3125,7 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult) DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__)); } +#ifdef MOZ_EME void MediaDecoderStateMachine::OnCDMProxyReady(RefPtr aProxy) { @@ -3124,7 +3142,7 @@ MediaDecoderStateMachine::OnCDMProxyNotReady() MOZ_ASSERT(OnTaskQueue()); mCDMProxyPromise.Complete(); } - +#endif void MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured) { diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index ff3258ff1..f04f34983 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -768,10 +768,12 @@ private: // Playback will not start when audio is offloading. bool mAudioOffloading; +#ifdef MOZ_EME void OnCDMProxyReady(RefPtr aProxy); void OnCDMProxyNotReady(); RefPtr mCDMProxy; MozPromiseRequestHolder mCDMProxyPromise; +#endif private: // The buffered range. Mirrored from the decoder thread. diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 773434710..8f934fa82 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -4,7 +4,9 @@ * 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/. */ +#ifdef MOZ_EME #include "mozilla/CDMProxy.h" +#endif #include "mozilla/ClearOnShutdown.h" #include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/Preferences.h" @@ -367,7 +369,9 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) : *ownerData.mOriginalInfo->GetAsAudioInfo(), ownerData.mTaskQueue, ownerData.mCallback.get(), +#ifdef THE_GMP mOwner->mCrashHelper, +#endif ownerData.mIsBlankDecode, &result }); @@ -385,7 +389,9 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) ownerData.mCallback.get(), mOwner->mKnowsCompositor, mOwner->GetImageContainer(), +#ifdef THE_GMP mOwner->mCrashHelper, +#endif ownerData.mIsBlankDecode, &result }); @@ -580,7 +586,9 @@ MediaFormatReader::InitInternal() // Note: GMPCrashHelper must be created on main thread, as it may use // weak references, which aren't threadsafe. +#ifdef THE_GMP mCrashHelper = mDecoder->GetCrashHelper(); +#endif return NS_OK; } @@ -613,6 +621,7 @@ private: }; #endif +#ifdef MOZ_EME void MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) { @@ -624,7 +633,7 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) }); OwnerThread()->Dispatch(r.forget()); } - +#endif bool MediaFormatReader::IsWaitingOnCDMResource() { MOZ_ASSERT(OnTaskQueue()); diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index 4d05ca201..7d07ef08c 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -20,7 +20,9 @@ namespace mozilla { +#ifdef MOZ_EME class CDMProxy; +#endif class MediaFormatReader final : public MediaDecoderReader { @@ -91,7 +93,9 @@ public: return mTrackDemuxersMayBlock; } +#ifdef MOZ_EME void SetCDMProxy(CDMProxy* aProxy) override; +#endif // Returns a string describing the state of the decoder data. // Used for debugging purposes. @@ -584,9 +588,12 @@ private: RefPtr mVideoFrameContainer; layers::ImageContainer* GetImageContainer(); +#ifdef MOZ_EME RefPtr mCDMProxy; - +#endif +#ifdef THE_GMP RefPtr mCrashHelper; +#endif void SetBlankDecode(TrackType aTrack, bool aIsBlankDecode); diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index c67a89989..0a076d0f6 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -95,14 +95,20 @@ private: // VideoSink DECL_MEDIA_PREF("media.ruin-av-sync.enabled", RuinAvSync, bool, false); +#ifdef MOZ_EME // Encrypted Media Extensions DECL_MEDIA_PREF("media.clearkey.persistent-license.enabled", ClearKeyPersistentLicenseEnabled, bool, false); +#endif // PlatformDecoderModule DECL_MEDIA_PREF("media.apple.forcevda", AppleForceVDA, bool, false); +#ifdef THE_GMP DECL_MEDIA_PREF("media.gmp.insecure.allow", GMPAllowInsecure, bool, false); DECL_MEDIA_PREF("media.gmp.async-shutdown-timeout", GMPAsyncShutdownTimeout, uint32_t, GMP_DEFAULT_ASYNC_SHUTDOWN_TIMEOUT); +#endif +#ifdef MOZ_EME DECL_MEDIA_PREF("media.eme.enabled", EMEEnabled, bool, false); +#endif DECL_MEDIA_PREF("media.use-blank-decoder", PDMUseBlankDecoder, bool, false); DECL_MEDIA_PREF("media.gpu-process-decoder", PDMUseGPUDecoder, bool, false); #ifdef MOZ_WIDGET_ANDROID @@ -130,9 +136,11 @@ private: DECL_MEDIA_PREF("media.decoder.fuzzing.enabled", PDMFuzzingEnabled, bool, false); DECL_MEDIA_PREF("media.decoder.fuzzing.video-output-minimum-interval-ms", PDMFuzzingInterval, uint32_t, 0); DECL_MEDIA_PREF("media.decoder.fuzzing.dont-delay-inputexhausted", PDMFuzzingDelayInputExhausted, bool, true); +#ifdef THE_GMP DECL_MEDIA_PREF("media.gmp.decoder.enabled", PDMGMPEnabled, bool, true); DECL_MEDIA_PREF("media.gmp.decoder.aac", GMPAACPreferred, uint32_t, 0); DECL_MEDIA_PREF("media.gmp.decoder.h264", GMPH264Preferred, uint32_t, 0); +#endif // MediaDecoderStateMachine DECL_MEDIA_PREF("media.suspend-bkgnd-video.enabled", MDSMSuspendBackgroundVideoEnabled, bool, false); diff --git a/dom/media/eme/MediaKeySystemAccess.cpp b/dom/media/eme/MediaKeySystemAccess.cpp index 7007d3a03..4f2737805 100644 --- a/dom/media/eme/MediaKeySystemAccess.cpp +++ b/dom/media/eme/MediaKeySystemAccess.cpp @@ -142,10 +142,10 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem, } #ifdef XP_WIN // Win Vista and later only. - if (!IsVistaOrLater()) { - aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME"); - return MediaKeySystemStatus::Cdm_not_supported; - } +// if (!IsVistaOrLater()) { +// aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME"); +// return MediaKeySystemStatus::Cdm_not_supported; +// } #endif return EnsureCDMInstalled(aKeySystem, aOutMessage); } @@ -155,10 +155,10 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem, if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) { #ifdef XP_WIN // Win Vista and later only. - if (!IsVistaOrLater()) { - aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME"); - return MediaKeySystemStatus::Cdm_not_supported; - } +// if (!IsVistaOrLater()) { +// aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME"); +// return MediaKeySystemStatus::Cdm_not_supported; +// } #endif if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) { aOutMessage = NS_LITERAL_CSTRING("Widevine EME disabled"); diff --git a/dom/media/fmp4/MP4Decoder.cpp b/dom/media/fmp4/MP4Decoder.cpp index 6954e9757..7c77c7eed 100644 --- a/dom/media/fmp4/MP4Decoder.cpp +++ b/dom/media/fmp4/MP4Decoder.cpp @@ -10,7 +10,9 @@ #include "MP4Demuxer.h" #include "mozilla/Preferences.h" #include "nsCharSeparatedTokenizer.h" +#ifdef MOZ_EME #include "mozilla/CDMProxy.h" +#endif #include "mozilla/Logging.h" #include "mozilla/SharedThreadPool.h" #include "nsMimeTypes.h" diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 14b06cc72..88c87591f 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -23,6 +23,7 @@ #include "prio.h" #include "base/task.h" #include "widevine-adapter/WidevineAdapter.h" +#include "utils.h" using namespace mozilla::ipc; diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 418f14736..b1de82f98 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -21,6 +21,7 @@ #include "GMPContentParent.h" #include "MediaPrefs.h" #include "VideoUtils.h" +#include "utils.h" using mozilla::ipc::GeckoChildProcessHost; diff --git a/dom/media/gmp/GMPUtils.cpp b/dom/media/gmp/GMPUtils.cpp index d27523760..891d9eedc 100644 --- a/dom/media/gmp/GMPUtils.cpp +++ b/dom/media/gmp/GMPUtils.cpp @@ -12,6 +12,7 @@ #include "nsCRTGlue.h" #include "mozilla/Base64.h" #include "nsISimpleEnumerator.h" +#include "utils.h" namespace mozilla { @@ -39,19 +40,6 @@ EMEVoucherFileExists() exists; } -void -SplitAt(const char* aDelims, - const nsACString& aInput, - nsTArray& aOutTokens) -{ - nsAutoCString str(aInput); - char* end = str.BeginWriting(); - const char* start = nullptr; - while (!!(start = NS_strtok(aDelims, &end))) { - aOutTokens.AppendElement(nsCString(start)); - } -} - nsCString ToBase64(const nsTArray& aBytes) { diff --git a/dom/media/gmp/GMPUtils.h b/dom/media/gmp/GMPUtils.h index 7e7b9f26f..3fff18d97 100644 --- a/dom/media/gmp/GMPUtils.h +++ b/dom/media/gmp/GMPUtils.h @@ -32,11 +32,6 @@ bool GetEMEVoucherPath(nsIFile** aPath); bool EMEVoucherFileExists(); -void -SplitAt(const char* aDelims, - const nsACString& aInput, - nsTArray& aOutTokens); - nsCString ToBase64(const nsTArray& aBytes); diff --git a/dom/media/moz.build b/dom/media/moz.build index df8cb619d..495493d47 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -20,12 +20,8 @@ with Files('GetUserMedia*'): BUG_COMPONENT = component_av DIRS += [ - 'eme', 'encoder', 'flac', - 'gmp', - 'gmp-plugin', - 'gmp-plugin-openh264', 'imagecapture', 'ipc', 'mediasink', @@ -46,6 +42,13 @@ DIRS += [ if CONFIG['MOZ_FMP4']: DIRS += ['fmp4'] +if CONFIG['THE_GMP']: + DIRS += ['gmp', + 'gmp-plugin', + 'gmp-plugin-openh264',] + if CONFIG['MOZ_EME']: + DIRS += ['eme'] + if CONFIG['MOZ_WEBRTC']: DIRS += ['bridge'] @@ -136,6 +139,7 @@ EXPORTS += [ 'ThreadPoolCOMListener.h', 'TimeUnits.h', 'TrackUnionStream.h', + 'utils.h', 'VideoFrameContainer.h', 'VideoLimits.h', 'VideoSegment.h', @@ -251,6 +255,8 @@ UNIFIED_SOURCES += [ 'XiphExtradata.cpp', ] +SOURCES += [ 'utils.cpp' ] + if CONFIG['OS_TARGET'] == 'WINNT': SOURCES += [ 'ThreadPoolCOMListener.cpp' ] diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp index 2680964f7..349e8bcba 100644 --- a/dom/media/platforms/PDMFactory.cpp +++ b/dom/media/platforms/PDMFactory.cpp @@ -22,9 +22,12 @@ #ifdef MOZ_WIDGET_ANDROID #include "AndroidDecoderModule.h" #endif +#ifdef THE_GMP #include "GMPDecoderModule.h" - +#endif +#ifdef MOZ_EME #include "mozilla/CDMProxy.h" +#endif #include "mozilla/ClearOnShutdown.h" #include "mozilla/SharedThreadPool.h" #include "mozilla/StaticPtr.h" @@ -37,7 +40,9 @@ #include "H264Converter.h" #include "AgnosticDecoderModule.h" +#ifdef MOZ_EME #include "EMEDecoderModule.h" +#endif #include "DecoderDoctorDiagnostics.h" @@ -225,9 +230,11 @@ PDMFactory::CreateDecoder(const CreateDecoderParams& aParams) if (mFFmpegFailedToLoad) { diagnostics->SetFFmpegFailedToLoad(); } +#ifdef THE_GMP if (mGMPPDMFailedToStartup) { diagnostics->SetGMPPDMFailedToStartup(); } +#endif } for (auto& current : mCurrentPDMs) { @@ -409,13 +416,14 @@ PDMFactory::CreatePDMs() m = new AgnosticDecoderModule(); StartupPDM(m); - +#ifdef THE_GMP if (MediaPrefs::PDMGMPEnabled()) { m = new GMPDecoderModule(); mGMPPDMFailedToStartup = !StartupPDM(m); } else { mGMPPDMFailedToStartup = false; } +#endif } void @@ -448,9 +456,11 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo, if (mFFmpegFailedToLoad) { aDiagnostics->SetFFmpegFailedToLoad(); } +#ifdef THE_GMP if (mGMPPDMFailedToStartup) { aDiagnostics->SetGMPPDMFailedToStartup(); } +#endif } RefPtr pdm; @@ -463,11 +473,12 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo, return pdm.forget(); } +#ifdef MOZ_EME void PDMFactory::SetCDMProxy(CDMProxy* aProxy) { RefPtr m = new PDMFactory(); mEMEPDM = new EMEDecoderModule(aProxy, m); } - +#endif } // namespace mozilla diff --git a/dom/media/platforms/PDMFactory.h b/dom/media/platforms/PDMFactory.h index 94be7e928..0adcb5150 100644 --- a/dom/media/platforms/PDMFactory.h +++ b/dom/media/platforms/PDMFactory.h @@ -11,7 +11,9 @@ #include "mozilla/Function.h" #include "mozilla/StaticMutex.h" +#ifdef MOZ_EME class CDMProxy; +#endif namespace mozilla { @@ -43,7 +45,9 @@ public: // does not decode, we create a PDM and use that to create MediaDataDecoders // that we use on on aTaskQueue to decode the decrypted stream. // This is called on the decode task queue. +#ifdef MOZ_EME void SetCDMProxy(CDMProxy* aProxy); +#endif static constexpr int kYUV400 = 0; static constexpr int kYUV420 = 1; @@ -71,7 +75,9 @@ private: bool mWMFFailedToLoad = false; bool mFFmpegFailedToLoad = false; +#ifdef THE_GMP bool mGMPPDMFailedToStartup = false; +#endif void EnsureInit() const; template friend class StaticAutoPtr; diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index 7480d8ff9..3889fff7e 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -14,7 +14,9 @@ #include "mozilla/layers/KnowsCompositor.h" #include "nsTArray.h" #include "mozilla/RefPtr.h" +#ifdef THE_GMP #include "GMPService.h" +#endif #include #include "MediaResult.h" @@ -36,7 +38,9 @@ class RemoteDecoderModule; class MediaDataDecoder; class MediaDataDecoderCallback; class TaskQueue; +#ifdef MOZ_EME class CDMProxy; +#endif static LazyLogModule sPDMLog("PlatformDecoderModule"); @@ -79,7 +83,9 @@ struct MOZ_STACK_CLASS CreateDecoderParams final { layers::ImageContainer* mImageContainer = nullptr; MediaResult* mError = nullptr; RefPtr mKnowsCompositor; +#ifdef THE_GMP RefPtr mCrashHelper; +#endif bool mUseBlankDecoder = false; private: @@ -88,7 +94,9 @@ private: void Set(DecoderDoctorDiagnostics* aDiagnostics) { mDiagnostics = aDiagnostics; } void Set(layers::ImageContainer* aImageContainer) { mImageContainer = aImageContainer; } void Set(MediaResult* aError) { mError = aError; } +#ifdef THE_GMP void Set(GMPCrashHelper* aCrashHelper) { mCrashHelper = aCrashHelper; } +#endif void Set(bool aUseBlankDecoder) { mUseBlankDecoder = aUseBlankDecoder; } void Set(layers::KnowsCompositor* aKnowsCompositor) { mKnowsCompositor = aKnowsCompositor; } template diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build index f5fb72c5d..6f70238bb 100644 --- a/dom/media/platforms/moz.build +++ b/dom/media/platforms/moz.build @@ -29,11 +29,13 @@ UNIFIED_SOURCES += [ 'wrappers/H264Converter.cpp' ] -DIRS += [ - 'agnostic/eme', - 'agnostic/gmp', - 'omx' -] +if CONFIG['MOZ_EME']: + DIRS += ['agnostic/eme'] + +if CONFIG['THE_GMP']: + DIRS += ['agnostic/gmp'] + +DIRS += ['omx'] if CONFIG['MOZ_WMF']: DIRS += [ 'wmf' ]; diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index a7633a7de..562c2c66c 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -27,7 +27,7 @@ #include "mozilla/WindowsVersion.h" #include "mozilla/Telemetry.h" #include "nsPrintfCString.h" -#include "GMPUtils.h" // For SplitAt. TODO: Move SplitAt to a central place. +#include "utils.h" #include "MP4Decoder.h" #include "VPXDecoder.h" #include "mozilla/SyncRunnable.h" diff --git a/dom/media/platforms/wrappers/H264Converter.cpp b/dom/media/platforms/wrappers/H264Converter.cpp index 0edbfc10c..525285eaa 100644 --- a/dom/media/platforms/wrappers/H264Converter.cpp +++ b/dom/media/platforms/wrappers/H264Converter.cpp @@ -24,7 +24,9 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM, , mTaskQueue(aParams.mTaskQueue) , mCallback(aParams.mCallback) , mDecoder(nullptr) +#ifdef THE_GMP , mGMPCrashHelper(aParams.mCrashHelper) +#endif , mNeedAVCC(aPDM->DecoderNeedsConversion(aParams.mConfig) == PlatformDecoderModule::ConversionRequired::kNeedAVCC) , mLastError(NS_OK) @@ -200,8 +202,10 @@ H264Converter::CreateDecoder(DecoderDoctorDiagnostics* aDiagnostics) mCallback, aDiagnostics, mImageContainer, - mKnowsCompositor, - mGMPCrashHelper + mKnowsCompositor +#ifdef THE_GMP + ,mGMPCrashHelper +#endif }); if (!mDecoder) { diff --git a/dom/media/platforms/wrappers/H264Converter.h b/dom/media/platforms/wrappers/H264Converter.h index 6905b1c74..0d3499280 100644 --- a/dom/media/platforms/wrappers/H264Converter.h +++ b/dom/media/platforms/wrappers/H264Converter.h @@ -63,7 +63,9 @@ private: MediaDataDecoderCallback* mCallback; RefPtr mDecoder; MozPromiseRequestHolder mInitPromiseRequest; +#ifdef THE_GMP RefPtr mGMPCrashHelper; +#endif bool mNeedAVCC; nsresult mLastError; bool mNeedKeyframe = true; diff --git a/dom/media/utils.cpp b/dom/media/utils.cpp new file mode 100644 index 000000000..079c55456 --- /dev/null +++ b/dom/media/utils.cpp @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 "utils.h" +#include "nsLiteralString.h" +#include "nsCRTGlue.h" + +namespace mozilla { + +void +SplitAt(const char* aDelims, + const nsACString& aInput, + nsTArray& aOutTokens) +{ + nsAutoCString str(aInput); + char* end = str.BeginWriting(); + const char* start = nullptr; + while (!!(start = NS_strtok(aDelims, &end))) { + aOutTokens.AppendElement(nsCString(start)); + } +} + + +} // namespace mozilla diff --git a/dom/media/utils.h b/dom/media/utils.h new file mode 100644 index 000000000..0789ddb5d --- /dev/null +++ b/dom/media/utils.h @@ -0,0 +1,23 @@ +/* -*- 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 MUtils_h_ +#define MUtils_h_ + +#include "nsTArray.h" + +class nsCString; + +namespace mozilla { + +void +SplitAt(const char* aDelims, + const nsACString& aInput, + nsTArray& aOutTokens); + + +} // namespace mozilla + +#endif diff --git a/dom/media/webaudio/BufferDecoder.cpp b/dom/media/webaudio/BufferDecoder.cpp index 053a13bec..bd53d3f08 100644 --- a/dom/media/webaudio/BufferDecoder.cpp +++ b/dom/media/webaudio/BufferDecoder.cpp @@ -8,15 +8,23 @@ #include "nsISupports.h" #include "MediaResource.h" +#ifdef THE_GMP #include "GMPService.h" +#endif namespace mozilla { NS_IMPL_ISUPPORTS0(BufferDecoder) -BufferDecoder::BufferDecoder(MediaResource* aResource, GMPCrashHelper* aCrashHelper) +BufferDecoder::BufferDecoder(MediaResource* aResource +#ifdef THE_GMP +, GMPCrashHelper* aCrashHelper +#endif +) : mResource(aResource) +#ifdef THE_GMP , mCrashHelper(aCrashHelper) +#endif { MOZ_ASSERT(NS_IsMainThread()); MOZ_COUNT_CTOR(BufferDecoder); @@ -67,11 +75,12 @@ BufferDecoder::GetOwner() const // unknown return nullptr; } - +#ifdef THE_GMP already_AddRefed BufferDecoder::GetCrashHelper() { return do_AddRef(mCrashHelper); } +#endif } // namespace mozilla diff --git a/dom/media/webaudio/BufferDecoder.h b/dom/media/webaudio/BufferDecoder.h index 52cb92489..4df800fb2 100644 --- a/dom/media/webaudio/BufferDecoder.h +++ b/dom/media/webaudio/BufferDecoder.h @@ -24,7 +24,11 @@ class BufferDecoder final : public AbstractMediaDecoder public: // This class holds a weak pointer to MediaResource. It's the responsibility // of the caller to manage the memory of the MediaResource object. - explicit BufferDecoder(MediaResource* aResource, GMPCrashHelper* aCrashHelper); + explicit BufferDecoder(MediaResource* aResource +#ifdef THE_GMP +,GMPCrashHelper* aCrashHelper +#endif +); NS_DECL_THREADSAFE_ISUPPORTS @@ -40,13 +44,17 @@ public: MediaDecoderOwner* GetOwner() const final override; +#ifdef THE_GMP already_AddRefed GetCrashHelper() override; +#endif private: virtual ~BufferDecoder(); RefPtr mTaskQueueIdentity; RefPtr mResource; +#ifdef THE_GMP RefPtr mCrashHelper; +#endif }; } // namespace mozilla diff --git a/dom/media/webaudio/MediaBufferDecoder.cpp b/dom/media/webaudio/MediaBufferDecoder.cpp index f3b75ca1a..3b04e429c 100644 --- a/dom/media/webaudio/MediaBufferDecoder.cpp +++ b/dom/media/webaudio/MediaBufferDecoder.cpp @@ -24,7 +24,9 @@ #include "WebAudioUtils.h" #include "mozilla/dom/Promise.h" #include "nsPrintfCString.h" +#ifdef THE_GMP #include "GMPService.h" +#endif namespace mozilla { @@ -180,6 +182,7 @@ MediaDecodeTask::Run() return NS_OK; } +#ifdef THE_GMP class BufferDecoderGMPCrashHelper : public GMPCrashHelper { public: @@ -197,6 +200,7 @@ public: private: nsWeakPtr mParent; }; +#endif bool MediaDecodeTask::CreateReader() @@ -215,8 +219,11 @@ MediaDecodeTask::CreateReader() mLength, principal, mContentType); MOZ_ASSERT(!mBufferDecoder); - mBufferDecoder = new BufferDecoder(resource, - new BufferDecoderGMPCrashHelper(mDecodeJob.mContext->GetParentObject())); + mBufferDecoder = new BufferDecoder(resource +#ifdef THE_GMP +,new BufferDecoderGMPCrashHelper(mDecodeJob.mContext->GetParentObject()) +#endif +); // If you change this list to add support for new decoders, please consider // updating HTMLMediaElement::CreateDecoder as well. diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 06fea2f20..9a50eb975 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -286,15 +286,7 @@ WEBIDL_FILES = [ 'MediaDeviceInfo.webidl', 'MediaDevices.webidl', 'MediaElementAudioSourceNode.webidl', - 'MediaEncryptedEvent.webidl', 'MediaError.webidl', - 'MediaKeyError.webidl', - 'MediaKeyMessageEvent.webidl', - 'MediaKeys.webidl', - 'MediaKeySession.webidl', - 'MediaKeysRequestStatus.webidl', - 'MediaKeyStatusMap.webidl', - 'MediaKeySystemAccess.webidl', 'MediaList.webidl', 'MediaQueryList.webidl', 'MediaRecorder.webidl', @@ -591,6 +583,17 @@ WEBIDL_FILES = [ 'XULElement.webidl', ] +if CONFIG['MOZ_EME']: + WEBIDL_FILES += ['MediaEncryptedEvent.webidl', + 'MediaKeyError.webidl', + 'MediaKeyMessageEvent.webidl', + 'MediaKeys.webidl', + 'MediaKeySession.webidl', + 'MediaKeysRequestStatus.webidl', + 'MediaKeyStatusMap.webidl', + 'MediaKeySystemAccess.webidl', +] + if CONFIG['MOZ_WEBEXTENSIONS']: WEBIDL_FILES += ['AddonManager.webidl'] diff --git a/gfx/layers/ipc/PAPZCTreeManager.ipdl b/gfx/layers/ipc/PAPZCTreeManager.ipdl index 21d899f91..bef6c2ecc 100644 --- a/gfx/layers/ipc/PAPZCTreeManager.ipdl +++ b/gfx/layers/ipc/PAPZCTreeManager.ipdl @@ -22,6 +22,7 @@ using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/Geck using nsEventStatus from "mozilla/EventForwards.h"; using EventMessage from "mozilla/EventForwards.h"; using mozilla::Modifiers from "mozilla/EventForwards.h"; +using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h"; using class mozilla::WidgetInputEvent from "mozilla/BasicEvents.h"; using class mozilla::WidgetMouseEventBase from "mozilla/MouseEvents.h"; using mozilla::WidgetMouseEvent::Reason from "mozilla/MouseEvents.h"; diff --git a/ipc/app/moz.build b/ipc/app/moz.build index 3e6461584..02372eeb9 100644 --- a/ipc/app/moz.build +++ b/ipc/app/moz.build @@ -29,7 +29,7 @@ LOCAL_INCLUDES += [ # We link GMPLoader into plugin-container on desktop so that its code is # covered by the desktop DRM vendor's voucher. -if CONFIG['OS_TARGET'] != 'Android': +if CONFIG['OS_TARGET'] != 'Android' and CONFIG['THE_GMP']: SOURCES += [ '../../dom/media/gmp/GMPLoader.cpp', ] diff --git a/ipc/contentproc/plugin-container.cpp b/ipc/contentproc/plugin-container.cpp index 2fb9bd4f5..e66e95b87 100644 --- a/ipc/contentproc/plugin-container.cpp +++ b/ipc/contentproc/plugin-container.cpp @@ -20,6 +20,7 @@ #include #endif +#ifdef THE_GMP #include "GMPLoader.h" mozilla::gmp::SandboxStarter* @@ -27,6 +28,7 @@ MakeSandboxStarter() { return nullptr; } +#endif int content_process_main(int argc, char* argv[]) @@ -50,7 +52,7 @@ content_process_main(int argc, char* argv[]) SetDllDirectoryW(L""); } #endif -#if !defined(MOZ_WIDGET_ANDROID) && defined(MOZ_PLUGIN_CONTAINER) +#if !defined(MOZ_WIDGET_ANDROID) && defined(MOZ_PLUGIN_CONTAINER) && defined(THE_GMP) // On desktop, the GMPLoader lives in plugin-container, so that its // code can be covered by an EME/GMP vendor's voucher. nsAutoPtr starter(MakeSandboxStarter()); diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 8bb70f85c..36b51c37a 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -187,7 +187,9 @@ static void Shutdown(); #include "MediaManager.h" +#ifdef THE_GMP #include "GMPService.h" +#endif #include "mozilla/dom/PresentationDeviceManager.h" #include "mozilla/dom/PresentationTCPSessionTransport.h" @@ -203,7 +205,9 @@ using mozilla::dom::workers::WorkerDebuggerManager; using mozilla::dom::UDPSocketChild; using mozilla::dom::time::TimeService; using mozilla::net::StreamingProtocolControllerService; +#ifdef THE_GMP using mozilla::gmp::GeckoMediaPluginService; +#endif #define NS_EDITORCOMMANDTABLE_CID \ { 0x4f5e62b8, 0xd659, 0x4156, \ @@ -557,8 +561,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer) NS_GENERIC_FACTORY_CONSTRUCTOR(OSFileConstantsService) NS_GENERIC_FACTORY_CONSTRUCTOR(UDPSocketChild) - +#ifdef THE_GMP NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(GeckoMediaPluginService, GeckoMediaPluginService::GetGeckoMediaPluginService) +#endif #ifdef ACCESSIBILITY #include "xpcAccessibilityService.h" @@ -967,7 +972,9 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, Module::ALLOW_IN_GPU_PROCESS }, { &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor }, { &kUDPSOCKETCHILD_CID, false, nullptr, UDPSocketChildConstructor }, +#ifdef THE_GMP { &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor }, +#endif { &kNS_TIMESERVICE_CID, false, nullptr, nsITimeServiceConstructor }, { &kNS_MEDIASTREAMCONTROLLERSERVICE_CID, false, nullptr, nsIStreamingProtocolControllerServiceConstructor }, { &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor }, @@ -1104,7 +1111,9 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID }, { "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID }, #endif +#ifdef THE_GMP { "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID }, +#endif { PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID }, { PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_CID }, { PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID, &kPRESENTATION_TCP_SESSION_TRANSPORT_CID }, diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list index b2da025d5..ce7eae7c1 100644 --- a/layout/reftests/reftest.list +++ b/layout/reftests/reftest.list @@ -418,5 +418,3 @@ include invalidation/reftest.list # encodings include ../../dom/encoding/test/reftest/reftest.list -# APZ/async positioning tests -include ../../gfx/layers/apz/test/reftest/reftest.list diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index ef4764d88..bb9bfb813 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -830,8 +830,10 @@ pref("device.storage.enabled", true); // Enable meta-viewport support for font inflation code pref("dom.meta-viewport.enabled", true); +#ifdef THE_GMP // Enable GMP support in the addon manager. pref("media.gmp-provider.enabled", true); +#endif // The default color scheme in reader mode (light, dark, auto) // auto = color automatically adjusts according to ambient light level diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index eac831421..3d7dd8689 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -558,9 +558,6 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [ 'media/Codec.java', 'media/CodecProxy.java', 'media/FormatParam.java', - 'media/GeckoMediaDrm.java', - 'media/GeckoMediaDrmBridgeV21.java', - 'media/GeckoMediaDrmBridgeV23.java', 'media/JellyBeanAsyncCodec.java', 'media/LocalMediaDrmBridge.java', 'media/MediaControlService.java', @@ -783,6 +780,14 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [ 'widget/TwoWayView.java', 'ZoomedView.java', ]] + +if CONFIG['THE_GMP']: + gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [ + 'media/GeckoMediaDrm.java', + 'media/GeckoMediaDrmBridgeV21.java', + 'media/GeckoMediaDrmBridgeV23.java', + ]] + # The following sources are checked in to version control but # generated by a script (java/org/mozilla/gecko/widget/themed/generate_themed_views.py). # If you're editing this list, make sure to edit that script. diff --git a/mobile/android/components/AddonUpdateService.js b/mobile/android/components/AddonUpdateService.js index 2505e2796..942a8d270 100644 --- a/mobile/android/components/AddonUpdateService.js +++ b/mobile/android/components/AddonUpdateService.js @@ -15,8 +15,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate", XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", "resource://gre/modules/addons/AddonRepository.jsm"); +#ifdef THE_GMP XPCOMUtils.defineLazyModuleGetter(this, "GMPInstallManager", "resource://gre/modules/GMPInstallManager.jsm"); +#endif XPCOMUtils.defineLazyModuleGetter(this, "Messaging", "resource://gre/modules/Messaging.jsm"); @@ -58,8 +60,10 @@ AddonUpdateService.prototype = { AddonManagerPrivate.backgroundUpdateCheck(); +#ifdef THE_GMP let gmp = new GMPInstallManager(); gmp.simpleCheckAndInstall().then(null, () => {}); +#endif let interval = 1000 * getPref("getIntPref", PREF_ADDON_UPDATE_INTERVAL, 86400); Messaging.sendRequest({ diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index f59a67072..7b8bc21a0 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -394,9 +394,11 @@ pref("media.libavcodec.allow-obsolete", false); #if defined(MOZ_FFVPX) pref("media.ffvpx.enabled", true); #endif +#ifdef THE_GMP pref("media.gmp.decoder.enabled", false); pref("media.gmp.decoder.aac", 0); pref("media.gmp.decoder.h264", 0); +#endif #ifdef MOZ_RAW pref("media.raw.enabled", true); #endif @@ -418,7 +420,9 @@ pref("media.apple.mp4.enabled", true); // we clear storage and set media.gmp.storage.version.observed=expected. // This provides a mechanism to clear GMP storage when non-compatible // changes are made. +#ifdef THE_GMP pref("media.gmp.storage.version.expected", 1); +#endif // Filter what triggers user notifications. // See DecoderDoctorDocumentWatcher::ReportAnalysis for details. @@ -5233,6 +5237,7 @@ pref("browser.search.official", true); //pref("media.gmp-manager.url.override", ""); // Update service URL for GMP install/updates: +#ifdef THE_GMP pref("media.gmp-manager.url", "https://aus5.mozilla.org/update/3/GMP/60.0/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); // When |media.gmp-manager.cert.requireBuiltIn| is true or not specified the @@ -5262,6 +5267,7 @@ pref("media.gmp-manager.certs.1.issuerName", "CN=DigiCert SHA2 Secure Server CA, pref("media.gmp-manager.certs.1.commonName", "aus5.mozilla.org"); pref("media.gmp-manager.certs.2.issuerName", "CN=thawte SSL CA - G2,O=\"thawte, Inc.\",C=US"); pref("media.gmp-manager.certs.2.commonName", "aus5.mozilla.org"); +#endif // Whether or not to perform reader mode article parsing on page load. // If this pref is disabled, we will never show a reader mode icon in the toolbar. diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index e1d432cb3..98aa480fe 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -61,7 +61,7 @@ toolkit.jar: #ifdef MOZ_PHOENIX content/global/logopage.xhtml #endif - content/global/process-content.js +* content/global/process-content.js content/global/resetProfile.css content/global/resetProfile.js content/global/resetProfile.xul @@ -131,6 +131,8 @@ toolkit.jar: content/global/macWindowMenu.js #endif content/global/svg/svgBindings.xml (/layout/svg/resources/content/svgBindings.xml) +#ifdef THE_GMP content/global/gmp-sources/eme-adobe.json (gmp-sources/eme-adobe.json) content/global/gmp-sources/openh264.json (gmp-sources/openh264.json) content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json) +#endif diff --git a/toolkit/content/process-content.js b/toolkit/content/process-content.js index 2ff8f908a..179662de9 100644 --- a/toolkit/content/process-content.js +++ b/toolkit/content/process-content.js @@ -14,6 +14,8 @@ Cu.import("resource://gre/modules/Services.jsm"); const gInContentProcess = Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT; +#ifdef THE_GMP + Services.cpmm.addMessageListener("gmp-plugin-crash", msg => { let gmpservice = Cc["@mozilla.org/gecko-media-plugin-service;1"] .getService(Ci.mozIGeckoMediaPluginService); @@ -21,6 +23,8 @@ Services.cpmm.addMessageListener("gmp-plugin-crash", msg => { gmpservice.RunPluginCrashCallbacks(msg.data.pluginID, msg.data.pluginName); }); +#endif + if (gInContentProcess) { let ProcessObserver = { TOPICS: [ diff --git a/toolkit/forgetaboutsite/ForgetAboutSite.jsm b/toolkit/forgetaboutsite/ForgetAboutSite.jsm index 8c7825392..6c36465ca 100644 --- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm +++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm @@ -84,6 +84,7 @@ this.ForgetAboutSite = { throw new Error("Exception thrown while clearning cookies: " + ex); })); +#ifdef THE_GMP // EME promises.push(Task.spawn(function*() { let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"]. @@ -92,6 +93,7 @@ this.ForgetAboutSite = { }).catch(ex => { throw new Error("Exception thrown while clearing Encrypted Media Extensions: " + ex); })); +#endif // Plugin data const phInterface = Ci.nsIPluginHost; diff --git a/toolkit/forgetaboutsite/moz.build b/toolkit/forgetaboutsite/moz.build index 73bb42b0b..0e9d2f68d 100644 --- a/toolkit/forgetaboutsite/moz.build +++ b/toolkit/forgetaboutsite/moz.build @@ -7,7 +7,7 @@ BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] -EXTRA_JS_MODULES += [ +EXTRA_PP_JS_MODULES += [ 'ForgetAboutSite.jsm', ] diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 792fb113d..3f72dac64 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -322,7 +322,20 @@ def wmf(value, target): set_config('MOZ_WMF', wmf) set_define('MOZ_WMF', wmf) +# GMP +# ============================================================== +option('--disable-gmp', + help='Disable support for gmp') +@depends('--disable-gmp', target) +def gmp(value, target): + enabled = bool(value) + if value.origin == 'default': + enabled = true + if enabled: + return True +set_config('THE_GMP', gmp) +set_define('THE_GMP', gmp) # FFmpeg H264/AAC Decoding Support # ============================================================== option('--disable-ffmpeg', diff --git a/toolkit/mozapps/extensions/extensions.manifest b/toolkit/mozapps/extensions/extensions.manifest index 7efb74a9d..2cb1c91aa 100644 --- a/toolkit/mozapps/extensions/extensions.manifest +++ b/toolkit/mozapps/extensions/extensions.manifest @@ -11,4 +11,6 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr #ifndef MOZ_WIDGET_ANDROID category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm #endif +#ifdef THE_GMP category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm +#endif diff --git a/toolkit/mozapps/extensions/internal/moz.build b/toolkit/mozapps/extensions/internal/moz.build index 337df3104..a4e7cafff 100644 --- a/toolkit/mozapps/extensions/internal/moz.build +++ b/toolkit/mozapps/extensions/internal/moz.build @@ -8,12 +8,17 @@ EXTRA_JS_MODULES.addons += [ 'AddonLogging.jsm', 'AddonRepository_SQLiteMigrator.jsm', 'Content.js', - 'GMPProvider.jsm', 'LightweightThemeImageOptimizer.jsm', - 'ProductAddonChecker.jsm', 'SpellCheckDictionaryBootstrap.js', ] +if CONFIG['THE_GMP']: + EXTRA_JS_MODULES.addons += [ + 'GMPProvider.jsm', + 'ProductAddonChecker.jsm', + ] + + # Don't ship unused providers on Android if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': EXTRA_JS_MODULES.addons += [ diff --git a/toolkit/mozapps/extensions/jar.mn b/toolkit/mozapps/extensions/jar.mn index c4d8874c9..2dc2da7a1 100644 --- a/toolkit/mozapps/extensions/jar.mn +++ b/toolkit/mozapps/extensions/jar.mn @@ -29,8 +29,10 @@ toolkit.jar: * content/mozapps/extensions/newaddon.js (content/newaddon.js) content/mozapps/extensions/setting.xml (content/setting.xml) content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul) +#ifdef THE_GMP content/mozapps/extensions/gmpPrefs.xul (content/gmpPrefs.xul) content/mozapps/extensions/OpenH264-license.txt (content/OpenH264-license.txt) +#endif content/mozapps/xpinstall/xpinstallConfirm.xul (content/xpinstallConfirm.xul) content/mozapps/xpinstall/xpinstallConfirm.js (content/xpinstallConfirm.js) content/mozapps/xpinstall/xpinstallConfirm.css (content/xpinstallConfirm.css) diff --git a/toolkit/mozapps/extensions/moz.build b/toolkit/mozapps/extensions/moz.build index 104e8d734..67b8d70de 100644 --- a/toolkit/mozapps/extensions/moz.build +++ b/toolkit/mozapps/extensions/moz.build @@ -29,15 +29,18 @@ EXTRA_PP_COMPONENTS += [ EXTRA_JS_MODULES += [ 'ChromeManifestParser.jsm', 'DeferredSave.jsm', - 'GMPUtils.jsm', 'LightweightThemeManager.jsm', ] EXTRA_PP_JS_MODULES += [ 'AddonManager.jsm', - 'GMPInstallManager.jsm', ] +if CONFIG['THE_GMP']: + EXTRA_JS_MODULES += ['GMPUtils.jsm',] + EXTRA_PP_JS_MODULES += ['GMPInstallManager.jsm',] + + # Additional debugging info is exposed in debug builds if CONFIG['MOZ_EM_DEBUG']: DEFINES['MOZ_EM_DEBUG'] = 1 diff --git a/toolkit/mozapps/webextensions/extensions.manifest b/toolkit/mozapps/webextensions/extensions.manifest index 2129012ab..a78e56227 100644 --- a/toolkit/mozapps/webextensions/extensions.manifest +++ b/toolkit/mozapps/webextensions/extensions.manifest @@ -13,6 +13,8 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr #ifndef MOZ_WIDGET_ANDROID category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm #endif +#ifdef THE_GMP category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm +#endif component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235} diff --git a/toolkit/mozapps/webextensions/jar.mn b/toolkit/mozapps/webextensions/jar.mn index 0c63396cc..84b65fbc3 100644 --- a/toolkit/mozapps/webextensions/jar.mn +++ b/toolkit/mozapps/webextensions/jar.mn @@ -25,8 +25,10 @@ toolkit.jar: content/mozapps/extensions/newaddon.xul (content/newaddon.xul) * content/mozapps/extensions/newaddon.js (../extensions/content/newaddon.js) content/mozapps/extensions/pluginPrefs.xul (../extensions/content/pluginPrefs.xul) +#ifdef THE_GMP content/mozapps/extensions/gmpPrefs.xul (../extensions/content/gmpPrefs.xul) content/mozapps/extensions/OpenH264-license.txt (../extensions/content/OpenH264-license.txt) +#endif #endif content/mozapps/extensions/setting.xml (content/setting.xml) content/mozapps/xpinstall/xpinstallConfirm.xul (../extensions/content/xpinstallConfirm.xul) diff --git a/toolkit/mozapps/webextensions/moz.build b/toolkit/mozapps/webextensions/moz.build index f6e83a355..2a46251bb 100644 --- a/toolkit/mozapps/webextensions/moz.build +++ b/toolkit/mozapps/webextensions/moz.build @@ -30,12 +30,15 @@ EXTRA_PP_COMPONENTS += [ EXTRA_JS_MODULES += [ '../extensions/ChromeManifestParser.jsm', '../extensions/DeferredSave.jsm', - '../extensions/GMPUtils.jsm', 'AddonManager.jsm', 'LightweightThemeManager.jsm', - 'GMPInstallManager.jsm', ] +if CONFIG['THE_GMP']: + EXTRA_JS_MODULES += ['../extensions/GMPUtils.jsm', + 'GMPInstallManager.jsm', + ] + JAR_MANIFESTS += ['jar.mn'] EXPORTS.mozilla += [ diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index de906c51c..b6650ea85 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -67,8 +67,10 @@ #include "mozilla/ipc/XPCShellEnvironment.h" #include "mozilla/WindowsDllBlocklist.h" +#ifdef THE_GMP #include "GMPProcessChild.h" #include "GMPLoader.h" +#endif #include "mozilla/gfx/GPUProcessImpl.h" #include "GeckoProfiler.h" @@ -95,9 +97,11 @@ using mozilla::dom::ContentProcess; using mozilla::dom::ContentParent; using mozilla::dom::ContentChild; +#ifdef THE_GMP using mozilla::gmp::GMPLoader; using mozilla::gmp::CreateGMPLoader; using mozilla::gmp::GMPProcessChild; +#endif using mozilla::ipc::TestShellParent; using mozilla::ipc::TestShellCommandParent; @@ -267,6 +271,7 @@ XRE_InitChildProcess(int aArgc, NS_ENSURE_ARG_POINTER(aArgv[0]); MOZ_ASSERT(aChildData); +#ifdef THE_GMP #if !defined(MOZ_WIDGET_ANDROID) // On non-Fennec Gecko, the GMPLoader code resides in plugin-container, // and we must forward it through to the GMP code here. @@ -278,6 +283,7 @@ XRE_InitChildProcess(int aArgc, UniquePtr loader = CreateGMPLoader(nullptr); GMPProcessChild::SetGMPLoader(loader.get()); #endif +#endif #if defined(XP_WIN) // From the --attach-console support in nsNativeAppSupportWin.cpp, but @@ -480,9 +486,11 @@ XRE_InitChildProcess(int aArgc, // Content processes need the XPCOM/chromium frankenventloop uiLoopType = MessageLoop::TYPE_MOZILLA_CHILD; break; +#ifdef THE_GMP case GeckoProcessType_GMPlugin: uiLoopType = MessageLoop::TYPE_DEFAULT; break; +#endif default: uiLoopType = MessageLoop::TYPE_UI; break; @@ -544,9 +552,11 @@ XRE_InitChildProcess(int aArgc, #endif break; +#ifdef THE_GMP case GeckoProcessType_GMPlugin: process = new gmp::GMPProcessChild(parentPID); break; +#endif case GeckoProcessType_GPU: process = new gfx::GPUProcessImpl(parentPID); diff --git a/xpcom/build/XREChildData.h b/xpcom/build/XREChildData.h index c849131d6..3a5291934 100644 --- a/xpcom/build/XREChildData.h +++ b/xpcom/build/XREChildData.h @@ -9,18 +9,19 @@ #include "mozilla/UniquePtr.h" +#ifdef THE_GMP namespace mozilla { namespace gmp { class GMPLoader; } } - +#endif /** * Data needed to start a child process. */ struct XREChildData { -#if !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) && defined(THE_GMP) /** * Used to load the GMP binary. */ diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index c077c7e36..e79fd4cd9 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -425,11 +425,13 @@ XRE_API(const char*, XRE_API(void, XRE_SetProcessType, (const char* aProcessTypeString)) +#ifdef THE_GMP namespace mozilla { namespace gmp { class GMPLoader; } // namespace gmp } // namespace mozilla +#endif XRE_API(nsresult, XRE_InitChildProcess, (int aArgc,