Skip to content

Conversation

sm17p
Copy link

@sm17p sm17p commented Jul 14, 2025

Overview

My attempt to resolve backgroundScript detection logic for analytics module based on
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support

Manual Testing

I'm going to add this soon

Related Issue

This PR closes #1807

@sm17p sm17p requested review from aklinker1 and Timeraa as code owners July 14, 2025 03:55
Copy link

netlify bot commented Jul 14, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit e1085b3
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/687e3bfce2159c00081f10b7
😎 Deploy Preview https://deploy-preview-1808--creative-fairy-df92c4.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.

const backgoundPageorScriptsCheck =
location.pathname === '/_generated_background_page.html' ||
(backgroundPageManifest && location.pathname.endsWith(backgroundPageManifest)) ||
(backgroundPageWXT && location.pathname.endsWith(backgroundPageWXT));
Copy link
Author

Choose a reason for hiding this comment

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

I need help over here. I couldn't find background_page property on the manifest anywhere, so I'm not sure if this internal and needs to be checked

Copy link
Member

Choose a reason for hiding this comment

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

Not sure where you found this property in the first place... Isn't it background.page?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are right. I earlier thought that having background_page set in the manifest would generate _generated_background_page.html but it's actually when you only specify '.js' files in the scripts

@sm17p sm17p force-pushed the fix-analytics-background-script branch 3 times, most recently from 3ef5496 to b3b2d5d Compare July 14, 2025 05:18
@sm17p sm17p force-pushed the fix-analytics-background-script branch from b3b2d5d to e1085b3 Compare July 21, 2025 13:09
const backgroundPageManifest = (background as any)?.page;

const backgroundPageOrScriptsCheck =
location.pathname === '/_generated_background_page.html' ||
Copy link
Member

Choose a reason for hiding this comment

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

Where is this string coming from?

Copy link
Author

const backgoundPageorScriptsCheck =
location.pathname === '/_generated_background_page.html' ||
(backgroundPageManifest && location.pathname.endsWith(backgroundPageManifest)) ||
(backgroundPageWXT && location.pathname.endsWith(backgroundPageWXT));
Copy link
Member

Choose a reason for hiding this comment

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

Not sure where you found this property in the first place... Isn't it background.page?

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.

@wxt-dev/analytics | Firefox MV2 & MV3 | createBackgroundAnalytics execution skipped
2 participants