Bug 1336018 - Get rid of objectURLOptions dictionary in URL.createObjectURL, r=smaug
☠☠ backed out by cc3e830547b3 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 02 Feb 2017 15:15:54 +0100
changeset 469650 bfaa720977d27855278f1c1985636ea9f76d3cb4
parent 469649 00aaf25b6e055dd3b557b0546a9c886865b5fff8
child 469651 95fe30082f2c014c9d9878109c8ff419429029c5
push id43793
push userdmitchell@mozilla.com
push dateThu, 02 Feb 2017 14:41:57 +0000
reviewerssmaug
bugs1336018
milestone54.0a1
Bug 1336018 - Get rid of objectURLOptions dictionary in URL.createObjectURL, r=smaug
dom/url/URL.cpp
dom/url/URL.h
dom/webidl/URL.webidl
--- a/dom/url/URL.cpp
+++ b/dom/url/URL.cpp
@@ -75,36 +75,33 @@ public:
               const nsAString& aBase, ErrorResult& aRv);
 
   static already_AddRefed<URLMainThread>
   Constructor(nsISupports* aParent, const nsAString& aURL, nsIURI* aBase,
               ErrorResult& aRv);
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
-                  const objectURLOptions& aOptions, nsAString& aResult,
-                  ErrorResult& aRv)
+                  nsAString& aResult, ErrorResult& aRv)
   {
     MOZ_ASSERT(NS_IsMainThread());
     CreateObjectURLInternal(aGlobal, aBlob.Impl(), aResult, aRv);
   }
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
-                  const objectURLOptions& aOptions, nsAString& aResult,
-                  ErrorResult& aRv)
+                  nsAString& aResult, ErrorResult& aRv)
   {
     MOZ_ASSERT(NS_IsMainThread());
     CreateObjectURLInternal(aGlobal, &aStream, aResult, aRv);
   }
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
-                  const objectURLOptions& aOptions, nsAString& aResult,
-                  ErrorResult& aRv);
+                  nsAString& aResult, ErrorResult& aRv);
 
   static void
   RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,
                   ErrorResult& aRv);
 
   static bool
   IsValidURL(const GlobalObject& aGlobal, const nsAString& aURL,
              ErrorResult& aRv);
@@ -252,17 +249,16 @@ URLMainThread::Constructor(nsISupports* 
 
   RefPtr<URLMainThread> url = new URLMainThread(aParent, uri.forget());
   return url.forget();
 }
 
 /* static */ void
 URLMainThread::CreateObjectURL(const GlobalObject& aGlobal,
                                MediaSource& aSource,
-                               const objectURLOptions& aOptions,
                                nsAString& aResult, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIPrincipal> principal =
     nsContentUtils::ObjectPrincipal(aGlobal.Get());
 
   nsAutoCString url;
@@ -649,17 +645,16 @@ public:
               const Optional<nsAString>& aBase, ErrorResult& aRv);
 
   static already_AddRefed<URLWorker>
   Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
               const nsAString& aBase, ErrorResult& aRv);
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
-                  const mozilla::dom::objectURLOptions& aOptions,
                   nsAString& aResult, mozilla::ErrorResult& aRv);
 
   static void
   RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aUrl,
                   ErrorResult& aRv);
 
   static bool
   IsValidURL(const GlobalObject& aGlobal, const nsAString& aUrl,
@@ -750,17 +745,16 @@ private:
 class CreateURLRunnable : public WorkerMainThreadRunnable
 {
 private:
   BlobImpl* mBlobImpl;
   nsAString& mURL;
 
 public:
   CreateURLRunnable(WorkerPrivate* aWorkerPrivate, BlobImpl* aBlobImpl,
-                    const objectURLOptions& aOptions,
                     nsAString& aURL)
   : WorkerMainThreadRunnable(aWorkerPrivate,
                              NS_LITERAL_CSTRING("URL :: CreateURL"))
   , mBlobImpl(aBlobImpl)
   , mURL(aURL)
   {
     MOZ_ASSERT(aBlobImpl);
 
@@ -1292,32 +1286,31 @@ URLWorker::Constructor(const GlobalObjec
   RefPtr<ConstructorRunnable> runnable =
     new ConstructorRunnable(workerPrivate, aURL, base);
 
   return FinishConstructor(cx, workerPrivate, runnable, aRv);
 }
 
 /* static */ void
 URLWorker::CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
-                           const mozilla::dom::objectURLOptions& aOptions,
                            nsAString& aResult, mozilla::ErrorResult& aRv)
 {
   JSContext* cx = aGlobal.Context();
   WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(cx);
 
   RefPtr<BlobImpl> blobImpl = aBlob.Impl();
   MOZ_ASSERT(blobImpl);
 
   aRv = blobImpl->SetMutable(false);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   RefPtr<CreateURLRunnable> runnable =
-    new CreateURLRunnable(workerPrivate, blobImpl, aOptions, aResult);
+    new CreateURLRunnable(workerPrivate, blobImpl, aResult);
 
   runnable->Dispatch(Terminating, aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   if (workerPrivate->IsSharedWorker() || workerPrivate->IsServiceWorker()) {
     WorkerGlobalScope* scope = workerPrivate->GlobalScope();
@@ -1715,43 +1708,39 @@ URL::Constructor(const GlobalObject& aGl
 URL::WorkerConstructor(const GlobalObject& aGlobal, const nsAString& aURL,
                        const nsAString& aBase, ErrorResult& aRv)
 {
   return URLWorker::Constructor(aGlobal, aURL, aBase, aRv);
 }
 
 void
 URL::CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
-                     const objectURLOptions& aOptions, nsAString& aResult,
-                     ErrorResult& aRv)
+                     nsAString& aResult, ErrorResult& aRv)
 {
   if (NS_IsMainThread()) {
-    URLMainThread::CreateObjectURL(aGlobal, aBlob, aOptions, aResult, aRv);
+    URLMainThread::CreateObjectURL(aGlobal, aBlob, aResult, aRv);
   } else {
-    URLWorker::CreateObjectURL(aGlobal, aBlob, aOptions, aResult, aRv);
+    URLWorker::CreateObjectURL(aGlobal, aBlob, aResult, aRv);
   }
 }
 
 void
 URL::CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
-                     const objectURLOptions& aOptions, nsAString& aResult,
-                     ErrorResult& aRv)
+                     nsAString& aResult, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  URLMainThread::CreateObjectURL(aGlobal, aStream, aOptions, aResult, aRv);
+  URLMainThread::CreateObjectURL(aGlobal, aStream, aResult, aRv);
 }
 
 void
 URL::CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
-                     const objectURLOptions& aOptions,
-                     nsAString& aResult,
-                     ErrorResult& aRv)
+                     nsAString& aResult, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  URLMainThread::CreateObjectURL(aGlobal, aSource, aOptions, aResult, aRv);
+  URLMainThread::CreateObjectURL(aGlobal, aSource, aResult, aRv);
 }
 
 void
 URL::RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,
                      ErrorResult& aRv)
 {
   if (NS_IsMainThread()) {
     URLMainThread::RevokeObjectURL(aGlobal, aURL, aRv);
--- a/dom/url/URL.h
+++ b/dom/url/URL.h
@@ -21,17 +21,16 @@ namespace mozilla {
 class ErrorResult;
 class DOMMediaStream;
 
 namespace dom {
 
 class Blob;
 class MediaSource;
 class GlobalObject;
-struct objectURLOptions;
 
 class URL : public URLSearchParamsObserver
           , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(URL)
 
@@ -59,28 +58,25 @@ public:
   // Helper for Fetch API
   static already_AddRefed<URL>
   WorkerConstructor(const GlobalObject& aGlobal, const nsAString& aURL,
                     const nsAString& aBase, ErrorResult& aRv);
 
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
-                  const objectURLOptions& aOptions,
                   nsAString& aResult, ErrorResult& aRv);
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
-                  const objectURLOptions& aOptions, nsAString& aResult,
-                  ErrorResult& aRv);
+                  nsAString& aResult, ErrorResult& aRv);
 
   static void
   CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
-                  const objectURLOptions& aOptions, nsAString& aResult,
-                  ErrorResult& aRv);
+                  nsAString& aResult, ErrorResult& aRv);
 
   static void
   RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,
                   ErrorResult& aRv);
 
   static bool
   IsValidURL(const GlobalObject& aGlobal, const nsAString& aURL,
              ErrorResult& aRv);
--- a/dom/webidl/URL.webidl
+++ b/dom/webidl/URL.webidl
@@ -46,27 +46,22 @@ interface URL {
            attribute USVString search;
   readonly attribute URLSearchParams searchParams;
   [Throws]
            attribute USVString hash;
 };
 
 partial interface URL {
   [Throws]
-  static DOMString createObjectURL(Blob blob, optional objectURLOptions options);
+  static DOMString createObjectURL(Blob blob);
   [Throws]
-  static DOMString createObjectURL(MediaStream stream, optional objectURLOptions options);
+  static DOMString createObjectURL(MediaStream stream);
   [Throws]
   static void revokeObjectURL(DOMString url);
   [ChromeOnly, Throws]
   static boolean isValidURL(DOMString url);
 };
 
-dictionary objectURLOptions
-{
-/* boolean autoRevoke = true; */ /* not supported yet */
-};
-
 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html
 partial interface URL {
   [Throws]
-  static DOMString? createObjectURL(MediaSource source, optional objectURLOptions options);
+  static DOMString? createObjectURL(MediaSource source);
 };