-
-
Notifications
You must be signed in to change notification settings - Fork 368
fix: Improve background script detection logic for analytics package #1807 #1808
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
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)); |
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.
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
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.
Not sure where you found this property in the first place... Isn't it background.page
?
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.
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
3ef5496
to
b3b2d5d
Compare
b3b2d5d
to
e1085b3
Compare
const backgroundPageManifest = (background as any)?.page; | ||
|
||
const backgroundPageOrScriptsCheck = | ||
location.pathname === '/_generated_background_page.html' || |
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.
Where is this string coming from?
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.
I found it in source code of browsers
- https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/chromium/chromium%24+_generated_background_page.html&patternType=keyword&sm=0
- https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/mozilla-firefox/firefox%24++_generated_background_page.html&patternType=keyword&sm=0
- https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/WebKit/WebKit%24+_generated_background_page.html&patternType=keyword&sm=0
const backgoundPageorScriptsCheck = | ||
location.pathname === '/_generated_background_page.html' || | ||
(backgroundPageManifest && location.pathname.endsWith(backgroundPageManifest)) || | ||
(backgroundPageWXT && location.pathname.endsWith(backgroundPageWXT)); |
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.
Not sure where you found this property in the first place... Isn't it background.page
?
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