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
Error when requesting blob object urls through XHR #2634
Comments
Thank you for submitting this issue. We would love to assist you and diagnose it. However, we need a simple sample that we can easily run on our side in order to replicate the issue and research its cause. Without a sample, we are not able to figure out what's going on and why this issue occurs. We look forward to your response. |
Hey, sorry! just added more details. Please let me know if y'all need anything else from my side. |
Hi @acostajohn Thank you for the shared information. I've reproduced the issue. For team
<html>
<body>
<button id="send">Send blob via xhr</button>
<script>
var sendBtn = document.getElementById('send');
sendBtn.addEventListener('click', function () {
const blob = new Blob(['this is a text'], { type: 'plain/text' });
const url = URL.createObjectURL(blob);
const xhr = new XMLHttpRequest();
xhr.open('get', url, false);
xhr.addEventListener('load', () => {
console.log(xhr.responseText);
});
xhr.send();
});
</script>
</body>
</html> in |
Hi, any updates here? |
No updates yet. Once we get any results, we will post them in this thread. |
Hello I want to try to fix this issue, by adding check for reqOpts variable existence in send method override:
and test
|
Please submit a Pull Request with the fix. See the Сontribution guide for more information. |
What is your Scenario?
Using XHR to request object urls of type
blob:
will make hammerhead error out and thus, the request is not made.I tracked down the exception to this line which expects
reqOpts
to have a value in thesend
wrapper, but no values where defined in theopen
method wrapper because it is a local object url.Here is where the request options are supposed to be set (
xhr.open
). This only happens forhttp
andfile
domains, not forblob
which I think makes sense.testcafe-hammerhead/src/client/sandbox/xhr.ts
Line 149 in a878aef
And here in
xhr.send
it tries to retrieve the request options which never fails for regular requests tohttp
urls, but since those never are set forblob:
urls, it fails badly.testcafe-hammerhead/src/client/sandbox/xhr.ts
Line 162 in a878aef
What is the Current behavior?
Considering the following snippet:
Because of the exception, the request is not made.
What is the Expected behavior?
xhr.send();
correctly sends the request and the event listener printsthis is a text
.What is your public web site URL?
Your website URL (or attach your complete example):
Your complete app code (or attach your test files):
Screenshots:
Steps to Reproduce:
Your Environment details:
The text was updated successfully, but these errors were encountered: