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 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 InjectedScript.CallFrameProxy.prototype = { | 1504 InjectedScript.CallFrameProxy.prototype = { |
1505 /** | 1505 /** |
1506 * @param {!JavaScriptCallFrame} callFrame | 1506 * @param {!JavaScriptCallFrame} callFrame |
1507 * @return {!Array.<!DebuggerAgent.Scope>} | 1507 * @return {!Array.<!DebuggerAgent.Scope>} |
1508 */ | 1508 */ |
1509 _wrapScopeChain: function(callFrame) | 1509 _wrapScopeChain: function(callFrame) |
1510 { | 1510 { |
1511 var scopeChain = callFrame.scopeChain; | 1511 var scopeChain = callFrame.scopeChain; |
1512 var scopeChainProxy = []; | 1512 var scopeChainProxy = []; |
1513 for (var i = 0; i < scopeChain.length; ++i) | 1513 for (var i = 0; i < scopeChain.length; ++i) |
1514 scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(
callFrame.scopeType(i), callFrame.scopeName(i), scopeChain[i], "backtrace"); | 1514 scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(
callFrame.scopeType(i), callFrame.scopeName(i), scopeChain[i], "backtrace", call
Frame.scopeStartLocation(i), callFrame.scopeEndLocation(i) ); |
1515 return scopeChainProxy; | 1515 return scopeChainProxy; |
1516 }, | 1516 }, |
1517 | 1517 |
1518 __proto__: null | 1518 __proto__: null |
1519 } | 1519 } |
1520 | 1520 |
1521 /** | 1521 /** |
1522 * @const | 1522 * @const |
1523 * @type {!Object.<number, !DebuggerAgent.ScopeType>} | 1523 * @type {!Object.<number, !DebuggerAgent.ScopeType>} |
1524 */ | 1524 */ |
1525 InjectedScript.CallFrameProxy._scopeTypeNames = { | 1525 InjectedScript.CallFrameProxy._scopeTypeNames = { |
1526 0: "global", | 1526 0: "global", |
1527 1: "local", | 1527 1: "local", |
1528 2: "with", | 1528 2: "with", |
1529 3: "closure", | 1529 3: "closure", |
1530 4: "catch", | 1530 4: "catch", |
1531 5: "block", | 1531 5: "block", |
1532 6: "script", | 1532 6: "script", |
1533 __proto__: null | 1533 __proto__: null |
1534 }; | 1534 }; |
1535 | 1535 |
1536 /** | 1536 /** |
1537 * @param {number} scopeTypeCode | 1537 * @param {number} scopeTypeCode |
1538 * @param {string} scopeName | 1538 * @param {string} scopeName |
1539 * @param {*} scopeObject | 1539 * @param {*} scopeObject |
1540 * @param {string} groupId | 1540 * @param {string} groupId |
| 1541 * @param {?DebuggerAgent.Location=} startLocation |
| 1542 * @param {?DebuggerAgent.Location=} endLocation |
1541 * @return {!DebuggerAgent.Scope} | 1543 * @return {!DebuggerAgent.Scope} |
1542 */ | 1544 */ |
1543 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeNa
me, scopeObject, groupId) | 1545 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeNa
me, scopeObject, groupId, startLocation, endLocation) |
1544 { | 1546 { |
1545 var scope = { | 1547 var scope = { |
1546 object: injectedScript._wrapObject(scopeObject, groupId), | 1548 object: injectedScript._wrapObject(scopeObject, groupId), |
1547 type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode], | 1549 type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode], |
1548 __proto__: null | 1550 __proto__: null |
1549 }; | 1551 }; |
1550 if (scopeName) | 1552 if (scopeName) |
1551 scope.name = scopeName; | 1553 scope.name = scopeName; |
| 1554 |
| 1555 if (startLocation) |
| 1556 scope.startLocation = startLocation; |
| 1557 if (endLocation) |
| 1558 scope.endLocation = endLocation; |
| 1559 |
1552 return scope; | 1560 return scope; |
1553 } | 1561 } |
1554 | 1562 |
1555 /** | 1563 /** |
1556 * @constructor | 1564 * @constructor |
1557 * @param {!CommandLineAPIImpl} commandLineAPIImpl | 1565 * @param {!CommandLineAPIImpl} commandLineAPIImpl |
1558 * @param {?JavaScriptCallFrame} callFrame | 1566 * @param {?JavaScriptCallFrame} callFrame |
1559 */ | 1567 */ |
1560 function CommandLineAPI(commandLineAPIImpl, callFrame) | 1568 function CommandLineAPI(commandLineAPIImpl, callFrame) |
1561 { | 1569 { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 */ | 1912 */ |
1905 _logEvent: function(event) | 1913 _logEvent: function(event) |
1906 { | 1914 { |
1907 inspectedGlobalObject.console.log(event.type, event); | 1915 inspectedGlobalObject.console.log(event.type, event); |
1908 } | 1916 } |
1909 } | 1917 } |
1910 | 1918 |
1911 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1919 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
1912 return injectedScript; | 1920 return injectedScript; |
1913 }) | 1921 }) |
OLD | NEW |