|
1 <head> |
|
2 <title>Do plugin stream requests send the Referer header correctly?</title> |
|
3 <script type="application/javascript" |
|
4 src="/tests/SimpleTest/SimpleTest.js"></script> |
|
5 <script type="application/javascript" src="utils.js"></script> |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <body onload="runTests()"> |
|
10 <script class="testbody" type="application/javascript"> |
|
11 SimpleTest.waitForExplicitFinish(); |
|
12 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
13 |
|
14 var pending = 3; |
|
15 function testDone() { |
|
16 --pending; |
|
17 if (0 == pending) |
|
18 SimpleTest.finish() |
|
19 } |
|
20 |
|
21 function runTests() { |
|
22 var p = document.getElementById('plugin1'); |
|
23 var p2 = document.getElementById('plugin2'); |
|
24 |
|
25 ok(p.streamTest('plugin-stream-referer.sjs', false, null, null, |
|
26 function(r, t) { |
|
27 is(r, 0, "GET plugin-stream-referer.sjs"); |
|
28 is(t, "Referer found: " + window.location, |
|
29 "GET Referer correct"); |
|
30 testDone(); |
|
31 }, null, true), "referer GET"); |
|
32 |
|
33 ok(p.streamTest('plugin-stream-referer.sjs', true, "Dummy Data", null, |
|
34 function(r, t) { |
|
35 is(r, 0, "POST plugin-stream-referer.sjs"); |
|
36 is(t, "No Referer found", "POST Referer absent"); |
|
37 testDone(); |
|
38 }, null, true), "referer POST"); |
|
39 |
|
40 ok(p2.streamTest('plugin-stream-referer.sjs', false, null, null, |
|
41 function(r, t) { |
|
42 is(r, 0, "GET plugin-stream-referer.sjs (2)"); |
|
43 var expectedreferer = String(window.location).replace("test_pluginstream_referer.html", "loremipsum.xtest"); |
|
44 is(t, "Referer found: " + expectedreferer, |
|
45 "GET Referer correct with plugin src"); |
|
46 testDone(); |
|
47 }, null, true), "referer GET (2)"); |
|
48 |
|
49 } |
|
50 </script> |
|
51 |
|
52 <p id="display"></p> |
|
53 |
|
54 <embed id="plugin1" type="application/x-test" width="200" height="200"></embed> |
|
55 <embed id="plugin2" type="application/x-test" src="loremipsum.xtest" width="200" height="200"></embed> |