Commit 34dd3dd2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Support onload handlers in script elements.

parent da30fa03
......@@ -723,12 +723,22 @@ static void dispatch_script_readystatechange_event(HTMLScriptElement *script)
DOMEvent *event;
HRESULT hres;
hres = create_document_event(script->element.node.doc, EVENTID_READYSTATECHANGE, &event);
if(FAILED(hres))
return;
if(script->readystate != READYSTATE_LOADED ||
dispex_compat_mode(&script->element.node.event_target.dispex) < COMPAT_MODE_IE10) {
hres = create_document_event(script->element.node.doc, EVENTID_READYSTATECHANGE, &event);
if(SUCCEEDED(hres)) {
dispatch_event(&script->element.node.event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);
}
}
dispatch_event(&script->element.node.event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);
if(script->readystate == READYSTATE_LOADED) {
hres = create_document_event(script->element.node.doc, EVENTID_LOAD, &event);
if(SUCCEEDED(hres)) {
dispatch_event(&script->element.node.event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);
}
}
}
typedef struct {
......@@ -758,6 +768,10 @@ static void set_script_elem_readystate(HTMLScriptElement *script_elem, READYSTAT
{
script_elem->readystate = readystate;
if(readystate != READYSTATE_LOADED &&
dispex_compat_mode(&script_elem->element.node.event_target.dispex) >= COMPAT_MODE_IE11)
return;
if(readystate != READYSTATE_INTERACTIVE) {
if(!script_elem->element.node.doc->window->parser_callback_cnt) {
fire_readystatechange_task_t *task;
......
......@@ -323,3 +323,40 @@ sync_test("conditional_comments", function() {
test_version(7);
test_version(8);
});
var ready_states;
async_test("script_load", function() {
var v = document.documentMode;
if(v < 9) {
next_test();
return;
}
var elem = document.createElement("script");
ready_states = "";
elem.onreadystatechange = guard(function() {
ok(v < 11, "unexpected onreadystatechange call");
ready_states += elem.readyState + ",";
});
elem.onload = guard(function() {
switch(v) {
case 9:
ok(ready_states === "loading,exec,loaded,", "ready_states = " + ready_states);
break;
case 10:
ok(ready_states === "loading,exec,", "ready_states = " + ready_states);
break;
case 11:
ok(ready_states === "exec,", "ready_states = " + ready_states);
break;
}
next_test();
});
document.body.appendChild(elem);
elem.src = "jsstream.php?simple";
external.writeStream("simple", "ready_states += 'exec,';");
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment