Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Inline javascript might be executed first time page is loaded #35

Closed

Description

@gorhill

Test case:
http://acid3.acidtests.org/

This is probably due to the fact that chrome.contentSettings.javascript.set() is asynchronous, which means the preventing of inline javascript is not guaranteed to take effect before the page is processed/executed by the browser.

Until there is a fix (chromium developers might need to come up with something):

[Edit 2014-05-26: Some people are still using this entry as a reference. Since issue #35 has been fixed, the "workaround" below is no longer needed, it is has been rendered irrelevant with the fix.]

Workaround:

- Go to chrome/chromium "Settings".
- You might need to click "Show advanced settings".
- In "Privacy" section, click "Content settings..." button.
- In the "Javascript" section, click "Do not allow any site to run JavaScript".

HTTP Switchboard will continue to take care to enable javascript for whitelisted site.

Activity

  1. gorhill commented on Oct 27, 2013

    @gorhill
    OwnerAuthor

    No, this needs to be studied more. Above workaround is best solution for now.

  2. gorhill commented on Nov 5, 2013

    @gorhill
    OwnerAuthor

    There is an unfortunate side-effect of using "Do not allow any site to run JavaScript": When a main_frame is blocked (this happens for blacklisted hostnames), the page won't reload when unblocking it, this happens because the embedded replacement main_frame (encoded as a data URI) uses javascript to reload the page which has been unblocked. So far, it appears it is not possible to allow javascript for data URI... Sigh...

    EDIT 2013-11-09: This one particular issue was resolved in v0.5.0 (using a different way to reload formerly blacklisted page)

  3. gorhill commented on Nov 9, 2013

    @gorhill
    OwnerAuthor

    A side effect of the workaround, and for the same reason that contentSettings.javascript.set() is asynchronous, a web page might have its inline script blocked the first time the page is loaded. A refresh of the page allows the script to be properly executed.

  4. added a commit that references this issue on Nov 15, 2013
  5. gorhill commented on Nov 16, 2013

    @gorhill
    OwnerAuthor

    A bug has been formally submitted in chromium bug db: https://code.google.com/p/chromium/issues/detail?id=320300

  6. gorhill commented on Nov 17, 2013

    @gorhill
    OwnerAuthor

    If javascript is disabled by default, one solution could be to generate the exceptions for all whitelist rules with an explicit hostname when the extension is first executed -- there can't be that many hostname/script or hostname/* for one user I suppose... Still feel a hack, but in the meantime (if even chromium address the issue), that would be better than nothing.

  7. hrj commented on Dec 1, 2013

    @hrj

    👍 Nice to see your detailed analysis. Hoping for an update from Chromium devs.

  8. gorhill commented on Dec 5, 2013

    @gorhill
    OwnerAuthor

    Found a fix, so far it's working well. Will test more. Side-effect of the fix: blocked javascript won't be shown as blocked by chromium/chrome in the omnibar... Is it a big deal?

  9. added a commit that references this issue on Dec 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions