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.
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
core(global-listeners): iterate all execution contexts #15054
core(global-listeners): iterate all execution contexts #15054
Changes from 4 commits
d4fe038
84afe30
9b4c35d
3a9be89
078123a
ed67e34
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
do we need this since we only listen on the root session?
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.
Nope, just adding for later in case that ever changes. Could be easy to overlook.
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.
er, wait no this is important now. It filters out a number of execution contexts for this simple page:
coming from the iframe. comment out the iframe, and only the first execution context is present
9 is the iframe in the main document, 11 is an inframe inside
a11y_tester.html
. not sure what 13 could be, perhaps an extenstion.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.
I'm not sure why, but puppeteer is sending a context created event twice for every single one. So I had to do a check on
uniqueId
here.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.
This seems like a reasonable time to stop trying for parity wrt legacy driver. So...just giving the default EC here.
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.
I did some poking around. I think it's because we
Runtime.disable
in thestopInstrumentation
phase console messages gathererlighthouse/core/gather/gatherers/console-messages.js
Line 163 in 3ba11a8
Presumably
Runtime.enable
is called sometime in thegetArtifact
phase which re-emits the events.Regardless, de-duping on the
uniqueId
is probably the safest way to handle this.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.
Although we only want to process main frames in global listeners, I don't want that to happen via a method called just
executionContexts
because that locks in the contract that this is only main frames (which could mess with potential plugins if we ever need to expand that). Having the gatherer provide the main frame id is not possible for snapshots, so this logic is kept in target manager. Hence, an explicitmainFrameExecutionContexts
... and addingexecutionContexts
just-cuz.