Chromium Code Reviews| 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..422845e0bc8c89cf03c3a42ce7eb26924984e541 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/Runtime.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/Runtime.js |
| @@ -214,6 +214,30 @@ Runtime._queryParamsObject = { __proto__: null }; |
| Runtime.cachedResources = { __proto__: null }; |
| /** |
| + * @param {string} url |
| + * @param {boolean=} doNotAddSourceURL |
|
dgozman
2016/07/08 05:45:07
Let's make it non-optional |addSourceURL|.
lushnikov
2016/07/08 17:09:53
Done.
|
| + * @return {!Promise<undefined>} |
| + */ |
| +Runtime.loadResourceIntoCache = function(url, doNotAddSourceURL) |
| +{ |
| + return loadResourcePromise(url).then(cacheResource.bind(this, url), cacheResource.bind(this, url, undefined)); |
| + |
| + /** |
| + * @param {string} path |
| + * @param {string=} content |
| + */ |
| + function cacheResource(path, content) |
| + { |
| + if (!content) { |
| + console.error("Failed to load resource: " + path); |
| + return; |
| + } |
| + var sourceURL = doNotAddSourceURL ? "" : Runtime.resolveSourceURL(path); |
| + Runtime.cachedResources[path] = content + sourceURL; |
| + } |
| +} |
| + |
| +/** |
| * @return {boolean} |
| */ |
| Runtime.isReleaseMode = function() |
| @@ -773,22 +797,9 @@ Runtime.Module.prototype = { |
| var promises = []; |
| for (var i = 0; i < resources.length; ++i) { |
| var url = this._modularizeURL(resources[i]); |
| - promises.push(loadResourcePromise(url).then(cacheResource.bind(this, url), cacheResource.bind(this, url, undefined))); |
| + promises.push(Runtime.loadResourceIntoCache(url)); |
| } |
| return Promise.all(promises).then(undefined); |
| - |
| - /** |
| - * @param {string} path |
| - * @param {string=} content |
| - */ |
| - function cacheResource(path, content) |
| - { |
| - if (!content) { |
| - console.error("Failed to load resource: " + path); |
| - return; |
| - } |
| - Runtime.cachedResources[path] = content + Runtime.resolveSourceURL(path); |
| - } |
| }, |
| /** |