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

Side by Side Diff: Source/devtools/front_end/Runtime.js

Issue 460323002: DevTools: Allow dynamic module registration only in tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector/documentation/documentation-url-provider.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return new Worker(moduleName + "/_module.js"); 125 return new Worker(moduleName + "/_module.js");
126 } 126 }
127 127
128 Runtime.prototype = { 128 Runtime.prototype = {
129 /** 129 /**
130 * @param {!Array.<string>} configuration 130 * @param {!Array.<string>} configuration
131 */ 131 */
132 registerModules: function(configuration) 132 registerModules: function(configuration)
133 { 133 {
134 for (var i = 0; i < configuration.length; ++i) 134 for (var i = 0; i < configuration.length; ++i)
135 this.registerModule(configuration[i]); 135 this._registerModule(configuration[i]);
136 }, 136 },
137 137
138 /** 138 /**
139 * @param {string} moduleName 139 * @param {string} moduleName
140 */ 140 */
141 registerModule: function(moduleName) 141 _registerModule: function(moduleName)
142 { 142 {
143 if (!this._descriptorsMap[moduleName]) { 143 if (!this._descriptorsMap[moduleName]) {
144 var content = loadResource(moduleName + "/module.json"); 144 var content = loadResource(moduleName + "/module.json");
145 if (!content) 145 if (!content)
146 throw new Error("Module is not defined: " + moduleName + " " + n ew Error().stack); 146 throw new Error("Module is not defined: " + moduleName + " " + n ew Error().stack);
147 var module = /** @type {!Runtime.ModuleDescriptor} */ (self.eval("(" + content + ")")); 147 var module = /** @type {!Runtime.ModuleDescriptor} */ (self.eval("(" + content + ")"));
148 module["name"] = moduleName; 148 module["name"] = moduleName;
149 this._descriptorsMap[moduleName] = module; 149 this._descriptorsMap[moduleName] = module;
150 } 150 }
151 var module = new Runtime.Module(this, this._descriptorsMap[moduleName]); 151 var module = new Runtime.Module(this, this._descriptorsMap[moduleName]);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 this._instance = new constructorFunction(); 523 this._instance = new constructorFunction();
524 } 524 }
525 return this._instance; 525 return this._instance;
526 } 526 }
527 } 527 }
528 528
529 /** 529 /**
530 * @type {!Runtime} 530 * @type {!Runtime}
531 */ 531 */
532 var runtime; 532 var runtime;
OLDNEW
« no previous file with comments | « LayoutTests/inspector/documentation/documentation-url-provider.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698