-
Notifications
You must be signed in to change notification settings - Fork 28
Support navigation based conditional matching #1610
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
Conversation
Additionally ensure all checks match
✅ Deploy Preview for content-scope-scripts ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Temporary Branch UpdateThe temporary branch has been updated with the latest changes. Below are the details:
Please use the above install command to update to the latest version. |
[Beta] Generated file diffTime updated: Wed, 16 Apr 2025 14:11:56 GMT Android
File has changed Chrome-mv3
File has changed Firefox
File has changed Integration
File has changed Windows
File has changed Apple
File has changed |
9aae6f9
to
698d54f
Compare
@@ -26,6 +28,11 @@ export default class ApiManipulation extends ContentFeature { | |||
} | |||
} | |||
|
|||
urlChanged(site) { | |||
super.urlChanged(site); | |||
this.init(); |
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 means we'll rerun rules on navigation change.
registerForURLChanges(() => { | ||
// The rationale for the two separate call here is to ensure that | ||
// extensions to the class don't need to call super.urlChanged() | ||
featureInstance.recomputeSiteObject(); |
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.
@dbajpeyi this is now split out so feature authors don't need to call super() as before.
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.
Non-blocking: do we forsee any major issues if we have both recomputeSiteObject
and urlChanged
being called? Can there be any inconsistencies?
if ('navigation' in globalThis && 'addEventListener' in globalThis.navigation) { | ||
// if the browser supports the navigation API, we can use that to listen for URL changes | ||
// Listening to navigatesuccess instead of navigate to ensure the navigation is committed. | ||
globalThis.navigation.addEventListener('navigatesuccess', () => { |
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.
@dbajpeyi the navigate event actually fired too early, I validated this works as expected. The API has a way to modify and deny navigations before they happen.
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! Tested the password import case too, for sanity! All working well.
Asana Task/Github Issue: https://app.asana.com/0/481882893211075/1209844047592403/f
Description
Part of: https://app.asana.com/0/481882893211075/1209844047592403/f for navigation handling.
Testing Steps
Checklist
Please tick all that apply: