/
swf-as-src-of-iframe.html
46 lines (41 loc) · 1.65 KB
/
swf-as-src-of-iframe.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<head>
<title>Test that iframe with src set to swf uses plugin document</title>
<!--- This will ensure that the "missing plugin text" is shown when the FlashPlayer plugin is disabled. -->
<script>
function runTest() {
framedocument = document.getElementById('frame').contentWindow.document;
innerhtml = framedocument.getElementsByTagName('body')[0].innerHTML;
if (innerhtml[0] === 'C') {
// This is the 'C' from the ActionScript SWC. The contents are being
// rendered as text. Fail the test.
document.getElementById('console').textContent = "FAILED due to plugin rendered as gibberish text (PR293098).";
} else {
var flashplayerLoaded = false;
for (i = 0; i < navigator.plugins.length; ++i) {
for (j = 0; j < navigator.plugins[i].length; ++j) {
if (navigator.plugins[i][j].type == "application/x-shockwave-flash") {
flashplayerLoaded = true;
}
}
}
if (flashplayerLoaded) {
document.getElementById('console').textContent = "FAILED due to FlashPlayer plugin enabled. Please disable it.";
} else if (framedocument.getElementsByTagName('embed')[0]){
// There is an embed element instead of gibberish text. This is what we
// want and indicates that a plugin document was created instead of an
// HTML document.
document.getElementById('console').textContent = "PASSED";
} else {
document.getElementById('console').textContent = "FAILED for an unknown reson.";
}
}
}
</script>
</head>
<body onload="runTest();">
<iframe id="frame" src="../../../plugins/resources/simple_blank.swf" width="100" height="100">
</iframe>
<div id="console"></div>
</body>
</html>