bug 1116382 test auto-revoking behavior with URL.createObjectURL(MediaSource) r=bholley

This commit is contained in:
Karl Tomlinson 2015-05-29 00:01:34 +12:00
parent 7e2353ac43
commit cc5c7cf737
2 changed files with 17 additions and 2 deletions

View File

@ -155,8 +155,7 @@ URL::CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
nsHostObjectProtocolHandler::RemoveDataEntry(url);
});
rv = nsContentUtils::RunInStableState(revocation);
MOZ_ASSERT(NS_SUCCEEDED(rv), "RunInStableState() failure");
nsContentUtils::RunInStableState(revocation.forget());
CopyASCIItoUTF16(url, aResult);
}

View File

@ -38,6 +38,22 @@ async_test(function(t) {
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>