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

Unexpected result when blocking Javascript #1642

Closed
choog opened this issue May 17, 2016 · 5 comments
Closed

Unexpected result when blocking Javascript #1642

choog opened this issue May 17, 2016 · 5 comments

Comments

@choog
Copy link

choog commented May 17, 2016

I want uBlock Origin to block all Javascript until I allow it on a per-site basis. To accomplish this I have enabled medium mode and added these additional rules in My Rules pane:

* * 1p-script block
* * inline-script block

By looking in the Dynamic filtering pane I can confirm that all rules are enabled.

I would now expect all Javascript to be blocked, but by doing a Google search I see a different result than when disabling Javascript directly in Firefox:

Firefox with Javascript disabled in about:config:
google_javascript_disabled


Firefox with Javascript enabled in about:config and uBlock Origin installed:
ublock_origin

In Firefox with Javascript enabled and uBlock Origin configured as above, Google is almost identical to when Javascript is fully enabled, the only difference being a missing image and all drop down menus not working.

I have been looking in Logger while searching and see inline-script gets blocked for every query.

With uBlock Origin configured as above, one would expect an identical output as when Javascript is disabled directly in Firefox.

Browser: Firefox 46.0.1
uBlock Origin version: 1.7.0

@gorhill
Copy link
Owner

gorhill commented May 17, 2016

In uBO, javascript is blocked using resource blocking and/or CSP directives.

@gorhill gorhill closed this as completed May 17, 2016
@choog
Copy link
Author

choog commented May 20, 2016

@gorhill Sorry for assuming it was a bug, I don't know much about this subject.

Of pure interest I have tried to research what "resource blocking" and "CSP directives" mean. I didn't understand too much but while I did a search query on Google, I could see in the Firefox console that scripts were blocked by CSP as you said:

Content Security Policy: The page's settings blocked the loading of a resource at self ("script-src" 'unsafe-eval' *").

If you don't mind I have two questions:

  1. I assume that by configuring uBO as explained above, absolutely no scripts are run before I allow them to. Disabling Javascript directly in Firefox also prevents all scripts from runnning, then, how can Google "detect" the difference and serve me two different layouts?
  2. The layout when disabling scripts directly in Firefox is more friendly, as all the basic functions work, can I configure a filter or rule in uBO to get this layout when using Google?

Thanks.

@gwarser
Copy link
Contributor

gwarser commented May 20, 2016

@gorhill
Copy link
Owner

gorhill commented May 20, 2016

how can Google "detect" the difference and serve me two different layouts?

See #308.

@choog
Copy link
Author

choog commented May 20, 2016

@gorhill What if a button was available in the popup UI for advanced users, that would enable/disable Javascript by toggling pref("javascript.enabled", BOOL)
in Firefox or the equivalent in other supported browsers?

One could then use the Web with Javascript disabled and noscript tags would be honoured, if a site was deemed worthy to have it's Javascript executed, one could toggle the switch and already added rules would apply or the dynamic filtering pane could be used.

This would not require changing how uBO works, only a button that would enable/disable Javascript in the browsers. Of course, one could just do this directly in the browser, but it would be much less awkward with a button in the UI.

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

No branches or pull requests

3 participants