mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
84797e72d2
--HG-- extra : transplant_source : %1Et%11L%F7%13%F6%FCl%C4%0C%C8%95%04%AF-%14%0E%C1%B5
94 lines
3.5 KiB
HTML
94 lines
3.5 KiB
HTML
<head>
|
|
<title>NPN_Get/PostURLNotify tests</title>
|
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<body onload="runTests()">
|
|
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var pending = 6;
|
|
function testDone() {
|
|
dump("testDone: " + pending + "\n")
|
|
--pending;
|
|
|
|
// Wait for a bit so that any unexpected notifications from the
|
|
// malformed data or null-post tests are received.
|
|
if (0 == pending)
|
|
window.setTimeout(SimpleTest.finish, 2000);
|
|
}
|
|
|
|
function runTests() {
|
|
var p = document.getElementById('plugin1');
|
|
|
|
ok(p.streamTest("loremipsum.txt", false, null,
|
|
function(r, t) {
|
|
is(r, 0, "GET loremipsum.txt");
|
|
is(t.substr(0, 11), "Lorem ipsum",
|
|
"GET loremipsum.txt correct");
|
|
testDone();
|
|
}), "streamTest GET");
|
|
|
|
ok(!p.streamTest("post.sjs", true, null,
|
|
function(r, t) {
|
|
ok(false, "Shouldn't get callback from null post");
|
|
}), "streamTest POST null postdata");
|
|
|
|
ok(p.streamTest("post.sjs", true, "Something good",
|
|
function(r, t) {
|
|
is(r, 0, "POST something good");
|
|
is(t, "Something good", "POST non-null correct");
|
|
testDone();
|
|
}), "streamTest POST valid postdata");
|
|
|
|
ok(p.streamTest("http://example.invalid/", false, null,
|
|
function(r, t) {
|
|
is(r, 1, "Shouldn't load example.invalid DNS name");
|
|
testDone();
|
|
}), "streamTest GET bad DNS");
|
|
|
|
ok(p.streamTest("http://localhost:-8/", false, null,
|
|
function(r, t) {
|
|
is(r, 1, "Shouldn't load invalid URI");
|
|
testDone();
|
|
}), "streamTest GET invalid URL");
|
|
|
|
ok(p.streamTest("javascript:'Hello';", false, null,
|
|
function(r, t) {
|
|
is(r, 0, "GET javascript: URI");
|
|
is(t, "Hello", "GET javascript: URI correct");
|
|
testDone();
|
|
}), "streamTest GET javascript: URI");
|
|
|
|
/*
|
|
* XXX/cjones: disabled for now because it appears to be hard to make
|
|
* mochitest ignore the malformed javascript
|
|
|
|
ok(!p.streamTest("javascript:syntax##$&*@error-*", false, null,
|
|
function(r, t) {
|
|
is(r, 1, "Shouldn't load invalid javascript: URI");
|
|
testDone();
|
|
}), "streamTest GET bad javascript: URI");
|
|
*/
|
|
|
|
ok(p.streamTest("data:text/plain,World", false, null,
|
|
function(r, t) {
|
|
is(r, 0, "GET data: URI");
|
|
is(t, "World", "GET data: URI correct");
|
|
testDone();
|
|
}), "streamTest GET data: URI");
|
|
|
|
/*
|
|
* XXX/bsmedberg: disable this test as well, since the pluginhost is broken
|
|
* and the testplugin is double-deleting the urlnotify context.
|
|
|
|
ok(!p.streamTest("data:malformed?", false, null,
|
|
function(r, t) {
|
|
todo(false, "Shouldn't get callback for invalid data: URI");
|
|
}), "streamTest GET bad data: URI");
|
|
*/
|
|
}
|
|
</script>
|