| Index: third_party/WebKit/LayoutTests/webaudio/resources/buffer-loader.js
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/buffer-loader.js b/third_party/WebKit/LayoutTests/webaudio/resources/buffer-loader.js
|
| index f089290aace3c67e695cf0a5189bdc62700c14ad..fc91aa64bf440fa3479570c308760ce5080250e6 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/resources/buffer-loader.js
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/resources/buffer-loader.js
|
| @@ -1,45 +1,50 @@
|
| function BufferLoader(context, urlList, callback) {
|
| - this.context = context;
|
| - this.urlList = urlList;
|
| - this.onload = callback;
|
| - this.bufferList = new Array();
|
| - this.loadCount = 0;
|
| + this.context = context;
|
| + this.urlList = urlList;
|
| + this.onload = callback;
|
| + this.bufferList = new Array();
|
| + this.loadCount = 0;
|
| }
|
|
|
| -BufferLoader.prototype.loadBuffer = function(url, index) {
|
| - // Load buffer asynchronously
|
| - var request = new XMLHttpRequest();
|
| - request.open("GET", url, true);
|
| - request.responseType = "arraybuffer";
|
| +BufferLoader.prototype.loadBuffer =
|
| + function(url, index) {
|
| + // Load buffer asynchronously
|
| + let request = new XMLHttpRequest();
|
| + request.open('GET', url, true);
|
| + request.responseType = 'arraybuffer';
|
|
|
| - var loader = this;
|
| + let loader = this;
|
|
|
| - request.onload = function() {
|
| - loader.context.decodeAudioData(
|
| - request.response,
|
| - function (decodedAudio) {
|
| - try {
|
| - loader.bufferList[index] = decodedAudio;
|
| - if (++loader.loadCount == loader.urlList.length)
|
| - loader.onload(loader.bufferList);
|
| - } catch(e) {
|
| - console.log(e);
|
| - alert('BufferLoader: unable to load buffer ' + index + ", url: " + loader.urlList[index]);
|
| - }
|
| - },
|
| - function () {
|
| - alert('error decoding file data: ' + url);
|
| - });
|
| - }
|
| + request.onload =
|
| + function() {
|
| + loader.context.decodeAudioData(
|
| + request.response,
|
| + function(decodedAudio) {
|
| + try {
|
| + loader.bufferList[index] = decodedAudio;
|
| + if (++loader.loadCount == loader.urlList.length)
|
| + loader.onload(loader.bufferList);
|
| + } catch (e) {
|
| + console.log(e);
|
| + alert(
|
| + 'BufferLoader: unable to load buffer ' + index +
|
| + ', url: ' + loader.urlList[index]);
|
| + }
|
| + },
|
| + function() {
|
| + alert('error decoding file data: ' + url);
|
| + });
|
| + }
|
|
|
| - request.onerror = function() {
|
| - alert('BufferLoader: XHR error');
|
| - }
|
| + request.onerror =
|
| + function() {
|
| + alert('BufferLoader: XHR error');
|
| + }
|
|
|
| - request.send();
|
| + request.send();
|
| }
|
|
|
| -BufferLoader.prototype.load = function() {
|
| - for (var i = 0; i < this.urlList.length; ++i)
|
| - this.loadBuffer(this.urlList[i], i);
|
| + BufferLoader.prototype.load = function() {
|
| + for (let i = 0; i < this.urlList.length; ++i)
|
| + this.loadBuffer(this.urlList[i], i);
|
| }
|
|
|