| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * @override | 83 * @override |
| 84 * @param {!Workspace.UISourceCode} uiSourceCode | 84 * @param {!Workspace.UISourceCode} uiSourceCode |
| 85 * @param {number} lineNumber | 85 * @param {number} lineNumber |
| 86 * @param {number} columnNumber | 86 * @param {number} columnNumber |
| 87 * @return {?SDK.DebuggerModel.Location} | 87 * @return {?SDK.DebuggerModel.Location} |
| 88 */ | 88 */ |
| 89 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { | 89 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { |
| 90 var script = uiSourceCode[Bindings.DefaultScriptMapping._scriptSymbol]; | 90 var script = uiSourceCode[Bindings.DefaultScriptMapping._scriptSymbol]; |
| 91 if (!script) |
| 92 return null; |
| 91 if (script.isInlineScriptWithSourceURL()) { | 93 if (script.isInlineScriptWithSourceURL()) { |
| 92 return this._debuggerModel.createRawLocation( | 94 return this._debuggerModel.createRawLocation( |
| 93 script, lineNumber + script.lineOffset, lineNumber ? columnNumber : co
lumnNumber + script.columnOffset); | 95 script, lineNumber + script.lineOffset, lineNumber ? columnNumber : co
lumnNumber + script.columnOffset); |
| 94 } | 96 } |
| 95 return this._debuggerModel.createRawLocation(script, lineNumber, columnNumbe
r); | 97 return this._debuggerModel.createRawLocation(script, lineNumber, columnNumbe
r); |
| 96 } | 98 } |
| 97 | 99 |
| 98 /** | 100 /** |
| 99 * @param {!SDK.Script} script | 101 * @param {!SDK.Script} script |
| 100 */ | 102 */ |
| 101 addScript(script) { | 103 addScript(script) { |
| 102 var name = Common.ParsedURL.extractName(script.sourceURL); | 104 var name = Common.ParsedURL.extractName(script.sourceURL); |
| 103 var url = 'debugger:///VM' + script.scriptId + (name ? ' ' + name : ''); | 105 var url = 'debugger:///VM' + script.scriptId + (name ? ' ' + name : ''); |
| 104 | 106 |
| 105 var uiSourceCode = this._project.createUISourceCode(url, Common.resourceType
s.Script); | 107 var uiSourceCode = this._project.createUISourceCode(url, Common.resourceType
s.Script); |
| 106 uiSourceCode[Bindings.DefaultScriptMapping._scriptSymbol] = script; | 108 uiSourceCode[Bindings.DefaultScriptMapping._scriptSymbol] = script; |
| 107 script[Bindings.DefaultScriptMapping._uiSourceCodeSymbol] = uiSourceCode; | 109 script[Bindings.DefaultScriptMapping._uiSourceCodeSymbol] = uiSourceCode; |
| 108 this._project.addUISourceCodeWithProvider(uiSourceCode, script, null, 'text/
javascript'); | 110 this._project.addUISourceCodeWithProvider(uiSourceCode, script, null, 'text/
javascript'); |
| 109 | 111 this._debuggerWorkspaceBinding.updateLocations(script); |
| 110 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSourc
eCode, this); | |
| 111 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); | |
| 112 } | 112 } |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * @param {!SDK.Script} script | 115 * @param {!SDK.Script} script |
| 116 */ | 116 */ |
| 117 removeScript(script) { | 117 removeScript(script) { |
| 118 var uiSourceCode = script[Bindings.DefaultScriptMapping._uiSourceCodeSymbol]
; | 118 var uiSourceCode = script[Bindings.DefaultScriptMapping._uiSourceCodeSymbol]
; |
| 119 if (!uiSourceCode) | 119 if (!uiSourceCode) |
| 120 return; | 120 return; |
| 121 delete script[Bindings.DefaultScriptMapping._uiSourceCodeSymbol]; | 121 delete script[Bindings.DefaultScriptMapping._uiSourceCodeSymbol]; |
| 122 delete uiSourceCode[Bindings.DefaultScriptMapping._scriptSymbol]; | 122 delete uiSourceCode[Bindings.DefaultScriptMapping._scriptSymbol]; |
| 123 this._project.removeUISourceCode(uiSourceCode.url()); | 123 this._project.removeUISourceCode(uiSourceCode.url()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 /** | |
| 127 * @override | |
| 128 * @return {boolean} | |
| 129 */ | |
| 130 isIdentity() { | |
| 131 return true; | |
| 132 } | |
| 133 | |
| 134 /** | |
| 135 * @override | |
| 136 * @param {!Workspace.UISourceCode} uiSourceCode | |
| 137 * @param {number} lineNumber | |
| 138 * @return {boolean} | |
| 139 */ | |
| 140 uiLineHasMapping(uiSourceCode, lineNumber) { | |
| 141 return true; | |
| 142 } | |
| 143 | |
| 144 _debuggerReset() { | 126 _debuggerReset() { |
| 145 this._project.reset(); | 127 this._project.reset(); |
| 146 } | 128 } |
| 147 | 129 |
| 148 dispose() { | 130 dispose() { |
| 149 Common.EventTarget.removeEventListeners(this._eventListeners); | 131 Common.EventTarget.removeEventListeners(this._eventListeners); |
| 150 this._debuggerReset(); | 132 this._debuggerReset(); |
| 151 this._project.dispose(); | 133 this._project.dispose(); |
| 152 } | 134 } |
| 153 }; | 135 }; |
| 154 | 136 |
| 155 Bindings.DefaultScriptMapping._scriptSymbol = Symbol('symbol'); | 137 Bindings.DefaultScriptMapping._scriptSymbol = Symbol('symbol'); |
| 156 Bindings.DefaultScriptMapping._uiSourceCodeSymbol = Symbol('uiSourceCodeSymbol')
; | 138 Bindings.DefaultScriptMapping._uiSourceCodeSymbol = Symbol('uiSourceCodeSymbol')
; |
| OLD | NEW |