Skip to content

Conversation

@jonathanKingston
Copy link
Contributor

@jonathanKingston jonathanKingston commented Aug 20, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/1201614831475344/task/1211099580633727?focus=true

Fixes: #1900

Description

I think this issue is due to tab restoration in the service worker mv3 handling code in Firefox code only and only when the extension is updated (hence a new bout of reproductions).

I've done the following:

  • Short circuited the init code when we get an invalid message, we can't do much in this scenario. The extension side needs to investigate this. These messages are likely more corrupt than just the enabledFeatures missing, so we just shouldn't risk breaking the page.
  • Added typing to the isFeatureBroken method which would have prevented this exact issue.
  • Handled the undefined enabledFeatures case in this method.
  • Split out the logic as it was getting a little unreadable.

As a perf benefit:

  • Short circuited the update logic just for the CTL feature as it's not required so it cuts out many function calls with checking listenForUpdateChanges

Testing Steps

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

@netlify
Copy link

netlify bot commented Aug 20, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit 21fc401
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/68a5ad349acb080008fd3537
😎 Deploy Preview https://deploy-preview-1907--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Aug 20, 2025

Temporary Branch Update

The 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.

@github-actions
Copy link

github-actions bot commented Aug 20, 2025

[Beta] Generated file diff

Time updated: Wed, 20 Aug 2025 11:11:36 GMT

Android
    - android/autofillPasswordImport.js
  • android/brokerProtection.js
  • android/contentScope.js

File has changed

Apple
    - apple/contentScope.js
  • apple/contentScopeIsolated.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

@jonathanKingston jonathanKingston marked this pull request as ready for review August 20, 2025 11:03
Copy link
Contributor

@dharb dharb left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@jonathanKingston jonathanKingston added this pull request to the merge queue Aug 20, 2025
Merged via the queue into main with commit 09c0a93 Aug 20, 2025
20 checks passed
@jonathanKingston jonathanKingston deleted the jkt/featureEnabled branch August 20, 2025 15:52
jonathanKingston added a commit that referenced this pull request Aug 21, 2025
* Ensure we check isFeatureEnabled correctly

* Only trigger updates on listenForUpdateChanges enabled features (CTL)

* Add bail out option for invalid messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't access property "includes", args.site.enabledFeatures is undefined

2 participants