OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 var scopeChainProxy = []; | 1422 var scopeChainProxy = []; |
1423 for (var i = 0; i < scopeChain.length; ++i) | 1423 for (var i = 0; i < scopeChain.length; ++i) |
1424 scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(
callFrame.scopeType(i), scopeChain[i], "backtrace"); | 1424 scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(
callFrame.scopeType(i), scopeChain[i], "backtrace"); |
1425 return scopeChainProxy; | 1425 return scopeChainProxy; |
1426 }, | 1426 }, |
1427 | 1427 |
1428 __proto__: null | 1428 __proto__: null |
1429 } | 1429 } |
1430 | 1430 |
1431 /** | 1431 /** |
| 1432 * @const |
| 1433 * @type {!Object.<number, !DebuggerAgent.ScopeType>} |
| 1434 */ |
| 1435 InjectedScript.CallFrameProxy._scopeTypeNames = { |
| 1436 0: "global", |
| 1437 1: "local", |
| 1438 2: "with", |
| 1439 3: "closure", |
| 1440 4: "catch", |
| 1441 5: "block", |
| 1442 6: "script", |
| 1443 __proto__: null |
| 1444 }; |
| 1445 |
| 1446 /** |
1432 * @param {number} scopeTypeCode | 1447 * @param {number} scopeTypeCode |
1433 * @param {*} scopeObject | 1448 * @param {*} scopeObject |
1434 * @param {string} groupId | 1449 * @param {string} groupId |
1435 * @return {!DebuggerAgent.Scope} | 1450 * @return {!DebuggerAgent.Scope} |
1436 */ | 1451 */ |
1437 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeOb
ject, groupId) | 1452 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeOb
ject, groupId) |
1438 { | 1453 { |
1439 const GLOBAL_SCOPE = 0; | |
1440 const LOCAL_SCOPE = 1; | |
1441 const WITH_SCOPE = 2; | |
1442 const CLOSURE_SCOPE = 3; | |
1443 const CATCH_SCOPE = 4; | |
1444 | |
1445 /** @type {!Object.<number, string>} */ | |
1446 var scopeTypeNames = { __proto__: null }; | |
1447 scopeTypeNames[GLOBAL_SCOPE] = "global"; | |
1448 scopeTypeNames[LOCAL_SCOPE] = "local"; | |
1449 scopeTypeNames[WITH_SCOPE] = "with"; | |
1450 scopeTypeNames[CLOSURE_SCOPE] = "closure"; | |
1451 scopeTypeNames[CATCH_SCOPE] = "catch"; | |
1452 | |
1453 return { | 1454 return { |
1454 object: injectedScript._wrapObject(scopeObject, groupId), | 1455 object: injectedScript._wrapObject(scopeObject, groupId), |
1455 type: /** @type {!DebuggerAgent.ScopeType} */ (scopeTypeNames[scopeTypeC
ode]), | 1456 type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode], |
1456 __proto__: null | 1457 __proto__: null |
1457 }; | 1458 }; |
1458 } | 1459 } |
1459 | 1460 |
1460 /** | 1461 /** |
1461 * @constructor | 1462 * @constructor |
1462 * @param {!CommandLineAPIImpl} commandLineAPIImpl | 1463 * @param {!CommandLineAPIImpl} commandLineAPIImpl |
1463 * @param {?JavaScriptCallFrame} callFrame | 1464 * @param {?JavaScriptCallFrame} callFrame |
1464 */ | 1465 */ |
1465 function CommandLineAPI(commandLineAPIImpl, callFrame) | 1466 function CommandLineAPI(commandLineAPIImpl, callFrame) |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 */ | 1807 */ |
1807 _logEvent: function(event) | 1808 _logEvent: function(event) |
1808 { | 1809 { |
1809 inspectedWindow.console.log(event.type, event); | 1810 inspectedWindow.console.log(event.type, event); |
1810 } | 1811 } |
1811 } | 1812 } |
1812 | 1813 |
1813 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1814 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
1814 return injectedScript; | 1815 return injectedScript; |
1815 }) | 1816 }) |
OLD | NEW |