vimium icon indicating copy to clipboard operation
vimium copied to clipboard

Fix css injection on Chrome [improved but not perfect]

Open gdh1995 opened this issue 2 years ago • 7 comments

This ensures userDefinedLinkHintCss can override those in vimium.css, so it can replace #3421, fix #3418, fix #3452 and fix #3956.

As said in https://github.com/philc/vimium/issues/3418#issuecomment-549160351 , during my tests the document about chrome.tabs.insertCSS is not correct - the CSS may be used earlier than those defined in manifest.json.

Updated (2021/11/16): as said in #3956, CSS inserted at document_start may be used earlier even on a top iframe on Chrome 95+Win10.

gdh1995 avatar Aug 08 '21 08:08 gdh1995

Aching to see this fix implemented in master. Great stuff @gdh1995 !

fiskhest avatar Aug 16 '21 10:08 fiskhest

Tested on Chrome 94.0.4606.54 by installing from the source. It works like a charm! Thank you. :pray:

hisener avatar Oct 02 '21 18:10 hisener

Also tested on Chromium 94.0.4606.71 and it resolves all race conditions. Thanks @gdh1995 for the fix!

BachoSeven avatar Oct 02 '21 19:10 BachoSeven

What's the status here?

philiparvidsson avatar Dec 11 '21 02:12 philiparvidsson

Any updates on when this might be merged? I'm still experiencing #3956.

ceiphr avatar Apr 06 '22 14:04 ceiphr

How is this not merged yet? It's a super annoying bug. I've inserted custom CSS to have blank link hints with white text. But now I get the yellow default hints with white text, making them barely readable.

philiparvidsson avatar Jul 16 '22 20:07 philiparvidsson

I hope a maintainer with merge access sees this PR. This code fixes https://github.com/philc/vimium/issues/3956

austintraver avatar Jul 28 '22 07:07 austintraver

Sorry for the delay here. I'd like to merge this, but I haven't been able to reproduce the underlying issue. Is there a reliable test case?

philc avatar Jul 23 '23 18:07 philc

@philc Chrome 102 and 115 on Windows 11 with Vimium master can reproduce this: image image

gdh1995 avatar Jul 24 '23 14:07 gdh1995

OK, I was finally able to reproduce this. Thank you @gdh1995. My notes:

  • I couldn't reproduce this in MacOS, only windows.
  • It reliably occurred once in about ten tries. Load "C:/" as the URL in windows. Hit reload, and then press f to activate link hints and see if the custom styles appear.
  • I never saw this occur in Firefox in Windows or MacOS using the same procedure.

I also couldn't reproduce this in Vimium 2.0 on either Windows or MacOS. This may be because we're now using the chrome.scripting.insertCSS instead of chrome.tabs.insertCSS (chrome.tabs.insertCSS was removed in Manifest v3), and chrome.scripting.insertCSS somehow behaves differently such that this issue doesn't occur.

I'm going to close this as I believe it should finally be resolved once Vimium 2.0 hits the store. Also, the fix in this PR won't work on the current manifest v3 codebase, since scripting.insertCSS doesn't have a run_at parameter.

If anyone is still able to reproduce this on Vimium 2.0, please post a comment in #3452 indicating the procedure to do so, and your browser and OS.

philc avatar Aug 12 '23 22:08 philc