Bug 1336018 - Get rid of objectURLOptions dictionary in URL.createObjectURL, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 03 Feb 2017 08:28:52 +0100
changeset 381370 e1cd10009f350edfde30a3110f2e24a8079a50df
parent 381369 d1c9f43d45bb2c9d0ae1fa5f65c888b8db4c338a
child 381371 eefc0b77e8cd3634483af8f2ab1c5c8338d85866
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1336018
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 1336018 - Get rid of objectURLOptions dictionary in URL.createObjectURL, r=smaug
dom/bindings/test/test_exception_messages.html
dom/url/URL.cpp
dom/url/URL.h
dom/webidl/URL.webidl
--- a/dom/bindings/test/test_exception_messages.html
+++ b/dom/bindings/test/test_exception_messages.html
@@ -42,18 +42,18 @@ https://bugzilla.mozilla.org/show_bug.cg
         "Argument 1 of CanvasRenderingContext2D.fill 'bogus' is not a valid value for enumeration CanvasWindingRule.",
         "bogus enum value" ],
       [ 'document.createTreeWalker(document, 0xFFFFFFFF, { acceptNode: 5 }).nextNode()',
         "Property 'acceptNode' is not callable.",
         "non-callable callback interface operation property" ],
       [ '(new TextDecoder).decode(new Uint8Array(), 5)',
         "Argument 2 of TextDecoder.decode can't be converted to a dictionary.",
         "primitive passed for a dictionary" ],
-      [ 'URL.createObjectURL(null, null)',
-        "Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",
+      [ 'URL.createObjectURL(null)',
+        "Argument 1 is not valid for any of the 1-argument overloads of URL.createObjectURL.",
         "overload resolution failure" ],
       [ 'document.createElement("select").add({})',
         "Argument 1 of HTMLSelectElement.add could not be converted to any of: HTMLOptionElement, HTMLOptGroupElement.",
         "invalid value passed for union" ],
       [ 'document.createElement("canvas").getContext("2d").createLinearGradient(0, 1, 0, 1).addColorStop(NaN, "")',
         "Argument 1 of CanvasGradient.addColorStop is not a finite floating-point value.",
         "invalid float" ]
   ];
--- 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);
 };