| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 }, | 98 }, |
| 99 | 99 |
| 100 nameOrSourceURL: function() | 100 nameOrSourceURL: function() |
| 101 { | 101 { |
| 102 return this.url; | 102 return this.url; |
| 103 } | 103 } |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 DartDebug.FrameMirror = function(callFrame) | 106 DartDebug.FrameMirror = function(callFrame) |
| 107 { | 107 { |
| 108 this._callFrame = callFrame; |
| 108 this._functionName = callFrame.functionName; | 109 this._functionName = callFrame.functionName; |
| 109 this._scriptId = DartDebug.scriptURLToScriptId[callFrame.scriptURL]; | 110 this._scriptId = DartDebug.scriptURLToScriptId[callFrame.scriptURL]; |
| 110 this._lineNumber = callFrame.lineNumber; | 111 this._lineNumber = callFrame.lineNumber; |
| 112 this._columnNumber = callFrame.columnNumber; |
| 111 this._localScope = new DartDebug.ScopeMirror(callFrame.localScopeProxy, Scop
eType.Local); | 113 this._localScope = new DartDebug.ScopeMirror(callFrame.localScopeProxy, Scop
eType.Local); |
| 112 this._globalScope = new DartDebug.ScopeMirror(callFrame.libraryProxy, ScopeT
ype.Global); | 114 this._globalScope = new DartDebug.ScopeMirror(callFrame.libraryProxy, ScopeT
ype.Global); |
| 113 | 115 |
| 114 this._scopes = [this._localScope, this._globalScope]; | 116 this._scopes = [this._localScope, this._globalScope]; |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 DartDebug.FrameMirror.prototype = { | 119 DartDebug.FrameMirror.prototype = { |
| 118 func: function() | 120 func: function() |
| 119 { | 121 { |
| 120 var self = this; | 122 var self = this; |
| 121 return { | 123 return { |
| 122 name: function() { return self._functionName; }, | 124 name: function() { return self._functionName; }, |
| 123 inferredName: function() { return self._functionName; }, | 125 inferredName: function() { return self._functionName; }, |
| 124 script: function() { return { id: function() { return self._scriptId
; } }; } | 126 script: function() { return { id: function() { return self._scriptId
; } }; } |
| 125 }; | 127 }; |
| 126 }, | 128 }, |
| 127 | 129 |
| 128 sourceLocation: function() | 130 sourceLocation: function() |
| 129 { | 131 { |
| 130 return { line: this._lineNumber, column: 0 }; | 132 return { line: this._lineNumber, column: this._columnNumber }; |
| 131 }, | 133 }, |
| 132 | 134 |
| 133 scopeCount: function() | 135 scopeCount: function() |
| 134 { | 136 { |
| 135 return this._scopes.length; | 137 return this._scopes.length; |
| 136 }, | 138 }, |
| 137 | 139 |
| 138 scope: function(index) | 140 scope: function(index) |
| 139 { | 141 { |
| 140 return this._scopes[index]; | 142 return this._scopes[index]; |
| 141 }, | 143 }, |
| 142 | 144 |
| 143 evaluate: function(expression, disableBreak) | 145 evaluate: function(expression, disableBreak) |
| 144 { | 146 { |
| 145 // FIXME: Dart VM doesn't currently support evaluations. Use | 147 // FIXME: Dart VM doesn't currently support evaluations. Use |
| 146 // JavaScript eval and 'with' statement to emulate evaluation on Dart | 148 // JavaScript eval and 'with' statement to emulate evaluation on Dart |
| 147 // call frame. | 149 // call frame. |
| 148 | 150 |
| 149 // FIXME: dartbug.com/10434 find a less fragile way to determine whether | 151 // FIXME: dartbug.com/10434 find a less fragile way to determine whether |
| 150 // we need to strip off console API support added by InjectedScript. | 152 // we need to strip off console API support added by InjectedScript. |
| 151 var CONSOLE_API_SUPPORT_HEADER = | 153 var CONSOLE_API_SUPPORT_HEADER = |
| 152 'with ((this && this.console && this.console._commandLineAPI) || {})
{\n'; | 154 'with ((this && this.console && this.console._commandLineAPI) || {})
{\n'; |
| 153 if (expression.indexOf(CONSOLE_API_SUPPORT_HEADER) == 0) { | 155 if (expression.indexOf(CONSOLE_API_SUPPORT_HEADER) == 0) { |
| 154 expression = expression.substr(expression.indexOf('\n') + 1); | 156 expression = expression.substr(expression.indexOf('\n') + 1); |
| 155 expression = expression.substr(0, expression.lastIndexOf('\n')); | 157 expression = expression.substr(0, expression.lastIndexOf('\n')); |
| 156 } | 158 } |
| 157 | 159 |
| 158 var result = DartDebug.nativeCallbacks.evaluateInScope(expression, this.
_localScope.receiver(), | 160 var result = DartDebug.nativeCallbacks.invocationTrampoline( |
| 159 this._globalScope._object, this._localScope._object); | 161 DartDebug.nativeCallbacks.evaluateInScope, |
| 162 [expression, this._localScope.receiver(), this._callFrame.functionPr
oxy, this._callFrame.localVariables]); |
| 160 return { value: function() { return result; } }; | 163 return { value: function() { return result; } }; |
| 161 }, | 164 }, |
| 162 | 165 |
| 163 get details_() | 166 get details_() |
| 164 { | 167 { |
| 165 var receiver = this._localScope.receiver(); | 168 var receiver = this._localScope.receiver(); |
| 166 return { receiver: function() { return receiver; } }; | 169 return { receiver: function() { return receiver; } }; |
| 167 } | 170 } |
| 168 }; | 171 }; |
| 169 | 172 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 400 |
| 398 Debug.clearBreakOnUncaughtException = function() | 401 Debug.clearBreakOnUncaughtException = function() |
| 399 { | 402 { |
| 400 originals.clearBreakOnUncaughtException.apply(Debug); | 403 originals.clearBreakOnUncaughtException.apply(Debug); |
| 401 DartDebug.updateExceptionPauseInfo(); | 404 DartDebug.updateExceptionPauseInfo(); |
| 402 } | 405 } |
| 403 | 406 |
| 404 return DartDebug; | 407 return DartDebug; |
| 405 | 408 |
| 406 })() | 409 })() |
| OLD | NEW |