OLD | NEW |
---|---|
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 17 matching lines...) Expand all Loading... | |
28 * @extends {WebInspector.SDKObject} | 28 * @extends {WebInspector.SDKObject} |
29 * @implements {WebInspector.ContentProvider} | 29 * @implements {WebInspector.ContentProvider} |
30 * @param {!WebInspector.DebuggerModel} debuggerModel | 30 * @param {!WebInspector.DebuggerModel} debuggerModel |
31 * @param {string} scriptId | 31 * @param {string} scriptId |
32 * @param {string} sourceURL | 32 * @param {string} sourceURL |
33 * @param {number} startLine | 33 * @param {number} startLine |
34 * @param {number} startColumn | 34 * @param {number} startColumn |
35 * @param {number} endLine | 35 * @param {number} endLine |
36 * @param {number} endColumn | 36 * @param {number} endColumn |
37 * @param {!RuntimeAgent.ExecutionContextId} executionContextId | 37 * @param {!RuntimeAgent.ExecutionContextId} executionContextId |
38 * @param {string} hash | |
39 * @param {boolean} isContentScript | 38 * @param {boolean} isContentScript |
40 * @param {boolean} isInternalScript | 39 * @param {boolean} isInternalScript |
41 * @param {boolean} isLiveEdit | 40 * @param {boolean} isLiveEdit |
41 * @param {string=} hash | |
42 * @param {string=} sourceMapURL | 42 * @param {string=} sourceMapURL |
43 * @param {boolean=} hasSourceURL | 43 * @param {boolean=} hasSourceURL |
44 */ | 44 */ |
45 WebInspector.Script = function(debuggerModel, scriptId, sourceURL, startLine, st artColumn, endLine, endColumn, executionContextId, hash, isContentScript, isInte rnalScript, isLiveEdit, sourceMapURL, hasSourceURL) | 45 WebInspector.Script = function(debuggerModel, scriptId, sourceURL, startLine, st artColumn, endLine, endColumn, executionContextId, isContentScript, isInternalSc ript, isLiveEdit, hash, sourceMapURL, hasSourceURL) |
46 { | 46 { |
47 WebInspector.SDKObject.call(this, debuggerModel.target()); | 47 WebInspector.SDKObject.call(this, debuggerModel.target()); |
48 this.debuggerModel = debuggerModel; | 48 this.debuggerModel = debuggerModel; |
49 this.scriptId = scriptId; | 49 this.scriptId = scriptId; |
50 this.sourceURL = sourceURL; | 50 this.sourceURL = sourceURL; |
51 this.lineOffset = startLine; | 51 this.lineOffset = startLine; |
52 this.columnOffset = startColumn; | 52 this.columnOffset = startColumn; |
53 this.endLine = endLine; | 53 this.endLine = endLine; |
54 this.endColumn = endColumn; | 54 this.endColumn = endColumn; |
55 this._executionContextId = executionContextId; | 55 this._executionContextId = executionContextId; |
56 this.hash = hash; | |
57 this._isContentScript = isContentScript; | 56 this._isContentScript = isContentScript; |
58 this._isInternalScript = isInternalScript; | 57 this._isInternalScript = isInternalScript; |
59 this._isLiveEdit = isLiveEdit; | 58 this._isLiveEdit = isLiveEdit; |
59 this._hash = hash; | |
60 this.sourceMapURL = sourceMapURL; | 60 this.sourceMapURL = sourceMapURL; |
61 this.hasSourceURL = hasSourceURL; | 61 this.hasSourceURL = hasSourceURL; |
62 } | 62 } |
63 | 63 |
64 WebInspector.Script.Events = { | 64 WebInspector.Script.Events = { |
65 ScriptEdited: "ScriptEdited", | 65 ScriptEdited: "ScriptEdited", |
66 SourceMapURLAdded: "SourceMapURLAdded" | 66 SourceMapURLAdded: "SourceMapURLAdded" |
67 } | 67 } |
68 | 68 |
69 WebInspector.Script.sourceURLRegex = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$ /m; | 69 WebInspector.Script.sourceURLRegex = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$ /m; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 */ | 291 */ |
292 isInlineScriptWithSourceURL: function() | 292 isInlineScriptWithSourceURL: function() |
293 { | 293 { |
294 return !!this.hasSourceURL && this.isInlineScript(); | 294 return !!this.hasSourceURL && this.isInlineScript(); |
295 }, | 295 }, |
296 | 296 |
297 /** | 297 /** |
298 * @param {!Array<!DebuggerAgent.ScriptPosition>} positions | 298 * @param {!Array<!DebuggerAgent.ScriptPosition>} positions |
299 * @return {!Promise<boolean>} | 299 * @return {!Promise<boolean>} |
300 */ | 300 */ |
301 setBlackboxedRanges: function(positions) | 301 addBlackboxPattern: function(positions) |
302 { | 302 { |
303 return new Promise(setBlackboxedRanges.bind(this)); | 303 return new Promise(addBlackboxPattern.bind(this)); |
304 | 304 |
305 /** | 305 /** |
306 * @param {function(?)} fulfill | 306 * @param {function(?)} fulfill |
307 * @param {function(*)} reject | 307 * @param {function(*)} reject |
308 * @this {WebInspector.Script} | 308 * @this {WebInspector.Script} |
309 */ | 309 */ |
310 function setBlackboxedRanges(fulfill, reject) | 310 function addBlackboxPattern(fulfill, reject) |
311 { | 311 { |
312 this.target().debuggerAgent().setBlackboxedRanges(this.scriptId, pos itions, callback); | 312 var pattern = this.hasSourceURL ? { url: this.sourceURL } : { hash: this._hash }; |
dgozman
2016/03/08 18:48:12
hasSourceURL is suspicious
| |
313 pattern.positions = positions; | |
314 this.target().debuggerAgent().addBlackboxPatterns([pattern], callbac k); | |
313 /** | 315 /** |
314 * @param {?Protocol.Error} error | 316 * @param {?Protocol.Error} error |
315 */ | 317 */ |
316 function callback(error) | 318 function callback(error) |
317 { | 319 { |
318 if (error) | 320 if (error) |
319 console.error(error); | 321 console.error(error); |
320 fulfill(!error); | 322 fulfill(!error); |
321 } | 323 } |
322 } | 324 } |
323 }, | 325 }, |
324 | 326 |
325 __proto__: WebInspector.SDKObject.prototype | 327 __proto__: WebInspector.SDKObject.prototype |
326 } | 328 } |
OLD | NEW |