Skip to content
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

fix: remove normalizeLinksContentScript #836

Merged
merged 1 commit into from Dec 12, 2019
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Dec 12, 2019

Part of performance improvements (cc #721, @autonome).

This PR removes normalizeLinks content script, which run by default. IPFS Companion will no longer process the DOM of every page, which should benefit overall browsing performance, and make it easier to test and reason about protocol handler support across browser vendors.

Motivation

The script executed on every page. Was responsible for overriding all src and href attributes found in DOM with value from window.ipfsCompanionPubGwURL.
The goal was to ensure content addressed with ipfs:// URL "just loads", but in reality it worked only for simple <img> and <a> tags.

Looking back, it does not align well with our opportunistic-upgrade-path, and the result across browser vendors was buggy at best. While it allowed loading simple images, it did not help with broken XHR, iframe quirks (PR closes #816) and introduced unnecessary battery drain. The test page at https://ipfs.github.io/in-web-browsers/ipfs-protocol-handler-support-tests.html is a good demonstration of how partial solution it was.

Due to this, it is better to remove it and advise users to use content-addressing at a public gateway. That way upgrade path is more robust: everything works for people without IPFS client, and browsers with IPFS support can easily detect it and upgrade the call.
See my suggestion posted to original issue: #286 (comment)

The script was responsible for overriding all src and href in DOM of
every page to ensure content addressed with ipfs:// URL loads.

Looking back, it does not align well with our upgrade path, and the
result across browser vendors was buggy. While it allowed loading simple
images, it did not help with broken XHR and iframe quirks and introduced
unnecessary battery drain.

Due to this, it is better to remove it and advise users to use
content-addressing at a public gateway.
This way everything works for people without IPFS client, and browsers
with IPFS support can easily detect it and upgrade the call.
@lidel lidel added this to the v2.10 milestone Dec 12, 2019
@lidel lidel merged commit f31605b into master Dec 12, 2019
@lidel lidel deleted the fix/cleanup-contentscripts branch December 12, 2019 17:16
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.

URI normalization triggers redirect to iframe src in Firefox
1 participant