Closed Bug 458320 Opened 16 years ago Closed 16 years ago

Workers: Support synchronous events from within XHR methods

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.1b1

People

(Reporter: bent.mozilla, Assigned: bent.mozilla)

References

Details

Attachments

(1 file)

Attached patch Patch, v1Splinter Review
Some method calls (like Abort) cause events to be generated that, according to spec, should run before returning from the method.
Attachment #341548 - Flags: superreview?(jst)
Attachment #341548 - Flags: review?(jonas)
Well, they should run immediately after the method is returned.

x = 1
client.abort()
x = 2

While the events are processed x should be 1, basically. I should really update XMLHttpRequest and XMLHttpRequest Level 2 to be described in terms of the "event loop" as defined by HTML5. I haven't had time to do that yet though.
That is not true in the mozilla implementation. We don't fire them all at the end, they fire at various points during the execution of the method.

This matters in what the state of the XHR object is when the event fires. For example when the Abort method is called we do the following (among other things)

1. Set readystate to 4
2. Fire readystatechange
3. Set readystate to 0
4. return

This means that the readystatechange event handler sees readystate 4, whereas when the function returns the readystate is 0.

Not sure if this is different from what the spec states though.
Attachment #341548 - Flags: superreview?(jst)
Attachment #341548 - Flags: superreview+
Attachment #341548 - Flags: review?(jonas)
Attachment #341548 - Flags: review+
Comment on attachment 341548 [details] [diff] [review]
Patch, v1

+  RUN_PROXIED_FUNCTION(GetAllResponseHeaders, (this, &queue, _retval));

The &queue argument is a bit out there :). Maybe you could make the macro do that internally by making the runnable hold that pointer as a member (and |this| too, maybe) rather than having to pass that in all the time?

Separate bug material, probably.

r+sr=jst
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Component: DOM: Mozilla Extensions → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: