mshtml: Added IHTMLScriptElement::put_src tests.
This commit is contained in:
parent
b882b18402
commit
bfd25b4f50
|
@ -4,26 +4,82 @@ Script execution test
|
|||
<div id="b1"></div>
|
||||
<div id="b2"></div>
|
||||
<div id="b3"></div>
|
||||
<script id="emptyscript"></script>
|
||||
<script>
|
||||
function ok(b, msg) {
|
||||
return external.ok(b, msg);
|
||||
}
|
||||
|
||||
var executed = false;
|
||||
var len = document.getElementsByTagName('div').length;
|
||||
ok(len === 3, "init length = " + len);
|
||||
var extern_cnt = 0;
|
||||
|
||||
document.write("<script>"
|
||||
+ "var len = document.getElementsByTagName('div').length;"
|
||||
+ "ok(len === 3, 'unexpected length ' + len);"
|
||||
+ "executed = true;"
|
||||
+ "<" + "/script>");
|
||||
function testWriteScript() {
|
||||
var len = document.getElementsByTagName('div').length;
|
||||
ok(len === 3, "init length = " + len);
|
||||
|
||||
len = document.getElementsByTagName('script').length;
|
||||
ok(len === 2, "script col length = " + len);
|
||||
ok(executed, "written script not executed");
|
||||
document.write("<script>"
|
||||
+ "var len = document.getElementsByTagName('div').length;"
|
||||
+ "ok(len === 3, 'unexpected length ' + len);"
|
||||
+ "executed = true;"
|
||||
+ "<" + "/script>");
|
||||
|
||||
external.reportSuccess();
|
||||
len = document.getElementsByTagName('script').length;
|
||||
ok(len === 3, "script col length = " + len);
|
||||
ok(executed, "written script not executed");
|
||||
}
|
||||
|
||||
function testPutSrc() {
|
||||
var elem = document.getElementById("emptyscript");
|
||||
|
||||
ok(extern_cnt === 0, "extern_cnt = " + extern_cnt + " expected 0");
|
||||
elem.src = "externscr.js";
|
||||
ok(extern_cnt === 0, "extern_cnt = " + extern_cnt + " expected 0");
|
||||
}
|
||||
|
||||
try {
|
||||
testWriteScript();
|
||||
testPutSrc();
|
||||
}catch(e) {
|
||||
ok(false, "Got an exception");
|
||||
}
|
||||
|
||||
function testPutSrc2() {
|
||||
var elem, elem2;
|
||||
|
||||
elem = document.createElement("script");
|
||||
elem.src = "externscr.js";
|
||||
ok(extern_cnt === 1, "extern_cnt = " + extern_cnt + " expected 1");
|
||||
document.body.appendChild(elem);
|
||||
ok(extern_cnt === 2, "extern_cnt = " + extern_cnt + " expected 2");
|
||||
|
||||
elem = document.createElement("script");
|
||||
document.body.appendChild(elem);
|
||||
ok(extern_cnt === 2, "extern_cnt = " + extern_cnt + " expected 2");
|
||||
elem.src = "externscr.js";
|
||||
ok(extern_cnt === 3, "extern_cnt = " + extern_cnt + " expected 3");
|
||||
|
||||
elem2 = document.createElement("div");
|
||||
elem = document.createElement("script");
|
||||
elem.src = "externscr.js";
|
||||
ok(extern_cnt === 3, "extern_cnt = " + extern_cnt + " expected 3");
|
||||
elem2.appendChild(elem);
|
||||
document.body.appendChild(elem2);
|
||||
ok(extern_cnt === 4, "extern_cnt = " + extern_cnt + " expected 4");
|
||||
}
|
||||
|
||||
document.body.onload = function() {
|
||||
ok(extern_cnt === 1, "extern_cnt = " + extern_cnt);
|
||||
try {
|
||||
testPutSrc2();
|
||||
}catch(e) {
|
||||
ok(false, "got an exception");
|
||||
}
|
||||
|
||||
external.reportSuccess();
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
ok(extern_cnt === 1, "extern_cnt = " + extern_cnt);
|
||||
</script>
|
||||
<div id="a1"></div>
|
||||
<div id="a2"></div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
extern_cnt++;
|
|
@ -28,5 +28,8 @@ vbtest.html HTML "vbtest.html"
|
|||
/* @makedep: events.html */
|
||||
events.html HTML "events.html"
|
||||
|
||||
/* @makedep: externscr.js */
|
||||
externscr.js HTML "externscr.js"
|
||||
|
||||
/* @makedep: test_tlb.tlb */
|
||||
1 TYPELIB test_tlb.tlb
|
||||
|
|
Loading…
Reference in New Issue