Bug 172873 - Implement content sniffing for blob URLs
Summary: Implement content sniffing for blob URLs
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar, WebExposed
Depends on:
Blocks:
 
Reported: 2017-06-02 14:33 PDT by Daniel Bates
Modified: 2017-06-07 14:22 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2017-06-02 14:33:48 PDT
Following up from a conversation in <https://github.com/w3c/FileAPI/issues/82>, we should apply the MIME type sniffing algorithm when navigating to a blob URL. Currently we do not implement support for content sniffing for blob URLs. When navigating to a blob URL that does not have a type (content-type) we start a download because we do not apply the MIME type sniffing algorithm as part of step 4 of the "process a navigate response" algorithm in the HTML standard: <https://html.spec.whatwg.org/#process-a-navigate-response> (2 June 2017). Instead we should apply the MIME type sniffing algorithm.

Note WebKit defers to the underlying network stack (CFNetwork) to implement content sniffing. Unless we move such content sniffing into WebCore, we may need new API/SPI to access the content sniffing algorithm in the underlying network stack.

Example:

Open a page with the following markup:

<!DOCTYPE html>
<html>
<body>
<script>
var frame = document.createElement("iframe");
frame.src = URL.createObjectURL(new Blob(["<h1>Hello</h1>"]));
document.body.appendChild(frame)
</script>
</body>
</html>

Then you should see "Hello" (rendered as HTML) in the frame. But in Safari Version 10.1 (12603.1.24) we initiate a download.
Comment 1 Radar WebKit Bug Importer 2017-06-02 14:34:11 PDT
<rdar://problem/32544847>