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

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

Issue 607893002: DevTools: Avoid build errors when dynamic module and application names clash (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix BUILD.gn Created 6 years, 2 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 | « Source/devtools/devtools.gypi ('k') | Source/devtools/scripts/concatenate_application_code.py » ('j') | 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 /** 159 /**
160 * @param {string} moduleName 160 * @param {string} moduleName
161 * @param {string} workerName 161 * @param {string} workerName
162 * @return {!SharedWorker} 162 * @return {!SharedWorker}
163 */ 163 */
164 Runtime.startSharedWorker = function(moduleName, workerName) 164 Runtime.startSharedWorker = function(moduleName, workerName)
165 { 165 {
166 if (Runtime.isReleaseMode()) 166 if (Runtime.isReleaseMode())
167 return new SharedWorker(moduleName + ".js", workerName); 167 return new SharedWorker(moduleName + "_module.js", workerName);
168 168
169 var content = loadResource(moduleName + "/module.json"); 169 var content = loadResource(moduleName + "/module.json");
170 if (!content) 170 if (!content)
171 throw new Error("Worker is not defined: " + moduleName + " " + new Error ().stack); 171 throw new Error("Worker is not defined: " + moduleName + " " + new Error ().stack);
172 var scripts = JSON.parse(content)["scripts"]; 172 var scripts = JSON.parse(content)["scripts"];
173 if (scripts.length !== 1) 173 if (scripts.length !== 1)
174 throw Error("Runtime.startSharedWorker supports modules with only one sc ript!"); 174 throw Error("Runtime.startSharedWorker supports modules with only one sc ript!");
175 return new SharedWorker(moduleName + "/" + scripts[0], workerName); 175 return new SharedWorker(moduleName + "/" + scripts[0], workerName);
176 } 176 }
177 177
178 /** 178 /**
179 * @param {string} moduleName 179 * @param {string} moduleName
180 * @return {!Worker} 180 * @return {!Worker}
181 */ 181 */
182 Runtime.startWorker = function(moduleName) 182 Runtime.startWorker = function(moduleName)
183 { 183 {
184 if (Runtime.isReleaseMode()) 184 if (Runtime.isReleaseMode())
185 return new Worker(moduleName + ".js"); 185 return new Worker(moduleName + "_module.js");
186 186
187 var content = loadResource(moduleName + "/module.json"); 187 var content = loadResource(moduleName + "/module.json");
188 if (!content) 188 if (!content)
189 throw new Error("Worker is not defined: " + moduleName + " " + new Error ().stack); 189 throw new Error("Worker is not defined: " + moduleName + " " + new Error ().stack);
190 var message = []; 190 var message = [];
191 var scripts = JSON.parse(content)["scripts"]; 191 var scripts = JSON.parse(content)["scripts"];
192 for (var i = 0; i < scripts.length; ++i) { 192 for (var i = 0; i < scripts.length; ++i) {
193 var url = self._importScriptPathPrefix + moduleName + "/" + scripts[i]; 193 var url = self._importScriptPathPrefix + moduleName + "/" + scripts[i];
194 var parts = url.split("://"); 194 var parts = url.split("://");
195 url = parts.length === 1 ? url : parts[0] + "://" + normalizePath(parts[ 1]); 195 url = parts.length === 1 ? url : parts[0] + "://" + normalizePath(parts[ 1]);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 Error.stackTraceLimit = oldStackTraceLimit; 650 Error.stackTraceLimit = oldStackTraceLimit;
651 return; 651 return;
652 } 652 }
653 653
654 this._isLoading = true; 654 this._isLoading = true;
655 var dependencies = this._descriptor.dependencies; 655 var dependencies = this._descriptor.dependencies;
656 for (var i = 0; dependencies && i < dependencies.length; ++i) 656 for (var i = 0; dependencies && i < dependencies.length; ++i)
657 this._manager.loadModule(dependencies[i]); 657 this._manager.loadModule(dependencies[i]);
658 if (this._descriptor.scripts) { 658 if (this._descriptor.scripts) {
659 if (Runtime.isReleaseMode()) { 659 if (Runtime.isReleaseMode()) {
660 loadScript(this._name + ".js"); 660 loadScript(this._name + "_module.js");
661 } else { 661 } else {
662 var scripts = this._descriptor.scripts; 662 var scripts = this._descriptor.scripts;
663 for (var i = 0; i < scripts.length; ++i) 663 for (var i = 0; i < scripts.length; ++i)
664 loadScript(this._name + "/" + scripts[i]); 664 loadScript(this._name + "/" + scripts[i]);
665 } 665 }
666 } 666 }
667 this._isLoading = false; 667 this._isLoading = false;
668 this._loaded = true; 668 this._loaded = true;
669 } 669 }
670 } 670 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 for (var key in settings) 764 for (var key in settings)
765 window.localStorage[key] = settings[key]; 765 window.localStorage[key] = settings[key];
766 } catch(e) { 766 } catch(e) {
767 // Ignore malformed settings. 767 // Ignore malformed settings.
768 } 768 }
769 } 769 }
770 })();} 770 })();}
771 771
772 /** @type {!Runtime} */ 772 /** @type {!Runtime} */
773 var runtime; 773 var runtime;
OLDNEW
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/scripts/concatenate_application_code.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698