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

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

Issue 1763883003: [DevTools] Fix compiler errors in bindings module (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prepare-ui-module
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 */ 9 */
10 WebInspector.BlackboxManager = function(debuggerWorkspaceBinding, networkMapping ) 10 WebInspector.BlackboxManager = function(debuggerWorkspaceBinding, networkMapping )
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return Promise.resolve(); 109 return Promise.resolve();
110 var previousScriptState = this._scriptPositions(script); 110 var previousScriptState = this._scriptPositions(script);
111 if (!previousScriptState) 111 if (!previousScriptState)
112 return Promise.resolve(); 112 return Promise.resolve();
113 113
114 var mappings = sourceMap.mappings().slice(); 114 var mappings = sourceMap.mappings().slice();
115 mappings.sort(mappingComparator); 115 mappings.sort(mappingComparator);
116 116
117 if (!mappings.length) { 117 if (!mappings.length) {
118 if (previousScriptState.length > 0) 118 if (previousScriptState.length > 0)
119 return this._setScriptState(script, []).then(this._sourceMapLoad edForTest); 119 return this._setScriptState(script, []);
120 } 120 }
121 121
122 var currentBlackboxed = false; 122 var currentBlackboxed = false;
123 var isBlackboxed = false; 123 var isBlackboxed = false;
124 var positions = []; 124 var positions = [];
125 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it. 125 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it.
126 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { 126 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) {
127 positions.push({ line: 0, column: 0}); 127 positions.push({ line: 0, column: 0});
128 currentBlackboxed = true; 128 currentBlackboxed = true;
129 } 129 }
130 for (var mapping of mappings) { 130 for (var mapping of mappings) {
131 if (currentBlackboxed !== this.isBlackboxedURL(mapping.sourceURL)) { 131 if (mapping.sourceURL && currentBlackboxed !== this.isBlackboxedURL( mapping.sourceURL)) {
132 positions.push({ line: mapping.lineNumber, column: mapping.colum nNumber }); 132 positions.push({ line: mapping.lineNumber, column: mapping.colum nNumber });
133 currentBlackboxed = !currentBlackboxed; 133 currentBlackboxed = !currentBlackboxed;
134 } 134 }
135 isBlackboxed = currentBlackboxed || isBlackboxed; 135 isBlackboxed = currentBlackboxed || isBlackboxed;
136 } 136 }
137 return this._setScriptState(script, !isBlackboxed ? [] : positions).then (this._sourceMapLoadedForTest); 137 return this._setScriptState(script, !isBlackboxed ? [] : positions);
138 /** 138 /**
139 * @param {!WebInspector.SourceMap.Entry} a 139 * @param {!WebInspector.SourceMap.Entry} a
140 * @param {!WebInspector.SourceMap.Entry} b 140 * @param {!WebInspector.SourceMap.Entry} b
141 * @return {number} 141 * @return {number}
142 */ 142 */
143 function mappingComparator(a, b) 143 function mappingComparator(a, b)
144 { 144 {
145 if (a.lineNumber !== b.lineNumber) 145 if (a.lineNumber !== b.lineNumber)
146 return a.lineNumber - b.lineNumber; 146 return a.lineNumber - b.lineNumber;
147 return a.columnNumber - b.columnNumber; 147 return a.columnNumber - b.columnNumber;
148 } 148 }
149 }, 149 },
150 150
151 _sourceMapLoadedForTest: function()
152 {
153 // This method is sniffed in tests.
154 },
155
156 /** 151 /**
157 * @param {!WebInspector.UISourceCode} uiSourceCode 152 * @param {!WebInspector.UISourceCode} uiSourceCode
158 * @return {?string} 153 * @return {?string}
159 */ 154 */
160 _uiSourceCodeURL: function(uiSourceCode) 155 _uiSourceCodeURL: function(uiSourceCode)
161 { 156 {
162 var networkURL = this._networkMapping.networkURL(uiSourceCode); 157 var networkURL = this._networkMapping.networkURL(uiSourceCode);
163 var projectType = uiSourceCode.project().type(); 158 var projectType = uiSourceCode.project().type();
164 if (projectType === WebInspector.projectTypes.Debugger) 159 if (projectType === WebInspector.projectTypes.Debugger)
165 return null; 160 return null;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 this._isBlackboxedURLCache.clear(); 256 this._isBlackboxedURLCache.clear();
262 257
263 var promises = []; 258 var promises = [];
264 for (var debuggerModel of WebInspector.DebuggerModel.instances()) { 259 for (var debuggerModel of WebInspector.DebuggerModel.instances()) {
265 for (var scriptId in debuggerModel.scripts) { 260 for (var scriptId in debuggerModel.scripts) {
266 var script = debuggerModel.scripts[scriptId]; 261 var script = debuggerModel.scripts[scriptId];
267 promises.push(this._addScript(script) 262 promises.push(this._addScript(script)
268 .then(loadSourceMap.bind(this, script))); 263 .then(loadSourceMap.bind(this, script)));
269 } 264 }
270 } 265 }
271 Promise.all(promises).then(this._patternChangeFinishedForTests); 266 Promise.all(promises).then(this._patternChangeFinishedForTests.bind(this ));
272 267
273 /** 268 /**
274 * @param {!WebInspector.Script} script 269 * @param {!WebInspector.Script} script
275 * @return {!Promise<undefined>} 270 * @return {!Promise<undefined>}
276 * @this {WebInspector.BlackboxManager} 271 * @this {WebInspector.BlackboxManager}
277 */ 272 */
278 function loadSourceMap(script) 273 function loadSourceMap(script)
279 { 274 {
280 return this.sourceMapLoaded(script, this._debuggerWorkspaceBinding.s ourceMapForScript(script)); 275 return this.sourceMapLoaded(script, this._debuggerWorkspaceBinding.s ourceMapForScript(script));
281 } 276 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (scheme === "chrome-extension") 411 if (scheme === "chrome-extension")
417 prefix += parsedURL.host + "\\b"; 412 prefix += parsedURL.host + "\\b";
418 prefix += ".*"; 413 prefix += ".*";
419 } 414 }
420 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b"); 415 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b");
421 } 416 }
422 } 417 }
423 418
424 /** @type {!WebInspector.BlackboxManager} */ 419 /** @type {!WebInspector.BlackboxManager} */
425 WebInspector.blackboxManager; 420 WebInspector.blackboxManager;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698