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

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

Issue 573453004: DevTools: Get rid of frontend_modules.json (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 3 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
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/audits/module.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/Runtime.js
diff --git a/Source/devtools/front_end/Runtime.js b/Source/devtools/front_end/Runtime.js
index 9f0e5b6f2c5e3715b4b544b5664464a0d98039d6..817c59379b068c965dc881a3e982fce59a256b0f 100644
--- a/Source/devtools/front_end/Runtime.js
+++ b/Source/devtools/front_end/Runtime.js
@@ -137,6 +137,12 @@ var Runtime = function()
* @type {!Object.<string, !Runtime.ModuleDescriptor>}
*/
this._descriptorsMap = {};
+
+ /**
+ * @type {!Object.<string, boolean>}
+ */
+ this._coreModules = {};
+
for (var i = 0; i < allDescriptors.length; ++i)
this._descriptorsMap[allDescriptors[i]["name"]] = allDescriptors[i];
}
@@ -220,9 +226,12 @@ Runtime.startWorker = function(moduleName)
Runtime.prototype = {
/**
* @param {!Array.<string>} configuration
+ * @param {!Array.<string>} coreModules
*/
- registerModules: function(configuration)
+ registerModules: function(configuration, coreModules)
{
+ for (var i = 0; i < coreModules.length; ++i)
+ this._coreModules[coreModules[i]] = true;
for (var i = 0; i < configuration.length; ++i)
this._registerModule(configuration[i]);
},
@@ -233,9 +242,17 @@ Runtime.prototype = {
_registerModule: function(moduleName)
{
if (!this._descriptorsMap[moduleName]) {
- var content = loadResource(moduleName + "/module.json");
+ var content;
+ // FIXME: This is a temp workaround to avoid core module loading attempts in the release mode.
+ // It should be removed when the new application loader is implemented.
+ if (!this._coreModules.hasOwnProperty(moduleName))
+ content = loadResource(moduleName + "/module.json");
+ else
+ content = "{}";
+
if (!content)
throw new Error("Module is not defined: " + moduleName + " " + new Error().stack);
+
var module = /** @type {!Runtime.ModuleDescriptor} */ (self.eval("(" + content + ")"));
module["name"] = moduleName;
this._descriptorsMap[moduleName] = module;
@@ -537,7 +554,10 @@ Runtime.Module.prototype = {
this._manager.loadModule(dependencies[i]);
if (this._descriptor.scripts) {
if (Runtime.isReleaseMode()) {
- loadScript(this._name + ".js");
+ // FIXME: This is a temp workaround to avoid core module loading attempts in the release mode.
+ // It should be removed when the new application loader is implemented.
+ if (!this._manager._coreModules.hasOwnProperty(this._name))
+ loadScript(this._name + ".js");
} else {
var scripts = this._descriptor.scripts;
for (var i = 0; i < scripts.length; ++i)
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/audits/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698