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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js

Issue 2125423002: [DevTools] Rename ScriptPosition.line|column into lineNumber|columnNumber (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding 7 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
8 * @param {!WebInspector.NetworkMapping} networkMapping 8 * @param {!WebInspector.NetworkMapping} networkMapping
9 * @implements {WebInspector.TargetManager.Observer} 9 * @implements {WebInspector.TargetManager.Observer}
10 */ 10 */
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 var index = positions.lowerBound(location, comparator); 91 var index = positions.lowerBound(location, comparator);
92 return !!(index % 2); 92 return !!(index % 2);
93 93
94 /** 94 /**
95 * @param {!WebInspector.DebuggerModel.Location} a 95 * @param {!WebInspector.DebuggerModel.Location} a
96 * @param {!DebuggerAgent.ScriptPosition} b 96 * @param {!DebuggerAgent.ScriptPosition} b
97 * @return {number} 97 * @return {number}
98 */ 98 */
99 function comparator(a, b) 99 function comparator(a, b)
100 { 100 {
101 if (a.lineNumber !== b.line) 101 if (a.lineNumber !== b.lineNumber)
102 return a.lineNumber - b.line; 102 return a.lineNumber - b.lineNumber;
103 return a.columnNumber - b.column; 103 return a.columnNumber - b.columnNumber;
104 } 104 }
105 }, 105 },
106 106
107 /** 107 /**
108 * @param {!WebInspector.UISourceCode} uiSourceCode 108 * @param {!WebInspector.UISourceCode} uiSourceCode
109 * @return {boolean} 109 * @return {boolean}
110 */ 110 */
111 isBlackboxedUISourceCode: function(uiSourceCode) 111 isBlackboxedUISourceCode: function(uiSourceCode)
112 { 112 {
113 var projectType = uiSourceCode.project().type(); 113 var projectType = uiSourceCode.project().type();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (previousScriptState.length > 0) 155 if (previousScriptState.length > 0)
156 return this._setScriptState(script, []); 156 return this._setScriptState(script, []);
157 return Promise.resolve(); 157 return Promise.resolve();
158 } 158 }
159 159
160 var currentBlackboxed = false; 160 var currentBlackboxed = false;
161 var isBlackboxed = false; 161 var isBlackboxed = false;
162 var positions = []; 162 var positions = [];
163 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it. 163 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it.
164 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { 164 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) {
165 positions.push({ line: 0, column: 0}); 165 positions.push({ lineNumber: 0, columnNumber: 0});
166 currentBlackboxed = true; 166 currentBlackboxed = true;
167 } 167 }
168 for (var mapping of mappings) { 168 for (var mapping of mappings) {
169 if (mapping.sourceURL && currentBlackboxed !== this.isBlackboxedURL( mapping.sourceURL)) { 169 if (mapping.sourceURL && currentBlackboxed !== this.isBlackboxedURL( mapping.sourceURL)) {
170 positions.push({ line: mapping.lineNumber, column: mapping.colum nNumber }); 170 positions.push({ lineNumber: mapping.lineNumber, columnNumber: m apping.columnNumber });
171 currentBlackboxed = !currentBlackboxed; 171 currentBlackboxed = !currentBlackboxed;
172 } 172 }
173 isBlackboxed = currentBlackboxed || isBlackboxed; 173 isBlackboxed = currentBlackboxed || isBlackboxed;
174 } 174 }
175 return this._setScriptState(script, !isBlackboxed ? [] : positions); 175 return this._setScriptState(script, !isBlackboxed ? [] : positions);
176 /** 176 /**
177 * @param {!WebInspector.SourceMapEntry} a 177 * @param {!WebInspector.SourceMapEntry} a
178 * @param {!WebInspector.SourceMapEntry} b 178 * @param {!WebInspector.SourceMapEntry} b
179 * @return {number} 179 * @return {number}
180 */ 180 */
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 this._addScript(script); 339 this._addScript(script);
340 }, 340 },
341 341
342 /** 342 /**
343 * @param {!WebInspector.Script} script 343 * @param {!WebInspector.Script} script
344 * @return {!Promise<undefined>} 344 * @return {!Promise<undefined>}
345 */ 345 */
346 _addScript: function(script) 346 _addScript: function(script)
347 { 347 {
348 var blackboxed = this._isBlackboxedScript(script); 348 var blackboxed = this._isBlackboxedScript(script);
349 return this._setScriptState(script, blackboxed ? [ { line: 0, column: 0 } ] : []); 349 return this._setScriptState(script, blackboxed ? [ { lineNumber: 0, colu mnNumber: 0 } ] : []);
350 }, 350 },
351 351
352 /** 352 /**
353 * @param {!WebInspector.Script} script 353 * @param {!WebInspector.Script} script
354 * @return {boolean} 354 * @return {boolean}
355 */ 355 */
356 _isBlackboxedScript: function(script) 356 _isBlackboxedScript: function(script)
357 { 357 {
358 return this.isBlackboxedURL(script.sourceURL, script.isContentScript()); 358 return this.isBlackboxedURL(script.sourceURL, script.isContentScript());
359 }, 359 },
(...skipping 26 matching lines...) Expand all
386 * @param {!Array<!DebuggerAgent.ScriptPosition>} positions 386 * @param {!Array<!DebuggerAgent.ScriptPosition>} positions
387 * @return {!Promise<undefined>} 387 * @return {!Promise<undefined>}
388 */ 388 */
389 _setScriptState: function(script, positions) 389 _setScriptState: function(script, positions)
390 { 390 {
391 var previousScriptState = this._scriptPositions(script); 391 var previousScriptState = this._scriptPositions(script);
392 if (previousScriptState) { 392 if (previousScriptState) {
393 var hasChanged = false; 393 var hasChanged = false;
394 hasChanged = previousScriptState.length !== positions.length; 394 hasChanged = previousScriptState.length !== positions.length;
395 for (var i = 0; !hasChanged && i < positions.length; ++i) 395 for (var i = 0; !hasChanged && i < positions.length; ++i)
396 hasChanged = positions[i].line !== previousScriptState[i].line | | positions[i].column !== previousScriptState[i].column; 396 hasChanged = positions[i].lineNumber !== previousScriptState[i]. lineNumber || positions[i].columnNumber !== previousScriptState[i].columnNumber;
397 if (!hasChanged) 397 if (!hasChanged)
398 return Promise.resolve(); 398 return Promise.resolve();
399 } else { 399 } else {
400 if (positions.length === 0) 400 if (positions.length === 0)
401 return Promise.resolve().then(updateState.bind(this, false)); 401 return Promise.resolve().then(updateState.bind(this, false));
402 } 402 }
403 403
404 return script.setBlackboxedRanges(positions).then(updateState.bind(this) ); 404 return script.setBlackboxedRanges(positions).then(updateState.bind(this) );
405 405
406 /** 406 /**
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (scheme === "chrome-extension") 450 if (scheme === "chrome-extension")
451 prefix += parsedURL.host + "\\b"; 451 prefix += parsedURL.host + "\\b";
452 prefix += ".*"; 452 prefix += ".*";
453 } 453 }
454 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b"); 454 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b");
455 } 455 }
456 } 456 }
457 457
458 /** @type {!WebInspector.BlackboxManager} */ 458 /** @type {!WebInspector.BlackboxManager} */
459 WebInspector.blackboxManager; 459 WebInspector.blackboxManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698