-
-
Notifications
You must be signed in to change notification settings - Fork 420
Initial steps towards Chrome support #1683
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
Conversation
Build using `yarn run build` and then `eval (yarn bin)/webpack --browser chrome`. Load into chrome://extensions by toggling Developer Mode and then 'Load unpacked' the build/ directory. What works: - the options page - simple commands on the options page What doesn't work: - our iframe is loaded into other pages but we don't capture keyevents - new tab page - most ex-commands on the options page (we often hit errors due to using Firefox features that aren't in Chrome) - styling on the command line We clearly need a wrapper for the `browser` API that fails more gracefully where something isn't available.
ea95c3c to
f642335
Compare
|
I have been working on making the changes in the I have tried: plugins.push(
new webpack.ProvidePlugin({
browser: 'webextension-polyfill-for-webpack',
customElements: '@webcomponents/custom-elements'
})
)Which imports something, but i get an error saying the I have also tried this example mentioned in this issue but couldn't get it to work. My current solution is just to import it in the import "@webcomponents/custom-elements";
customElements.define("find-highlight", FindHighlight, { extends: "span" })I know this is not ideal, but i can't get it to work with webpack and i have spent way to much time on this so i could use some help, if you know a solution @bovine3dom? My changes are on my |
|
As far as I can tell, customElements is supported by Chrome out of the box. Have you tried I don't know what you're doing wrong with webpack - I haven't had to touch it much myself. I can look into it if you get really stuck. I think this hits at a deeper issue, however: Tridactyl shouldn't break just because find mode doesn't work. Find mode should only be able to break find mode : ) I think a port to Chrome needs to do two fundamental things:
I think you might be getting a little ahead of yourself by trying to fix find mode :) |
|
I'd recommend not wasting too much energy on `find`, you can wrap the
customElements.define call in a try/catch block for now and see if there
are other problems.
Since this is the only place where they are used we can just go back to
creating elements manually with document.createElement if we want to.
|
|
NB: using awesome-typescript-loader in this PR wasn't a conscious choice - it's just what we used in Tridactyl at the time. It isn't maintained so we should avoid using it. In #1914 we switched Tridactyl to ts-loader. |
This comment has been minimized.
This comment has been minimized.
I wouldn't be surprised if that example implementation has simply stopped working since it was posted. It has all of the hallmarks of a kludgy prototype with rough edges that'd break if you breathed on it. Particularly given that the bug has had no movement since 2019. I think that resolving that whole issue is outside the scope of this porting effort.
That feels reasonable to me, as long as there's a comment in the code documenting that it's a workaround. For this I personally tend toward TODO comments with links to discussions on PRs and issues. |
|
Thanks for all of your help! I will now try to find all of the places where tridactyl fails in chrome and make issues for them. I will also start looking at the tests, haven't look at them yet so it's probably gonna take me a few days to understand how everything works. |
Build using
yarn run buildand theneval (yarn bin)/webpack --browser chrome. Load into chrome://extensions by toggling Developer Mode and then 'Load unpacked' the build/ directory.What works:
the options page (insofar as it appears)
simple commands on the options page (e.g.
j)What doesn't work:
our iframe is loaded into other pages but we don't capture keyevents
new tab page (doesn't show but commandline does work)
most ex-commands on the options page (we often hit errors due to using Firefox features that aren't in Chrome)
styling on the command line
We clearly need a wrapper for the
browserAPI that fails more gracefully where something isn't available / have some wrapper that allows us to mark a function call as non-essential (e.g.tabopenautomatic container support,openbrowser.searchsupport).Related #1619. Pinging @saulrh as he expressed some interest in this.