Skip to content
This repository was archived by the owner on Feb 25, 2023. It is now read-only.

Sometimes scanning doesn't work #305

Closed
seanblue opened this issue Dec 9, 2019 · 20 comments · Fixed by #1748
Closed

Sometimes scanning doesn't work #305

seanblue opened this issue Dec 9, 2019 · 20 comments · Fixed by #1748

Comments

@seanblue
Copy link

seanblue commented Dec 9, 2019

This error happened on Bunpro (which happens occasionally, though it usually works), but I've also seen scanning randomly fail on other websites over many months. I wonder if there's something about how their JavaScript is written that causes a conflict or race condition with the extension.

Here is the error for this occurrence:

popup.js:291 Uncaught (in promise) TypeError: Cannot read property 'postMessage' of null
    at Popup.invokeApi (popup.js:291)
    at Popup.termsShow (popup.js:276)
invokeApi @ popup.js:291
termsShow @ popup.js:276
async function (async)
termsShow @ popup.js:275
searchTerms @ frontend.js:360
async function (async)
searchTerms @ frontend.js:351
searchAt @ frontend.js:315
async function (async)
searchAt @ frontend.js:301
search @ frontend.js:94
onMouseMove @ frontend.js:103
@toasted-nutbread
Copy link
Collaborator

It looks like the error is coming from contentWindow being null, which appears to be possible in the HTML spec. It may be a timing issue where the frame isn't initialized, but that's not necessarily the cause.

A few questions:

  • What browser are you seeing the error in?
  • Does this error happen only once? Or do repeated scans also trigger a new error?
  • Is it consistently reproducible if the page is refreshed, or is it sporadic?
  • Is there any example content on the site which triggers the error? Since it appears to be a paid service, I don't have access to anything immediate to test with.

@seanblue
Copy link
Author

What browser are you seeing the error in?

Google Chrome on Windows 10.

Does this error happen only once? Or do repeated scans also trigger a new error?

Whenever this happens it's as if the page gets into a bad state. Once it happens once it happens 100% of the time until I reload the page.

Is it consistently reproducible if the page is refreshed, or is it sporadic?

It's sporadic. Some websites never exhibit this problem, while others do on occasion. This is why I believe it's some combination of website and extension code causing a race condition.

Is there any example content on the site which triggers the error?

There was nothing special about the page it happened on. All I can say is that the content was not in an iframe. I'll be sure to comment again when I see the issue happen on a free/open website. For now I just wanted to make you aware of the general problem in case the cause was obvious. This isn't a new issue by the way. This has been happening on and off for a long time.

@toasted-nutbread
Copy link
Collaborator

I'm hoping the issue is a simple timing issue, where the window is being accessed before it's loaded. That should be relatively easy to fix. That's what it sounds like is happening, but it's odd that the page doesn't recover without refreshing. I'll implement a fix for that soon, but I probably won't be able to 100% verify that it fixes the issue, since I've never seen the error before.

@toasted-nutbread
Copy link
Collaborator

Closing since the codebase has changed in ways that should have resolved this issue.

@lenamx
Copy link

lenamx commented Jun 22, 2021

I'm having trouble with scanning in one specific website. I've checked the dictionaries and reloading the page, it seems everything is in order.
Does anyone have any idea on how to solve this? I have used scanning in this website before, so I wonder why it suddenly stopped working...

Thanks!

@toasted-nutbread
Copy link
Collaborator

What website?

@lenamx
Copy link

lenamx commented Jun 22, 2021

What website?

This one:
http://jti.lib.virginia.edu/japanese/genji/modern.html

I have used Yomichan in this site many times without issues, but lately it hasn't been working...

@toasted-nutbread
Copy link
Collaborator

It seems to work for me. Can you:

  • Check the dev console to see if there are any errors in red? (F12 => Console)
  • Export your settings file and share it here

@lenamx
Copy link

lenamx commented Jun 23, 2021

It seems to work for me. Can you:

  • Check the dev console to see if there are any errors in red? (F12 => Console)
  • Export your settings file and share it here

image

Hi, is this printscreen what you were asking for? Also, I had to convert the exported Yomichan settings file, because I couldn't upload a .json file here. I'm sorry if I got it wrong, I'm totally new to this.

sakcn-wsc4d.pdf

@toasted-nutbread
Copy link
Collaborator

Add the .json file to a .zip, or rename to a .txt; github doesn't let you upload json for some reason.

@lenamx
Copy link

lenamx commented Jun 24, 2021

Add the .json file to a .zip, or rename to a .txt; github doesn't let you upload json for some reason.

yomichan-settings-2021-06-23-12-01-36.txt

Is this what you were asking for? I tried uninstalling the dictionaries and reinstalling, but the same issue keeps happening only with this particular website.

@toasted-nutbread
Copy link
Collaborator

I see the issue now. As a temporary workaround, go to the settings and disable Show iframe popups in the root frame under the Popup heading (you'll need to enable Advanced mode) and the website should work. I'll work on a fix for the issue for when that setting is enabled.

@lenamx
Copy link

lenamx commented Jun 25, 2021

I see the issue now. As a temporary workaround, go to the settings and disable Show iframe popups in the root frame under the Popup heading (you'll need to enable Advanced mode) and the website should work. I'll work on a fix for the issue for when that setting is enabled.

Done, it's working now! Thank you so much!!

@lenamx
Copy link

lenamx commented Apr 18, 2022

Hi,
I'm having trouble with scanning Google documents. I have been using it constantly with no problems, but recently it has stopped working,
Does anyone could help me with this issue?

Thanks!

@toasted-nutbread
Copy link
Collaborator

See #2093; there is an updated workaround in the latest release (#2110) which hasn't yet been pushed to stable.

@FooSoft
Copy link
Owner

FooSoft commented Apr 20, 2022

@toasted-nutbread should already be available :)

@lenamx
Copy link

lenamx commented Apr 20, 2022

@toasted-nutbread should already be available :)

Thanks so much, it has started working again!!

@toasted-nutbread
Copy link
Collaborator

@FooSoft My mistake, thanks!

@lenamx
Copy link

lenamx commented Sep 16, 2022

Hi,
I'm having trouble again to scan Google documents. Does anyone could help me with this issue?

Thanks!

@toasted-nutbread
Copy link
Collaborator

The actual issue is #2093, Google has made some changes which basically block Yomichan from functioning on Google Docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants