Closed Bug 882458 Opened 11 years ago Closed 2 years ago

Hook up CORS tests to workers

Categories

(Core :: DOM: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: bent.mozilla, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch Patch, v1 (obsolete) (deleted) — Splinter Review
Attached patch hooks CORS tests up to workers and fixes a few bugs that the tests found.
Attachment #761746 - Flags: review?(jonas)
Attached patch Patch, v1.1 (obsolete) (deleted) — Splinter Review
With some test cleanups.
Attachment #761746 - Attachment is obsolete: true
Attachment #761746 - Flags: review?(jonas)
Attachment #761764 - Flags: review?(jonas)
Attached patch Patch, v1.2 (deleted) — Splinter Review
Updated, thanks to xKhorasan+mozilla@gmail.com
Attachment #761764 - Attachment is obsolete: true
Anne, this patch exposes a problem in test_bug435425.html that sicking says needs spec direction to resolve.

Basically we have a XHR POST request that is initially same-origin and has upload listeners attached. We don't do a preflight and we fire a loadstart event on the upload object. Then we redirect to some cross-origin url. Currently we fire error/loadend events at the upload object. Is that correct? As I understand it we're not supposed to fire events on the upload object if we haven't done a preflight...
Flags: needinfo?(annevk)
I think per the current specification that would require us to do a preflight before we do the cross-origin request as the mode is "CORS-with-forced-preflight" due to the listeners being attached.
Flags: needinfo?(annevk)
Ok, sicking, what do you want me to do here?
Flags: needinfo?(jonas)
Comment 5 would violate two of the design patterns that I think we've aimed for:

1. It would force implementations to be able to do a preflight after the initial request has already started.

Right now the preflight either happens before the initial request, or it doesn't happen at all. It never happens as a result of a redirect.

Gecko used to not be able to "pause" a redirect and do a preflight. This has since been fixed in Gecko, but I don't know if other implementations are able to do this.

2. It would mean that we're checking "are there any registered event listeners" at a random time.

Right now the "force preflight" flag is set when a request is first initiated. From the webpage point of view this is a very well defined point in time: When .send() is called.

If we were to check for upload event listeners when the redirect from same-origin to cross-origin happens, then that results in very racy behavior from the webpage point of view. An event handler that is added after .send() may or may not cause a preflight to happen and so may or may not affect what events are fired.
Flags: needinfo?(jonas)
1. I think this is already true. If you do a same-origin PUT request and you get a 307 redirect to a cross-origin URL, that should work.

2. The preflight flag would still be set at a deterministic point (although it is unfortunate we make listeners observable). Namely when you invoke send().
Flags: needinfo?(jonas)
(In reply to Anne (:annevk) from comment #8)
> 1. I think this is already true. If you do a same-origin PUT request and you
> get a 307 redirect to a cross-origin URL, that should work.

Mind verifying that first sentence? Has anyone implemented that?

> 2. The preflight flag would still be set at a deterministic point (although
> it is unfortunate we make listeners observable). Namely when you invoke
> send().

So if an event listener is added after send(), we'll send upload events as long as the request is same-origin, and then stop doing upload events as soon as there's a redirect to cross origin?
Flags: needinfo?(jonas)
http://dump.testsuite.org/xhr/cross-origin-upload-redirect.html seems to work in Chrome. (Just follow along in the network tab of the inspector.)

http://dump.testsuite.org/xhr/cross-origin-upload-redirect-late-listeners.html seems to suggest Chrome simply does not dispatch events on .upload if there's no listeners before send().
Flags: needinfo?(bent.mozilla)
Component: DOM → DOM: Core & HTML

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: bent.mozilla → nobody
Status: ASSIGNED → NEW

Redirect a needinfo that is pending on an inactive user to the triage owner.
:hsinyi, since the bug has recent activity, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bent.mozilla) → needinfo?(htsai)
Component: DOM: Core & HTML → DOM: Networking
Flags: needinfo?(htsai)

I think we can close this one, since we probably have necessary tests for this.
If not, feel free to reopen.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: