aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-11-04 05:06:34 -0700
committerbors-servo <metajack+bors@gmail.com>2014-11-04 05:06:34 -0700
commit4e24e4d8e92528a5a6f7bb571c6557b5bca11ea9 (patch)
tree8c1c7940e8c5842c97c2861b80d354709e8b1015 /components/script/script_task.rs
parentc4cfb4aae0491ca8016d3cbae9a39a6488b24739 (diff)
parent9bafd5f28ae3351a7f94b29ed95d93eb1c4797ce (diff)
downloadservo-4e24e4d8e92528a5a6f7bb571c6557b5bca11ea9.tar.gz
servo-4e24e4d8e92528a5a6f7bb571c6557b5bca11ea9.zip
auto merge of #3732 : mukilan/servo/xhr-issue-3630, r=jdm
This fixes issue #3630 A short summary of the changes: * Use atomic 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 * Handles both timeout, errors and abort/open in a symmetric fashion i.e All inflight events will be cancelled for timeouts, aborts, errors and on calling open. * Change the ErroredMsg enum to be more symmetric with the returned Error enum I noticed a few possible changes that could make the code for fetch task simpler: * We can remove the additional timer task and let the fetch task manage its own timer (or maybe the resource loader can do this.) * The CORS related steps could also be moved into the resource loader. * Right now upload events are not support. This requires some support from resource loader.
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 7ef0d095545..5dd6f7c2d02 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),