Skip to content
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

Fix devtools iframe backend ready bug #54805

Conversation

AleksanderBodurri
Copy link
Member

Previously, a race condition could cause DevTools to enter a state where it could not detect an application after a reload. This was caused by a sequencing issue between the content script connection, the devtools panel connection and an event "backendReady" that lets DevTools know when a particular frame is ready to be inspected.

Two commits that caused this behaviour were reverted, along with the features they implemented.

These two commits have been re-reverted, and one new commit has been introduced fixing the issue. This new commit replaces the previously stored backendReady boolean with a promise, so that the devtools panel can eventually run a callback to connect to a content script when that content script emits it's backendReady message.

Related #53953

@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch from ed9f9a2 to 96a3298 Compare March 12, 2024 05:56
@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch 2 times, most recently from d7ab4e6 to 02471b7 Compare March 12, 2024 06:16
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-for: dev-infra

@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch from 02471b7 to 8cefec5 Compare March 12, 2024 15:48
@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch from 8cefec5 to d295ae0 Compare March 13, 2024 00:13
topLevelContentScriptPort,
childContentScriptPort,
devtoolsPort,
} of eachPermutationOfDevToolsInitializing()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider: We don't strictly need to do this for every test as long as we have reasonable confidence that we're correctly handling all the initialization possibilities. It might be possible to do this only for a subset of tests and still get the same confidence. Up to you which tests that is, or if we really need to do it for all of the tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this too 🤔 I think it's fine to run this for every test case in this file since we expect this part of the code base to be pretty stable. At worst it does little harm and at best it could catch non-obvious sequencing edge cases in the future. By having it run for all (or most) of the cases in this file we're also conveying that the output state of TabManager should be identical regardless of the ordering of events that it processes

@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch 3 times, most recently from abdd5d9 to 00dc64e Compare March 15, 2024 05:22
@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch 3 times, most recently from 21e729e to 3632924 Compare March 19, 2024 17:51
… not detected error

Previously, a race condition could cause DevTools to enter a state where it can't detect an application on reload. This was caused by a sequencing issue between the content script connection, the devtools panel connection and an event "backendReady" that lets DevTools know when a particular frame is ready to be inspected.

This commit replaces the previously stored backendReady boolean with a promise, so that the devtools panel can eventually run a callback to connect to a content script when that content script emits it's backendReady message.
@AleksanderBodurri AleksanderBodurri force-pushed the fix-devtools-iframe-backend-ready-bug branch from 3632924 to 38fa6fa Compare March 25, 2024 23:07
@ngbot ngbot bot added this to the Backlog milestone Mar 26, 2024
@dgp1130 dgp1130 added the target: patch This PR is targeted for the next patch release label Mar 26, 2024
@dgp1130 dgp1130 removed the request for review from josephperrott March 26, 2024 16:08
@dgp1130 dgp1130 added the action: merge The PR is ready for merge by the caretaker label Mar 26, 2024
@dylhunn
Copy link
Contributor

dylhunn commented Mar 26, 2024

This PR was merged into the repository by commit d15dca0.

dylhunn pushed a commit that referenced this pull request Mar 26, 2024
…lar DevTools' browser code (#53934)" (#54629)" (#54805)

This reverts commit dd9f9d7.

PR Close #54805
dylhunn pushed a commit that referenced this pull request Mar 26, 2024
dylhunn pushed a commit that referenced this pull request Mar 26, 2024
… not detected error (#54805)

Previously, a race condition could cause DevTools to enter a state where it can't detect an application on reload. This was caused by a sequencing issue between the content script connection, the devtools panel connection and an event "backendReady" that lets DevTools know when a particular frame is ready to be inspected.

This commit replaces the previously stored backendReady boolean with a promise, so that the devtools panel can eventually run a callback to connect to a content script when that content script emits it's backendReady message.

PR Close #54805
@dylhunn dylhunn closed this in 15b54ce Mar 26, 2024
dylhunn pushed a commit that referenced this pull request Mar 26, 2024
dylhunn pushed a commit that referenced this pull request Mar 26, 2024
… not detected error (#54805)

Previously, a race condition could cause DevTools to enter a state where it can't detect an application on reload. This was caused by a sequencing issue between the content script connection, the devtools panel connection and an event "backendReady" that lets DevTools know when a particular frame is ready to be inspected.

This commit replaces the previously stored backendReady boolean with a promise, so that the devtools panel can eventually run a callback to connect to a content script when that content script emits it's backendReady message.

PR Close #54805
ilirbeqirii pushed a commit to ilirbeqirii/angular that referenced this pull request Apr 6, 2024
ilirbeqirii pushed a commit to ilirbeqirii/angular that referenced this pull request Apr 6, 2024
ilirbeqirii pushed a commit to ilirbeqirii/angular that referenced this pull request Apr 6, 2024
… not detected error (angular#54805)

Previously, a race condition could cause DevTools to enter a state where it can't detect an application on reload. This was caused by a sequencing issue between the content script connection, the devtools panel connection and an event "backendReady" that lets DevTools know when a particular frame is ready to be inspected.

This commit replaces the previously stored backendReady boolean with a promise, so that the devtools panel can eventually run a callback to connect to a content script when that content script emits it's backendReady message.

PR Close angular#54805
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: devtools target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants