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

##script:inject(...) takes too long to inject the script #3357

Closed
bakugo opened this issue Dec 19, 2017 · 4 comments
Closed

##script:inject(...) takes too long to inject the script #3357

bakugo opened this issue Dec 19, 2017 · 4 comments

Comments

@bakugo
Copy link

bakugo commented Dec 19, 2017

The ##script:inject(...) directive seems to take 10-50ms to actually inject the specified script after the document starts rendering. This becomes a problem when using scripts like abort-current-inline-script.js because inline scripts placed early enough in the document can bypass it completely by executing early on. It can also lead to cases where a "blocked" script will execute on some page loads but not others.

For example, this rule:

##script:inject(abort-current-inline-script.js, String.fromCharCode)

Should kill this script, but if it loads too fast, it won't happen:

<script>
	window.test = String.fromCharCode;
	console.log("this is not blocked :(");
</script>

Is there any way to remove this delay or is this a browser issue that can't be fixed?

  • OS/version: Windows 8.1
  • Browser/version: Chrome 63.0.3239.84
  • uBlock Origin version: 1.14.20
@uBlock-user
Copy link
Contributor

uBlock-user commented Dec 19, 2017

It can also lead to cases where a "blocked" script will execute on some page loads but not others.

Chrome has a race condition issue, so it's not just that it executes late.

@gorhill
Copy link
Owner

gorhill commented Dec 19, 2017

Browser limitation.

@gorhill gorhill closed this as completed Dec 19, 2017
@gorhill
Copy link
Owner

gorhill commented Dec 19, 2017

I've been looking at how to solve this issue since a long time. For example, see #3069.

@uBlock-user
Copy link
Contributor

But that's just for Firefox, what about chrome ?

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

No branches or pull requests

3 participants