| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (eventData.script().data() === "injected-script") | 264 if (eventData.script().data() === "injected-script") |
| 265 return; | 265 return; |
| 266 eventData.script().setSource(source); | 266 eventData.script().setSource(source); |
| 267 } | 267 } |
| 268 | 268 |
| 269 DebuggerScript.getScriptName = function(eventData) | 269 DebuggerScript.getScriptName = function(eventData) |
| 270 { | 270 { |
| 271 return eventData.script().script_.nameOrSourceURL(); | 271 return eventData.script().script_.nameOrSourceURL(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // Matched enum in V8 objects.hs |
| 275 DebuggerScript.ScriptCompilationType = { |
| 276 Host: 0, |
| 277 Eval: 1, |
| 278 JSON: 2 |
| 279 }; |
| 280 |
| 281 DebuggerScript._getScriptCompilationTypeInfo = function(script) { |
| 282 var result = ""; |
| 283 var fromScript = script.evalFromScript(); |
| 284 if (script.compilationType() == DebuggerScript.ScriptCompilationType.Eval &&
fromScript) { |
| 285 result += 'eval from '; |
| 286 if (fromScript.compilationType() == DebuggerScript.ScriptCompilationType
.Eval) { |
| 287 result += DebuggerScript._getScriptCompilationTypeInfo(fromScript); |
| 288 } else { |
| 289 var name = fromScript.name(); |
| 290 if (name) { |
| 291 var location = script.evalFromLocation(); |
| 292 result += name + (location ? ':' + (location.line + 1) + ':' + (
location.column + 1) : ''); |
| 293 } else { |
| 294 result += '(unknown source)'; |
| 295 } |
| 296 } |
| 297 return result; |
| 298 } else if (script.compilationType() == Debug.ScriptCompilationType.JSON) { |
| 299 result += 'JSON '; |
| 300 } else { // script.compilation == Debug.ScriptCompilationType.Host |
| 301 result += '[unnamed] '; |
| 302 } |
| 303 return result || 'Failed to extract info'; |
| 304 } |
| 305 |
| 306 DebuggerScript.getScriptCompilationTypeInfo = function(eventData) |
| 307 { |
| 308 try { |
| 309 var script = eventData.script(); |
| 310 return DebuggerScript._getScriptCompilationTypeInfo(script); |
| 311 } catch (exc) { |
| 312 return exc + ''; |
| 313 } |
| 314 } |
| 315 |
| 274 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) | 316 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) |
| 275 { | 317 { |
| 276 // Get function name. | 318 // Get function name. |
| 277 var func; | 319 var func; |
| 278 try { | 320 try { |
| 279 func = frameMirror.func(); | 321 func = frameMirror.func(); |
| 280 } catch(e) { | 322 } catch(e) { |
| 281 } | 323 } |
| 282 var functionName; | 324 var functionName; |
| 283 if (func) | 325 if (func) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 break; | 401 break; |
| 360 case ScopeType.Block: | 402 case ScopeType.Block: |
| 361 // Unsupported yet. Mustn't be reachable. | 403 // Unsupported yet. Mustn't be reachable. |
| 362 break; | 404 break; |
| 363 } | 405 } |
| 364 return scopeObject; | 406 return scopeObject; |
| 365 } | 407 } |
| 366 | 408 |
| 367 return DebuggerScript; | 409 return DebuggerScript; |
| 368 })(); | 410 })(); |
| OLD | NEW |