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

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

Issue 2608043002: DevTools: extract modules (with extensions) (Closed)
Patch Set: fix externs (PerfUI) Created 3 years, 11 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 2a9732f894d62fad9ff7681a60349973c163d872..0d500cb7de91dc4ecae2235df9e9e1c6ba741287 100644
--- a/third_party/WebKit/Source/devtools/front_end/Runtime.js
+++ b/third_party/WebKit/Source/devtools/front_end/Runtime.js
@@ -772,18 +772,20 @@ Runtime.Module = class {
if (!this._descriptor.scripts || !this._descriptor.scripts.length)
return Promise.resolve();
- // Module namespaces.
- var namespace = this._name.replace('_lazy', '');
// the namespace keyword confuses clang-format
// clang-format off
- if (namespace === 'sdk' || namespace === 'ui')
- namespace = namespace.toUpperCase();
- if (namespace === 'css_tracker')
- namespace = 'CSSTracker';
- // clang-format on
- namespace = namespace.split('_').map(a => a.substring(0, 1).toUpperCase() + a.substring(1)).join('');
+ // Module namespaces.
+ const specialCases = {
+ 'sdk': 'SDK',
+ 'ui': 'UI',
+ 'perf_ui': 'PerfUI',
+ 'css_tracker': 'CSSTracker',
+ 'ui_lazy': 'UI',
+ 'components_lazy': 'Components'
+ };
+ var namespace = specialCases[this._name] || this._name.split('_').map(a => a.substring(0, 1).toUpperCase() + a.substring(1)).join('');
self[namespace] = self[namespace] || {};
-
+ // clang-format on
return Runtime._loadScriptsPromise(this._descriptor.scripts.map(this._modularizeURL, this), this._remoteBase());
}

Powered by Google App Engine
This is Rietveld 408576698