bug 1116382 test auto-revoking behavior with URL.createObjectURL(MediaSource) r=bholley
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 29 May 2015 00:01:34 +1200
changeset 248223 d71b2d0ce9940fcdd1f5a538f1954b957fdb7464
parent 248222 7af729730a83ff2761cdfac063b346593bf82b37
child 248224 b61b49cd8e9b3594240b1c2b007ba1e718096888
push id28893
push userkwierso@gmail.com
push dateFri, 12 Jun 2015 00:02:58 +0000
treeherdermozilla-central@8cf9d3e497f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1116382
milestone41.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 1116382 test auto-revoking behavior with URL.createObjectURL(MediaSource) r=bholley
dom/base/URL.cpp
testing/web-platform/tests/media-source/URL-createObjectURL-revoke.html
--- a/dom/base/URL.cpp
+++ b/dom/base/URL.cpp
@@ -150,18 +150,17 @@ URL::CreateObjectURL(const GlobalObject&
     return;
   }
 
   nsCOMPtr<nsIRunnable> revocation = NS_NewRunnableFunction(
     [url] {
       nsHostObjectProtocolHandler::RemoveDataEntry(url);
     });
 
-  rv = nsContentUtils::RunInStableState(revocation);
-  MOZ_ASSERT(NS_SUCCEEDED(rv), "RunInStableState() failure");
+  nsContentUtils::RunInStableState(revocation.forget());
 
   CopyASCIItoUTF16(url, aResult);
 }
 
 void
 URL::CreateObjectURLInternal(const GlobalObject& aGlobal, nsISupports* aObject,
                              const nsACString& aScheme,
                              const objectURLOptions& aOptions,
--- a/testing/web-platform/tests/media-source/URL-createObjectURL-revoke.html
+++ b/testing/web-platform/tests/media-source/URL-createObjectURL-revoke.html
@@ -33,11 +33,27 @@ async_test(function(t) {
     video.src = url;
     window.URL.revokeObjectURL(url);
     mediaSource.addEventListener('sourceopen', t.step_func_done(function(e) {
         assert_equals(mediaSource.readyState, 'open');
         mediaSource.endOfStream();
         video.removeEventListener('error', unexpectedErrorHandler);
     }));
 }, "Check referenced MediaSource can open after URL.revokeObjectURL(url).");
+async_test(function(t) {
+    var mediaSource = new MediaSource();
+    var url = window.URL.createObjectURL(mediaSource);
+    setTimeout(function() {
+        mediaSource.addEventListener('sourceopen',
+                                     t.unreached_func("url should not reference MediaSource."));
+        var video = document.createElement('video');
+        video.src = url;
+        video.addEventListener('error', t.step_func_done(function(e) {
+            assert_equals(e.target.error.code,
+                          MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
+                          'Expected error code');
+            assert_equals(mediaSource.readyState, 'closed');
+        }));
+    }, 0);
+}, "Check auto-revoking behavior with URL.createObjectURL(MediaSource).");
 </script>
 </body>
 </html>