feat: disable creation of window.ipfs attribute in Firefox #495
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables Firefox users to disable creation of
window.ipfs
attribute via Preferences screen, solving fingerprinting issue raised in #451.It requires webpack, so should be merged after #498
Background
Existing
tabs.executeScript
API withrunAt: 'document_start'
flag was executing too late and page scripts were unable to detectwindow.ipfs
correctly. More info on the underlying issue: #368 #362 (comment)As a workaround that worked in both Chrome and Firefox, we were forced to always load content script via manifest definition. This meant no control over when it is loaded and no easy off switch. If
window.ipfs
was disabled via Preferences, it was throwing an Error on access, but remained in the scope.Mozilla added
contentScripts
API in Firefox 59. The key difference betweentabs.executeScript
andcontentScripts
API is that the latter provides guarantee to execute before anything else on the page, passing our synchronous smoke test.Known Issues
Chrome does not provide
contentScripts
API so it will continue to statically loadcontent_script
via manifest. Hopefully with time, other browser vendors will adopt the new API.