Open Bug 1223457 Opened 9 years ago Updated 3 years ago

Synchronous AJAX requests break event processing

Categories

(Core :: DOM: Events, defect, P5)

42 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: thephenix, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36

Steps to reproduce:

I started a async data request, then rendered a "loading" view, which deeper in the call triggered a synchronous request. Then back at my top level function I added an event listener for the async request. However the async request had already completed and never fired the event listener.

Example code:
  event = ajax('someURL', async: true);
  b();
  event.on('complete', e => console.log('completed'));

  function b() { ajax('someOtherURL', async: false) }


I have a working example here: https://jsfiddle.net/70po71L0/2/


Actual results:

Firefox processes the ajax complete event for the async request, before finishing processing the original event (in which we try set the event listener).

In the JSFiddle example the results div ends up containing "Wrong callback function"


Expected results:

I expect the `event.on` line to be executed before Firefox triggers the ajax complete event.

In the JSFiddle example the results div ends up containing `Callback: { msg: "1 second response" }`
Component: Untriaged → DOM: Events
Product: Firefox → Core

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.