-
Notifications
You must be signed in to change notification settings - Fork 81
Support using scope in evaluateInFrame #2122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
annagrin
merged 16 commits into
dart-lang:master
from
annagrin:annagrin/eval-and-browse-performance
Jun 2, 2023
Merged
Support using scope in evaluateInFrame #2122
annagrin
merged 16 commits into
dart-lang:master
from
annagrin:annagrin/eval-and-browse-performance
Jun 2, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elliette
reviewed
May 31, 2023
elliette
reviewed
May 31, 2023
elliette
reviewed
May 31, 2023
elliette
reviewed
May 31, 2023
elliette
reviewed
May 31, 2023
elliette
reviewed
May 31, 2023
…al-and-browse-performance
elliette
reviewed
Jun 1, 2023
elliette
reviewed
Jun 1, 2023
nshahan
reviewed
Jun 1, 2023
elliette
approved these changes
Jun 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple comments
jacob314
reviewed
Jun 1, 2023
jacob314
approved these changes
Jun 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nshahan
approved these changes
Jun 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support using scope in
evaluateInFrame
to allow DevTools eval-and-browse feature to work on web platform: flutter/devtools#4962Previously, to implement
VmService.evaluateInFrame
, we usedRuntime.evaluateOnCallFrame
chrome remote debugging API to evaluate the dart expression compiled to JS. Unfortunately, this API does not allow passing additional scope, so we did not support passing additional scope forvm_service.evaluateInFrame
on web platform. This worked well until the need for passing additional scope to expression evaluation surfaced in eval-and-browse feature in dart DevTools.This change supports passing scope to
VmService.evaluateInFrame
by:ExpressionEvaluator.evaluateExpressionInFrame
.JsBuilder
for efficient JS code building.JsBuilder
in expression evaluator to create JS expressions to pass to chrome DevTools API.evaluateExpressionInFrame
:WipCallFrame
object.Runtime.callFunctionOn
API, with scope variables passed as arguments.this
parameter specially by using JSbind()
.Details
For example, to evaluate a dart expression
in a dart scope that defines
a
andthis
, and additional scopex, y
, wecompile dart function
to JavaScript function
jsFunc
using the expression compiler (i.e. frontend server or expression compiler worker).
create JavaScript wrapper function,
jsWrapperFunc
, defined ascollect scope variable object IDs for total scope (frame scope from
WipCallFrame
object + additional scope)call
jsWrapperFunc
usingRuntime.callFunctionOn
chrome API with scope variable object IDs passed as arguments.Closes: #1344
Towards: flutter/devtools#4962