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

Iframe detection #10

Merged
merged 3 commits into from
Jan 21, 2018
Merged

Iframe detection #10

merged 3 commits into from
Jan 21, 2018

Conversation

FWeinb
Copy link
Collaborator

@FWeinb FWeinb commented Jan 21, 2018

This is a tricky detection. We can use an iframe to get a fresh window object and use that to potential rerun all the tests we did on the first window object.

I mocked the tests for this to show how it would go. The apply-evasion script should be injected into each JS context and not only the first one.

* paulirish/master:
  Detect permissions.query.toString() overwrite (paulirish#7)
  Add permissions.query to `__proto__` to fool `hasOwnProperty` (paulirish#6)
* paulirish/master:
  v1.1.0
  evasion: Use Proxy to better fake toString (paulirish#8)
@paulirish paulirish merged commit 8432b1c into paulirish:master Jan 21, 2018
@paulirish
Copy link
Owner

Hah. this PR really sent me on a journey.

page.evaluateOnNewDocument uses Page.addScriptToEvaluateOnNewDocument , which says that it applies within iframes.. But that's not working here.

But note this iframe uses iframe.srcdoc = 'about:blank';. That actually doesn't make sense, as you set the content of the iframe with srcdoc. So it should be iframe.srcdoc = 'page intentionally left blank';. 😛

Anyhow, if you use the [src] attribute, like iframe.src = 'about:blank'; ... then the addScriptToEvaluateOnNewDocument succeeds.

I'm not sure why there's a difference here, but it at least seems related to this report: puppeteer/puppeteer#1106

@paulirish
Copy link
Owner

I think i've found two chromium bugs, thanks to this PR. ;)

details in puppeteer/puppeteer#1106 (comment)

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

Successfully merging this pull request may close these issues.

2 participants