Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js

Issue 1653053002: Devtools: parse variables scopes and sourcemap them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 InjectedScript.CallFrameProxy.prototype = { 1526 InjectedScript.CallFrameProxy.prototype = {
1527 /** 1527 /**
1528 * @param {!JavaScriptCallFrame} callFrame 1528 * @param {!JavaScriptCallFrame} callFrame
1529 * @return {!Array.<!DebuggerAgent.Scope>} 1529 * @return {!Array.<!DebuggerAgent.Scope>}
1530 */ 1530 */
1531 _wrapScopeChain: function(callFrame) 1531 _wrapScopeChain: function(callFrame)
1532 { 1532 {
1533 var scopeChain = callFrame.scopeChain; 1533 var scopeChain = callFrame.scopeChain;
1534 var scopeChainProxy = []; 1534 var scopeChainProxy = [];
1535 for (var i = 0; i < scopeChain.length; ++i) 1535 for (var i = 0; i < scopeChain.length; ++i)
1536 scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson( callFrame.scopeType(i), callFrame.scopeName(i), scopeChain[i], "backtrace"); 1536 scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson( callFrame.scopeType(i), callFrame.scopeName(i), scopeChain[i], "backtrace", call Frame.scopeStartLocation(i), callFrame.scopeEndLocation(i) );
1537 return scopeChainProxy; 1537 return scopeChainProxy;
1538 }, 1538 },
1539 1539
1540 __proto__: null 1540 __proto__: null
1541 } 1541 }
1542 1542
1543 /** 1543 /**
1544 * @const 1544 * @const
1545 * @type {!Object.<number, !DebuggerAgent.ScopeType>} 1545 * @type {!Object.<number, !DebuggerAgent.ScopeType>}
1546 */ 1546 */
1547 InjectedScript.CallFrameProxy._scopeTypeNames = { 1547 InjectedScript.CallFrameProxy._scopeTypeNames = {
1548 0: "global", 1548 0: "global",
1549 1: "local", 1549 1: "local",
1550 2: "with", 1550 2: "with",
1551 3: "closure", 1551 3: "closure",
1552 4: "catch", 1552 4: "catch",
1553 5: "block", 1553 5: "block",
1554 6: "script", 1554 6: "script",
1555 __proto__: null 1555 __proto__: null
1556 }; 1556 };
1557 1557
1558 /** 1558 /**
1559 * @param {number} scopeTypeCode 1559 * @param {number} scopeTypeCode
1560 * @param {string} scopeName 1560 * @param {string} scopeName
1561 * @param {*} scopeObject 1561 * @param {*} scopeObject
1562 * @param {string} groupId 1562 * @param {string} groupId
1563 * @param {?DebuggerAgent.Location=} startLocation
1564 * @param {?DebuggerAgent.Location=} endLocation
1563 * @return {!DebuggerAgent.Scope} 1565 * @return {!DebuggerAgent.Scope}
1564 */ 1566 */
1565 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeNa me, scopeObject, groupId) 1567 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeNa me, scopeObject, groupId, startLocation, endLocation)
1566 { 1568 {
1567 var scope = { 1569 var scope = {
1568 object: injectedScript._wrapObject(scopeObject, groupId), 1570 object: injectedScript._wrapObject(scopeObject, groupId),
1569 type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode], 1571 type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode],
1570 __proto__: null 1572 __proto__: null
1571 }; 1573 };
1572 if (scopeName) 1574 if (scopeName)
1573 scope.name = scopeName; 1575 scope.name = scopeName;
1576
1577 if (startLocation)
1578 scope.startLocation = startLocation;
1579 if (endLocation)
1580 scope.endLocation = endLocation;
1581
1574 return scope; 1582 return scope;
1575 } 1583 }
1576 1584
1577 /** 1585 /**
1578 * @constructor 1586 * @constructor
1579 * @param {!CommandLineAPIImpl} commandLineAPIImpl 1587 * @param {!CommandLineAPIImpl} commandLineAPIImpl
1580 * @param {?JavaScriptCallFrame} callFrame 1588 * @param {?JavaScriptCallFrame} callFrame
1581 */ 1589 */
1582 function CommandLineAPI(commandLineAPIImpl, callFrame) 1590 function CommandLineAPI(commandLineAPIImpl, callFrame)
1583 { 1591 {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 */ 1934 */
1927 _logEvent: function(event) 1935 _logEvent: function(event)
1928 { 1936 {
1929 inspectedGlobalObject.console.log(event.type, event); 1937 inspectedGlobalObject.console.log(event.type, event);
1930 } 1938 }
1931 } 1939 }
1932 1940
1933 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1941 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1934 return injectedScript; 1942 return injectedScript;
1935 }) 1943 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698