WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
29616
Web Inspector: completions are always evaluated against window (discarding call frames)
https://bugs.webkit.org/show_bug.cgi?id=29616
Summary
Web Inspector: completions are always evaluated against window (discarding ca...
Pavel Feldman
Reported
2009-09-21 14:47:07 PDT
1. While on web inspector stop on a breakpoint 2. Type "<some-scope-var>." to see completions Expected: completions Actual: nothing The reason is that getCompletions is working against window only.
Attachments
patch
(3.85 KB, patch)
2009-09-21 15:44 PDT
,
Pavel Feldman
timothy
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Pavel Feldman
Comment 1
2009-09-21 15:44:45 PDT
Created
attachment 39889
[details]
patch
Timothy Hatcher
Comment 2
2009-09-21 15:54:11 PDT
Comment on
attachment 39889
[details]
patch
> + var callFrameId = WebInspector.panels.scripts && WebInspector.panels.scripts.paused ? WebInspector.panels.scripts.selectedCallFrameId() : null;
Thats a bit long. Maybe just have it be: if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); And it will be undefined by default for the normal case.
> + InjectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); > }, > > _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) { > diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js > index 4d96f68..726c7cc 100644 > --- a/WebCore/inspector/front-end/InjectedScript.js > +++ b/WebCore/inspector/front-end/InjectedScript.js > @@ -499,11 +499,20 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression > } > > > -InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI) > +InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI, callFrameId) > { > var props = {}; > try { > - var expressionResult = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression); > + var expressionResult; > + // Evaluate on call frame if call frame id is available. > + if (typeof callFrameId === "number") { > + var callFrame = InjectedScript._callFrameForId(callFrameId); > + if (!callFrame) > + return props; > + expressionResult = InjectedScript._evaluateOn(callFrame.evaluate, callFrame, expression); > + } else { > + expressionResult = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression); > + } > for (var prop in expressionResult) > props[prop] = true; > if (includeInspectorCommandLineAPI) > diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js > index 04f27bb..ae918d1 100644 > --- a/WebCore/inspector/front-end/ScriptsPanel.js > +++ b/WebCore/inspector/front-end/ScriptsPanel.js > @@ -351,6 +351,14 @@ WebInspector.ScriptsPanel.prototype = { > sourceFrame.removeBreakpoint(breakpoint); > }, > > + selectedCallFrameId: function() > + { > + var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; > + if (!selectedCallFrame) > + return null; > + return selectedCallFrame.id; > + }, > + > evaluateInSelectedCallFrame: function(code, updateInterface, callback) > { > var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
Pavel Feldman
Comment 3
2009-09-21 15:56:14 PDT
(In reply to
comment #2
)
> (From update of
attachment 39889
[details]
) > > > + var callFrameId = WebInspector.panels.scripts && WebInspector.panels.scripts.paused ? WebInspector.panels.scripts.selectedCallFrameId() : null; > > Thats a bit long. Maybe just have it be:
Done!
Pavel Feldman
Comment 4
2009-09-21 15:59:13 PDT
Committing to
http://svn.webkit.org/repository/webkit/trunk
... M WebCore/ChangeLog M WebCore/inspector/front-end/ConsoleView.js M WebCore/inspector/front-end/InjectedScript.js M WebCore/inspector/front-end/ScriptsPanel.js Committed
r48608
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug