Skip to content

fix: use BlockedRequest struct to handle webRequest data - #42647

Merged
codebytere merged 3 commits into
mainfrom
webrequest-rework
Jul 2, 2024
Merged

codebytere merged 3 commits into
mainfrom
webrequest-rework

Conversation

@codebytere

@codebytere codebytere commented Jun 25, 2024 •

Copy link
Copy Markdown
Member

Description of Change

Closes #42149.

Fixes an issue where Chromium could crash on a dangling unretained pointer in one of several webRequest functions. This was happening as a result of the fact that we had outstanding blocking requests continue to reference state owned by ProxyingWebsocket and ProxyingURLLoaderFactory after the requests were destroyed.

This had been going on for a few years, and was likely leading to some ongoing memory issues. To fix this, we need to ensure that all state is cleaned up in OnRequestWillBeDestroyed. I chose to create a new BlockedRequest struct to do so, which approximates the approach that upstream takes. The complexities of doing so also made our templated approach more trouble than it felt worth, so i pried that apart into separate handlers.

h/t @ckerr for talking lots of this through with me 🙇🏻‍♀️

Checklist

Release Notes

Notes: Fixes an issue where Chromium could crash on a dangling unretained pointer in one of several webRequest functions

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jun 25, 2024
@codebytere codebytere changed the title refactor: use BlockedRequest model to handle webRequest refactor: use BlockedRequest struct to handle webRequest data Jun 25, 2024
@codebytere codebytere added the semver/patch backwards-compatible bug fixes label Jun 25, 2024
@codebytere codebytere changed the title refactor: use BlockedRequest struct to handle webRequest data fix: use BlockedRequest struct to handle webRequest data Jun 25, 2024
@codebytere codebytere changed the title fix: use BlockedRequest struct to handle webRequest data fix: use BlockedRequest struct to handle webRequest data Jun 25, 2024
@codebytere
codebytere marked this pull request as ready for review June 25, 2024 16:23
@codebytere
codebytere requested a review from ckerr June 25, 2024 16:23
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Jun 26, 2024
@codebytere codebytere added target/31-x-y PR should also be added to the "31-x-y" branch. target/32-x-y PR should also be added to the "32-x-y" branch. labels Jun 27, 2024
@codebytere
codebytere merged commit 1729a98 into main Jul 2, 2024
@codebytere
codebytere deleted the webrequest-rework branch July 2, 2024 12:02
@release-clerk

release-clerk Bot commented Jul 2, 2024

Copy link
Copy Markdown

Release Notes Persisted

Fixes an issue where Chromium could crash on a dangling unretained pointer in one of several webRequest functions

@trop

trop Bot commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "32-x-y", please check out #42750

@trop trop Bot added in-flight/32-x-y and removed target/32-x-y PR should also be added to the "32-x-y" branch. labels Jul 2, 2024
@trop

trop Bot commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "31-x-y", please check out #42751

@trop trop Bot added in-flight/31-x-y and removed target/31-x-y PR should also be added to the "31-x-y" branch. labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/31-x-y PR was merged to the "31-x-y" branch. merged/32-x-y PR was merged to the "32-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Asynchronous onBeforeRequest handler crashes Chromium with unretained dangling ptr error for specific websites

2 participants