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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1240471
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1240471</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
let SimpleTest = {
finish: function() {
parent.postMessage(JSON.stringify({fn: "finish"}), "*");
}
};
["ok", "is", "info"].forEach(fn => {
self[fn] = function (...args) {
parent.postMessage(JSON.stringify({fn: fn, args: args}), "*");
}
});
"use strict";
function onLoad() {
let youtube_changed_url_query = "https://mochitest.youtube.com/embed/Xm5i5kbIXzc?start=10&end=20";
function testEmbed(embed, expected_url, expected_fullscreen) {
ok (!!embed, "Embed node exists");
// getSVGDocument will return HTMLDocument if the content is HTML
let doc = embed.getSVGDocument();
// doc must be unprivileged because privileged doc will always be
// allowed to use fullscreen.
is (doc.fullscreenEnabled, expected_fullscreen,
"fullscreen should be " + (expected_fullscreen ? "enabled" : "disabled"));
embed = SpecialPowers.wrap(embed);
is (embed.srcURI.spec, expected_url, "Should have src uri of " + expected_url);
}
info("Running youtube rewrite query test");
testEmbed(document.getElementById("testembed-correct"), youtube_changed_url_query, false);
testEmbed(document.getElementById("testembed-correct-fs"), youtube_changed_url_query, true);
testEmbed(document.getElementById("testembed-wrong"), youtube_changed_url_query, false);
testEmbed(document.getElementById("testembed-whywouldyouevendothat"), youtube_changed_url_query, true);
SimpleTest.finish();
}
</script>
</head>
<body onload="onLoad()">
<embed id="testembed-correct"
src="https://mochitest.youtube.com/v/Xm5i5kbIXzc?start=10&end=20"
type="application/x-shockwave-flash"
allowscriptaccess="always"></embed>
<embed id="testembed-correct-fs"
src="https://mochitest.youtube.com/v/Xm5i5kbIXzc?start=10&end=20"
type="application/x-shockwave-flash"
allowfullscreen
allowscriptaccess="always"></embed>
<embed id="testembed-wrong"
src="https://mochitest.youtube.com/v/Xm5i5kbIXzc&start=10&end=20"
type="application/x-shockwave-flash"
allowscriptaccess="always"></embed>
<embed id="testembed-whywouldyouevendothat"
src="https://mochitest.youtube.com/v/Xm5i5kbIXzc&start=10?end=20"
type="application/x-shockwave-flash"
allowfullscreen
allowscriptaccess="always"></embed>
</body>
</html>
|