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

The document.open function throws an error because document.defaultView returns null #1272

Closed
LavrovArtem opened this issue Aug 18, 2017 · 2 comments
Assignees
Labels
AREA: client health-monitor STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@LavrovArtem
Copy link
Contributor

LavrovArtem commented Aug 18, 2017

Error message: Uncaught TypeError: Cannot read property 'top' of null
Find on http://www.virgilio.it/.
Example for reproducing:

<body>
<script>
	var counter = 0;
	var getHtml = function () {
		return '<div>Hello ' + (counter++) + '</div>';
	};
	
	var loadHandler = function (iframe) {
		var win = iframe.contentWindow;
		var doc = iframe.contentDocument;
		
		win.__renderer__ || (win.__renderer__ = true, setTimeout(function () {
			doc.open();
			doc.write(getHtml());
			win.__renderer__ = true;
			doc.close();
		}, 0));
	}
	
	var div = document.createElement('div');
	
	div.innerHTML = '<iframe src="javascript:\'\';" onload="eval(\'(\' + loadHandler' +
					'.toString() + \')(this);\')"></iframe>';
	
	var iframe = div.firstChild;
	
	document.body.appendChild(iframe);
</script>
</body>
@LavrovArtem
Copy link
Contributor Author

I'm working on this

LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Aug 21, 2017
@churkin churkin closed this as completed in cb25e7f Sep 4, 2017
AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…ultView returns null` (close DevExpress#1272) (DevExpress#1279)

* fix `The document.open function throws an error because document.defaultView returns null` (close DevExpress#1272)

* test refactoring

* fix review's issues

* fix review's issues
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client health-monitor STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

1 participant