From c34c417518637a89e1e65103b40e3f4a52eed1a8 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 24 Oct 2019 10:51:01 +0000 Subject: [PATCH] Bug 1556854 - Enable ESLint for dom/media/test/ - Enable automatically fixable rules. r=jya. This enables the following rules: - dot-notation - mozilla/no-useless-parameters - no-else-return - no-useless-return - object-shorthand Differential Revision: https://phabricator.services.mozilla.com/D50131 --HG-- extra : moz-landing-system : lando --- .eslintrc.js | 5 - dom/media/test/eme.js | 5 +- ...file_autoplay_policy_activation_frame.html | 2 +- ..._autoplay_policy_eventdown_activation.html | 2 +- dom/media/test/manifest.js | 8 +- .../test/marionette/yttest/debug_info.js | 4 +- dom/media/test/marionette/yttest/force_hd.js | 4 +- ...lay_policy_web_audio_AudioParamStream.html | 2 +- .../test/test_background_video_suspend.html | 2 +- .../test_background_video_suspend_ends.html | 2 +- dom/media/test/test_bug686942.html | 2 +- dom/media/test/test_decoder_disable.html | 12 +- dom/media/test/test_eme_pssh_in_moof.html | 2 +- dom/media/test/test_fragment_noplay.html | 2 +- dom/media/test/test_fragment_play.html | 2 +- dom/media/test/test_load.html | 21 ++-- .../test/test_midflight_redirect_blocked.html | 4 +- dom/media/test/test_played.html | 14 +-- dom/media/test/test_preload_actions.html | 108 ++++++------------ dom/media/test/test_preload_suspend.html | 6 +- dom/media/test/test_seekable1.html | 2 +- dom/media/test/test_source.html | 4 +- .../test/test_timeupdate_small_files.html | 10 +- 23 files changed, 87 insertions(+), 138 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0badd9172706..36b3df0ca361 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -388,13 +388,10 @@ module.exports = { ], "rules": { "consistent-return": "off", - "dot-notation": "off", - "mozilla/no-useless-parameters": "off", "mozilla/use-default-preference-values": "off", "mozilla/use-services": "off", "no-array-constructor": "off", "no-async-promise-executor": "off", - "no-else-return": "off", "no-redeclare": "off", "no-nested-ternary": "off", "no-self-assign": "off", @@ -402,8 +399,6 @@ module.exports = { "no-undef": "off", "no-unsanitized/property": "off", "no-unused-vars": "off", - "no-useless-return": "off", - "object-shorthand": "off", } }] }; diff --git a/dom/media/test/eme.js b/dom/media/test/eme.js index dd636db75fc6..e267d151aab1 100644 --- a/dom/media/test/eme.js +++ b/dom/media/test/eme.js @@ -137,7 +137,7 @@ function GenerateClearKeyLicense(licenseRequest, keyStore) { return new TextEncoder().encode( JSON.stringify({ - keys: keys, + keys, type: msg.type || "temporary", }) ); @@ -165,9 +165,8 @@ function UpdateSessionFunc(test, token, sessionType, resolve, reject) { function MaybeCrossOriginURI(test, uri) { if (test.crossOrigin) { return "https://example.com:443/tests/dom/media/test/allowed.sjs?" + uri; - } else { - return uri; } + return uri; } function AppendTrack(test, ms, track, token) { diff --git a/dom/media/test/file_autoplay_policy_activation_frame.html b/dom/media/test/file_autoplay_policy_activation_frame.html index 7294e8924e75..104db724035d 100644 --- a/dom/media/test/file_autoplay_policy_activation_frame.html +++ b/dom/media/test/file_autoplay_policy_activation_frame.html @@ -23,7 +23,7 @@ } else if (event.data == "play-muted") { playAndPostResult(true, event.source); } - }, false); + }); let w = window.opener || window.parent; w.postMessage("ready", "*"); diff --git a/dom/media/test/file_autoplay_policy_eventdown_activation.html b/dom/media/test/file_autoplay_policy_eventdown_activation.html index e63bddf58b2c..f5fd8b05662c 100644 --- a/dom/media/test/file_autoplay_policy_eventdown_activation.html +++ b/dom/media/test/file_autoplay_policy_eventdown_activation.html @@ -41,7 +41,7 @@ let p = await element.play().then(() => true, () => false); ok(p, "Expect to be activated already in " + eventName); resolve(); - }, false); + }); }); }); diff --git a/dom/media/test/manifest.js b/dom/media/test/manifest.js index 24f69133246d..d3ac57e2731b 100644 --- a/dom/media/test/manifest.js +++ b/dom/media/test/manifest.js @@ -1918,9 +1918,8 @@ function getPlayableAudio(candidates) { function getMajorMimeType(mimetype) { if (/^video/.test(mimetype)) { return "video"; - } else { - return "audio"; } + return "audio"; } // Force releasing decoder to avoid timeout in waiting for decoding resource. @@ -1959,10 +1958,10 @@ function once(target, name, cb) { function nextEvent(video, eventName) { return new Promise(function(resolve, reject) { let f = function(event) { - video.removeEventListener(eventName, f, false); + video.removeEventListener(eventName, f); resolve(event); }; - video.addEventListener(eventName, f, false); + video.addEventListener(eventName, f); }); } @@ -2186,7 +2185,6 @@ function MediaTestManager() { SimpleTest.finish(); }; mediaTestCleanup(onCleanup); - return; } }; } diff --git a/dom/media/test/marionette/yttest/debug_info.js b/dom/media/test/marionette/yttest/debug_info.js index 0be81eae1a92..b94637b4008f 100644 --- a/dom/media/test/marionette/yttest/debug_info.js +++ b/dom/media/test/marionette/yttest/debug_info.js @@ -9,10 +9,10 @@ video.mozRequestDebugInfo().then(debugInfo => { } JSONDebugInfo = JSONDebugInfo.slice(0, JSONDebugInfo.length - 1); JSONDebugInfo += "}"; - result["mozRequestDebugInfo"] = JSON.parse(JSONDebugInfo); + result.mozRequestDebugInfo = JSON.parse(JSONDebugInfo); } catch (err) { console.log(`Error '${err.toString()} in JSON.parse(${debugInfo})`); - result["mozRequestDebugInfo"] = debugInfo; + result.mozRequestDebugInfo = debugInfo; } resolve(result); }); diff --git a/dom/media/test/marionette/yttest/force_hd.js b/dom/media/test/marionette/yttest/force_hd.js index 25fe5ac345f2..d99883b140a3 100644 --- a/dom/media/test/marionette/yttest/force_hd.js +++ b/dom/media/test/marionette/yttest/force_hd.js @@ -5,11 +5,11 @@ var config = { HD: true, LQ: false, ID: "auto-hd-lq-for-ytb", - type: function(t) { + type(t) { config.HD = t === "hd"; config.LQ = t === "lq"; }, - quality: function() { + quality() { if (config.HD || config.LQ) { var youtubePlayerListener = function(LQ, HD) { return function(e) { diff --git a/dom/media/test/test_autoplay_policy_web_audio_AudioParamStream.html b/dom/media/test/test_autoplay_policy_web_audio_AudioParamStream.html index 4f181332cb1a..ad70210fa482 100644 --- a/dom/media/test/test_autoplay_policy_web_audio_AudioParamStream.html +++ b/dom/media/test/test_autoplay_policy_web_audio_AudioParamStream.html @@ -101,7 +101,7 @@ function createAudioParams(nodeType) { return [ac.createStereoPanner().pan]; default: ok(false, `non-defined node type ${nodeType}.`); - return; + } } diff --git a/dom/media/test/test_background_video_suspend.html b/dom/media/test/test_background_video_suspend.html index c5461c2eb84a..a6a720ad1341 100644 --- a/dom/media/test/test_background_video_suspend.html +++ b/dom/media/test/test_background_video_suspend.html @@ -76,6 +76,6 @@ ["privacy.reduceTimerPrecision", false] ], tests: gDecodeSuspendTests, - runTest: runTest + runTest }); \ No newline at end of file diff --git a/dom/media/test/test_background_video_suspend_ends.html b/dom/media/test/test_background_video_suspend_ends.html index 26180c586a0f..c16ffff290fc 100644 --- a/dom/media/test/test_background_video_suspend_ends.html +++ b/dom/media/test/test_background_video_suspend_ends.html @@ -50,6 +50,6 @@ ["media.suspend-bkgnd-video.delay-ms", 1000] ], tests: gDecodeSuspendTests, - runTest: runTest + runTest }); \ No newline at end of file diff --git a/dom/media/test/test_bug686942.html b/dom/media/test/test_bug686942.html index 771dc645fb3e..66b48d69f02b 100644 --- a/dom/media/test/test_bug686942.html +++ b/dom/media/test/test_bug686942.html @@ -21,7 +21,7 @@ function onloaded(event) { var v = event.target; v.removeEventListener("loadedmetadata", onloaded); v.currentTime = v.duration; - return; + } function checkNotPlaying(v) { diff --git a/dom/media/test/test_decoder_disable.html b/dom/media/test/test_decoder_disable.html index f875ac1f25f5..86aaa87c80ef 100644 --- a/dom/media/test/test_decoder_disable.html +++ b/dom/media/test/test_decoder_disable.html @@ -26,9 +26,9 @@ function e(id) { var gLoadError = new Object(); -gLoadError['video1'] = 0; -gLoadError['video2'] = 0; -gLoadError['video3'] = 0; +gLoadError.video1 = 0; +gLoadError.video2 = 0; +gLoadError.video3 = 0; var gErrorCount = 0; @@ -45,9 +45,9 @@ function finishTest() { filename(e('video3').src), 'video3 currentSrc should match src'); - is(gLoadError['video1'], 2, "Expect one error per invalid source child on video1"); - is(gLoadError['video2'], 1, "Expect one error on video2"); - is(gLoadError['video3'], 1, "Expect one error on video3"); + is(gLoadError.video1, 2, "Expect one error per invalid source child on video1"); + is(gLoadError.video2, 1, "Expect one error on video2"); + is(gLoadError.video3, 1, "Expect one error on video3"); SimpleTest.finish(); } diff --git a/dom/media/test/test_eme_pssh_in_moof.html b/dom/media/test/test_eme_pssh_in_moof.html index 6e3ca01b33db..d1965be8449a 100644 --- a/dom/media/test/test_eme_pssh_in_moof.html +++ b/dom/media/test/test_eme_pssh_in_moof.html @@ -117,7 +117,7 @@ session.generateRequest(event.initDataType, event.initData); } - video.addEventListener("encrypted", handleEncrypted, false); + video.addEventListener("encrypted", handleEncrypted); video.addEventListener("ended", () => { let expectedEncryptedEvents = diff --git a/dom/media/test/test_fragment_noplay.html b/dom/media/test/test_fragment_noplay.html index de33a545c6e1..742023b8cd81 100644 --- a/dom/media/test/test_fragment_noplay.html +++ b/dom/media/test/test_fragment_noplay.html @@ -116,7 +116,7 @@ function startTest(test, token) { removeNodeAndSource(v); m.finished(v.token); }}(video, manager); - window['test_fragment_noplay'](video, test.start, test.end, localIs, localOk, localFinish); + window.test_fragment_noplay(video, test.start, test.end, localIs, localOk, localFinish); } manager.runTests(createTestArray(), startTest); diff --git a/dom/media/test/test_fragment_play.html b/dom/media/test/test_fragment_play.html index ad32bb2ff6dc..55a5f7e50127 100644 --- a/dom/media/test/test_fragment_play.html +++ b/dom/media/test/test_fragment_play.html @@ -80,7 +80,7 @@ function startTest(test, token) { removeNodeAndSource(v); m.finished(v.token); }}(video, manager); - window['test_fragment_play'](video, test.start, test.end, localIs, localOk, localFinish); + window.test_fragment_play(video, test.start, test.end, localIs, localOk, localFinish); } manager.runTests(createTestArray(), startTest); diff --git a/dom/media/test/test_load.html b/dom/media/test/test_load.html index 00385eae8b4f..de8fd6394862 100644 --- a/dom/media/test/test_load.html +++ b/dom/media/test/test_load.html @@ -89,16 +89,14 @@ function prependSource(src, type) { var gTests = [ { // Test 0: adding video to doc, then setting src should load implicitly. - create: - function(src, type) { + create(src, type) { document.body.appendChild(gMedia); gMedia.src = src; }, expectedEvents: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata'] }, { // Test 1: adding video to doc, then adding source. - create: - function(src, type) { + create(src, type) { document.body.appendChild(gMedia); addSource(src, type); }, @@ -106,8 +104,7 @@ var gTests = [ },{ // Test 2: video with multiple source, the first of which are bad, we should load the last, // and receive error events for failed loads on the source children. - create: - function(src, type) { + create(src, type) { document.body.appendChild(gMedia); addSource("404a", type); addSource("404b", type); @@ -116,8 +113,7 @@ var gTests = [ expectedEvents: ['loadstart', 'source_error', 'source_error', 'durationchange', 'loadedmetadata', 'loadeddata'] }, { // Test 3: video with bad src, good , ensure that aren't used. - create: - function(src, type) { + create(src, type) { gMedia.src = "404a"; addSource(src, type); document.body.appendChild(gMedia); @@ -126,8 +122,7 @@ var gTests = [ }, { // Test 4: video with only bad source, loading, then adding a good source // - should resume load. - create: - function(src, type) { + create(src, type) { addSource("404a", type); var s2 = addSource("404b", type); s2.addEventListener("error", @@ -143,8 +138,7 @@ var gTests = [ // a good to the video, it shouldn't be selected, because the // "pointer" should be after the last child - the bad source. prepended: false, - create: - function(src, type) { + create(src, type) { var prepended = false; addSource("404a", type); var s2 = addSource("404b", type); @@ -162,8 +156,7 @@ var gTests = [ }, { // Test 6: (Bug 1165203) preload="none" then followed by an explicit // call to load() should load metadata - create: - function(src, type) { + create(src, type) { gMedia.preload = "none"; gMedia.src = src; document.body.appendChild(gMedia); diff --git a/dom/media/test/test_midflight_redirect_blocked.html b/dom/media/test/test_midflight_redirect_blocked.html index 21e7a5813cff..72dd7e124eb0 100644 --- a/dom/media/test/test_midflight_redirect_blocked.html +++ b/dom/media/test/test_midflight_redirect_blocked.html @@ -34,12 +34,12 @@ element.addEventListener("loadedmetadata", ()=>{ resolve(true); removeNodeAndSource(element); - }, false); + }); element.addEventListener("error", ()=>{ resolve(false); removeNodeAndSource(element); - }, false); + }); var noise = Math.floor(Math.random() * 100000000); // Note: request redirect before the end of metadata, otherwise we won't diff --git a/dom/media/test/test_played.html b/dom/media/test/test_played.html index f2b4a7a202e1..f8b946b8bb7a 100644 --- a/dom/media/test/test_played.html +++ b/dom/media/test/test_played.html @@ -32,7 +32,7 @@ function check_full_file_played(element) { var tests = [ // Without playing, check that player.played.length == 0. { - setup : function(element) { + setup(element) { element.addEventListener("loadedmetadata", function() { is(element.played.length, 0, element.token + ": initial played.length equals zero"); finish_test(element); @@ -42,7 +42,7 @@ var tests = [ }, // Play the file, test the range we have. { - setup : function(element) { + setup(element) { check_full_file_played(element); element.play(); }, @@ -52,7 +52,7 @@ var tests = [ // Play the second half of the file, pause, play // an check we have only one range. { - setup : function (element) { + setup (element) { element.onended = function (e) { var t = e.target; t.onended = null; @@ -72,7 +72,7 @@ var tests = [ // Play the first half of the file, seek back, while // continuing to play. We shall have only one range. { - setup : function (element) { + setup (element) { let onTimeUpdate = function() { if (element.currentTime > element.duration / 2) { info(element.token + ": currentTime=" + element.currentTime + ", duration=" + element.duration); @@ -95,7 +95,7 @@ var tests = [ // Play and seek to have two ranges, and check that, as well a // boundaries. { - setup : function (element) { + setup (element) { let seekTarget = 0; let onTimeUpdate = function() { if (element.currentTime > element.duration / 2) { @@ -132,7 +132,7 @@ var tests = [ // Play to create two ranges, in the reverse order. check that they are sorted. { - setup : function (element) { + setup (element) { function end() { element.pause(); let p = element.played; @@ -178,7 +178,7 @@ var tests = [ }, // Seek repeatedly without playing. No range should appear. { - setup : function(element) { + setup(element) { let index = 1; element.addEventListener('seeked', function() { diff --git a/dom/media/test/test_preload_actions.html b/dom/media/test/test_preload_actions.html index 0e979590a8e3..68eb18365cf1 100644 --- a/dom/media/test/test_preload_actions.html +++ b/dom/media/test/test_preload_actions.html @@ -65,8 +65,7 @@ var tests = [ // after receiving a suspend event. Should not receive loaded events until after we call load(). // Note the suspend event is explictly sent by our "stop the load" code, but other tests can't rely // on it for the preload:metadata case, as there can be multiple suspend events when loading metadata. - suspend: - function(e) { + suspend(e) { var v = e.target; is(v._gotLoadStart, true, "(1) Must get loadstart."); is(v._gotLoadedMetaData, false, "(1) Must not get loadedmetadata."); @@ -76,8 +75,7 @@ var tests = [ maybeFinish(v, 1); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "none"; @@ -93,8 +91,7 @@ var tests = [ { // 2. Add preload:metadata video with src to document. Should halt with NETWORK_IDLE, HAVE_CURRENT_DATA // after suspend event and after loadedmetadata. - loadeddata: - function(e) { + loadeddata(e) { var v = e.target; is(v._gotLoadStart, true, "(2) Must get loadstart."); is(v._gotLoadedMetaData, true, "(2) Must get loadedmetadata."); @@ -104,8 +101,7 @@ var tests = [ maybeFinish(v, 2); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "metadata"; @@ -121,16 +117,14 @@ var tests = [ }, { // 3. Add preload:auto to document. Should receive canplaythrough eventually. - canplaythrough: - function(e) { + canplaythrough(e) { var v = e.target; is(v._gotLoadStart, true, "(3) Must get loadstart."); is(v._gotLoadedMetaData, true, "(3) Must get loadedmetadata."); maybeFinish(v, 3); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "auto"; @@ -145,8 +139,7 @@ var tests = [ }, { // 4. Add preload:none video to document. Call play(), should load then play through. - suspend: - function(e) { + suspend(e) { var v = e.target; if (v._gotSuspend) { return; // We can receive multiple suspend events, like the one after download completes. @@ -160,14 +153,12 @@ var tests = [ v.play(); // Should load and play through. }, - ended: - function(e) { + ended(e) { ok(true, "(4) Got playback ended"); maybeFinish(e.target, 4); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v._gotSuspend = false; @@ -185,8 +176,7 @@ var tests = [ { // 5. preload:none video without resource, add to document, will implicitly start a // preload:none load. Add a src, it shouldn't load. - suspend: - function(e) { + suspend(e) { var v = e.target; is(v._gotLoadStart, true, "(5) Must get loadstart."); is(v._gotLoadedMetaData, false, "(5) Must not get loadedmetadata."); @@ -196,8 +186,7 @@ var tests = [ maybeFinish(v, 5); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "none"; @@ -213,8 +202,7 @@ var tests = [ { // 6. preload:none video without resource, add to document, will implicitly start a // preload:none load. Add a source, it shouldn't load. - suspend: - function(e) { + suspend(e) { var v = e.target; is(v._gotLoadStart, true, "(6) Must get loadstart."); is(v._gotLoadedMetaData, false, "(6) Must not get loadedmetadata."); @@ -224,8 +212,7 @@ var tests = [ maybeFinish(v, 6); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "none"; @@ -244,8 +231,7 @@ var tests = [ { // 7. create a preload:none document with multiple sources, the first of which is invalid. // Add to document, then play. It should load and play through the second source. - suspend: - function(e) { + suspend(e) { var v = e.target; if (v._gotSuspend) return; // We can receive multiple suspend events, like the one after download completes. @@ -258,16 +244,14 @@ var tests = [ v.play(); // Should load and play through. }, - ended: - function(e) { + ended(e) { ok(true, "(7) Got playback ended"); var v = e.target; is(v._gotErrorEvent, true, "(7) Should get error event from first source load failure"); maybeFinish(v, 7); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "none"; @@ -292,8 +276,7 @@ var tests = [ }, { // 8. Change preload value from none to metadata should cause metadata to be loaded. - loadeddata: - function(e) { + loadeddata(e) { var v = e.target; is(v._gotLoadedMetaData, true, "(8) Must get loadedmetadata."); ok(v.readyState >= v.HAVE_CURRENT_DATA, "(8) ReadyState must be >= HAVE_CURRENT_DATA on suspend."); @@ -302,8 +285,7 @@ var tests = [ maybeFinish(v, 8); }, - setup: - function(v) { + setup(v) { v._gotLoadedMetaData = false; v.preload = "none"; v.addEventListener("loadstart", function(e){v.preload = "metadata";}); @@ -342,15 +324,13 @@ var tests = [ },*/ { // 10. Change preload value from none to auto should cause entire media to be loaded. - canplaythrough: - function(e) { + canplaythrough(e) { var v = e.target; is(v._gotLoadedMetaData, true, "(10) Must get loadedmetadata."); maybeFinish(v, 10); }, - setup: - function(v) { + setup(v) { v._gotLoadedMetaData = false; v.preload = "none"; v.addEventListener("loadstart", function(e){v.preload = "auto";}); @@ -364,8 +344,7 @@ var tests = [ }, { // 11. Change preload value from none to metadata should cause metadata to load. - loadeddata: - function(e) { + loadeddata(e) { var v = e.target; is(v._gotLoadedMetaData, true, "(11) Must get loadedmetadata."); ok(v.readyState >= v.HAVE_CURRENT_DATA, "(11) ReadyState must be >= HAVE_CURRENT_DATA."); @@ -374,8 +353,7 @@ var tests = [ maybeFinish(v, 11); }, - setup: - function(v) { + setup(v) { v._gotLoadedMetaData = false; v.preload = "none"; v.addEventListener("loadstart", function(e){v.preload = "metadata";}); @@ -390,8 +368,7 @@ var tests = [ { // 13. Change preload value from auto to none after specifying a src // should load according to preload none, no buffering should have taken place - suspend: - function(e) { + suspend(e) { var v = e.target; is(v._gotLoadStart, true, "(13) Must get loadstart."); is(v._gotLoadedMetaData, false, "(13) Must not get loadedmetadata."); @@ -401,8 +378,7 @@ var tests = [ maybeFinish(v, 13); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "auto"; @@ -419,8 +395,7 @@ var tests = [ }, { // 14. Add preload:metadata video with src to document. Play(), should play through. - loadeddata: - function(e) { + loadeddata(e) { var v = e.target; is(v._gotLoadStart, true, "(14) Must get loadstart."); is(v._gotLoadedMetaData, true, "(14) Must get loadedmetadata."); @@ -430,15 +405,13 @@ var tests = [ v.play(); }, - ended: - function(e) { + ended(e) { ok(true, "(14) Got playback ended"); var v = e.target; maybeFinish(v, 14); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "metadata"; @@ -455,15 +428,13 @@ var tests = [ }, { // 15. Autoplay should override preload:none. - ended: - function(e) { + ended(e) { ok(true, "(15) Got playback ended."); var v = e.target; maybeFinish(v, 15); }, - setup: - function(v) { + setup(v) { v._gotLoadStart = false; v._gotLoadedMetaData = false; v.preload = "none"; @@ -490,15 +461,13 @@ var tests = [ }, { // 16. Autoplay should override preload:metadata. - ended: - function(e) { + ended(e) { ok(true, "(16) Got playback ended."); var v = e.target; maybeFinish(v, 16); }, - setup: - function(v) { + setup(v) { v.preload = "metadata"; v.autoplay = true; v.addEventListener("ended", this.ended); @@ -510,15 +479,13 @@ var tests = [ }, { // 17. On a preload:none video, adding autoplay should disable preload none, i.e. don't break autoplay! - ended: - function(e) { + ended(e) { ok(true, "(17) Got playback ended."); var v = e.target; maybeFinish(v, 17); }, - setup: - function(v) { + setup(v) { v.addEventListener("ended", this.ended); v.preload = "none"; document.body.appendChild(v); // Causes implicit load, which will be halted due to preload:none. @@ -531,15 +498,13 @@ var tests = [ { // 18. On a preload='none' video, call play() before load algorithms's sync // has run, the play() call should override preload='none'. - ended: - function(e) { + ended(e) { ok(true, "(18) Got playback ended."); var v = e.target; maybeFinish(v, 18); }, - setup: - function(v) { + setup(v) { v.addEventListener("ended", this.ended); v.preload = "none"; v.src = test.name; // Schedules async section to continue load algorithm. @@ -552,8 +517,7 @@ var tests = [ { // 19. Set preload='auto' on first video source then switching preload='none' and swapping the video source to another. // The second video should not start playing as it's preload state has been changed to 'none' from 'auto' - setup: - function(v) { + setup(v) { v.preload = "auto"; v.src = test.name; // add a listener for when the video has loaded, so we know preload auto has worked diff --git a/dom/media/test/test_preload_suspend.html b/dom/media/test/test_preload_suspend.html index 9e565f2ef4a3..7f1146360f86 100644 --- a/dom/media/test/test_preload_suspend.html +++ b/dom/media/test/test_preload_suspend.html @@ -29,7 +29,7 @@ var tests = [ name: 'v1', preload: 'none', expectedSuspendCount: 2, - onsuspend: function(evt) { + onsuspend(evt) { checkSuspendCount(evt); if (evt.target.suspendCount == 1) { evt.target.preload = 'auto'; @@ -53,7 +53,7 @@ var tests = [ name: 'v4', preload: 'none', expectedSuspendCount: 2, - onsuspend: function(evt) { + onsuspend(evt) { checkSuspendCount(evt); if (evt.target.suspendCount == 1) { evt.target.play(); @@ -76,7 +76,7 @@ var tests = [ name: 'v6', preload: 'none', expectedSuspendCount: 2, - onsuspend: function(evt) { + onsuspend(evt) { checkSuspendCount(evt); if (evt.target.suspendCount == 1) { evt.target.autoplay = true; diff --git a/dom/media/test/test_seekable1.html b/dom/media/test/test_seekable1.html index 3667d5526c87..1d668d0c62d9 100644 --- a/dom/media/test/test_seekable1.html +++ b/dom/media/test/test_seekable1.html @@ -23,7 +23,7 @@ function finish_test(element) { var tests = [ // Test using a finite media stream, and a server supporting range requests { -setup : function(element) { +setup(element) { is(element.seekable.length, 0, "seekable.length should be initialy 0."); element.addEventListener("loadedmetadata", function() { is(element.seekable.length, 1, "seekable.length should be 1 for a server supporting range requests."); diff --git a/dom/media/test/test_source.html b/dom/media/test/test_source.html index 7cc97e98f711..d6db407769f1 100644 --- a/dom/media/test/test_source.html +++ b/dom/media/test/test_source.html @@ -31,9 +31,9 @@ function newSource(filter) { e.type = candidates[0].type; e.src = candidates[0].name; return e; - } else { + } return null - } + } var audioLoaded = false; diff --git a/dom/media/test/test_timeupdate_small_files.html b/dom/media/test/test_timeupdate_small_files.html index cc7f50dbbe8a..fca35e5b7154 100644 --- a/dom/media/test/test_timeupdate_small_files.html +++ b/dom/media/test/test_timeupdate_small_files.html @@ -19,9 +19,9 @@ var manager = new MediaTestManager; function ended(e) { var v = e.target; - ++v.counter["ended"]; - is(v.counter["ended"], 1, v._name + " should see ended only once"); - ok(v.counter["timeupdate"] > 0, v._name + " should see at least one timeupdate: " + v.currentTime); + ++v.counter.ended; + is(v.counter.ended, 1, v._name + " should see ended only once"); + ok(v.counter.timeupdate > 0, v._name + " should see at least one timeupdate: " + v.currentTime); // Rest event counters for we don't allow events after ended. eventsToLog.forEach(function(event) { @@ -55,7 +55,7 @@ var eventsToLog = ["play", "canplay", "canplaythrough", "loadstart", "loadedmeta function logEvent(event) { var v = event.target; ++v.counter[event.type]; - if (v.counter["ended"] > 0) { + if (v.counter.ended > 0) { is(v.counter[event.type], 0, v._name + " got unexpected " + event.type + " after ended"); } } @@ -75,7 +75,7 @@ function startTest(test, token) { v.counter[e] = 0; }); v.addEventListener("ended", ended); - v.counter["ended"] = 0; + v.counter.ended = 0; document.body.appendChild(v); v.play(); }