rugk / mastodon-simplified-federation

Simplifies following and interacting with remote users on other Mastodon instances.
https://addons.mozilla.org/firefox/addon/mastodon-simplified-federation/?utm_source=github.com&utm_medium=github&utm_content=github-url-description&campaign=github-url-description
Other
255 stars 20 forks source link

"waitForElement timed out" after wake from sleep. #119

Closed lil5 closed 6 months ago

lil5 commented 10 months ago

Bug description

After opening from sleep errors appear on a development website (localhost:3131 vite dev)

Steps to reproduce

  1. Create a small website using npm create vite@latest my-vue-app -- --template vue; cd my-vue-app; npm i; npm run dev
  2. Open said website on Firefox with this extension running.
  3. Let computer sleep.
  4. Wake up & re-login to computer.
  5. Check the console.

Actual behavior

Tones of error logs in console

Expected behavior

No error logs from this extension.

System

M1 MacOS 14.2

Operating system and version: Browser and version: Firefox Add-on version: 2.1

Possible solution

lil5 commented 10 months ago

Here is the log:

Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:60
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:59
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:51
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:185
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:195
Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:53
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:52
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:44
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:136
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:146

Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:60
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:59
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:51
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:185
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:195

Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:53
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:52
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:44
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:136
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:146

Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:60
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:59
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:51
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:185
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:195

Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:53
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:52
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:44
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:136
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:146

Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:60
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:59
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:51
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:185
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/mastodonInject.js:195
Error: waitForElement timed out
    timeout moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:53
    setTimeout handler*waitForElement/< moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:52
    waitForElement moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:44
    init moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:136
    <anonymous> moz-extension://8ed2c7c4-fe04-4c34-87cd-0f9bde1bf859/content_script/misskeyInject.js:146
rugk commented 10 months ago

Okay, could you attach a test case ZIP with that website files? (Or is it reproducible on any website, actually?) You could also upload it to GitHub Pages, Neocities or so, that would make testing even easier.

Also what is the connection to Mastodon/Fediverse for this site? Likely none hmm?


Okay I could reproduce this, it runs on every site and just shows that the site is not detected as being either a Mastodon or Misskey instance. Also no need for standby, as it retries this for a few times, you actually just need to wait/stay on the site for some time.

Well… I agree that error message is not very good. Anyway it's nothing bad, it may just be a little annoying for web devs/in your browser console there.

So as in https://github.com/rugk/mastodon-simplified-federation/issues/95 we should maybe fail more silently in such a case.

deevroman commented 6 months ago

Anyway it's nothing bad, it may just be a little annoying for web devs/in your browser console there.

Yes, it's annoying. These errors clog up the console even when I debug the site on localhost. Ideally, if this is a common situation, then this should not be shown in the console as an error on any sites.

lil5 commented 6 months ago

https://github.com/rugk/mastodon-simplified-federation/blob/main/src/content_script/mastodonInject.js#L185-L188

A promise without a catch handler

try {
...
} catch() {return}

There fixed it with an early return.

rugk commented 6 months ago

@lil5 feel free to submit a PR to contribute this and be properly credited.