Ferdi: Dark Reader prevents certain services from loadng

Created on 30 Dec 2019  路  1Comment  路  Source: getferdi/ferdi

Hey! Thanks for your work on Ferdi, love it so far. I've encountered a bug with Fastmail today, and I believe it's connected with Dark Reader.

Describe the bug
When adding Fastmail service, it won't load - JS and other assets load fine, but something prevents the page from loading completely. This something is CORS and DarkReader related - see console logs. Nothing noteworthy in Network tab.

I've tried disabling Dark Mode completely, but it looks like the offending JS is still injected in page.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Add New Service
  2. Type in "FastMail"
  3. Create it
  4. Open it
  5. It won't load

JS Console

/usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1 Error: document.body is null, if you're calling this in a preload script you need to wrap it in a setTimeout
    at SpellCheckHandler.attachToInput (/usr/lib/ferdi/resources/app.asar/node_modules/electron-spellchecker/src/spell-check-handler.js:214)
    at initialize (/usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1)
    at _temp.initialize (/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1)
    at new _temp (/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1)
    at Object.<anonymous> (/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1)
    at Object.<anonymous> (/usr/lib/ferdi/resources/app.asar/webview/recipe.js:2)
    at Module._compile (internal/modules/cjs/loader.js:786)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798)
    at Module.load (internal/modules/cjs/loader.js:645)
    at Function.Module._load (internal/modules/cjs/loader.js:560)
initialize @ /usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 Set theme to:  Light
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 DarkMode disabled - removing remaining styles
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 Removing DarkReader
/usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1 Dictionary is already used en-us
switchDict @ /usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 Set theme to:  Dark
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 darkmode.css exists?  No
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 Injecting DarkReader
/usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1 Dictionary is already used en-us
switchDict @ /usr/lib/ferdi/resources/app.asar/webview/spellchecker.js:1
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 Set theme to:  Dark
/usr/lib/ferdi/resources/app.asar/webview/recipe.js:1 darkmode.css exists?  No
/usr/lib/ferdi/resources/app.asar/node_modules/darkreader/darkreader.js:82 Uncaught Error: Access to some of your resources was blocked by cross-origin policy
    at Object.throwCORSError [as sendMessage] (/usr/lib/ferdi/resources/app.asar/node_modules/darkreader/darkreader.js:82)
    at Object.t.getMessagePort (base-raw.js:24911)
    at Object.t.getPortSingleton_ (base-raw.js:25265)
    at Object.t.getApiVersion (base-raw.js:25405)
    at eval (base-raw.js:25478)
    at eval (base-raw.js:25454)
    at eval (<anonymous>)
    at bootstrap-raw.js:93

Expected behavior
Fastmail loaded :)

Desktop (please complete the following information):

  • OS: Arch Linux
  • Ferdi Version: 5.4.0
bug

Most helpful comment

The problem seems to be that DarkReader tries to use the chrome message API even though it isn't inside a context that would allow this.
After some testing it seems like the solution was to simply add a mock function for sending messages but that doesn't actually do anything. FastMail now loads again and it even works with DarkReader darkmode.

>All comments

The problem seems to be that DarkReader tries to use the chrome message API even though it isn't inside a context that would allow this.
After some testing it seems like the solution was to simply add a mock function for sending messages but that doesn't actually do anything. FastMail now loads again and it even works with DarkReader darkmode.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AP-Hunt picture AP-Hunt  路  3Comments

maciesse picture maciesse  路  3Comments

pktiuk picture pktiuk  路  3Comments

idonthaveanametoday picture idonthaveanametoday  路  3Comments

PeSader picture PeSader  路  3Comments