From fd0dc8a5ccbbe07f6a32e2b8f462442559fbab44 Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Mon, 17 Jun 2019 14:51:41 -0700 Subject: [PATCH] Add utility for looping from 0 to n. Closes #1518 Change-Id: I865f7a0311516d04ae84532dab873e1aaa31eb24 --- build/misspellings.txt | 1 + lib/dash/mpd_utils.js | 3 +- lib/dash/segment_list.js | 3 +- lib/media/adaptation_set.js | 3 +- lib/media/mp4_segment_index_parser.js | 4 +- lib/media/streaming_engine.js | 2 +- lib/media/time_ranges_utils.js | 3 +- lib/text/mp4_vtt_parser.js | 4 +- lib/util/ebml_parser.js | 9 ++-- lib/util/functional.js | 7 +++ lib/util/iterables.js | 12 +++++ lib/util/mp4_parser.js | 10 ++-- lib/util/pssh.js | 4 +- lib/util/string_utils.js | 2 +- lib/util/uint8array_utils.js | 9 ++-- test/cast/cast_receiver_integration.js | 3 +- .../dash_parser_content_protection_unit.js | 2 +- test/dash/mpd_utils_unit.js | 8 ++-- test/hls/hls_live_unit.js | 3 +- test/media/buffering_observer_unit.js | 2 +- test/media/period_observer_unit.js | 2 +- test/media/streaming_engine_unit.js | 46 ++++++------------- test/test/util/indexeddb_utils.js | 3 +- test/test/util/test_scheme.js | 2 +- test/test/util/util.js | 9 ++-- test/ui/ui_unit.js | 3 +- 26 files changed, 89 insertions(+), 70 deletions(-) diff --git a/build/misspellings.txt b/build/misspellings.txt index 7d1d2d079..665e128db 100644 --- a/build/misspellings.txt +++ b/build/misspellings.txt @@ -5,6 +5,7 @@ r'(?i)arti?fi?ci?ai?l': 'artificial', r'(?i)cur+ent': 'current', r'(?i)ful+screen': 'fullscreen', + r'(?i)interable': 'iterable', r'(?i)int(er|re)p(er|er)tation': 'interpretation', r'(?i)langauge': 'language', r'(?i)mananger': 'manager', diff --git a/lib/dash/mpd_utils.js b/lib/dash/mpd_utils.js index ec125b89d..fe917dfc9 100644 --- a/lib/dash/mpd_utils.js +++ b/lib/dash/mpd_utils.js @@ -233,7 +233,8 @@ shaka.dash.MpdUtils = class { timeline[timeline.length - 1].end = startTime / timescale; } - for (let j = 0; j <= repeat; ++j) { + for (const _ of shaka.util.Iterables.range(repeat + 1)) { + shaka.util.Functional.ignored(_); const endTime = startTime + d; const item = { start: startTime / timescale, diff --git a/lib/dash/segment_list.js b/lib/dash/segment_list.js index 2dd205a1c..f540b6e59 100644 --- a/lib/dash/segment_list.js +++ b/lib/dash/segment_list.js @@ -25,6 +25,7 @@ goog.require('shaka.media.SegmentIndex'); goog.require('shaka.media.SegmentReference'); goog.require('shaka.util.Error'); goog.require('shaka.util.Functional'); +goog.require('shaka.util.Iterables'); goog.require('shaka.util.ManifestParserUtils'); goog.require('shaka.util.XmlUtils'); @@ -212,7 +213,7 @@ shaka.dash.SegmentList = class { /** @type {!Array.} */ const references = []; let prevEndTime = info.startTime; - for (let i = 0; i < max; i++) { + for (const i of shaka.util.Iterables.range(max)) { const segment = info.mediaSegments[i]; const mediaUri = ManifestParserUtils.resolveUris( baseUris, [segment.mediaUri]); diff --git a/lib/media/adaptation_set.js b/lib/media/adaptation_set.js index 8d1b75a56..f28b20672 100644 --- a/lib/media/adaptation_set.js +++ b/lib/media/adaptation_set.js @@ -18,6 +18,7 @@ goog.provide('shaka.media.AdaptationSet'); goog.require('goog.asserts'); +goog.require('shaka.util.Iterables'); goog.require('shaka.util.MimeUtils'); @@ -219,7 +220,7 @@ shaka.media.AdaptationSet = class { codecsA.sort(); codecsB.sort(); - for (let i = 0; i < codecsA.length; i++) { + for (const i of shaka.util.Iterables.range(codecsA.length)) { if (codecsA[i] != codecsB[i]) { return false; } diff --git a/lib/media/mp4_segment_index_parser.js b/lib/media/mp4_segment_index_parser.js index f6b9c7c2d..b3c8bb27b 100644 --- a/lib/media/mp4_segment_index_parser.js +++ b/lib/media/mp4_segment_index_parser.js @@ -21,6 +21,7 @@ goog.require('goog.asserts'); goog.require('shaka.log'); goog.require('shaka.media.SegmentReference'); goog.require('shaka.util.Error'); +goog.require('shaka.util.Iterables'); goog.require('shaka.util.Mp4Parser'); @@ -123,7 +124,8 @@ shaka.media.Mp4SegmentIndexParser = class { let unscaledStartTime = earliestPresentationTime; let startByte = sidxOffset + box.size + firstOffset; - for (let i = 0; i < referenceCount; i++) { + for (const _ of shaka.util.Iterables.range(referenceCount)) { + shaka.util.Functional.ignored(_); // |chunk| is 1 bit for |referenceType|, and 31 bits for |referenceSize|. const chunk = box.reader.readUint32(); const referenceType = (chunk & 0x80000000) >>> 31; diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index c2e3cab7c..762d8ac7e 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -2004,7 +2004,7 @@ shaka.media.StreamingEngine = class { } // Now setup all known Periods. - for (let i = 0; i < this.manifest_.periods.length; ++i) { + for (const i of shaka.util.Iterables.range(this.manifest_.periods.length)) { this.setupPeriod_(i).catch(Functional.noop); } diff --git a/lib/media/time_ranges_utils.js b/lib/media/time_ranges_utils.js index e7b92ff23..0694d9726 100644 --- a/lib/media/time_ranges_utils.js +++ b/lib/media/time_ranges_utils.js @@ -17,6 +17,7 @@ goog.provide('shaka.media.TimeRangesUtils'); +goog.require('shaka.util.Iterables'); goog.require('shaka.util.Platform'); @@ -181,7 +182,7 @@ shaka.media.TimeRangesUtils = class { return []; } const ret = []; - for (let i = 0; i < b.length; i++) { + for (const i of shaka.util.Iterables.range(b.length)) { ret.push({start: b.start(i), end: b.end(i)}); } return ret; diff --git a/lib/text/mp4_vtt_parser.js b/lib/text/mp4_vtt_parser.js index e3cb7e50e..24abdac27 100644 --- a/lib/text/mp4_vtt_parser.js +++ b/lib/text/mp4_vtt_parser.js @@ -25,6 +25,7 @@ goog.require('shaka.text.VttTextParser'); goog.require('shaka.util.DataViewReader'); goog.require('shaka.util.Error'); goog.require('shaka.util.Functional'); +goog.require('shaka.util.Iterables'); goog.require('shaka.util.Mp4Parser'); goog.require('shaka.util.StringUtils'); goog.require('shaka.util.TextParser'); @@ -299,7 +300,8 @@ shaka.text.Mp4VttParser = class { const samples = []; - for (let sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++) { + for (const _ of shaka.util.Iterables.range(sampleCount)) { + shaka.util.Functional.ignored(_); /** @type {shaka.text.Mp4VttParser.TimeSegment} */ const sample = { duration: null, diff --git a/lib/util/ebml_parser.js b/lib/util/ebml_parser.js index bd4ea8bd0..2170b5fd8 100644 --- a/lib/util/ebml_parser.js +++ b/lib/util/ebml_parser.js @@ -144,11 +144,8 @@ shaka.util.EbmlParser = class { goog.asserts.assert(numBytes <= 8 && numBytes >= 1, 'Incorrect log2 value'); const vint = new Uint8Array(numBytes); - vint[0] = firstByte; - - // Include the remaining bytes. - for (let i = 1; i < numBytes; i++) { - vint[i] = this.reader_.readUint8(); + for (const i of shaka.util.Iterables.range(numBytes)) { + vint[i] = i == 0 ? firstByte : this.reader_.readUint8(); } return vint; @@ -292,7 +289,7 @@ shaka.util.EbmlElement = class { let value = 0; - for (let i = 0; i < this.dataView_.byteLength; i++) { + for (const i of shaka.util.Iterables.range(this.dataView_.byteLength)) { const chunk = this.dataView_.getUint8(i); value = (256 * value) + chunk; } diff --git a/lib/util/functional.js b/lib/util/functional.js index 11132ef3d..8f839b7d2 100644 --- a/lib/util/functional.js +++ b/lib/util/functional.js @@ -54,6 +54,13 @@ shaka.util.Functional = class { return all.concat(part); } + /** + * A no-op function that ignores its arguments. This is used to suppress + * unused variable errors. + * @param {...*} args + */ + static ignored(...args) {} + /** * A no-op function. Useful in promise chains. diff --git a/lib/util/iterables.js b/lib/util/iterables.js index 824a3dbd9..4b4df1769 100644 --- a/lib/util/iterables.js +++ b/lib/util/iterables.js @@ -87,6 +87,18 @@ shaka.util.Iterables = class { return out; } + /** + * Returns an iterable that contains numbers in the range [0, end). + * + * @param {number=} end The exclusive end of the list. + * @return {!Iterable.} + */ + static* range(end) { + for (let i = 0; i < end; i++) { + yield i; + } + } + /** * Iterates over an iterable object and includes additional info about each * item: diff --git a/lib/util/mp4_parser.js b/lib/util/mp4_parser.js index b7fd7f337..599617450 100644 --- a/lib/util/mp4_parser.js +++ b/lib/util/mp4_parser.js @@ -20,6 +20,7 @@ goog.provide('shaka.util.Mp4Parser'); goog.require('goog.asserts'); goog.require('shaka.log'); goog.require('shaka.util.DataViewReader'); +goog.require('shaka.util.Iterables'); /** @@ -208,10 +209,13 @@ shaka.util.Mp4Parser = class { * @export */ static sampleDescription(box) { - for (let count = box.reader.readUint32(); - count > 0 && !box.parser.done_; - count -= 1) { + const count = box.reader.readUint32(); + for (const _ of shaka.util.Iterables.range(count)) { + shaka.util.Functional.ignored(_); box.parser.parseNext(box.start, box.reader, box.partialOkay); + if (box.parser.done_) { + break; + } } } diff --git a/lib/util/pssh.js b/lib/util/pssh.js index 3d7f2eca6..aa4bc3a57 100644 --- a/lib/util/pssh.js +++ b/lib/util/pssh.js @@ -19,6 +19,7 @@ goog.provide('shaka.util.Pssh'); goog.require('goog.asserts'); goog.require('shaka.log'); +goog.require('shaka.util.Iterables'); goog.require('shaka.util.Mp4Parser'); goog.require('shaka.util.Uint8ArrayUtils'); @@ -84,7 +85,8 @@ shaka.util.Pssh = class { const keyIds = []; if (box.version > 0) { const numKeyIds = box.reader.readUint32(); - for (let i = 0; i < numKeyIds; ++i) { + for (const _ of shaka.util.Iterables.range(numKeyIds)) { + shaka.util.Functional.ignored(_); const keyId = shaka.util.Uint8ArrayUtils.toHex(box.reader.readBytes(16)); keyIds.push(keyId); diff --git a/lib/util/string_utils.js b/lib/util/string_utils.js index e0af52f25..a6be8f8ee 100644 --- a/lib/util/string_utils.js +++ b/lib/util/string_utils.js @@ -110,7 +110,7 @@ shaka.util.StringUtils = class { const length = Math.floor(data.byteLength / 2); const arr = new Uint16Array(length); const dataView = new DataView(buffer); - for (let i = 0; i < length; i++) { + for (const i of shaka.util.Iterables.range(length)) { arr[i] = dataView.getUint16(i * 2, littleEndian); } return shaka.util.StringUtils.fromCharCode(arr); diff --git a/lib/util/uint8array_utils.js b/lib/util/uint8array_utils.js index bd19476c7..efbb8b015 100644 --- a/lib/util/uint8array_utils.js +++ b/lib/util/uint8array_utils.js @@ -81,9 +81,10 @@ shaka.util.Uint8ArrayUtils = class { * @export */ static fromHex(str) { - const arr = new Uint8Array(str.length / 2); - for (let i = 0; i < str.length; i += 2) { - arr[i / 2] = window.parseInt(str.substr(i, 2), 16); + const size = str.length / 2; + const arr = new Uint8Array(size); + for (const i of shaka.util.Iterables.range(size)) { + arr[i] = window.parseInt(str.substr(i * 2, 2), 16); } return arr; } @@ -128,7 +129,7 @@ shaka.util.Uint8ArrayUtils = class { if (arr1.length != arr2.length) { return false; } - for (let i = 0; i < arr1.length; ++i) { + for (const i of shaka.util.Iterables.range(arr1.length)) { if (arr1[i] != arr2[i]) { return false; } diff --git a/test/cast/cast_receiver_integration.js b/test/cast/cast_receiver_integration.js index 2eb19c3a2..74aa3f28b 100644 --- a/test/cast/cast_receiver_integration.js +++ b/test/cast/cast_receiver_integration.js @@ -183,7 +183,8 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => { // the average length is expected to be lower than the length of the first // update message. let totalLength = 0; - for (let i = 0; i < 50; i++) { + for (const _ of shaka.util.Iterables.range(50)) { + shaka.util.Functional.ignored(_); // eslint-disable-next-line no-await-in-loop const message = await waitForUpdateMessage(); totalLength += message.length; diff --git a/test/dash/dash_parser_content_protection_unit.js b/test/dash/dash_parser_content_protection_unit.js index 727bbcd2a..a50136260 100644 --- a/test/dash/dash_parser_content_protection_unit.js +++ b/test/dash/dash_parser_content_protection_unit.js @@ -104,7 +104,7 @@ describe('DashParser ContentProtection', () => { } const variants = []; - for (let i = 0; i < numVariants; i++) { + for (const i of shaka.util.Iterables.range(numVariants)) { const variant = jasmine.objectContaining({ drmInfos: drmInfos, video: jasmine.objectContaining({ diff --git a/test/dash/mpd_utils_unit.js b/test/dash/mpd_utils_unit.js index 1454b3190..c1212239f 100644 --- a/test/dash/mpd_utils_unit.js +++ b/test/dash/mpd_utils_unit.js @@ -522,10 +522,10 @@ describe('MpdUtils', () => { it('fails if it recurses too many times', async () => { const baseXMLString = inBaseContainer( - ''); + ''); // Create a large but finite number of links, so this won't // infinitely recurse if there isn't a depth limit. - for (let i = 1; i < 20; i++) { + for (const i of shaka.util.Iterables.range(20)) { const key = 'https://xlink' + i; const value = makeRecursiveXMLString(0, 'https://xlink' + (i + 1)); @@ -645,10 +645,10 @@ describe('MpdUtils', () => { it('interrupts requests on abort', async () => { const baseXMLString = inBaseContainer( - ''); + ''); // Create a few links. This is few enough that it would succeed if we // didn't abort it. - for (let i = 1; i < 3; i++) { + for (const i of shaka.util.Iterables.range(4)) { const key = 'https://xlink' + i; const value = makeRecursiveXMLString(0, 'https://xlink' + (i + 1)); diff --git a/test/hls/hls_live_unit.js b/test/hls/hls_live_unit.js index 9a08b5a4f..d63dad548 100644 --- a/test/hls/hls_live_unit.js +++ b/test/hls/hls_live_unit.js @@ -406,7 +406,8 @@ describe('HlsParser live', () => { '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n', '#EXT-X-MEDIA-SEQUENCE:0\n', ].join(''); - for (let i = 0; i < 1000; ++i) { + for (const _ of shaka.util.Iterables.range(1000)) { + shaka.util.Functional.ignored(_); mediaWithManySegments += '#EXTINF:2,\n'; mediaWithManySegments += 'main.mp4\n'; } diff --git a/test/media/buffering_observer_unit.js b/test/media/buffering_observer_unit.js index 3829f43cb..e43a7e4fe 100644 --- a/test/media/buffering_observer_unit.js +++ b/test/media/buffering_observer_unit.js @@ -123,7 +123,7 @@ describe('BufferingObserver', () => { /** @type {boolean} */ let changed; - for (let lead = 0; lead <= 4; lead++) { + for (const lead of shaka.util.Iterables.range(5)) { changed = controller.update(lead, /* toEnd= */ false); expect(changed).toBeFalsy(); } diff --git a/test/media/period_observer_unit.js b/test/media/period_observer_unit.js index d7a9a1349..b8b0986f0 100644 --- a/test/media/period_observer_unit.js +++ b/test/media/period_observer_unit.js @@ -56,7 +56,7 @@ describe('PeriodObserver', () => { expect(onPeriodChanged).toHaveBeenCalledOnceMoreWith([manifest.periods[0]]); // Playing in period 0 (period 1 starts at 10). - for (let time = 1; time <= 9; time++) { + for (const time of shaka.util.Iterables.range(10)) { poll(observer, time); expect(onPeriodChanged).not.toHaveBeenCalled(); } diff --git a/test/media/streaming_engine_unit.js b/test/media/streaming_engine_unit.js index 970164bed..c7b7fca5c 100644 --- a/test/media/streaming_engine_unit.js +++ b/test/media/streaming_engine_unit.js @@ -256,7 +256,7 @@ describe('StreamingEngine', () => { }; const segmentsInFirstPeriod = 12; - for (let i = 0; i < segmentsInFirstPeriod; ++i) { + for (const i of shaka.util.Iterables.range(segmentsInFirstPeriod)) { segmentData[ContentType.AUDIO].segments.push( makeBuffer(segmentSizes[ContentType.AUDIO])); segmentData[ContentType.VIDEO].segments.push( @@ -274,7 +274,7 @@ describe('StreamingEngine', () => { } const segmentsInSecondPeriod = 2; - for (let i = 0; i < segmentsInSecondPeriod; ++i) { + for (const i of shaka.util.Iterables.range(segmentsInSecondPeriod)) { segmentData[ContentType.AUDIO].segments.push( makeBuffer(segmentSizes[ContentType.AUDIO])); segmentData[ContentType.VIDEO].segments.push( @@ -695,16 +695,10 @@ describe('StreamingEngine', () => { // Since we started playback from segment 11, segments 10 through 14 // should be buffered. - for (let i = 0; i <= 8; ++i) { - expect(mediaSourceEngine.segments[ContentType.AUDIO][i]).toBeFalsy(); - expect(mediaSourceEngine.segments[ContentType.VIDEO][i]).toBeFalsy(); - expect(mediaSourceEngine.segments[ContentType.TEXT][i]).toBeFalsy(); - } - - for (let i = 9; i <= 13; ++i) { - expect(mediaSourceEngine.segments[ContentType.AUDIO][i]).toBeTruthy(); - expect(mediaSourceEngine.segments[ContentType.VIDEO][i]).toBeTruthy(); - expect(mediaSourceEngine.segments[ContentType.TEXT][i]).toBeTruthy(); + for (const i of shaka.util.Iterables.range(14)) { + expect(mediaSourceEngine.segments[ContentType.AUDIO][i]).toBe(i >= 9); + expect(mediaSourceEngine.segments[ContentType.VIDEO][i]).toBe(i >= 9); + expect(mediaSourceEngine.segments[ContentType.TEXT][i]).toBe(i >= 9); } }); @@ -1824,16 +1818,10 @@ describe('StreamingEngine', () => { // Since we performed an unbuffered seek into the second Period, the // first 12 segments should not be buffered. - for (let i = 0; i <= 11; ++i) { - expect(mediaSourceEngine.segments[ContentType.AUDIO][i]).toBeFalsy(); - expect(mediaSourceEngine.segments[ContentType.VIDEO][i]).toBeFalsy(); - expect(mediaSourceEngine.segments[ContentType.TEXT][i]).toBeFalsy(); - } - - for (let i = 12; i <= 13; ++i) { - expect(mediaSourceEngine.segments[ContentType.AUDIO][i]).toBeTruthy(); - expect(mediaSourceEngine.segments[ContentType.VIDEO][i]).toBeTruthy(); - expect(mediaSourceEngine.segments[ContentType.TEXT][i]).toBeTruthy(); + for (const i of shaka.util.Iterables.range(14)) { + expect(mediaSourceEngine.segments[ContentType.AUDIO][i]).toBe(i >= 12); + expect(mediaSourceEngine.segments[ContentType.VIDEO][i]).toBe(i >= 12); + expect(mediaSourceEngine.segments[ContentType.TEXT][i]).toBe(i >= 12); } }); }); @@ -2627,16 +2615,10 @@ describe('StreamingEngine', () => { text: [], }); - for (let i = 0; i <= 8; ++i) { - expect(mediaSourceEngine.segments['audio'][i]).toBeFalsy(); - expect(mediaSourceEngine.segments['video'][i]).toBeFalsy(); - expect(mediaSourceEngine.segments['text'][i]).toBeFalsy(); - } - - for (let i = 9; i <= 13; ++i) { - expect(mediaSourceEngine.segments['audio'][i]).toBeTruthy(); - expect(mediaSourceEngine.segments['video'][i]).toBeTruthy(); - expect(mediaSourceEngine.segments['text'][i]).toBeTruthy(); + for (const i of shaka.util.Iterables.range(14)) { + expect(mediaSourceEngine.segments['audio'][i]).toBe(i >= 9); + expect(mediaSourceEngine.segments['video'][i]).toBe(i >= 9); + expect(mediaSourceEngine.segments['text'][i]).toBe(i >= 9); } } diff --git a/test/test/util/indexeddb_utils.js b/test/test/util/indexeddb_utils.js index 89cfd2bd3..349357e9e 100644 --- a/test/test/util/indexeddb_utils.js +++ b/test/test/util/indexeddb_utils.js @@ -47,7 +47,8 @@ shaka.test.IndexedDBUtils = class { // connection after 5 attempts (with delays in between), just give // up. let lastError; - for (let i = 0; i < 5; i++) { + for (const _ of shaka.util.Iterables.range(5)) { + shaka.util.Functional.ignored(_); try { return await tryOpen(); // eslint-disable-line no-await-in-loop } catch (e) { // eslint-disable-line no-restricted-syntax diff --git a/test/test/util/test_scheme.js b/test/test/util/test_scheme.js index 69832d25f..725731606 100644 --- a/test/test/util/test_scheme.js +++ b/test/test/util/test_scheme.js @@ -246,7 +246,7 @@ shaka.test.TestScheme = class { .setPresentationDuration(periodDuration * numPeriods); let idCount = 1; - for (let i = 0; i < numPeriods; i++) { + for (const i of windowShaka.util.Iterables.range(numPeriods)) { gen.addPeriod(/* startTime= */ periodDuration * i); gen.addVariant(idCount++).language('en'); diff --git a/test/test/util/util.js b/test/test/util/util.js index e4d41f047..86259a192 100644 --- a/test/test/util/util.js +++ b/test/test/util/util.js @@ -53,9 +53,10 @@ shaka.test.Util = class { */ static async fakeEventLoop(duration, onTick) { // Run this synchronously: - for (let time = 0; time < duration; ++time) { + for (const time of shaka.util.Iterables.range(duration)) { // We shouldn't need more than 6 rounds. - for (let i = 0; i < 6; ++i) { + for (const _ of shaka.util.Iterables.range(6)) { + shaka.util.Functional.ignored(_); jasmine.clock().tick(0); await Promise.resolve(); // eslint-disable-line no-await-in-loop } @@ -181,7 +182,7 @@ shaka.test.Util = class { if (actual.attributes.length != expected.attributes.length) { return prospectiveDiff + 'Different attribute list length.'; } - for (let i = 0; i < actual.attributes.length; i++) { + for (const i of shaka.util.Iterables.range(actual.attributes.length)) { const aAttrib = actual.attributes[i].nodeName; const aAttribVal = actual.getAttribute(aAttrib); const eAttrib = expected.attributes[i].nodeName; @@ -197,7 +198,7 @@ shaka.test.Util = class { if (actual.childNodes.length != expected.childNodes.length) { return prospectiveDiff + 'Different child node list length.'; } - for (let i = 0; i < actual.childNodes.length; i++) { + for (const i of shaka.util.Iterables.range(actual.childNodes.length)) { const aNode = actual.childNodes[i]; const eNode = expected.childNodes[i]; const diff = diff --git a/test/ui/ui_unit.js b/test/ui/ui_unit.js index 4c8328482..ac6b30063 100644 --- a/test/ui/ui_unit.js +++ b/test/ui/ui_unit.js @@ -130,7 +130,8 @@ describe('UI', () => { // Four is just a random number I (ismena) came up with to test a // multi-video use case. It could be replaces with any other // (reasonable) number. - for (let i = 0; i < 4; i++) { + for (const _ of shaka.util.Iterables.range(4)) { + shaka.util.Functional.ignored(_); const video = /** @type {!HTMLVideoElement} */ (document.createElement('video'));