Bug 1334564 - Deprecate URL.createObjectURL(mediastream), r=smaug, r=rjesup
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 07 Feb 2017 08:58:35 +0100
changeset 341067 3d7fce1fab83e6a1c9b08f411d8f4170c4fa4287
parent 341066 17414d851efb55e58879157ef16f525a2e73ab0b
child 341068 8a8137a83c2aadd0ad5b49f19642f8c8d4e977f7
push id86626
push useramarchesini@mozilla.com
push dateTue, 07 Feb 2017 08:01:10 +0000
treeherdermozilla-inbound@3d7fce1fab83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, rjesup
bugs1334564
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1334564 - Deprecate URL.createObjectURL(mediastream), r=smaug, r=rjesup
dom/base/nsDeprecatedOperationList.h
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/locales/en-US/chrome/dom/dom.properties
dom/url/URL.cpp
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -45,8 +45,9 @@ DEPRECATED_OPERATION(NavigatorGetUserMed
 DEPRECATED_OPERATION(WebrtcDeprecatedPrefix)
 DEPRECATED_OPERATION(RTCPeerConnectionGetStreams)
 DEPRECATED_OPERATION(AppCache)
 DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled)
 DEPRECATED_OPERATION(PrefixedFullscreenAPI)
 DEPRECATED_OPERATION(LenientSetter)
 DEPRECATED_OPERATION(FileLastModifiedDate)
 DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
+DEPRECATED_OPERATION(URLCreateObjectURL_MediaStream)
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -3613,26 +3613,33 @@ DeprecationWarning(JSContext* aCx, JSObj
                    nsIDocument::DeprecatedOperations aOperation)
 {
   GlobalObject global(aCx, aObject);
   if (global.Failed()) {
     NS_ERROR("Could not create global for DeprecationWarning");
     return;
   }
 
+  DeprecationWarning(global, aOperation);
+}
+
+void
+DeprecationWarning(const GlobalObject& aGlobal,
+                   nsIDocument::DeprecatedOperations aOperation)
+{
   if (NS_IsMainThread()) {
-    nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(global.GetAsSupports());
+    nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
     if (window && window->GetExtantDoc()) {
       window->GetExtantDoc()->WarnOnceAbout(aOperation);
     }
 
     return;
   }
 
-  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aGlobal.Context());
   if (!workerPrivate) {
     return;
   }
 
   RefPtr<DeprecationWarningRunnable> runnable =
     new DeprecationWarningRunnable(workerPrivate, aOperation);
   runnable->Dispatch();
 }
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -3190,16 +3190,20 @@ void
 SetDocumentAndPageUseCounter(JSContext* aCx, JSObject* aObject,
                              UseCounter aUseCounter);
 
 // Warnings
 void
 DeprecationWarning(JSContext* aCx, JSObject* aObject,
                    nsIDocument::DeprecatedOperations aOperation);
 
+void
+DeprecationWarning(const GlobalObject& aGlobal,
+                   nsIDocument::DeprecatedOperations aOperation);
+
 // A callback to perform funToString on an interface object
 JSString*
 InterfaceObjectToString(JSContext* aCx, JS::Handle<JSObject*> aObject,
                         unsigned /* indent */);
 
 namespace binding_detail {
 // Get a JS global object that can be used for some temporary allocations.  The
 // idea is that this should be used for situations when you need to operate in
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -316,8 +316,10 @@ LargeAllocationSuccess=This page was loa
 LargeAllocationNonGetRequest=A Large-Allocation header was ignored due to the load being triggered by a non-GET request.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name. Do not translate `window.opener`.
 LargeAllocationNotOnlyToplevelInTabGroup=A Large-Allocation header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or window.opener.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name
 LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document not being loaded out of process.
 GeolocationInsecureRequestIsForbidden=A Geolocation request can only be fulfilled in a secure context.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name.
 LargeAllocationNonWin32=This page would be loaded in a new process due to a Large-Allocation header, however Large-Allocation process creation is disabled on non-Win32 platforms.
+# LOCALIZATION NOTE: Do not translate URL.createObjectURL(MediaStream).
+URLCreateObjectURL_MediaStream=URL.createObjectURL(MediaStream) is deprecated and will be removed soon.
--- a/dom/url/URL.cpp
+++ b/dom/url/URL.cpp
@@ -1722,16 +1722,19 @@ URL::CreateObjectURL(const GlobalObject&
   }
 }
 
 void
 URL::CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
                      nsAString& aResult, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
+
+  DeprecationWarning(aGlobal, nsIDocument::eURLCreateObjectURL_MediaStream);
+
   URLMainThread::CreateObjectURL(aGlobal, aStream, aResult, aRv);
 }
 
 void
 URL::CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
                      nsAString& aResult, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());