MystPi / ninetails

A private, fast, and beautiful web browser.
MIT License
68 stars 22 forks source link

Webview Dom Error #66

Closed ninjamar closed 2 years ago

ninjamar commented 2 years ago

Whenever I run ninetails, the console says

Uncaught (in promise) Error: The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.
    at HTMLElement.getWebContentsId (node:electron/js2c/isolated_bundle:17)
    at HTMLElement.e.<computed> [as getURL] (node:electron/js2c/isolated_bundle:21)
    at switchTabs (functions.js:36)
    at createTab (functions.js:94)
    at startup.js:13

Also, new tabs are blank

ninjamar commented 2 years ago

I can't do the extensions till this is fixed because the extension code doesn't run. If we use webview.insertCSS and webview.executeJavaScript, we have to bypass cors. My solution would be to make a cors proxy in node and run it when electron starts.

MystPi commented 2 years ago

I'm aware of this issue, but I'm not sure what's causing it. I'll try to find a fix.

ninjamar commented 2 years ago

I tried to fix it but I was confused since I thought the webview was already on the page. Maybe it has to do how the variable was set (document.createElement vs document.getElementById)?

MystPi commented 2 years ago

Pushed my fix to the v2.2.4 branch. I was just using getTitle before the webview was ready.

hello-smile6 commented 2 years ago

I can't do the extensions till this is fixed because the extension code doesn't run. If we use webview.insertCSS and webview.executeJavaScript, we have to bypass cors. My solution would be to make a cors proxy in node and run it when electron starts.

I'll deploy a cors-anywhere instance on replit.

MystPi commented 2 years ago

I can't do the extensions till this is fixed because the extension code doesn't run. If we use webview.insertCSS and webview.executeJavaScript, we have to bypass cors. My solution would be to make a cors proxy in node and run it when electron starts.

I'll deploy a cors-anywhere instance on replit.

Or use allOrigins.

hello-smile6 commented 2 years ago

Already set it up. See 9pfs/cors-anywhere

hello-smile6 commented 2 years ago

Use that for right now, I got another idea for a permanent solution.

ninjamar commented 2 years ago

I can't do the extensions till this is fixed because the extension code doesn't run. If we use webview.insertCSS and webview.executeJavaScript, we have to bypass cors. My solution would be to make a cors proxy in node and run it when electron starts.

should it be pinged once ninetails loads?

MystPi commented 2 years ago

Please discuss CORS and other unrelated topics in a different issue.