question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resource overrideMimeType not working on Edge

See original GitHub issue

TL;DR: I found a spec-compliance issue with how Resource does XHRs.

I came here to report an issue I was having with Edge, but to my surprise it isn’t Edge’s fault. I have some code that makes a Resource and calls fetchXML, treating the response as an XMLDocument. This failed in Edge, which led me to dig a bit – I noticed that my server was returning the (definitely valid XML, not HTML) content with a Content-Type of text/html. I don’t know why, it’s not under my control, so I’m stuck with it. Firefox and Chrome return an XMLDocument anyway; Edge was returning an HTMLDocument. I thought this was the bug, until I did a bunch of extra testing.

I found out that the XHR spec was recently updated to state that calling open() must reset the “override MIME type” – see bullet 12 in the current spec. I saw that the Resource class calls overrideMimeType before calling open. This results in the override getting ignored in recent builds of Edge, and the problem will get worse as other browsers come into compliance with the changes.

I believe the fix is as simple as moving the open call before the call to overrideMimeType. This would be a PR instead of an issue, but my CLA issues remain unresolved, so I’ll just point 👉

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hpinkoscommented, Sep 28, 2018

Thanks again for reporting this @thw0rted! We just merged a fix for this into master and it will be included in the 1.50 release on Monday

0reactions
mramatocommented, Sep 27, 2018

Thanks @thw0rted! I was able to replicate this behavior and opened #7091 with the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

XMLHttpRequest.overrideMimeType() - Web APIs | MDN
The XMLHttpRequest method overrideMimeType() specifies a MIME type other than the one provided by the server to be used instead when ...
Read more >
XMLHttpRequest.overrideMimeType() - Web APIs
The XMLHttpRequest method overrideMimeType() specifies a MIME type other than the one provided by the server to be used instead when interpreting the...
Read more >
xhr/overridemimetype-unsent-state-force-shiftjis is now at odds with ...
With the recent overrideMimeType changes, the WPT xhr/overridemimetype-unsent-state-force-shiftjis is now invalid (since the mimetype override is cleared as ...
Read more >
how to use xhr.overrideMimeType in Chrome / IE Edge?
So, I am trying to override the mimetype to match the same sent by Chrome on Linux which is text/csv. However the mimetype...
Read more >
capability.policy.mailnews.XMLHttpRequest.overrideMimeType
Registry Hive, HKEY_LOCAL_MACHINE. Registry Path, Software\Policies\Mozilla\lockPref. Value Name, capability.policy.mailnews.XMLHttpRequest.overrideMimeType.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found