Bug 182325

Summary: Align with Fetch on data: URLs
Product: WebKit Reporter: Anne van Kesteren <annevk>
Component: DOMAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, ews-watchlist, fred.wang, rbuis, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 180526    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews100 for mac-sierra
none
Archive of layout-test-results from ews106 for mac-sierra-wk2
none
Archive of layout-test-results from ews115 for mac-sierra
none
Patch
none
Patch
none
Archive of layout-test-results from ews122 for ios-simulator-wk2
none
Patch
none
Archive of layout-test-results from ews124 for ios-simulator-wk2
none
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews103 for mac-highsierra
none
Archive of layout-test-results from ews107 for mac-highsierra-wk2
none
Archive of layout-test-results from ews117 for mac-highsierra
none
Archive of layout-test-results from ews123 for ios-simulator-wk2
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews112 for mac-highsierra
none
Patch none

Description Anne van Kesteren 2018-01-31 01:09:13 PST
See https://fetch.spec.whatwg.org/#data-urls.

Tests have been reviewed and landed as well: https://github.com/w3c/web-platform-tests/pull/6890.
Comment 1 Rob Buis 2018-12-01 08:47:07 PST
Created attachment 356308 [details]
Patch
Comment 2 EWS Watchlist 2018-12-01 09:49:28 PST
Comment on attachment 356308 [details]
Patch

Attachment 356308 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/10230910

New failing tests:
imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.worker.html
Comment 3 EWS Watchlist 2018-12-01 09:49:30 PST
Created attachment 356310 [details]
Archive of layout-test-results from ews100 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 4 EWS Watchlist 2018-12-01 09:59:46 PST
Comment on attachment 356308 [details]
Patch

Attachment 356308 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/10230926

New failing tests:
imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.worker.html
Comment 5 EWS Watchlist 2018-12-01 09:59:48 PST
Created attachment 356312 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 6 EWS Watchlist 2018-12-01 10:40:12 PST
Comment on attachment 356308 [details]
Patch

Attachment 356308 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/10231064

New failing tests:
imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.worker.html
Comment 7 EWS Watchlist 2018-12-01 10:40:14 PST
Created attachment 356314 [details]
Archive of layout-test-results from ews115 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 8 Rob Buis 2018-12-01 11:59:55 PST
Created attachment 356319 [details]
Patch
Comment 9 Rob Buis 2018-12-02 04:21:36 PST
Created attachment 356335 [details]
Patch
Comment 10 Rob Buis 2018-12-02 13:19:27 PST
Comment on attachment 356335 [details]
Patch

I think this is an obvious first step, but to make real progress bug 180526 needs to be improved/fixed, in order to do even better handling data URLs.
Comment 11 EWS Watchlist 2018-12-02 15:05:41 PST
Comment on attachment 356335 [details]
Patch

Attachment 356335 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10242062

New failing tests:
imported/w3c/web-platform-tests/service-workers/service-worker/register-closed-window.https.html
Comment 12 EWS Watchlist 2018-12-02 15:05:43 PST
Created attachment 356348 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 13 Rob Buis 2018-12-02 23:42:03 PST
Created attachment 356359 [details]
Patch
Comment 14 EWS Watchlist 2018-12-03 14:00:10 PST
Comment on attachment 356359 [details]
Patch

Attachment 356359 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10252148

New failing tests:
imported/w3c/web-platform-tests/service-workers/service-worker/register-closed-window.https.html
Comment 15 EWS Watchlist 2018-12-03 14:00:12 PST
Created attachment 356404 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 16 Rob Buis 2018-12-04 09:15:57 PST
Created attachment 356504 [details]
Patch
Comment 17 Rob Buis 2018-12-05 00:12:30 PST
Comment on attachment 356504 [details]
Patch

Need to fix Changelog first.
Comment 18 Rob Buis 2018-12-05 00:21:51 PST
Created attachment 356588 [details]
Patch
Comment 19 WebKit Commit Bot 2018-12-05 01:26:35 PST
Comment on attachment 356588 [details]
Patch

Clearing flags on attachment: 356588

Committed r238890: <https://trac.webkit.org/changeset/238890>
Comment 20 WebKit Commit Bot 2018-12-05 01:26:36 PST
All reviewed patches have been landed.  Closing bug.
Comment 21 Radar WebKit Bug Importer 2018-12-05 01:27:38 PST
<rdar://problem/46480987>
Comment 22 Rob Buis 2018-12-05 02:22:01 PST
Reopening since there is more that needs fixing.
Comment 23 Rob Buis 2019-01-24 12:35:54 PST
Created attachment 360026 [details]
Patch
Comment 24 Alex Christensen 2019-01-24 12:41:29 PST
Comment on attachment 360026 [details]
Patch

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

> Source/WebCore/platform/network/DataURLDecoder.cpp:53
> +    if (!isValidContentType(mediaType))
> +        return { "text/plain"_s, "US-ASCII"_s, "text/plain;charset=US-ASCII"_s, nullptr };
> +    ParsedContentType parsedContentType(mediaType);

This seems to parse the content type twice.  Could we make a ParsedContentType::isValid instead?
Comment 25 Rob Buis 2019-01-24 12:44:47 PST
Hi Alex, yeah I realized the same thing. It is on my list, not sure if I should do it before or after this patch?
Comment 26 Alex Christensen 2019-01-24 12:46:00 PST
(In reply to Rob Buis from comment #25)
> Hi Alex, yeah I realized the same thing. It is on my list, not sure if I
> should do it before or after this patch?

Before or with this patch.
Comment 27 Alex Christensen 2019-01-24 12:46:42 PST
Alternatively, you could make a static create function that returns Optional< ParsedContentType>
Comment 28 Rob Buis 2019-01-24 12:49:08 PST
(In reply to Alex Christensen from comment #27)
> Alternatively, you could make a static create function that returns
> Optional< ParsedContentType>

I think that is less explicit, so I personally would prefer isValid. Anyway I'll make a patch tomorrow and we can always decide during review.
Comment 29 Rob Buis 2019-01-25 02:48:07 PST
Created attachment 360096 [details]
Patch
Comment 30 EWS Watchlist 2019-01-25 03:49:27 PST
Comment on attachment 360096 [details]
Patch

Attachment 360096 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/10884973

New failing tests:
imported/w3c/web-platform-tests/xhr/overridemimetype-blob.html
Comment 31 EWS Watchlist 2019-01-25 03:49:29 PST
Created attachment 360101 [details]
Archive of layout-test-results from ews103 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 32 EWS Watchlist 2019-01-25 04:01:59 PST
Comment on attachment 360096 [details]
Patch

Attachment 360096 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/10885063

New failing tests:
imported/w3c/web-platform-tests/xhr/overridemimetype-blob.html
Comment 33 EWS Watchlist 2019-01-25 04:02:01 PST
Created attachment 360102 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 34 EWS Watchlist 2019-01-25 04:16:10 PST
Comment on attachment 360096 [details]
Patch

Attachment 360096 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/10884935

New failing tests:
imported/w3c/web-platform-tests/xhr/overridemimetype-blob.html
Comment 35 EWS Watchlist 2019-01-25 04:16:12 PST
Created attachment 360104 [details]
Archive of layout-test-results from ews117 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 36 EWS Watchlist 2019-01-25 04:45:58 PST
Comment on attachment 360096 [details]
Patch

Attachment 360096 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10885195

New failing tests:
imported/w3c/web-platform-tests/xhr/overridemimetype-blob.html
Comment 37 EWS Watchlist 2019-01-25 04:46:00 PST
Created attachment 360106 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 38 Rob Buis 2019-01-26 08:20:08 PST
Created attachment 360239 [details]
Patch
Comment 39 Frédéric Wang (:fredw) 2019-01-28 06:51:03 PST
Is it ready for review?
Comment 40 Alex Christensen 2019-01-28 11:25:35 PST
Comment on attachment 360239 [details]
Patch

What do the getters return if m_isValid is false?  I think I prefer making a function that returns an Optional<ParsedContentType> rather than adding a bool and assuming all future users of this class will remember to check it.  An Optional makes it syntactically required to check.
Comment 41 Rob Buis 2019-01-28 13:22:50 PST
Created attachment 360365 [details]
Patch
Comment 42 Rob Buis 2019-01-28 13:32:35 PST
Created attachment 360367 [details]
Patch
Comment 43 Rob Buis 2019-01-28 13:40:53 PST
Created attachment 360370 [details]
Patch
Comment 44 Rob Buis 2019-01-28 14:06:32 PST
(In reply to Alex Christensen from comment #40)
> Comment on attachment 360239 [details]
> Patch
> 
> What do the getters return if m_isValid is false?  I think I prefer making a
> function that returns an Optional<ParsedContentType> rather than adding a
> bool and assuming all future users of this class will remember to check it. 
> An Optional makes it syntactically required to check.

Fair enough, I now went with this approach in my latest patch.
Comment 45 Alex Christensen 2019-01-29 12:22:36 PST
Comment on attachment 360370 [details]
Patch

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

r=me

> Source/WebCore/platform/network/ParsedContentType.cpp:188
> +    if (m_contentType.contains('\r') || m_contentType.contains('\n'))

These two checks could be done in one pass. Use this function in WTFString.h:
size_t find(CodeUnitMatchFunction matchFunction, unsigned start = 0)

> Source/WebCore/platform/network/ParsedContentType.cpp:289
> +    return parsedContentType;

I think this might unnecessarily copy parsedContentType and WTFMove(parsedContentType) might not, but I could be wrong.  Please double check.
Comment 46 Rob Buis 2019-01-29 14:10:21 PST
Created attachment 360499 [details]
Patch
Comment 47 Rob Buis 2019-01-29 23:31:30 PST
(In reply to Alex Christensen from comment #45)
> Comment on attachment 360370 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=360370&action=review
> 
> r=me
> 
> > Source/WebCore/platform/network/ParsedContentType.cpp:188
> > +    if (m_contentType.contains('\r') || m_contentType.contains('\n'))
> 
> These two checks could be done in one pass. Use this function in WTFString.h:
> size_t find(CodeUnitMatchFunction matchFunction, unsigned start = 0)

Done.

> > Source/WebCore/platform/network/ParsedContentType.cpp:289
> > +    return parsedContentType;
> 
> I think this might unnecessarily copy parsedContentType and
> WTFMove(parsedContentType) might not, but I could be wrong.  Please double
> check.

I checked, copy constructor was called indeed, so I added a move constructor and used WTFMove.
Comment 48 WebKit Commit Bot 2019-01-29 23:58:54 PST
Comment on attachment 360499 [details]
Patch

Clearing flags on attachment: 360499

Committed r240706: <https://trac.webkit.org/changeset/240706>
Comment 49 WebKit Commit Bot 2019-01-29 23:58:56 PST
All reviewed patches have been landed.  Closing bug.
Comment 50 Rob Buis 2019-02-12 08:51:22 PST
Reopening to attach new patch.
Comment 51 Rob Buis 2019-02-12 08:51:25 PST
Created attachment 361798 [details]
Patch
Comment 52 EWS Watchlist 2019-02-12 10:37:25 PST
Comment on attachment 361798 [details]
Patch

Attachment 361798 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/11123220

New failing tests:
http/tests/inspector/network/resource-initiatorNode.html
Comment 53 EWS Watchlist 2019-02-12 10:37:28 PST
Created attachment 361806 [details]
Archive of layout-test-results from ews112 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 54 Rob Buis 2019-02-12 14:26:47 PST
Created attachment 361842 [details]
Patch
Comment 55 WebKit Commit Bot 2019-02-12 17:34:01 PST
Comment on attachment 361842 [details]
Patch

Clearing flags on attachment: 361842

Committed r241333: <https://trac.webkit.org/changeset/241333>
Comment 56 WebKit Commit Bot 2019-02-12 17:34:03 PST
All reviewed patches have been landed.  Closing bug.