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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 2851483003: DevTools: only show one source map infobar at a time (Closed)
Patch Set: DevTools: only show one source map infobar at a time Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
index 86fd83ac9dd4e3ed4802260a5036b5e518e9ef3b..f5e28b2a9f0745bf92805081a3576655dbb288f1 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
@@ -1205,27 +1205,38 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
if (this._muted && !this.uiSourceCode().isDirty())
this._restoreBreakpointsIfConsistentScripts();
}
- if (newScriptFile)
- this._scriptFileForDebuggerModel.set(debuggerModel, newScriptFile);
-
- if (newScriptFile) {
- newScriptFile.addEventListener(Bindings.ResourceScriptFile.Events.DidMergeToVM, this._didMergeToVM, this);
- newScriptFile.addEventListener(Bindings.ResourceScriptFile.Events.DidDivergeFromVM, this._didDivergeFromVM, this);
- if (this.loaded)
- newScriptFile.checkMapping();
- if (newScriptFile.hasSourceMapURL()) {
- var sourceMapInfobar = UI.Infobar.create(
- UI.Infobar.Type.Info, Common.UIString('Source Map detected.'),
- Common.settings.createSetting('sourceMapInfobarDisabled', false));
- if (sourceMapInfobar) {
- sourceMapInfobar.createDetailsRowMessage(Common.UIString(
- 'Associated files should be added to the file tree. You can debug these resolved source files as regular JavaScript files.'));
- sourceMapInfobar.createDetailsRowMessage(Common.UIString(
- 'Associated files are available via file tree or %s.',
- UI.shortcutRegistry.shortcutTitleForAction('quickOpen.show')));
- this.attachInfobars([sourceMapInfobar]);
- }
+ if (!newScriptFile)
+ return;
+ this._scriptFileForDebuggerModel.set(debuggerModel, newScriptFile);
+ newScriptFile.addEventListener(Bindings.ResourceScriptFile.Events.DidMergeToVM, this._didMergeToVM, this);
+ newScriptFile.addEventListener(Bindings.ResourceScriptFile.Events.DidDivergeFromVM, this._didDivergeFromVM, this);
+ if (this.loaded)
+ newScriptFile.checkMapping();
+ this._showSourceMapInfobar(newScriptFile.hasSourceMapURL());
+ }
+
+ /**
+ * @param {boolean} show
+ */
+ _showSourceMapInfobar(show) {
+ if (this._sourceMapInfobar) {
+ if (!show) {
+ this._sourceMapInfobar.dispose();
+ delete this._sourceMapInfobar;
}
+ return;
+ }
+ this._sourceMapInfobar = UI.Infobar.create(
+ UI.Infobar.Type.Info, Common.UIString('Source Map detected.'),
+ Common.settings.createSetting('sourceMapInfobarDisabled', false));
+ if (this._sourceMapInfobar) {
+ this._sourceMapInfobar.createDetailsRowMessage(Common.UIString(
+ 'Associated files should be added to the file tree. You can debug these resolved source files as regular JavaScript files.'));
+ this._sourceMapInfobar.createDetailsRowMessage(Common.UIString(
+ 'Associated files are available via file tree or %s.',
+ UI.shortcutRegistry.shortcutTitleForAction('quickOpen.show')));
+ this._sourceMapInfobar.setCloseCallback(() => delete this._sourceMapInfobar);
+ this.attachInfobars([this._sourceMapInfobar]);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698