mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Fix race condition in XHR and handle other abort/open scenarios
This fixes issue #3630 A short summary of the changes: * Use generation id to cancel inflight requests * Handles nested calls to abort, open, send inside handlers * Adds XHRReleaseMsg to delay freeing XHR object till all inflight events are processed * Change the ErroredMsg enum to be more symmetric with the returned Error enum
This commit is contained in:
parent
1a3ff8739c
commit
7435db26ac
3 changed files with 242 additions and 135 deletions
|
@ -19,7 +19,7 @@ use dom::workerglobalscope::DedicatedGlobalScope;
|
|||
use dom::workerglobalscope::{WorkerGlobalScope, WorkerGlobalScopeHelpers};
|
||||
use dom::xmlhttprequest::XMLHttpRequest;
|
||||
use script_task::{ScriptTask, ScriptChan};
|
||||
use script_task::{ScriptMsg, FromWorker, DOMMessage, FireTimerMsg, XHRProgressMsg, WorkerRelease};
|
||||
use script_task::{ScriptMsg, FromWorker, DOMMessage, FireTimerMsg, XHRProgressMsg, XHRReleaseMsg, WorkerRelease};
|
||||
use script_task::WorkerPostMessage;
|
||||
use script_task::StackRootTLS;
|
||||
|
||||
|
@ -134,7 +134,10 @@ impl DedicatedWorkerGlobalScope {
|
|||
global.delayed_release_worker();
|
||||
},
|
||||
Ok(XHRProgressMsg(addr, progress)) => {
|
||||
XMLHttpRequest::handle_xhr_progress(addr, progress)
|
||||
XMLHttpRequest::handle_progress(addr, progress)
|
||||
},
|
||||
Ok(XHRReleaseMsg(addr)) => {
|
||||
XMLHttpRequest::handle_release(addr)
|
||||
},
|
||||
Ok(WorkerPostMessage(addr, data, nbytes)) => {
|
||||
Worker::handle_message(addr, data, nbytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue