| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 * @param {!Array.<!Protocol.Runtime.RemoteObject>} args | 404 * @param {!Array.<!Protocol.Runtime.RemoteObject>} args |
| 405 * @param {number} executionContextId | 405 * @param {number} executionContextId |
| 406 * @param {number} timestamp | 406 * @param {number} timestamp |
| 407 * @param {!Protocol.Runtime.StackTrace=} stackTrace | 407 * @param {!Protocol.Runtime.StackTrace=} stackTrace |
| 408 */ | 408 */ |
| 409 _consoleAPICalled(type, args, executionContextId, timestamp, stackTrace) { | 409 _consoleAPICalled(type, args, executionContextId, timestamp, stackTrace) { |
| 410 var consoleAPICall = | 410 var consoleAPICall = |
| 411 {type: type, args: args, executionContextId: executionContextId, timesta
mp: timestamp, stackTrace: stackTrace}; | 411 {type: type, args: args, executionContextId: executionContextId, timesta
mp: timestamp, stackTrace: stackTrace}; |
| 412 this.dispatchEventToListeners(SDK.RuntimeModel.Events.ConsoleAPICalled, cons
oleAPICall); | 412 this.dispatchEventToListeners(SDK.RuntimeModel.Events.ConsoleAPICalled, cons
oleAPICall); |
| 413 } | 413 } |
| 414 |
| 415 /** |
| 416 * @param {!Protocol.Runtime.ScriptId} scriptId |
| 417 * @return {number} |
| 418 */ |
| 419 executionContextIdForScriptId(scriptId) { |
| 420 var script = this.debuggerModel().scriptForId(scriptId); |
| 421 return script ? script.executionContextId : 0; |
| 422 } |
| 423 |
| 424 /** |
| 425 * @param {!Protocol.Runtime.StackTrace} stackTrace |
| 426 * @return {number} |
| 427 */ |
| 428 executionContextForStackTrace(stackTrace) { |
| 429 while (stackTrace && !stackTrace.callFrames.length) |
| 430 stackTrace = stackTrace.parent; |
| 431 if (!stackTrace || !stackTrace.callFrames.length) |
| 432 return 0; |
| 433 return this.executionContextIdForScriptId(stackTrace.callFrames[0].scriptId)
; |
| 434 } |
| 414 }; | 435 }; |
| 415 | 436 |
| 416 SDK.SDKModel.register(SDK.RuntimeModel, SDK.Target.Capability.JS, true); | 437 SDK.SDKModel.register(SDK.RuntimeModel, SDK.Target.Capability.JS, true); |
| 417 | 438 |
| 418 /** @enum {symbol} */ | 439 /** @enum {symbol} */ |
| 419 SDK.RuntimeModel.Events = { | 440 SDK.RuntimeModel.Events = { |
| 420 ExecutionContextCreated: Symbol('ExecutionContextCreated'), | 441 ExecutionContextCreated: Symbol('ExecutionContextCreated'), |
| 421 ExecutionContextDestroyed: Symbol('ExecutionContextDestroyed'), | 442 ExecutionContextDestroyed: Symbol('ExecutionContextDestroyed'), |
| 422 ExecutionContextChanged: Symbol('ExecutionContextChanged'), | 443 ExecutionContextChanged: Symbol('ExecutionContextChanged'), |
| 423 ExecutionContextOrderChanged: Symbol('ExecutionContextOrderChanged'), | 444 ExecutionContextOrderChanged: Symbol('ExecutionContextOrderChanged'), |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 return; | 703 return; |
| 683 } | 704 } |
| 684 if (this.name) { | 705 if (this.name) { |
| 685 this._label = this.name; | 706 this._label = this.name; |
| 686 return; | 707 return; |
| 687 } | 708 } |
| 688 var parsedUrl = this.origin.asParsedURL(); | 709 var parsedUrl = this.origin.asParsedURL(); |
| 689 this._label = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : ''; | 710 this._label = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : ''; |
| 690 } | 711 } |
| 691 }; | 712 }; |
| OLD | NEW |