-
Notifications
You must be signed in to change notification settings - Fork 327
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
Initial stab at Chromium compatibility #250
Conversation
Firefox supported simplified syntax, but Chromium does not. Implements part of #218
the syntax defined for Chrome's version is more restrictive than that used by Firefox: - https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/version - https://developer.chrome.com/extensions/manifest/version Part of #218 effort
Only one of browser_action, page_action can be specified in Chrome Part of #218 effort
Boilerplate for #218
This solves load error under Chromium Part of #218
Chromium does not support SVG [ticket below is 8 years old, I can't even..] https://bugs.chromium.org/p/chromium/issues/detail?id=29683 We use precomputed PNG versions instead. This fixes part of #218 effort
For some reason `js-ipfs-api` sends requests with "Origin: null" under Chrom which produces '403 - Forbidden' error. This workaround removes bogus header from API requests Part of #218 effort
Part of #218 effort
Part of #218 effort
Are we good to merge this? If so, hit me up with review approval. |
loading it into chrome i get:
Followed by the entire manifest.json in a little scrollybox |
chromium version: 58.0.3029.110 |
@whyrusleeping Are you sure you loaded code from |
@lidel youre right, i missed the checkout a branch bit. Works! 👍 👍 |
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.
This LGTM, exciting!
return context.getImageData(0, 0, size, size) | ||
} | ||
*/ | ||
|
||
// OPTIONS | ||
// =================================================================== |
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.
Wouldn't it make more sense to modularize these sections?
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, at some point.
I've added those "section" comments, as common.js
grew organically.
I was not sure what is the best course of action for "webextension modularization", as Firefox WX ecosystem was still brand new when I started the rewrite from legacy SDK.
In Chrome world people use ES6 modules, but feature is not implemented in any browsers natively at this time and requires you to transpile everything to a single .js
file (example).
I avoided it and right now add-on code runs "as-is" (no transpilling), but I am not sure if this approach can be maintained in the long run, especially now that we support multiple browser vendors.
If you feel it is the time, create a new Issue and copy/link this comment there.
Alternatively, we leave it be a monolith until ES6 modules are natively supported by both Firefox and Chrome:
Ah, only see that purple merged label after. awesome! |
This PR provides initial support for Chromium 58+ browsers (ipfs/in-web-browsers#54, #218).
Running in Chromium
First, build it manually:
Then open up
chrome://extensions
in Chromium-based browser, enable "Developer mode", click "Load unpacked extension..." and point it atadd-on/manifest.json
.It should load just fine, with some minor warnings (see known issues below):
Brief list of issues fixed in this PR
browser
object and requires a polyfill for standardized APIs (which is a subset of APIs provided by Firefox): https://github.com/mozilla/webextension-polyfillbrowser_action
,page_action
can be specified in Chromium-
from key names)version
in manifestOrigin: null
with XHR requests for/api/v0/swarm/peers
which causes403 - Forbidden
errorKnown Issues
Remaining Issues that are not covered by this PR:
web+foo
protocols. Chromium does not supportprotocol_handlers
in manifest, this needs to be detected and manual handler needs to be installed somehow.