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

Interaction with iframe that's from the same origin is incorrect #27

Open
yuhao opened this issue May 11, 2016 · 1 comment
Open

Interaction with iframe that's from the same origin is incorrect #27

yuhao opened this issue May 11, 2016 · 1 comment

Comments

@yuhao
Copy link
Owner

yuhao commented May 11, 2016

Consider the following code:

var el = document.getElementById("testid");
var iframe = document.getElementById("iframe");                                                   
var iframeDocument = iframe.contentWindow.document;                                               
iframeDocument.write("<html><head></head><body><p id=\"xxx\" >Main title</p></body></html>");     
var iframeBody = iframeDocument.body;
iframeBody.appendChild(el);

iframeDocument is not instrumented, so is iframeBody. iframeBody.appendChild(el); leads to a crash.

We observed this behavior in pubads_impl_86.js from www.cnn.com.

@yuhao
Copy link
Owner Author

yuhao commented May 11, 2016

The key to fix this issue is that we should always try to create a proxy for iframe's window. When the iframe is from the same origin this fix will allow us to instrument iframe DOM operations, and when the iframe is from a different origin, it should not work anyways.

@yuhao yuhao changed the title Code in iframe that interacts with the root window document could be incorrect Interaction with iframe that's from the same origin is incorrect May 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant