aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorMukilan Thiyagarajan <mukilanthiagarajan@gmail.com>2014-10-11 23:50:48 +0530
committerMukilan Thiyagarajan <mukilanthiagarajan@gmail.com>2014-11-03 22:06:17 +0530
commit7435db26ac93de57c24a5c29693282cd7bbf9f6c (patch)
tree173506f994fc722c7d1ce2b766c1f25f5952fd47 /components/script/script_task.rs
parent1a3ff8739c2a17d61f295f213f31ddee25e0b3ae (diff)
downloadservo-7435db26ac93de57c24a5c29693282cd7bbf9f6c.tar.gz
servo-7435db26ac93de57c24a5c29693282cd7bbf9f6c.zip
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
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index deb6aaded80..5a6e6ca4173 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -100,6 +100,8 @@ pub enum ScriptMsg {
ExitWindowMsg(PipelineId),
/// Notifies the script of progress on a fetch (dispatched to all tasks).
XHRProgressMsg(TrustedXHRAddress, XHRProgress),
+ /// Releases one reference to the XHR object (dispatched to all tasks).
+ XHRReleaseMsg(TrustedXHRAddress),
/// Message sent through Worker.postMessage (only dispatched to
/// DedicatedWorkerGlobalScope).
DOMMessage(*mut u64, size_t),
@@ -530,7 +532,8 @@ impl ScriptTask {
FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false },
FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id),
FromConstellation(ResizeMsg(..)) => fail!("should have handled ResizeMsg already"),
- FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_xhr_progress(addr, progress),
+ FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress),
+ FromScript(XHRReleaseMsg(addr)) => XMLHttpRequest::handle_release(addr),
FromScript(DOMMessage(..)) => fail!("unexpected message"),
FromScript(WorkerPostMessage(addr, data, nbytes)) => Worker::handle_message(addr, data, nbytes),
FromScript(WorkerRelease(addr)) => Worker::handle_release(addr),