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

uBlock error when using a command line switch in Chromium #296

Closed
8 tasks done
ghost opened this issue Nov 2, 2018 · 15 comments
Closed
8 tasks done

uBlock error when using a command line switch in Chromium #296

ghost opened this issue Nov 2, 2018 · 15 comments
Labels
Chromium specific to Chromium/Chrome fixed issue has been addressed

Comments

@ghost
Copy link

ghost commented Nov 2, 2018

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

When I start Chromium with the command Line switch "--disable-reading-from-canvas" I get an error.

Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.

js/vapi-background.js:705 (anonymous function)
let imgData = ctx.getImageData(0, 0, w, h);

A specific URL where the issue occurs

[A specific URL is MANDATORY for issue happening on a web page, even if it happens "everywhere" ]

Steps to Reproduce

  1. Start Chromium with command line switch "chromium --disable-reading-from-canvas"
  2. Go to extensions and enable developer mode
  3. Load unpacked uBlock Origin
  4. Click to open background.html page for uBlock Origin to see the errors.

Expected behavior:

Expected behavior is that uBlock Origin should not give an error on load.

Actual behavior:

An error on uBlock Origin load

Your environment

  • uBlock Origin version: 1.17.2
  • Browser Name and version: Chromium Version 70.0.3538.77 (Official Build)
  • Operating System and version: Arch Linux (64-bit)
@uBlock-user uBlock-user added the something to address something to address label Nov 2, 2018
@uBlock-user
Copy link
Contributor

uBlock-user commented Nov 2, 2018

uBO makes use of Canvas, you disabled Canvas reading functionality browser-wide, so it fails to read img data and browser spews Uncaught DomException

@gorhill
Copy link
Member

gorhill commented Nov 2, 2018

Not just uBO, I think that error also existed before using Canvas for the toolbar icon, the extension API itself makes use of the Canvas API for the same purpose if I am not mistaken (just try with any other extension).

@uBlock-user
Copy link
Contributor

Yes, happens with uMatrix and other VPN extensions too, where chromium fails to set icon.

@gorhill
Copy link
Member

gorhill commented Nov 2, 2018

I can't find any such issue on Chromium issue tracker -- so I am not sure anymore where I saw this before.

@uBlock-user
Copy link
Contributor

@uBlock-user uBlock-user added the Chromium specific to Chromium/Chrome label Nov 2, 2018
@gorhill
Copy link
Member

gorhill commented Nov 2, 2018

No, that one is not related to the extension API.

I did add the code to catch and handle the exception, and now the extension API framework throws, I think this is what I must have seen before -- so even fixing uBO's code, there are still errors thrown from within the extension API framwork:

extensions::setIcon:20 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
at Image.img.onload (extensions::setIcon:20:36)
extensions::setIcon:20 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
at Image.img.onload (extensions::setIcon:20:36)

@gorhill
Copy link
Member

gorhill commented Nov 2, 2018

I get the same errors with other extensions.

I will fix uBO handling the exception, but there will still be exceptions in the extension API framework, and these need to be reported to Chromium devs.

@uBlock-user
Copy link
Contributor

so even fixing uBO's code, there are still errors thrown from within the extension API framwork:

Yes, they will remain as chromium also access for setting extension icon via Canvas API when an extension is enabled after being disabled

@uBlock-user uBlock-user added fixed issue has been addressed and removed something to address something to address labels Nov 2, 2018
@gorhill
Copy link
Member

gorhill commented Nov 2, 2018

This is where I saw this before: gorhill/uBlock#1509.

@uBlock-user
Copy link
Contributor

Did you implement the fix suggested in gorhill/uBlock#1509 (comment) ?

@gorhill
Copy link
Member

gorhill commented Nov 2, 2018

I disagree the workaround is sane -- it requires to hard-code the image data in the extension code.

@ghost
Copy link

ghost commented Nov 2, 2018

I am getting the exact same error without using "--disable-reading-from-canvas" in ungoogled-chromium 70.0.3538.77 in Linux. It appears both in uBO 1.17.2 and uMatrix 1.3.14. I don't know if this is related but searching chrome://flags for "canvas" shows that I have #fingerprinting-canvas-measuretext-noise and #fingerprinting-canvas-image-data-noise enabled (flags which are custom to UGC).

@uBlock-user
Copy link
Contributor

@AnChEv #296 (comment)

@ghost
Copy link

ghost commented Nov 3, 2018

@uBlock-user yes, I saw that. Just wanted to mention that it happens even without the option reported by the OP.

@uBlock-user
Copy link
Contributor

because you have two other flags enabled, disable them and it won't happen.

@krystian3w krystian3w mentioned this issue Sep 3, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chromium specific to Chromium/Chrome fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

2 participants