Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix css injection on Chrome [improved but not perfect] #3883

Closed
wants to merge 2 commits into from

Conversation

gdh1995
Copy link
Contributor

@gdh1995 gdh1995 commented Aug 8, 2021

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

As said in #3418 (comment) , 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.

@fiskhest
Copy link

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

@hisener
Copy link

hisener commented Oct 2, 2021

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

@BachoSeven
Copy link

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

@gdh1995 gdh1995 mentioned this pull request Oct 21, 2021
@gdh1995 gdh1995 changed the title Fix css injection in iframes [improved] Fix css injection on Chrome [improved] Nov 16, 2021
@tx46
Copy link

tx46 commented Dec 11, 2021

What's the status here?

@ceiphr
Copy link

ceiphr commented Apr 6, 2022

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

@gdh1995 gdh1995 changed the title Fix css injection on Chrome [improved] Fix css injection on Chrome [improved but not perfect] May 22, 2022
@tx46
Copy link

tx46 commented Jul 16, 2022

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.

@austintraver
Copy link

I hope a maintainer with merge access sees this PR. This code fixes #3956

return chrome.tabs.insertCSS(tabId, cssConf, () => chrome.runtime.lastError);
const callback = () => chrome.runtime.lastError;
chrome.tabs.insertCSS(tabId, cssConf, callback);
if (Utils.isFirefox()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I see the same issue in Firefox.

@philc
Copy link
Owner

philc commented Jul 23, 2023

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?

@gdh1995
Copy link
Contributor Author

gdh1995 commented Jul 24, 2023

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

@philc
Copy link
Owner

philc commented Aug 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants