WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
184108
Align XMLHttpRequest's open() / send() / abort() with the latest specification
https://bugs.webkit.org/show_bug.cgi?id=184108
Summary
Align XMLHttpRequest's open() / send() / abort() with the latest specification
Chris Dumez
Reported
2018-03-28 12:45:53 PDT
Align XMLHttpRequest's open() / send() / abort() with the latest specification: -
https://xhr.spec.whatwg.org
Attachments
WIP Patch
(15.23 KB, patch)
2018-03-28 12:47 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
WIP Patch
(15.08 KB, patch)
2018-03-28 12:48 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
WIP Patch
(14.83 KB, patch)
2018-03-28 13:01 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
WIP Patch
(21.66 KB, patch)
2018-03-28 13:39 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
WIP Patch
(20.02 KB, patch)
2018-03-28 14:04 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(26.87 KB, patch)
2018-03-28 14:36 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(27.26 KB, patch)
2018-03-28 15:15 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(27.17 KB, patch)
2018-03-28 20:36 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2018-03-28 12:47:22 PDT
Created
attachment 336697
[details]
WIP Patch
Chris Dumez
Comment 2
2018-03-28 12:48:19 PDT
Created
attachment 336698
[details]
WIP Patch
Chris Dumez
Comment 3
2018-03-28 13:01:08 PDT
Created
attachment 336702
[details]
WIP Patch
Chris Dumez
Comment 4
2018-03-28 13:39:46 PDT
Created
attachment 336711
[details]
WIP Patch
Chris Dumez
Comment 5
2018-03-28 14:04:02 PDT
Created
attachment 336717
[details]
WIP Patch
Chris Dumez
Comment 6
2018-03-28 14:36:35 PDT
Created
attachment 336721
[details]
Patch
Chris Dumez
Comment 7
2018-03-28 15:15:58 PDT
Created
attachment 336725
[details]
Patch
youenn fablet
Comment 8
2018-03-28 18:50:44 PDT
Comment on
attachment 336725
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=336725&action=review
> Source/WebCore/xml/XMLHttpRequest.cpp:338 > + m_method = normalizeHTTPMethod(method);
We can probably normalize the method after the early returns, at the moment the spec says to set m_method.
> Source/WebCore/xml/XMLHttpRequest.cpp:381 > changeState(OPENED);
changeState is checking for m_state so we can probably call changeState directly, name is not great though.
> Source/WebCore/xml/XMLHttpRequest.cpp:591 > + // Also, only async requests support upload progress events.
Do we need this last comment?
> Source/WebCore/xml/XMLHttpRequest.cpp:622 > + return { };
As per spec, we should check for m_state and m_sendFlag, but I am not clear why we are checking for m_loader?
> Source/WebCore/xml/XMLHttpRequest.cpp:-679 > - m_state = UNSENT;
Above it is stated "// Clear headers as required by the spec", which is no longer the case. Maybe we can get rid of this comment or the spec is missing something. If we add a header, abort and add the same header, would the values be combined?
> LayoutTests/ChangeLog:14 > + per specification and those tests were also failing in Firefox.
I wonder whether these 3 tests bring actually anything compared to their WPT equivalent.
Chris Dumez
Comment 9
2018-03-28 19:13:07 PDT
Comment on
attachment 336725
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=336725&action=review
>> Source/WebCore/xml/XMLHttpRequest.cpp:338 >> + m_method = normalizeHTTPMethod(method); > > We can probably normalize the method after the early returns, at the moment the spec says to set m_method.
Good idea.
>> Source/WebCore/xml/XMLHttpRequest.cpp:381 >> changeState(OPENED); > > changeState is checking for m_state so we can probably call changeState directly, name is not great though.
Ok.
>> Source/WebCore/xml/XMLHttpRequest.cpp:591 >> + // Also, only async requests support upload progress events. > > Do we need this last comment?
I'll drop it.
>> Source/WebCore/xml/XMLHttpRequest.cpp:622 >> + return { }; > > As per spec, we should check for m_state and m_sendFlag, but I am not clear why we are checking for m_loader?
I had to add it or some WPT tests would still fail when: 1. We dispatch the loadstart event (above) 2. In the loadstart event handler, the JS calls both open() and send() again Because the JS has called open() and send() again, m_state is OPENED and m_sendFlag is true. open() normally cancels any pending load but we have no started the load yet (it happens a few lines below). Adding the m_loader check fixes the issue as we return early when we've re-entered and started a new load.
>> Source/WebCore/xml/XMLHttpRequest.cpp:-679 >> - m_state = UNSENT; > > Above it is stated "// Clear headers as required by the spec", which is no longer the case. > Maybe we can get rid of this comment or the spec is missing something. > If we add a header, abort and add the same header, would the values be combined?
I'll check.
Chris Dumez
Comment 10
2018-03-28 19:56:23 PDT
Comment on
attachment 336725
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=336725&action=review
>> LayoutTests/ChangeLog:14 >> + per specification and those tests were also failing in Firefox. > > I wonder whether these 3 tests bring actually anything compared to their WPT equivalent.
My understanding is that we are not actively trying to avoid duplication between layout tests and WPT?
Chris Dumez
Comment 11
2018-03-28 19:58:38 PDT
Comment on
attachment 336725
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=336725&action=review
>>> Source/WebCore/xml/XMLHttpRequest.cpp:622 >>> + return { }; >> >> As per spec, we should check for m_state and m_sendFlag, but I am not clear why we are checking for m_loader? > > I had to add it or some WPT tests would still fail when: > 1. We dispatch the loadstart event (above) > 2. In the loadstart event handler, the JS calls both open() and send() again > > Because the JS has called open() and send() again, m_state is OPENED and m_sendFlag is true. open() normally cancels any pending load but we have no started the load yet (it happens a few lines below). Adding the m_loader check fixes the issue as we return early when we've re-entered and started a new load.
This is the test that would fail: imported/w3c/web-platform-tests/XMLHttpRequest/loadstart-and-state.html Diff: -PASS open() during loadstart +FAIL open() during loadstart assert_equals: expected "BB-8" but got "R2-D2" This test is passing in both Firefox and Chrome.
youenn fablet
Comment 12
2018-03-28 20:24:21 PDT
> > I wonder whether these 3 tests bring actually anything compared to their WPT equivalent. > > My understanding is that we are not actively trying to avoid duplication > between layout tests and WPT?
That makes sense for tests that continue passing. When a test is obsolete, we should either think of modifying it or removing it if superseded by another test. I looked at http/tests/xmlhttprequest/onloadend-event-after-abort.html and it is not exactly a copy so they might still be useful.
> >> Source/WebCore/xml/XMLHttpRequest.cpp:622 > >> + return { }; > > > > As per spec, we should check for m_state and m_sendFlag, but I am not clear why we are checking for m_loader? > > I had to add it or some WPT tests would still fail when: > 1. We dispatch the loadstart event (above) > 2. In the loadstart event handler, the JS calls both open() and send() again > > Because the JS has called open() and send() again, m_state is OPENED and > m_sendFlag is true. open() normally cancels any pending load but we have no > started the load yet (it happens a few lines below). Adding the m_loader > check fixes the issue as we return early when we've re-entered and started a > new load.
That makes sense, maybe that is worth a comment.
Chris Dumez
Comment 13
2018-03-28 20:36:14 PDT
Created
attachment 336750
[details]
Patch
WebKit Commit Bot
Comment 14
2018-03-28 21:16:31 PDT
Comment on
attachment 336750
[details]
Patch Clearing flags on attachment: 336750 Committed
r230066
: <
https://trac.webkit.org/changeset/230066
>
WebKit Commit Bot
Comment 15
2018-03-28 21:16:33 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 16
2018-03-28 21:17:26 PDT
<
rdar://problem/38985134
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug