Omitting contentType in browser.protocol.registerProtocol crashes nightly
lidel opened this issue · comments
I've been experimenting with Protocol handler API (#2) and tried to follow suggestion from #2 (comment):
contentType/contentEncoding
In IPFS we do not store mime-types along with data, so we don't know it before data starts arriving. Public HTTP gateways are doing mime-type-sniffing and we will have to do the same in browser.
Question: is it possible for Firefox to provide access to its own mime-type-sniffer? Perhaps setting contentType to auto or null could enable already existing heuristics described here?
Reusing it would be more elegant than doing mime-sniffing in userland.I believe omitting
contentType
/contentEncoding
would do exactly that.
Feedback from battlefield: while it is ok to omit contentEncoding
, I get browser crash if I don't include contentType
.
Steps to reproduce
- Checkout current HEAD (c36533e) and grab yesterday's Nightly 63.0a1
- Comment out this line:
libdweb/demo/protocol/protocol.js
Line 19 in c36533e
yarn && yarn demo:protocol
- Open
dweb://crash
- Nightly dies:
@lidel Thanks for reporting. I'll look into this