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

Illegal invocation error on call 'FileListWrapper.item' method #1446

Closed
miherlosev opened this issue Jan 16, 2018 · 3 comments
Closed

Illegal invocation error on call 'FileListWrapper.item' method #1446

miherlosev opened this issue Jan 16, 2018 · 3 comments
Assignees
Labels
AREA: client !IMPORTANT! STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@miherlosev
Copy link
Contributor

Markup to reproduce:

<html>
	<body>
		<input type="file" id="test" multiple>
		<script>
			var testFile = document.getElementById('test');
			
			testFile.addEventListener('change', function (event) {
		
				 var files = event.target.files;
				
				for (var i = 0; i < files.length; i++) {
					console.log('retrieving file', i);
					
					var f = files.item(i); // Illegal invocation
					var formData = new FormData();
					console.log('about to append form data');
					formData.append(event.target.name, f, f.name);
					console.log('form data appended');
				}
			});
		</script>
	</body>
</html>
@javiercbk
Copy link

javiercbk commented Jan 24, 2018

I've created a PR that solves this issue.

I've tested it using hammerhead's playground and it is working. It seems that the item method on the FileListWrapper was being overwritten by some native method that was causing this error.

The PR is not the "cleanest" solution but it should help you pinpoint the exact problem, hope it helps

miherlosev pushed a commit to miherlosev/testcafe-hammerhead that referenced this issue Jan 25, 2018
@miherlosev
Copy link
Contributor Author

Hi, @javiercbk .
Thanks for your work. It helps us to fix the issue.
I've created the separate PR containing your fix and the test for it.

AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
@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 !IMPORTANT! STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

3 participants