Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: third_party/WebKit/Source/devtools/front_end/Runtime.js

Issue 2124203002: DevTools: copy protocol files to front-end to fix hosted mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pre-load json files for hosted mode Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
- }
},
/**

Powered by Google App Engine
This is Rietveld 408576698