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

Yellow click on images not working #5

Open
LinqLover opened this issue Nov 6, 2020 · 2 comments
Open

Yellow click on images not working #5

LinqLover opened this issue Nov 6, 2020 · 2 comments

Comments

@LinqLover
Copy link

I tried it with MMBrowser openOn: 'https://github.com/cmfcmf/MagicMouse/', but unfortunately, yellow clicks on the images in the readme appear not to work. I also could not select images from any other site using the yellow mouse button. Is this feature broken or am I visiting the wrong sites?

@cmfcmf
Copy link
Owner

cmfcmf commented Nov 11, 2020

Hi Christoph,
thank you for bringing this up! Indeed, accessing images from many modern websites like GitHub does not work. That's because GitHub uses a fairly restrictive Content Security Policy, which disallows many operations of the JavaScript code I inject to extract images. I have verified that it works fine on websites without or with less restrictive Content Security Policys, like https://squeak.org. Could you check whether it works for you there?

You could also enable the "Debug to Transcript" preference (I just pushed a commit that fixes preferences). You should see a stacktrace like the following when trying to extract images from websites with CSPs:

Error: Evaluation failed: DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
    at img2Base64 (__puppeteer_evaluation_script__:121:19)
    at extractImg (__puppeteer_evaluation_script__:141:27)
    at async Promise.all (index 0)
    at ExecutionContext._evaluateInternal (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/ExecutionContext.js:122:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  -- ASYNC --
    at ExecutionContext.<anonymous> (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/helper.js:111:15)
    at DOMWorld.evaluate (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/DOMWorld.js:112:20)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  -- ASYNC --
    at Frame.<anonymous> (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/helper.js:111:15)
    at Page.evaluate (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/Page.js:876:43)
    at Page.<anonymous> (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/helper.js:112:23)
    at run (/snapshot/MagicMouse/run.js:632:37)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
No elements found to create a portal

(I tested this in Squeak 5.3, not sure about Squeak 6)

@LinqLover
Copy link
Author

Hi Christian, thanks for the feedback!

I have verified that it works fine on websites without or with less restrictive Content Security Policys, like https://squeak.org. Could you check whether it works for you there?

Yes this works, great to know the feature is not broken itself.

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

2 participants