Bug 219612 - Parse content after # in data URLs with HLS mime types
Summary: Parse content after # in data URLs with HLS mime types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-07 13:27 PST by Alex Christensen
Modified: 2020-12-07 18:02 PST (History)
10 users (show)

See Also:


Attachments
Patch (8.65 KB, patch)
2020-12-07 13:31 PST, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (8.72 KB, patch)
2020-12-07 14:05 PST, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (9.01 KB, patch)
2020-12-07 14:53 PST, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (9.03 KB, patch)
2020-12-07 14:57 PST, Alex Christensen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2020-12-07 13:27:36 PST
Parse content after # in data URLs with HLS mime types
Comment 1 Alex Christensen 2020-12-07 13:31:18 PST
Created attachment 415576 [details]
Patch
Comment 2 Alex Christensen 2020-12-07 13:31:21 PST
<rdar://problem/71039282>
Comment 3 Darin Adler 2020-12-07 13:47:24 PST
Comment on attachment 415576 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=415576&action=review

> Source/WebCore/platform/network/DataURLDecoder.cpp:48
> +static bool shouldRemoveFragmentIdentifier(const String& mediaType)

I’d like to see a "why" comment mentioning the reason for the MIME type special cases here.

Also wondering if we will keep this forever.

> Source/WebCore/platform/network/DataURLDecoder.cpp:55
> +    return !equalIgnoringASCIICase(mediaType, "video/mpegURL")
> +        && !equalIgnoringASCIICase(mediaType, "audio/mpegURL");

This could instead be written in this slightly more efficient way:

    return !equalLettersIgnoringASCIICase(mediaType, "video/mpegurl")
        && !equalLettersIgnoringASCIICase(mediaType, "audio/mpegurl");

> Source/WebCore/platform/network/DataURLDecoder.cpp:127
> -    const String urlString;
> +    URL url;

This is a much bigger object. Is that OK?
Comment 4 Darin Adler 2020-12-07 13:56:08 PST
Comment on attachment 415576 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=415576&action=review

> Source/WebCore/platform/network/DataURLDecoder.cpp:54
> +    return !equalIgnoringASCIICase(mediaType, "video/mpegURL")

Would be nice if this was turned off if "Disable Site-specific Hacks" was set. While we are not limiting this to a particular website, turning this off to test if the website works without the quirk is something that fits the mission of that menu item and switch.
Comment 5 Darin Adler 2020-12-07 13:57:22 PST
Comment on attachment 415576 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=415576&action=review

>> Source/WebCore/platform/network/DataURLDecoder.cpp:54
>> +    return !equalIgnoringASCIICase(mediaType, "video/mpegURL")
> 
> Would be nice if this was turned off if "Disable Site-specific Hacks" was set. While we are not limiting this to a particular website, turning this off to test if the website works without the quirk is something that fits the mission of that menu item and switch.

Do non-Apple WebKit ports want this quirk? I’m guessing no, since they don’t have HTTP Live Streaming.
Comment 6 Alex Christensen 2020-12-07 14:00:50 PST
From what I understand, this is not site-specific or likely to go away because HLS manifests use # in the middle and aren't about to stop.  I will restrict it to cocoa platforms, though.
Comment 7 Alex Christensen 2020-12-07 14:02:44 PST
A URL is 32 bytes bigger than a String, but that's not significant compared to sizeof(DecodeTask) plus typical data URL sizes, and it's a very short-lived object.  We need the URL to know where to start removing the fragment that we've already found when parsing the URL.
Comment 8 Alex Christensen 2020-12-07 14:05:29 PST
Created attachment 415581 [details]
Patch
Comment 9 Alex Christensen 2020-12-07 14:53:05 PST
Created attachment 415588 [details]
Patch
Comment 10 Darin Adler 2020-12-07 14:55:50 PST
Comment on attachment 415588 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=415588&action=review

> Source/WebCore/platform/network/DataURLDecoder.cpp:58
> +    return !equalIgnoringASCIICase(mediaType, "video/mpegurl")
> +        && !equalIgnoringASCIICase(mediaType, "audio/mpegurl")
> +        && !equalIgnoringASCIICase(mediaType, "application/x-mpegurl")
> +        && !equalIgnoringASCIICase(mediaType, "vnd.apple.mpegurl");

This lowercases things as required by equalLettersIgnoringASCIICase, but didn’t add the word "Letters" to the function name.
Comment 11 Alex Christensen 2020-12-07 14:57:35 PST
Created attachment 415591 [details]
Patch
Comment 12 EWS 2020-12-07 15:44:10 PST
Committed r270526: <https://trac.webkit.org/changeset/270526>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 415591 [details].