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

feat: add will-frame-navigate event #34418

Merged
merged 27 commits into from Mar 28, 2023

Conversation

itsananderson
Copy link
Contributor

Description of Change

This PR adds a will-frame-navigate event to webContents. Unlike will-navigate which only fires for the mainFrame, this event fires for any frames within the webContents. Similarly, a will-frame-navigate attribute is added to the <webview> tag, which is called whenever that webview or any of its child frames attempts to navigate.

Because will-navigate and will-frame-navigate are so similar, I mostly copied the tests from will-navigate and updated them to test the correct event. I also added some additional tests for will-frame-navigate to verify the correct behavior when a subframe navigates.

Closes #7097

cc @samuelmaddock who has discussed adding this event in the past

Checklist

Release Notes

Notes: Added a will-frame-navigate event to webContents and the <webview> tag, which fires whenever any frame within the frame hierarchy attempts to navigate.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 2, 2022
@itsananderson itsananderson added the semver/minor backwards-compatible functionality label Jun 2, 2022
docs/api/web-contents.md Outdated Show resolved Hide resolved
@itsananderson itsananderson requested a review from a team as a code owner June 14, 2022 16:38
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 14, 2022
shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
docs/api/web-contents.md Outdated Show resolved Hide resolved
shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
lib/browser/guest-view-manager.ts Show resolved Hide resolved
@kevinushey
Copy link
Contributor

Is there a possibility that this PR will be reviewed / merged soon?

@itsananderson
Copy link
Contributor Author

I'm actually working on updating my branch this week. The webview-spec tests got migrated to a different spec runner so I'm having to rewrite those, but once that's done I think I'll be ready for another round of review

@miniak
Copy link
Contributor

miniak commented Mar 15, 2023

API LGTM

@jkleinsc jkleinsc merged commit 2b9dae4 into electron:main Mar 28, 2023
3 checks passed
@release-clerk
Copy link

release-clerk bot commented Mar 28, 2023

Release Notes Persisted

Added a will-frame-navigate event to webContents and the &lt;webview&gt; tag, which fires whenever any frame within the frame hierarchy attempts to navigate.

@trop
Copy link
Contributor

trop bot commented Mar 28, 2023

I was unable to backport this PR to "24-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot added needs-manual-bp/24-x-y and removed target/24-x-y PR should also be added to the "24-x-y" branch. labels Mar 28, 2023
@kevinushey
Copy link
Contributor

Thanks everyone :-)

@trop
Copy link
Contributor

trop bot commented Apr 11, 2023

@miniak has manually backported this PR to "24-x-y", please check out #37930

@trop
Copy link
Contributor

trop bot commented Apr 11, 2023

@miniak has manually backported this PR to "23-x-y", please check out #37931

miniak pushed a commit that referenced this pull request Apr 11, 2023
miniak pushed a commit that referenced this pull request Apr 11, 2023
miniak pushed a commit that referenced this pull request Apr 11, 2023
miniak pushed a commit that referenced this pull request Apr 11, 2023
miniak pushed a commit that referenced this pull request Apr 12, 2023
miniak pushed a commit that referenced this pull request Apr 12, 2023
miniak pushed a commit that referenced this pull request Apr 12, 2023
miniak pushed a commit that referenced this pull request Apr 12, 2023
miniak pushed a commit that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add will-frame-navigate event