| Index: LayoutTests/loader/iframe-sync-loads.html
|
| diff --git a/LayoutTests/loader/iframe-sync-loads.html b/LayoutTests/loader/iframe-sync-loads.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..34b3177ad2892ef773d22998e8a76a6b078b07bd
|
| --- /dev/null
|
| +++ b/LayoutTests/loader/iframe-sync-loads.html
|
| @@ -0,0 +1,59 @@
|
| +<body>
|
| +<pre id="log"></pre>
|
| +<script>
|
| +function log(msg) {
|
| + document.getElementById("log").textContent += msg + "\n";
|
| +}
|
| +
|
| +function getText(iframe) {
|
| + return iframe.contentDocument.documentElement.textContent;
|
| +}
|
| +
|
| +var testIndex = 0;
|
| +
|
| +function runTest(name, testFunction) {
|
| + var iframe = document.createElement('iframe');
|
| + document.body.appendChild(iframe);
|
| +
|
| + var expectedText = "foo " + testIndex;
|
| + iframe.onerror = function() {
|
| + log(name + ' error ' + getText(iframe));
|
| + }
|
| + testFunction(iframe, expectedText);
|
| + var resultText = getText(iframe);
|
| + if (resultText == expectedText) {
|
| + log(' sync : ' + name);
|
| + iframe.parentNode.removeChild(iframe);
|
| + nextTest();
|
| + } else {
|
| + iframe.onload = function() {
|
| + log('ASYNC : ' + name);
|
| + iframe.parentNode.removeChild(iframe);
|
| + nextTest();
|
| + }
|
| + }
|
| +}
|
| +
|
| +var tests = [
|
| + { name: 'src = javascript:"content"', testFunction: function(iframe, expectedText) { iframe.src = 'javascript: "' + expectedText + '"'} },
|
| + { name: 'src = data:text/html,content', testFunction: function(iframe, expectedText) { iframe.src = 'data:text/html,"' + expectedText + '"'} },
|
| + { name: 'srcdoc = "content"', testFunction: function(iframe, expectedText) { iframe.src = 'data:text/html,"' + expectedText + '"'} },
|
| +];
|
| +
|
| +if (window.testRunner) {
|
| + testRunner.dumpAsText();
|
| + testRunner.waitUntilDone();
|
| +}
|
| +
|
| +function nextTest() {
|
| + if (testIndex >= tests.length) {
|
| + log("done");
|
| + if (window.testRunner)
|
| + testRunner.notifyDone();
|
| + return;
|
| + }
|
| + var test = tests[testIndex++];
|
| + runTest(test.name, test.testFunction);
|
| +}
|
| +nextTest();
|
| +</script>
|
|
|