Backed out changeset 1e532bbff55b (bug 1060179)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 09 Oct 2014 12:48:33 +0200
changeset 209562 c9595f1fc91ff730ed549d6ef3f02b9c0d42af46
parent 209561 44e07888317ede7bbc4f3afee1181e6e40fe768d
child 209563 30d1c55eb4271da1338bf8d0b295e800d7ab2162
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs1060179
milestone35.0a1
backs out1e532bbff55beff6b385c3b1582b0737ab840efa
Backed out changeset 1e532bbff55b (bug 1060179)
content/media/eme/CDMProxy.cpp
content/media/eme/CDMProxy.h
content/media/eme/MediaKeys.cpp
content/media/eme/MediaKeys.h
content/media/fmp4/eme/EMEAudioDecoder.cpp
content/media/fmp4/eme/EMEH264Decoder.cpp
content/media/gmp/GMPParent.cpp
content/media/gmp/GMPParent.h
content/media/gmp/GMPService.cpp
content/media/gmp/GMPService.h
content/media/gmp/GMPStorageParent.cpp
content/media/gmp/GMPStorageParent.h
content/media/gmp/mozIGeckoMediaPluginService.idl
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
--- a/content/media/eme/CDMProxy.cpp
+++ b/content/media/eme/CDMProxy.cpp
@@ -36,22 +36,23 @@ CDMProxy::~CDMProxy()
 }
 
 void
 CDMProxy::Init(PromiseId aPromiseId)
 {
   MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
 
-  mNodeId = mKeys->GetNodeId();
-  if (mNodeId.IsEmpty()) {
+  nsresult rv = mKeys->GetOrigin(mOrigin);
+  if (NS_FAILED(rv)) {
     RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
-  EME_LOG("Creating CDMProxy for origin='%s'", GetNodeId().get());
+  EME_LOG("Creating CDMProxy for origin='%s'",
+          NS_ConvertUTF16toUTF8(GetOrigin()).get());
 
   if (!mGMPThread) {
     nsCOMPtr<mozIGeckoMediaPluginService> mps =
       do_GetService("@mozilla.org/gecko-media-plugin-service;1");
     if (!mps) {
       RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
       return;
     }
@@ -83,17 +84,17 @@ CDMProxy::gmp_Init(uint32_t aPromiseId)
     do_GetService("@mozilla.org/gecko-media-plugin-service;1");
   if (!mps) {
     RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
   nsTArray<nsCString> tags;
   tags.AppendElement(NS_ConvertUTF16toUTF8(mKeySystem));
-  nsresult rv = mps->GetGMPDecryptor(&tags, GetNodeId(), &mCDM);
+  nsresult rv = mps->GetGMPDecryptor(&tags, GetOrigin(), &mCDM);
   if (NS_FAILED(rv) || !mCDM) {
     RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
   } else {
     mCallback = new CDMCallbackProxy(this);
     mCDM->Init(mCallback);
     nsRefPtr<nsIRunnable> task(NS_NewRunnableMethodWithArg<uint32_t>(this, &CDMProxy::OnCDMCreated, aPromiseId));
     NS_DispatchToMainThread(task);
   }
@@ -298,19 +299,17 @@ CDMProxy::gmp_RemoveSession(nsAutoPtr<Se
 
 void
 CDMProxy::Shutdown()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mKeys.Clear();
   // Note: This may end up being the last owning reference to the CDMProxy.
   nsRefPtr<nsIRunnable> task(NS_NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
-  if (mGMPThread) {
-    mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
-  }
+  mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
 }
 
 void
 CDMProxy::gmp_Shutdown()
 {
   MOZ_ASSERT(IsOnGMPThread());
 
   // Abort any pending decrypt jobs, to awaken any clients waiting on a job.
@@ -352,20 +351,20 @@ CDMProxy::ResolvePromise(PromiseId aId)
     nsRefPtr<nsIRunnable> task;
     task = NS_NewRunnableMethodWithArg<PromiseId>(this,
                                                   &CDMProxy::ResolvePromise,
                                                   aId);
     NS_DispatchToMainThread(task);
   }
 }
 
-const nsCString&
-CDMProxy::GetNodeId() const
+const nsAString&
+CDMProxy::GetOrigin() const
 {
-  return mNodeId;
+  return mOrigin;
 }
 
 void
 CDMProxy::OnResolveNewSessionPromise(uint32_t aPromiseId,
                                      const nsAString& aSessionId)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mKeys.IsNull()) {
--- a/content/media/eme/CDMProxy.h
+++ b/content/media/eme/CDMProxy.h
@@ -97,17 +97,17 @@ public:
   // processed the request.
   void RemoveSession(const nsAString& aSessionId,
                      PromiseId aPromiseId);
 
   // Main thread only.
   void Shutdown();
 
   // Threadsafe.
-  const nsCString& GetNodeId() const;
+  const nsAString& GetOrigin() const;
 
   // Main thread only.
   void OnResolveNewSessionPromise(uint32_t aPromiseId,
                                   const nsAString& aSessionId);
 
   // Main thread only.
   void OnResolveLoadSessionPromise(uint32_t aPromiseId, bool aSuccess);
 
@@ -281,17 +281,17 @@ private:
   MainThreadOnlyRawPtr<dom::MediaKeys> mKeys;
 
   const nsAutoString mKeySystem;
 
   // Gecko Media Plugin thread. All interactions with the out-of-process
   // EME plugin must come from this thread.
   nsRefPtr<nsIThread> mGMPThread;
 
-  nsCString mNodeId;
+  nsAutoString mOrigin;
 
   GMPDecryptorProxy* mCDM;
   CDMCaps mCapabilites;
   nsAutoPtr<CDMCallbackProxy> mCallback;
 
   // Decryption jobs sent to CDM, awaiting result.
   // GMP thread only.
   nsTArray<nsAutoPtr<DecryptJob>> mDecryptionJobs;
--- a/content/media/eme/MediaKeys.cpp
+++ b/content/media/eme/MediaKeys.cpp
@@ -361,41 +361,36 @@ MediaKeys::OnSessionClosed(MediaKeySessi
 already_AddRefed<MediaKeySession>
 MediaKeys::GetSession(const nsAString& aSessionId)
 {
   nsRefPtr<MediaKeySession> session;
   mKeySessions.Get(aSessionId, getter_AddRefs(session));
   return session.forget();
 }
 
-const nsCString&
-MediaKeys::GetNodeId()
+nsresult
+MediaKeys::GetOrigin(nsString& aOutOrigin)
 {
   MOZ_ASSERT(NS_IsMainThread());
-
   // TODO: Bug 1035637, return a combination of origin and URL bar origin.
 
-  if (!mNodeId.IsEmpty()) {
-    return mNodeId;
-  }
-
   nsIPrincipal* principal = nullptr;
   nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(GetParentObject());
   nsCOMPtr<nsIScriptObjectPrincipal> scriptPrincipal =
     do_QueryInterface(pWindow);
   if (scriptPrincipal) {
     principal = scriptPrincipal->GetPrincipal();
   }
-  nsAutoString id;
-  if (principal && NS_SUCCEEDED(nsContentUtils::GetUTFOrigin(principal, id))) {
-    CopyUTF16toUTF8(id, mNodeId);
-    EME_LOG("EME Origin = '%s'", mNodeId.get());
-  }
+  NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
+
+  nsresult res = nsContentUtils::GetUTFOrigin(principal, aOutOrigin);
 
-  return mNodeId;
+  EME_LOG("EME Origin = '%s'", NS_ConvertUTF16toUTF8(aOutOrigin).get());
+
+  return res;
 }
 
 bool
 CopyArrayBufferViewOrArrayBufferData(const ArrayBufferViewOrArrayBuffer& aBufferOrView,
                                      nsTArray<uint8_t>& aOutData)
 {
   if (aBufferOrView.IsArrayBuffer()) {
     const ArrayBuffer& buffer = aBufferOrView.GetAsArrayBuffer();
--- a/content/media/eme/MediaKeys.h
+++ b/content/media/eme/MediaKeys.h
@@ -102,32 +102,31 @@ public:
   // promises to be resolved.
   PromiseId StorePromise(Promise* aPromise);
 
   // Reject promise with DOMException corresponding to aExceptionCode.
   void RejectPromise(PromiseId aId, nsresult aExceptionCode);
   // Resolves promise with "undefined".
   void ResolvePromise(PromiseId aId);
 
-  const nsCString& GetNodeId();
+  nsresult GetOrigin(nsString& aOutOrigin);
 
   void Shutdown();
 
 private:
 
   // Removes promise from mPromises, and returns it.
   already_AddRefed<Promise> RetrievePromise(PromiseId aId);
 
   // Owning ref to proxy. The proxy has a weak reference back to the MediaKeys,
   // and the MediaKeys destructor clears the proxy's reference to the MediaKeys.
   nsRefPtr<CDMProxy> mProxy;
 
   nsCOMPtr<nsPIDOMWindow> mParent;
   nsString mKeySystem;
-  nsCString mNodeId;
   KeySessionHashMap mKeySessions;
   PromiseHashMap mPromises;
   PendingKeySessionsHashMap mPendingSessions;
   PromiseId mCreatePromiseId;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/content/media/fmp4/eme/EMEAudioDecoder.cpp
+++ b/content/media/fmp4/eme/EMEAudioDecoder.cpp
@@ -237,17 +237,17 @@ nsresult
 EMEAudioDecoder::GmpInit()
 {
   MOZ_ASSERT(IsOnGMPThread());
 
   nsTArray<nsCString> tags;
   tags.AppendElement(NS_LITERAL_CSTRING("aac"));
   tags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
   nsresult rv = mMPS->GetGMPAudioDecoder(&tags,
-                                         mProxy->GetNodeId(),
+                                         mProxy->GetOrigin(),
                                          &mGMP);
   NS_ENSURE_SUCCESS(rv, rv);
   MOZ_ASSERT(mGMP);
 
   mAudioRate = mConfig.samples_per_second;
   mAudioBytesPerSample = mConfig.bits_per_sample / 8;
   mAudioChannels = mConfig.channel_count;
 
--- a/content/media/fmp4/eme/EMEH264Decoder.cpp
+++ b/content/media/fmp4/eme/EMEH264Decoder.cpp
@@ -228,17 +228,17 @@ nsresult
 EMEH264Decoder::GmpInit()
 {
   MOZ_ASSERT(IsOnGMPThread());
 
   nsTArray<nsCString> tags;
   tags.AppendElement(NS_LITERAL_CSTRING("h264"));
   tags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
   nsresult rv = mMPS->GetGMPVideoDecoder(&tags,
-                                         mProxy->GetNodeId(),
+                                         mProxy->GetOrigin(),
                                          &mHost,
                                          &mGMP);
   NS_ENSURE_SUCCESS(rv, rv);
   MOZ_ASSERT(mHost && mGMP);
 
   GMPVideoCodec codec;
   memset(&codec, 0, sizeof(codec));
 
--- a/content/media/gmp/GMPParent.cpp
+++ b/content/media/gmp/GMPParent.cpp
@@ -675,17 +675,17 @@ GMPParent::DeallocPGMPAudioDecoderParent
   GMPAudioDecoderParent* vdp = static_cast<GMPAudioDecoderParent*>(aActor);
   NS_RELEASE(vdp);
   return true;
 }
 
 PGMPStorageParent*
 GMPParent::AllocPGMPStorageParent()
 {
-  GMPStorageParent* p = new GMPStorageParent(mNodeId, this);
+  GMPStorageParent* p = new GMPStorageParent(mOrigin, this);
   mStorage.AppendElement(p); // Addrefs, released in DeallocPGMPStorageParent.
   return p;
 }
 
 bool
 GMPParent::DeallocPGMPStorageParent(PGMPStorageParent* aActor)
 {
   GMPStorageParent* p = static_cast<GMPStorageParent*>(aActor);
@@ -872,34 +872,34 @@ GMPParent::ReadGMPMetaData()
   if (mCapabilities.IsEmpty()) {
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 bool
-GMPParent::CanBeSharedCrossNodeIds() const
+GMPParent::CanBeSharedCrossOrigin() const
 {
-  return mNodeId.IsEmpty();
+  return mOrigin.IsEmpty();
 }
 
 bool
-GMPParent::CanBeUsedFrom(const nsACString& aNodeId) const
+GMPParent::CanBeUsedFrom(const nsAString& aOrigin) const
 {
-  return (mNodeId.IsEmpty() && State() == GMPStateNotLoaded) ||
-         mNodeId == aNodeId;
+  return (mOrigin.IsEmpty() && State() == GMPStateNotLoaded) ||
+         mOrigin.Equals(aOrigin);
 }
 
 void
-GMPParent::SetNodeId(const nsACString& aNodeId)
+GMPParent::SetOrigin(const nsAString& aOrigin)
 {
-  MOZ_ASSERT(!aNodeId.IsEmpty());
-  MOZ_ASSERT(CanBeUsedFrom(aNodeId));
-  mNodeId = aNodeId;
+  MOZ_ASSERT(!aOrigin.IsEmpty());
+  MOZ_ASSERT(CanBeUsedFrom(aOrigin));
+  mOrigin = aOrigin;
 }
 
 bool
 GMPParent::RecvAsyncShutdownRequired()
 {
   LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
   mAsyncShutdownRequired = true;
   mService->AsyncShutdownNeeded(this);
--- a/content/media/gmp/GMPParent.h
+++ b/content/media/gmp/GMPParent.h
@@ -94,38 +94,36 @@ public:
   void DecryptorDestroyed(GMPDecryptorParent* aSession);
 
   nsresult GetGMPAudioDecoder(GMPAudioDecoderParent** aGMPAD);
   void AudioDecoderDestroyed(GMPAudioDecoderParent* aDecoder);
 
   GMPState State() const;
   nsIThread* GMPThread();
 
-  // A GMP can either be a single instance shared across all NodeIds (like
+  // A GMP can either be a single instance shared across all origins (like
   // in the OpenH264 case), or we can require a new plugin instance for every
-  // NodeIds running the plugin (as in the EME plugin case).
+  // origin running the plugin (as in the EME plugin case).
   //
-  // A NodeId is a hash of the ($urlBarOrigin, $ownerDocOrigin) pair.
-  //
-  // Plugins are associated with an NodeIds by calling SetNodeId() before
+  // Plugins are associated with an origin by calling SetOrigin() before
   // loading.
   //
-  // If a plugin has no NodeId specified and it is loaded, it is assumed to
-  // be shared across NodeIds.
+  // If a plugin has no origin specified and it is loaded, it is assumed to
+  // be shared across origins.
 
-  // Specifies that a GMP can only work with the specified NodeIds.
-  void SetNodeId(const nsACString& aNodeId);
+  // Specifies that a GMP can only work with the specified origin.
+  void SetOrigin(const nsAString& aOrigin);
 
-  // Returns true if a plugin can be or is being used across multiple NodeIds.
-  bool CanBeSharedCrossNodeIds() const;
+  // Returns true if a plugin can be or is being used across multiple origins.
+  bool CanBeSharedCrossOrigin() const;
 
-  // A GMP can be used from a NodeId if it's already been set to work with
-  // that NodeId, or if it's not been set to work with any NodeId and has
-  // not yet been loaded (i.e. it's not shared across NodeIds).
-  bool CanBeUsedFrom(const nsACString& aNodeId) const;
+  // A GMP can be used from an origin if it's already been set to work with
+  // that origin, or if it's not been set to work with any origin and has
+  // not yet been loaded (i.e. it's not shared across origins).
+  bool CanBeUsedFrom(const nsAString& aOrigin) const;
 
   already_AddRefed<nsIFile> GetDirectory() {
     return nsCOMPtr<nsIFile>(mDirectory).forget();
   }
 
   // GMPSharedMem
   virtual void CheckThread() MOZ_OVERRIDE;
 
@@ -181,19 +179,19 @@ private:
 
   nsTArray<nsRefPtr<GMPVideoDecoderParent>> mVideoDecoders;
   nsTArray<nsRefPtr<GMPVideoEncoderParent>> mVideoEncoders;
   nsTArray<nsRefPtr<GMPDecryptorParent>> mDecryptors;
   nsTArray<nsRefPtr<GMPAudioDecoderParent>> mAudioDecoders;
   nsTArray<nsRefPtr<GMPTimerParent>> mTimers;
   nsTArray<nsRefPtr<GMPStorageParent>> mStorage;
   nsCOMPtr<nsIThread> mGMPThread;
-  // NodeId the plugin is assigned to, or empty if the the plugin is not
-  // assigned to a NodeId.
-  nsAutoCString mNodeId;
+  // Origin the plugin is assigned to, or empty if the the plugin is not
+  // assigned to an origin.
+  nsAutoString mOrigin;
 
   bool mAsyncShutdownRequired;
   bool mAsyncShutdownInProgress;
 };
 
 } // namespace gmp
 } // namespace mozilla
 
--- a/content/media/gmp/GMPService.cpp
+++ b/content/media/gmp/GMPService.cpp
@@ -319,28 +319,28 @@ GeckoMediaPluginService::GetThread(nsITh
   NS_ADDREF(mGMPThread);
   *aThread = mGMPThread;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginService::GetGMPAudioDecoder(nsTArray<nsCString>* aTags,
-                                            const nsACString& aNodeId,
+                                            const nsAString& aOrigin,
                                             GMPAudioDecoderProxy** aGMPAD)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aGMPAD);
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
-  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
+  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
                                                NS_LITERAL_CSTRING("decode-audio"),
                                                *aTags);
   if (!gmp) {
     return NS_ERROR_FAILURE;
   }
 
   GMPAudioDecoderParent* gmpADP;
   nsresult rv = gmp->GetGMPAudioDecoder(&gmpADP);
@@ -350,30 +350,30 @@ GeckoMediaPluginService::GetGMPAudioDeco
 
   *aGMPAD = gmpADP;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginService::GetGMPVideoDecoder(nsTArray<nsCString>* aTags,
-                                            const nsACString& aNodeId,
+                                            const nsAString& aOrigin,
                                             GMPVideoHost** aOutVideoHost,
                                             GMPVideoDecoderProxy** aGMPVD)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aOutVideoHost);
   NS_ENSURE_ARG(aGMPVD);
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
-  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
+  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
                                                NS_LITERAL_CSTRING("decode-video"),
                                                *aTags);
 #ifdef PR_LOGGING
   nsCString api = (*aTags)[0];
   LOGD(("%s: %p returning %p for api %s", __FUNCTION__, (void *)this, (void *)gmp, api.get()));
 #endif
   if (!gmp) {
     return NS_ERROR_FAILURE;
@@ -389,30 +389,30 @@ GeckoMediaPluginService::GetGMPVideoDeco
   *aGMPVD = gmpVDP;
   *aOutVideoHost = &gmpVDP->Host();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginService::GetGMPVideoEncoder(nsTArray<nsCString>* aTags,
-                                            const nsACString& aNodeId,
+                                            const nsAString& aOrigin,
                                             GMPVideoHost** aOutVideoHost,
                                             GMPVideoEncoderProxy** aGMPVE)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aOutVideoHost);
   NS_ENSURE_ARG(aGMPVE);
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
-  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
+  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
                                                NS_LITERAL_CSTRING("encode-video"),
                                                *aTags);
 #ifdef PR_LOGGING
   nsCString api = (*aTags)[0];
   LOGD(("%s: %p returning %p for api %s", __FUNCTION__, (void *)this, (void *)gmp, api.get()));
 #endif
   if (!gmp) {
     return NS_ERROR_FAILURE;
@@ -427,17 +427,17 @@ GeckoMediaPluginService::GetGMPVideoEnco
   *aGMPVE = gmpVEP;
   *aOutVideoHost = &gmpVEP->Host();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginService::GetGMPDecryptor(nsTArray<nsCString>* aTags,
-                                         const nsACString& aNodeId,
+                                         const nsAString& aOrigin,
                                          GMPDecryptorProxy** aDecryptor)
 {
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
   if (!mozilla::CanSandboxMediaPlugin()) {
     NS_WARNING("GeckoMediaPluginService::GetGMPDecryptor: "
                "EME decryption not available without sandboxing support.");
     return NS_ERROR_NOT_AVAILABLE;
   }
@@ -446,17 +446,17 @@ GeckoMediaPluginService::GetGMPDecryptor
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aDecryptor);
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
-  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aNodeId,
+  nsRefPtr<GMPParent> gmp = SelectPluginForAPI(aOrigin,
                                                NS_LITERAL_CSTRING("eme-decrypt"),
                                                *aTags);
   if (!gmp) {
     return NS_ERROR_FAILURE;
   }
 
   GMPDecryptorParent* ksp;
   nsresult rv = gmp->GetGMPDecryptor(&ksp);
@@ -653,38 +653,38 @@ GeckoMediaPluginService::RemovePluginDir
     return rv;
   }
   nsCOMPtr<nsIRunnable> r = new PathRunnable(this, aDirectory, false);
   thread->Dispatch(r, NS_DISPATCH_NORMAL);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginService::HasPluginForAPI(const nsACString& aNodeId,
+GeckoMediaPluginService::HasPluginForAPI(const nsAString& aOrigin,
                                          const nsACString& aAPI,
                                          nsTArray<nsCString>* aTags,
                                          bool* aResult)
 {
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aResult);
 
   nsCString temp(aAPI);
-  GMPParent *parent = SelectPluginForAPI(aNodeId, temp, *aTags, false);
+  GMPParent *parent = SelectPluginForAPI(aOrigin, temp, *aTags, false);
   *aResult = !!parent;
 
   return NS_OK;
 }
 
 GMPParent*
-GeckoMediaPluginService::SelectPluginForAPI(const nsACString& aNodeId,
+GeckoMediaPluginService::SelectPluginForAPI(const nsAString& aOrigin,
                                             const nsCString& aAPI,
                                             const nsTArray<nsCString>& aTags,
-                                            bool aCloneCrossNodeIds)
+                                            bool aCloneCrossOrigin)
 {
-  MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread || !aCloneCrossNodeIds,
+  MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread || !aCloneCrossOrigin,
              "Can't clone GMP plugins on non-GMP threads.");
 
   GMPParent* gmpToClone = nullptr;
   {
     MutexAutoLock lock(mMutex);
     for (uint32_t i = 0; i < mPlugins.Length(); i++) {
       GMPParent* gmp = mPlugins[i];
       bool supportsAllTags = true;
@@ -693,38 +693,39 @@ GeckoMediaPluginService::SelectPluginFor
         if (!gmp->SupportsAPI(aAPI, tag)) {
           supportsAllTags = false;
           break;
         }
       }
       if (!supportsAllTags) {
         continue;
       }
-      if (aNodeId.IsEmpty()) {
-        if (gmp->CanBeSharedCrossNodeIds()) {
+      if (aOrigin.IsEmpty()) {
+        if (gmp->CanBeSharedCrossOrigin()) {
           return gmp;
         }
-      } else if (gmp->CanBeUsedFrom(aNodeId)) {
-        MOZ_ASSERT(!aNodeId.IsEmpty());
-        gmp->SetNodeId(aNodeId);
+      } else if (gmp->CanBeUsedFrom(aOrigin)) {
+        if (!aOrigin.IsEmpty()) {
+          gmp->SetOrigin(aOrigin);
+        }
         return gmp;
       }
 
       // This GMP has the correct type but has the wrong origin; hold on to it
       // in case we need to clone it.
       gmpToClone = gmp;
     }
   }
 
   // Plugin exists, but we can't use it due to cross-origin separation. Create a
   // new one.
-  if (aCloneCrossNodeIds && gmpToClone) {
+  if (aCloneCrossOrigin && gmpToClone) {
     GMPParent* clone = ClonePlugin(gmpToClone);
-    if (!aNodeId.IsEmpty()) {
-      clone->SetNodeId(aNodeId);
+    if (!aOrigin.IsEmpty()) {
+      clone->SetOrigin(aOrigin);
     }
     return clone;
   }
 
   return nullptr;
 }
 
 class CreateGMPParentTask : public nsRunnable {
--- a/content/media/gmp/GMPService.h
+++ b/content/media/gmp/GMPService.h
@@ -40,20 +40,20 @@ public:
 
   void AsyncShutdownNeeded(GMPParent* aParent);
   void AsyncShutdownComplete(GMPParent* aParent);
   void AbortAsyncShutdown();
 
 private:
   ~GeckoMediaPluginService();
 
-  GMPParent* SelectPluginForAPI(const nsACString& aNodeId,
+  GMPParent* SelectPluginForAPI(const nsAString& aOrigin,
                                 const nsCString& aAPI,
                                 const nsTArray<nsCString>& aTags,
-                                bool aCloneCrossNodeIds = true);
+                                bool aCloneCrossOrigin = true);
 
   void UnloadPlugins();
   void CrashPlugins();
   void SetAsyncShutdownComplete();
 
   void LoadFromEnvironment();
   void ProcessPossiblePlugin(nsIFile* aDir);
 
--- a/content/media/gmp/GMPStorageParent.cpp
+++ b/content/media/gmp/GMPStorageParent.cpp
@@ -51,17 +51,17 @@ public:
     return NS_OK;
   }
 
   nsString mPath;
 };
 
 // We store the records in files in the system temp dir.
 static nsresult
-GetGMPStorageDir(nsIFile** aTempDir, const nsCString& aNodeId)
+GetGMPStorageDir(nsIFile** aTempDir, const nsString& aOrigin)
 {
   if (NS_WARN_IF(!aTempDir)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   // Directory service is main thread only...
   nsRefPtr<GetTempDirTask> task = new GetTempDirTask();
   nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
@@ -77,45 +77,45 @@ GetGMPStorageDir(nsIFile** aTempDir, con
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // TODO: When aOrigin is the same node-id as the GMP sees in the child
   // process (a UUID or somesuch), we can just append it un-hashed here.
   // This should reduce the chance of hash collsions exposing data.
   nsAutoString nodeIdHash;
-  nodeIdHash.AppendInt(HashString(aNodeId));
+  nodeIdHash.AppendInt(HashString(static_cast<const char16_t*>(aOrigin.get())));
   rv = tmpFile->Append(nodeIdHash);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = tmpFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
   if (rv != NS_ERROR_FILE_ALREADY_EXISTS && NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   tmpFile.forget(aTempDir);
 
   return NS_OK;
 }
 
-GMPStorageParent::GMPStorageParent(const nsCString& aNodeId,
+GMPStorageParent::GMPStorageParent(const nsString& aOrigin,
                                    GMPParent* aPlugin)
-  : mNodeId(aNodeId)
+  : mOrigin(aOrigin)
   , mPlugin(aPlugin)
   , mShutdown(false)
 {
 }
 
 enum OpenFileMode  { ReadWrite, Truncate };
 
 nsresult
 OpenStorageFile(const nsCString& aRecordName,
-                const nsCString& aNodeId,
+                const nsString& aNodeId,
                 const OpenFileMode aMode,
                 PRFileDesc** aOutFD)
 {
   MOZ_ASSERT(aOutFD);
 
   nsCOMPtr<nsIFile> f;
   nsresult rv = GetGMPStorageDir(getter_AddRefs(f), aNodeId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -136,31 +136,31 @@ OpenStorageFile(const nsCString& aRecord
 
 bool
 GMPStorageParent::RecvOpen(const nsCString& aRecordName)
 {
   if (mShutdown) {
     return true;
   }
 
-  if (mNodeId.EqualsLiteral("null")) {
-    // Refuse to open storage if the page is opened from local disk,
-    // or shared across origin.
-    NS_WARNING("Refusing to open storage for null NodeId");
+  if (mOrigin.EqualsASCII("null")) {
+    // Refuse to open storage if the page is the "null" origin; if the page
+    // is opened from disk.
+    NS_WARNING("Refusing to open storage for null origin");
     unused << SendOpenComplete(aRecordName, GMPGenericErr);
     return true;
   }
 
   if (aRecordName.IsEmpty() || mFiles.Contains(aRecordName)) {
     unused << SendOpenComplete(aRecordName, GMPRecordInUse);
     return true;
   }
 
   PRFileDesc* fd = nullptr;
-  nsresult rv = OpenStorageFile(aRecordName, mNodeId, ReadWrite, &fd);
+  nsresult rv = OpenStorageFile(aRecordName, mOrigin, ReadWrite, &fd);
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to open storage file.");
     unused << SendOpenComplete(aRecordName, GMPGenericErr);
     return true;
   }
 
   mFiles.Put(aRecordName, fd);
   unused << SendOpenComplete(aRecordName, GMPNoErr);
@@ -219,17 +219,17 @@ GMPStorageParent::RecvWrite(const nsCStr
     unused << SendWriteComplete(aRecordName, GMPGenericErr);
     return true;
   }
 
   // Write operations overwrite the entire record. So re-open the file
   // in truncate mode, to clear its contents.
   PR_Close(fd);
   mFiles.Remove(aRecordName);
-  if (NS_FAILED(OpenStorageFile(aRecordName, mNodeId, Truncate, &fd))) {
+  if (NS_FAILED(OpenStorageFile(aRecordName, mOrigin, Truncate, &fd))) {
     unused << SendWriteComplete(aRecordName, GMPGenericErr);
     return true;
   }
   mFiles.Put(aRecordName, fd);
 
   int32_t bytesWritten = PR_Write(fd, aBytes.Elements(), aBytes.Length());
   auto res = (bytesWritten == (int32_t)aBytes.Length()) ? GMPNoErr : GMPGenericErr;
   unused << SendWriteComplete(aRecordName, res);
--- a/content/media/gmp/GMPStorageParent.h
+++ b/content/media/gmp/GMPStorageParent.h
@@ -15,33 +15,33 @@
 namespace mozilla {
 namespace gmp {
 
 class GMPParent;
 
 class GMPStorageParent : public PGMPStorageParent {
 public:
   NS_INLINE_DECL_REFCOUNTING(GMPStorageParent)
-  GMPStorageParent(const nsCString& aNodeId, GMPParent* aPlugin);
+  GMPStorageParent(const nsString& aOrigin, GMPParent* aPlugin);
 
   void Shutdown();
 
 protected:
   virtual bool RecvOpen(const nsCString& aRecordName) MOZ_OVERRIDE;
   virtual bool RecvRead(const nsCString& aRecordName) MOZ_OVERRIDE;
   virtual bool RecvWrite(const nsCString& aRecordName,
                          const InfallibleTArray<uint8_t>& aBytes) MOZ_OVERRIDE;
   virtual bool RecvClose(const nsCString& aRecordName) MOZ_OVERRIDE;
   virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
 
 private:
   ~GMPStorageParent() {}
 
   nsDataHashtable<nsCStringHashKey, PRFileDesc*> mFiles;
-  const nsAutoCString mNodeId;
+  const nsString mOrigin;
   nsRefPtr<GMPParent> mPlugin;
   bool mShutdown;
 };
 
 } // namespace gmp
 } // namespace mozilla
 
 #endif // GMPStorageParent_h_
--- a/content/media/gmp/mozIGeckoMediaPluginService.idl
+++ b/content/media/gmp/mozIGeckoMediaPluginService.idl
@@ -20,68 +20,67 @@ class GMPVideoHost;
 [ptr] native GMPVideoDecoderProxy(GMPVideoDecoderProxy);
 [ptr] native GMPVideoEncoderProxy(GMPVideoEncoderProxy);
 [ptr] native GMPVideoHost(GMPVideoHost);
 [ptr] native MessageLoop(MessageLoop);
 [ptr] native TagArray(nsTArray<nsCString>);
 [ptr] native GMPDecryptorProxy(GMPDecryptorProxy);
 [ptr] native GMPAudioDecoderProxy(GMPAudioDecoderProxy);
 
-[scriptable, uuid(88ade941-a423-48f9-aa3d-a383af8de4b8)]
+[scriptable, uuid(6ea374fc-32ad-46f6-ae9d-80b668f4fd49)]
 interface mozIGeckoMediaPluginService : nsISupports
 {
-
   /**
    * The GMP thread. Callable from any thread.
    */
   readonly attribute nsIThread thread;
 
   /**
    * Get a plugin that supports the specified tags.
    * Callable on any thread
    */
   [noscript]
-  boolean hasPluginForAPI([optional] in ACString nodeId,
+  boolean hasPluginForAPI([optional] in AString origin,
                           in ACString api,
                           in TagArray tags);
 
   /**
    * Get a video decoder that supports the specified tags.
    * The array of tags should at least contain a codec tag, and optionally
    * other tags such as for EME keysystem.
    * Callable only on GMP thread.
    */
   [noscript]
   GMPVideoDecoderProxy getGMPVideoDecoder(in TagArray tags,
-                                          [optional] in ACString nodeId,
+                                          [optional] in AString origin,
                                           out GMPVideoHost outVideoHost);
 
   /**
    * Get a video encoder that supports the specified tags.
    * The array of tags should at least contain a codec tag, and optionally
    * other tags.
    * Callable only on GMP thread.
    */
   [noscript]
   GMPVideoEncoderProxy getGMPVideoEncoder(in TagArray tags,
-		                                      [optional] in ACString nodeId,
+		                                      [optional] in AString origin,
 		                                      out GMPVideoHost outVideoHost);
 
   // Returns an audio decoder that supports the specified tags.
   // The array of tags should at least contain a codec tag, and optionally
   // other tags such as for EME keysystem.
   // Callable only on GMP thread.
   GMPAudioDecoderProxy getGMPAudioDecoder(in TagArray tags,
-                                          [optional] in ACString nodeId);
+                                          [optional] in AString origin);
 
   // Returns a decryption session manager that supports the specified tags.
   // The array of tags should at least contain a key system tag, and optionally
   // other tags.
   // Callable only on GMP thread.
-  GMPDecryptorProxy getGMPDecryptor(in TagArray tags, in ACString nodeId);
+  GMPDecryptorProxy getGMPDecryptor(in TagArray tags, in AString origin);
 
   /**
    * Add a directory to scan for gecko media plugins.
    * @note Main-thread API.
    */
   void addPluginDirectory(in AString directory);
 
   /**
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
@@ -166,17 +166,17 @@ WebrtcGmpVideoEncoder::InitEncode(const 
 int32_t
 WebrtcGmpVideoEncoder::InitEncode_g(const webrtc::VideoCodec* aCodecSettings,
                                     int32_t aNumberOfCores,
                                     uint32_t aMaxPayloadSize)
 {
   nsTArray<nsCString> tags;
   tags.AppendElement(NS_LITERAL_CSTRING("h264"));
   if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoEncoder(&tags,
-                                                    NS_LITERAL_CSTRING(""),
+                                                    NS_LITERAL_STRING(""),
                                                     &mHost,
                                                     &mGMP)))) {
     mMPS = nullptr;
     mGMP = nullptr;
     mGMPThread = nullptr;
     mHost = nullptr;
     return WEBRTC_VIDEO_CODEC_ERROR;
   }
@@ -250,17 +250,17 @@ WebrtcGmpVideoEncoder::Encode_g(const we
     mGMP->Close();
 
     // OpenH264 codec (at least) can't handle dynamic input resolution changes
     // re-init the plugin when the resolution changes
     // XXX allow codec to indicate it doesn't need re-init!
     nsTArray<nsCString> tags;
     tags.AppendElement(NS_LITERAL_CSTRING("h264"));
     if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoEncoder(&tags,
-                                                      NS_LITERAL_CSTRING(""),
+                                                      NS_LITERAL_STRING(""),
                                                       &mHost,
                                                       &mGMP)))) {
       mGMP = nullptr;
       mHost = nullptr;
       return WEBRTC_VIDEO_CODEC_ERROR;
     }
 
     mCodecParams.mWidth = aInputImage->width();
@@ -553,17 +553,17 @@ WebrtcGmpVideoDecoder::InitDecode(const 
 
 int32_t
 WebrtcGmpVideoDecoder::InitDecode_g(const webrtc::VideoCodec* aCodecSettings,
                                     int32_t aNumberOfCores)
 {
   nsTArray<nsCString> tags;
   tags.AppendElement(NS_LITERAL_CSTRING("h264"));
   if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoDecoder(&tags,
-                                                    NS_LITERAL_CSTRING(""),
+                                                    NS_LITERAL_STRING(""),
                                                     &mHost,
                                                     &mGMP)))) {
     mMPS = nullptr;
     mGMP = nullptr;
     mGMPThread = nullptr;
     mHost = nullptr;
     return WEBRTC_VIDEO_CODEC_ERROR;
   }
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -198,25 +198,25 @@ int VcmSIPCCBinding::getVideoCodecsGmp()
   // XXX I'd prefer if this was all known ahead of time...
 
   nsTArray<nsCString> tags;
   tags.AppendElement(NS_LITERAL_CSTRING("h264"));
 
   // H.264 only for now
   bool has_gmp;
   nsresult rv;
-  rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_CSTRING(""),
+  rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_STRING(""),
                                            NS_LITERAL_CSTRING("encode-video"),
                                            &tags,
                                            &has_gmp);
   if (NS_FAILED(rv) || !has_gmp) {
     return 0;
   }
 
-  rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_CSTRING(""),
+  rv = gSelf->mGMPService->HasPluginForAPI(NS_LITERAL_STRING(""),
                                            NS_LITERAL_CSTRING("decode-video"),
                                            &tags,
                                            &has_gmp);
   if (NS_FAILED(rv) || !has_gmp) {
     return 0;
   }
 
   return VCM_CODEC_RESOURCE_H264;