Skip to content

Request onRequest with async: false fires too late in webkit/trident #2317

@DimitarChristoff

Description

@DimitarChristoff

The request fires on time, we just have it in the wrong place as it seems that webkit won't allow DOM updates once the xhr object exists with async...

http://jsfiddle.net/dimitar/gDjJG/

https://github.com/mootools/mootools-core/blob/master/Source/Request/Request.js#L199-212

it looks as if as soon as the xhr object is created with async: false, webkit locks the UI thread for DOM manipulations so that the onRequest DOM update never arrives. It does run the callback but the visual update does not happen until the UI thread is unlocked. in the test you can query back the html property of the element and it is correct, although it's not so on-screen.

possible solution would be to move the fireEvent further up before the xhr.open - what downsides can there be? I suppose if setRequesHeaders fails, it's not nice to have dispatched the onRequest before the onException - though I see little options...

works as expected in gecko.

update also fails in IE9

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/55911-request-onrequest-with-async-false-fires-too-late-in-webkit-trident?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions