dom/plugins/test/mochitest/test_pluginstream_referer.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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" />
     9 <body onload="runTests()">
    10   <script class="testbody" type="application/javascript">
    11   SimpleTest.waitForExplicitFinish();
    12   setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    14   var pending = 3;
    15   function testDone() {
    16     --pending;
    17     if (0 == pending)
    18       SimpleTest.finish()
    19   }
    21   function runTests() {
    22     var p = document.getElementById('plugin1');
    23     var p2 = document.getElementById('plugin2');
    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");
    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");
    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)");
    49   }
    50   </script>
    52   <p id="display"></p>
    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>

mercurial