| Index: third_party/WebKit/Source/devtools/front_end/Runtime.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/Runtime.js b/third_party/WebKit/Source/devtools/front_end/Runtime.js
|
| index 2f0b1ee9713e90beb692924aa62af7a8b27d0b35..adb09f22c15f2f6846c54120fbedc8997b589339 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/Runtime.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/Runtime.js
|
| @@ -116,6 +116,7 @@ function loadScriptsPromise(scriptNames, base)
|
| var promises = [];
|
| /** @type {!Array<string>} */
|
| var urls = [];
|
| + var pauseSourceEvaluation = false;
|
| var sources = new Array(scriptNames.length);
|
| var scriptToEval = 0;
|
| for (var i = 0; i < scriptNames.length; ++i) {
|
| @@ -131,27 +132,30 @@ function loadScriptsPromise(scriptNames, base)
|
| if (_loadedScripts[sourceURL])
|
| continue;
|
| urls.push(sourceURL);
|
| - promises.push(loadResourcePromise(sourceURL).then(scriptSourceLoaded.bind(null, i), scriptSourceLoaded.bind(null, i, undefined)));
|
| + var promise = loadResourcePromise(sourceURL)
|
| + .then(scriptSource => scriptSource || "")
|
| + .catch(e => "");
|
| + promises.push(promise);
|
| }
|
| - return Promise.all(promises).then(undefined);
|
| + var allSourcesPromise = /** @type {!Promise<!Array<string>>} */(Promise.all(promises));
|
| + return allSourcesPromise.then(evaluateSources);
|
|
|
| /**
|
| - * @param {number} scriptNumber
|
| - * @param {string=} scriptSource
|
| + * @param {!Array<string>} sources
|
| + * @return {!Promise}
|
| */
|
| - function scriptSourceLoaded(scriptNumber, scriptSource)
|
| + function evaluateSources(sources)
|
| {
|
| - sources[scriptNumber] = scriptSource || "";
|
| - // Eval scripts as fast as possible.
|
| - while (typeof sources[scriptToEval] !== "undefined") {
|
| - evaluateScript(urls[scriptToEval], sources[scriptToEval]);
|
| - ++scriptToEval;
|
| - }
|
| + var result = Promise.resolve();
|
| + for (var i = 0; i < sources.length; ++i)
|
| + result = result.then(evaluateScript.bind(null, urls[i], sources[i]));
|
| + return result;
|
| }
|
|
|
| /**
|
| * @param {string} sourceURL
|
| * @param {string=} scriptSource
|
| + * @return {?Promise}
|
| */
|
| function evaluateScript(sourceURL, scriptSource)
|
| {
|
| @@ -159,9 +163,10 @@ function loadScriptsPromise(scriptNames, base)
|
| if (!scriptSource) {
|
| // Do not reject, as this is normal in the hosted mode.
|
| console.error("Empty response arrived for script '" + sourceURL + "'");
|
| - return;
|
| + return null;
|
| }
|
| - self.eval(scriptSource + "\n//# sourceURL=" + sourceURL);
|
| + var result = self.eval(scriptSource + "\n//# sourceURL=" + sourceURL);
|
| + return result instanceof Promise ? result : null;
|
| }
|
| }
|
|
|
|
|