luciopaiva / witchcraft

Inject Javascript and CSS right from your file system. Think GreaseMonkey for more advanced users.
https://luciopaiva.com/witchcraft
MIT License
254 stars 18 forks source link

create new Popup asynchronously ? #27

Closed mjuksel closed 4 years ago

mjuksel commented 4 years ago

I've had a couple of instances where the popup wouldn't show the correct information. Illustrated in the image below, you can clearly see the scripts DO load, but aren't displayed properly in the popup. https://www.mjxl.net/img/wc_loadissue.png

This mostly happens when opening any page in a new tab (I think?)

I've changed the window.onload event to do it asynchronously, it seems to fix it. I haven't seen it on new tabs. It still happens on switching tabs, though i thought i saw a commit that should patch it?

Also, Hi ! Didn't look at Witchcraft for a while (obviously created tons of scripts and styles locally :D ) I just saw including CSS and external libs now works , woop ! Good job!

mjuksel commented 4 years ago

I'm now testing "DOMContentLoaded", that one might work better even.

mjuksel commented 4 years ago

Hmm, seems like i was living a lie.

It still shows as empty when opening Chrome, resuming from last time. :<

Guess this can be closed, it's not that big a "problem" anyways.

luciopaiva commented 4 years ago

Yeah, I think I've seen that happening before as well. If I remember correctly, it was not when switching tabs, but windows.

But anyway, awaiting on a constructor doesn't do any good. Constructors do not (and cannot) return promises.

When I get some time (probably not soon) I'll try to reproduce the issue and fix it. In case you decide to look into it, let's write down the steps to reproduce the issue first so we can be sure we're fixing it. But it's like you said: probably not that big of an issue.

Nevertheless, thanks for taking the time!