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

Side by Side Diff: Source/devtools/front_end/sources/CallStackSidebarPane.js

Issue 548323002: DevTools: Blackbox content scripts - frontend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added a test 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 { 107 {
108 var allPlacardsHidden = true; 108 var allPlacardsHidden = true;
109 for (var i = 0, n = callFrames.length; i < n; ++i) { 109 for (var i = 0, n = callFrames.length; i < n; ++i) {
110 var callFrame = callFrames[i]; 110 var callFrame = callFrames[i];
111 var placard = new WebInspector.CallStackSidebarPane.Placard(callFram e, asyncPlacard); 111 var placard = new WebInspector.CallStackSidebarPane.Placard(callFram e, asyncPlacard);
112 placard.element.addEventListener("click", this._placardSelected.bind (this, placard), false); 112 placard.element.addEventListener("click", this._placardSelected.bind (this, placard), false);
113 placard.element.addEventListener("contextmenu", this._placardContext Menu.bind(this, placard), true); 113 placard.element.addEventListener("contextmenu", this._placardContext Menu.bind(this, placard), true);
114 this.placards.push(placard); 114 this.placards.push(placard);
115 this.bodyElement.appendChild(placard.element); 115 this.bodyElement.appendChild(placard.element);
116 116
117 if (WebInspector.BlackboxSupport.isBlackboxedURL(callFrame.script.so urceURL)) { 117 if (WebInspector.BlackboxSupport.isBlackboxed(callFrame.script.sourc eURL, callFrame.script.isContentScript())) {
118 placard.setHidden(true); 118 placard.setHidden(true);
119 placard.element.classList.add("dimmed"); 119 placard.element.classList.add("dimmed");
120 ++this._hiddenPlacards; 120 ++this._hiddenPlacards;
121 } else { 121 } else {
122 allPlacardsHidden = false; 122 allPlacardsHidden = false;
123 } 123 }
124 } 124 }
125 if (allPlacardsHidden && asyncPlacard) 125 if (allPlacardsHidden && asyncPlacard)
126 asyncPlacard.setHidden(true); 126 asyncPlacard.setHidden(true);
127 }, 127 },
(...skipping 24 matching lines...) Expand all
152 var contextMenu = new WebInspector.ContextMenu(event); 152 var contextMenu = new WebInspector.ContextMenu(event);
153 153
154 if (!placard._callFrame.isAsync()) 154 if (!placard._callFrame.isAsync())
155 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Restart frame" : "Restart Frame"), this._restartFrame.bind(thi s, placard)); 155 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Restart frame" : "Restart Frame"), this._restartFrame.bind(thi s, placard));
156 156
157 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Copy stack trace" : "Copy Stack Trace"), this._copyStackTrace.bind (this)); 157 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Copy stack trace" : "Copy Stack Trace"), this._copyStackTrace.bind (this));
158 158
159 var script = placard._callFrame.script; 159 var script = placard._callFrame.script;
160 if (!script.isSnippet()) { 160 if (!script.isSnippet()) {
161 contextMenu.appendSeparator(); 161 contextMenu.appendSeparator();
162 this.appendBlackboxURLContextMenuItems(contextMenu, script.sourceURL ); 162 this.appendBlackboxURLContextMenuItems(contextMenu, script.sourceURL , script.isContentScript());
163 } 163 }
164 164
165 contextMenu.show(); 165 contextMenu.show();
166 }, 166 },
167 167
168 /** 168 /**
169 * @param {number} index 169 * @param {number} index
170 * @param {!Event} event 170 * @param {!Event} event
171 */ 171 */
172 _asyncPlacardContextMenu: function(index, event) 172 _asyncPlacardContextMenu: function(index, event)
173 { 173 {
174 for (; index < this.placards.length; ++index) { 174 for (; index < this.placards.length; ++index) {
175 var placard = this.placards[index]; 175 var placard = this.placards[index];
176 if (!placard.isHidden()) { 176 if (!placard.isHidden()) {
177 this._placardContextMenu(placard, event); 177 this._placardContextMenu(placard, event);
178 break; 178 break;
179 } 179 }
180 } 180 }
181 }, 181 },
182 182
183 /** 183 /**
184 * @param {!WebInspector.ContextMenu} contextMenu 184 * @param {!WebInspector.ContextMenu} contextMenu
185 * @param {string} url 185 * @param {string} url
186 * @param {boolean} isContentScript
186 */ 187 */
187 appendBlackboxURLContextMenuItems: function(contextMenu, url) 188 appendBlackboxURLContextMenuItems: function(contextMenu, url, isContentScrip t)
188 { 189 {
189 if (!url) 190 var blackboxed = WebInspector.BlackboxSupport.isBlackboxed(url, isConten tScript);
190 return; 191 if (blackboxed) {
191 var blackboxed = WebInspector.BlackboxSupport.isBlackboxedURL(url); 192 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Stop blackboxing" : "Stop Blackboxing"), this._handleContextMe nuBlackboxURL.bind(this, url, isContentScript, false));
192 if (blackboxed) 193 } else {
193 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Stop blackboxing" : "Stop Blackboxing"), this._handleContextMe nuBlackboxURL.bind(this, url, false)); 194 if (WebInspector.BlackboxSupport.canBlackboxURL(url))
194 else 195 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLow erCaseMenuTitles() ? "Blackbox script" : "Blackbox Script"), this._handleContext MenuBlackboxURL.bind(this, url, false, true));
195 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCa seMenuTitles() ? "Blackbox script" : "Blackbox Script"), this._handleContextMenu BlackboxURL.bind(this, url, true)); 196 if (isContentScript)
197 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLow erCaseMenuTitles() ? "Blackbox all content scripts" : "Blackbox All Content Scri pts"), this._handleContextMenuBlackboxURL.bind(this, url, true, true));
198 }
196 }, 199 },
197 200
198 /** 201 /**
199 * @param {string} url 202 * @param {string} url
203 * @param {boolean} isContentScript
200 * @param {boolean} blackbox 204 * @param {boolean} blackbox
201 */ 205 */
202 _handleContextMenuBlackboxURL: function(url, blackbox) 206 _handleContextMenuBlackboxURL: function(url, isContentScript, blackbox)
203 { 207 {
204 if (blackbox) 208 if (blackbox) {
205 WebInspector.BlackboxSupport.blackboxURL(url); 209 if (isContentScript)
206 else 210 WebInspector.settings.skipContentScripts.set(true);
207 WebInspector.BlackboxSupport.unblackboxURL(url); 211 else
212 WebInspector.BlackboxSupport.blackboxURL(url);
213 } else {
214 WebInspector.BlackboxSupport.unblackbox(url, isContentScript);
215 }
208 }, 216 },
209 217
210 _blackboxingStateChanged: function() 218 _blackboxingStateChanged: function()
211 { 219 {
212 if (!this._target) 220 if (!this._target)
213 return; 221 return;
214 var details = this._target.debuggerModel.debuggerPausedDetails(); 222 var details = this._target.debuggerModel.debuggerPausedDetails();
215 if (!details) 223 if (!details)
216 return; 224 return;
217 this.update(details); 225 this.update(details);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 /** 410 /**
403 * @param {!WebInspector.UILocation} uiLocation 411 * @param {!WebInspector.UILocation} uiLocation
404 */ 412 */
405 _update: function(uiLocation) 413 _update: function(uiLocation)
406 { 414 {
407 this.subtitle = uiLocation.linkText().trimMiddle(30); 415 this.subtitle = uiLocation.linkText().trimMiddle(30);
408 }, 416 },
409 417
410 __proto__: WebInspector.Placard.prototype 418 __proto__: WebInspector.Placard.prototype
411 } 419 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/settings/SettingsScreen.js ('k') | Source/devtools/front_end/sources/JavaScriptSourceFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698