diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d23a96709d6..ca5527b83dc 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -386,9 +386,12 @@ typedef struct task_t {
enum {
TASK_SETDOWNLOADSTATE,
TASK_PARSECOMPLETE,
- TASK_SETPROGRESS
+ TASK_SETPROGRESS,
+ TASK_START_BINDING
} task_id;
+ BSCallback *bscallback;
+
struct task_t *next;
} task_t;
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 1d1ec90b68f..973adcf6f68 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -605,6 +605,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
PRBool is_doc_uri;
LPCWSTR wine_url;
nsresult nsres;
+ task_t *task;
HRESULT hres;
TRACE("(%p)->(%p %p)\n", This, aListener, aContext);
@@ -718,8 +719,14 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
bscallback->nscontext = aContext;
}
- start_binding(bscallback);
- IBindStatusCallback_Release(STATUSCLB(bscallback));
+ task = mshtml_alloc(sizeof(task_t));
+
+ task->doc = bscallback->doc;
+ task->task_id = TASK_START_BINDING;
+ task->next = NULL;
+ task->bscallback = bscallback;
+
+ push_task(task);
return NS_OK;
}
diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c
index 84108d1b886..f6030f1ac5d 100644
--- a/dlls/mshtml/task.c
+++ b/dlls/mshtml/task.c
@@ -217,6 +217,12 @@ static void set_progress(HTMLDocument *doc)
}
}
+static void task_start_binding(BSCallback *bscallback)
+{
+ start_binding(bscallback);
+ IBindStatusCallback_Release(STATUSCLB(bscallback));
+}
+
static void process_task(task_t *task)
{
switch(task->task_id) {
@@ -226,6 +232,8 @@ static void process_task(task_t *task)
return set_parsecomplete(task->doc);
case TASK_SETPROGRESS:
return set_progress(task->doc);
+ case TASK_START_BINDING:
+ return task_start_binding(task->bscallback);
default:
ERR("Wrong task_id %d\n", task->task_id);
}