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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js

Issue 2112673003: [DevTools] Move suspended generator location to internal properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionStateChanged, this); 55 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionStateChanged, this);
56 WebInspector.moduleSetting("pauseOnCaughtException").addChangeListener(this. _pauseOnExceptionStateChanged, this); 56 WebInspector.moduleSetting("pauseOnCaughtException").addChangeListener(this. _pauseOnExceptionStateChanged, this);
57 WebInspector.moduleSetting("enableAsyncStackTraces").addChangeListener(this. asyncStackTracesStateChanged, this); 57 WebInspector.moduleSetting("enableAsyncStackTraces").addChangeListener(this. asyncStackTracesStateChanged, this);
58 58
59 this.enableDebugger(); 59 this.enableDebugger();
60 } 60 }
61 61
62 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?strin g, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */ 62 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?strin g, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */
63 WebInspector.DebuggerModel.FunctionDetails; 63 WebInspector.DebuggerModel.FunctionDetails;
64 64
65 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?strin g, functionName: string, status: string}} */
66 WebInspector.DebuggerModel.GeneratorObjectDetails;
67
68 /** 65 /**
69 * Keep these in sync with WebCore::V8Debugger 66 * Keep these in sync with WebCore::V8Debugger
70 * 67 *
71 * @enum {string} 68 * @enum {string}
72 */ 69 */
73 WebInspector.DebuggerModel.PauseOnExceptionsState = { 70 WebInspector.DebuggerModel.PauseOnExceptionsState = {
74 DontPauseOnExceptions : "none", 71 DontPauseOnExceptions : "none",
75 PauseOnAllExceptions : "all", 72 PauseOnAllExceptions : "all",
76 PauseOnUncaughtExceptions: "uncaught" 73 PauseOnUncaughtExceptions: "uncaught"
77 }; 74 };
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 callback(error); 708 callback(error);
712 return; 709 return;
713 } 710 }
714 if (callback) 711 if (callback)
715 callback(); 712 callback();
716 } 713 }
717 }, 714 },
718 715
719 /** 716 /**
720 * @param {!WebInspector.RemoteObject} remoteObject 717 * @param {!WebInspector.RemoteObject} remoteObject
721 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback 718 * @return {!Promise<?WebInspector.DebuggerModel.Location>}
722 */ 719 */
723 generatorObjectDetails: function(remoteObject, callback) 720 generatorObjectLocation: function(remoteObject)
724 { 721 {
725 this._agent.getGeneratorObjectDetails(remoteObject.objectId, didGetDetai ls.bind(this)); 722 if (remoteObject.subtype !== "generator")
723 return Promise.resolve(/** @type {?WebInspector.DebuggerModel.Locati on} */(null));
724 return remoteObject.getOwnPropertiesPromise().then(requestLocation.bind( this));
726 725
727 /** 726 /**
728 * @param {?Protocol.Error} error 727 * @this {!WebInspector.DebuggerModel}
729 * @param {!DebuggerAgent.GeneratorObjectDetails} response 728 * @param {!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, in ternalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}} response
730 * @this {WebInspector.DebuggerModel} 729 * @return {!Promise<?WebInspector.DebuggerModel.Location>}
731 */ 730 */
732 function didGetDetails(error, response) 731 function requestLocation(response)
733 { 732 {
734 if (error) { 733 if (!response || !response.internalProperties)
735 console.error(error); 734 return Promise.resolve(/** @type {?WebInspector.DebuggerModel.Lo cation} */(null));
736 callback(null); 735 var generatorFunction = null;
737 return; 736 for (var prop of response.internalProperties) {
737 if (prop.name === "[[GeneratorSuspendedLocation]]") {
738 generatorFunction = null;
739 var loc = prop.value.value;
740 return Promise.resolve(this.createRawLocationByScriptId(loc. scriptId, loc.lineNumber, loc.columnNumber));
741 }
742 if (prop.name === "[[GeneratorFunction]]")
743 generatorFunction = prop.value;
738 } 744 }
739 var location = response.location; 745 if (generatorFunction)
740 var script = location && this.scriptForId(location.scriptId); 746 return generatorFunction.functionDetailsPromise().then(response => response.location);
741 var rawLocation = script ? this.createRawLocation(script, location.l ineNumber, location.columnNumber || 0) : null; 747 return Promise.resolve(/** @type {?WebInspector.DebuggerModel.Locati on} */(null));
742 var sourceURL = script ? script.contentURL() : null;
743 callback({location: rawLocation, sourceURL: sourceURL, functionName: response.functionName, status: response.status});
744 } 748 }
745 }, 749 },
746 750
747 /** 751 /**
748 * @param {!DebuggerAgent.BreakpointId} breakpointId 752 * @param {!DebuggerAgent.BreakpointId} breakpointId
749 * @param {function(!WebInspector.Event)} listener 753 * @param {function(!WebInspector.Event)} listener
750 * @param {!Object=} thisObject 754 * @param {!Object=} thisObject
751 */ 755 */
752 addBreakpointListener: function(breakpointId, listener, thisObject) 756 addBreakpointListener: function(breakpointId, listener, thisObject)
753 { 757 {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 /** 1326 /**
1323 * @param {?WebInspector.Target} target 1327 * @param {?WebInspector.Target} target
1324 * @return {?WebInspector.DebuggerModel} 1328 * @return {?WebInspector.DebuggerModel}
1325 */ 1329 */
1326 WebInspector.DebuggerModel.fromTarget = function(target) 1330 WebInspector.DebuggerModel.fromTarget = function(target)
1327 { 1331 {
1328 if (!target || !target.hasJSContext()) 1332 if (!target || !target.hasJSContext())
1329 return null; 1333 return null;
1330 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel)); 1334 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel));
1331 } 1335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698