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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 /** | 26 /** |
27 * @implements {Common.ContentProvider} | 27 * @implements {Common.ContentProvider} |
28 * @unrestricted | 28 * @unrestricted |
29 */ | 29 */ |
30 SDK.Script = class extends SDK.SDKObject { | 30 SDK.Script = class { |
31 /** | 31 /** |
32 * @param {!SDK.DebuggerModel} debuggerModel | 32 * @param {!SDK.DebuggerModel} debuggerModel |
33 * @param {string} scriptId | 33 * @param {string} scriptId |
34 * @param {string} sourceURL | 34 * @param {string} sourceURL |
35 * @param {number} startLine | 35 * @param {number} startLine |
36 * @param {number} startColumn | 36 * @param {number} startColumn |
37 * @param {number} endLine | 37 * @param {number} endLine |
38 * @param {number} endColumn | 38 * @param {number} endColumn |
39 * @param {!Protocol.Runtime.ExecutionContextId} executionContextId | 39 * @param {!Protocol.Runtime.ExecutionContextId} executionContextId |
40 * @param {string} hash | 40 * @param {string} hash |
41 * @param {boolean} isContentScript | 41 * @param {boolean} isContentScript |
42 * @param {boolean} isLiveEdit | 42 * @param {boolean} isLiveEdit |
43 * @param {string=} sourceMapURL | 43 * @param {string=} sourceMapURL |
44 * @param {boolean=} hasSourceURL | 44 * @param {boolean=} hasSourceURL |
45 */ | 45 */ |
46 constructor( | 46 constructor( |
47 debuggerModel, | 47 debuggerModel, |
48 scriptId, | 48 scriptId, |
49 sourceURL, | 49 sourceURL, |
50 startLine, | 50 startLine, |
51 startColumn, | 51 startColumn, |
52 endLine, | 52 endLine, |
53 endColumn, | 53 endColumn, |
54 executionContextId, | 54 executionContextId, |
55 hash, | 55 hash, |
56 isContentScript, | 56 isContentScript, |
57 isLiveEdit, | 57 isLiveEdit, |
58 sourceMapURL, | 58 sourceMapURL, |
59 hasSourceURL) { | 59 hasSourceURL) { |
60 super(debuggerModel.target()); | |
61 this.debuggerModel = debuggerModel; | 60 this.debuggerModel = debuggerModel; |
62 this.scriptId = scriptId; | 61 this.scriptId = scriptId; |
63 this.sourceURL = sourceURL; | 62 this.sourceURL = sourceURL; |
64 this.lineOffset = startLine; | 63 this.lineOffset = startLine; |
65 this.columnOffset = startColumn; | 64 this.columnOffset = startColumn; |
66 this.endLine = endLine; | 65 this.endLine = endLine; |
67 this.endColumn = endColumn; | 66 this.endColumn = endColumn; |
| 67 |
68 this._executionContextId = executionContextId; | 68 this._executionContextId = executionContextId; |
69 this.hash = hash; | 69 this.hash = hash; |
70 this._isContentScript = isContentScript; | 70 this._isContentScript = isContentScript; |
71 this._isLiveEdit = isLiveEdit; | 71 this._isLiveEdit = isLiveEdit; |
72 this.sourceMapURL = sourceMapURL; | 72 this.sourceMapURL = sourceMapURL; |
73 this.hasSourceURL = hasSourceURL; | 73 this.hasSourceURL = hasSourceURL; |
74 } | 74 } |
75 | 75 |
76 /** | 76 /** |
77 * @param {string} source | 77 * @param {string} source |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return; | 115 return; |
116 var text = Common.UIString( | 116 var text = Common.UIString( |
117 '\'//@ sourceURL\' and \'//@ sourceMappingURL\' are deprecated, please u
se \'//# sourceURL=\' and \'//# sourceMappingURL=\' instead.'); | 117 '\'//@ sourceURL\' and \'//@ sourceMappingURL\' are deprecated, please u
se \'//# sourceURL=\' and \'//# sourceMappingURL=\' instead.'); |
118 var msg = new SDK.ConsoleMessage( | 118 var msg = new SDK.ConsoleMessage( |
119 script.target(), SDK.ConsoleMessage.MessageSource.JS, SDK.ConsoleMessage
.MessageLevel.Warning, text, undefined, | 119 script.target(), SDK.ConsoleMessage.MessageSource.JS, SDK.ConsoleMessage
.MessageLevel.Warning, text, undefined, |
120 undefined, undefined, undefined, undefined, undefined, undefined, undefi
ned, undefined, script.scriptId); | 120 undefined, undefined, undefined, undefined, undefined, undefined, undefi
ned, undefined, script.scriptId); |
121 consoleModel.addMessage(msg); | 121 consoleModel.addMessage(msg); |
122 } | 122 } |
123 | 123 |
124 /** | 124 /** |
| 125 * @return {!SDK.Target} |
| 126 */ |
| 127 target() { |
| 128 return this.debuggerModel.target(); |
| 129 } |
| 130 |
| 131 /** |
125 * @return {boolean} | 132 * @return {boolean} |
126 */ | 133 */ |
127 isContentScript() { | 134 isContentScript() { |
128 return this._isContentScript; | 135 return this._isContentScript; |
129 } | 136 } |
130 | 137 |
131 /** | 138 /** |
132 * @return {?SDK.ExecutionContext} | 139 * @return {?SDK.ExecutionContext} |
133 */ | 140 */ |
134 executionContext() { | 141 executionContext() { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 function callback(error) { | 334 function callback(error) { |
328 if (error) | 335 if (error) |
329 console.error(error); | 336 console.error(error); |
330 fulfill(!error); | 337 fulfill(!error); |
331 } | 338 } |
332 } | 339 } |
333 } | 340 } |
334 }; | 341 }; |
335 | 342 |
336 SDK.Script.sourceURLRegex = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m; | 343 SDK.Script.sourceURLRegex = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m; |
OLD | NEW |