dom/plugins/test/mochitest/test_streamatclose.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 <html>
     2 <head>
     3   <title>Stream open at NPP_Destroy</title>
     4   <script type="text/javascript"
     5 	  src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" src="utils.js"></script>
     7   <link rel="stylesheet" type="text/css"
     8 	href="/tests/SimpleTest/test.css">
    10 <body onload="startTest()">
    11   <script type="text/javascript">
    12   SimpleTest.waitForExplicitFinish();
    13   setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    15   var urlnotified = false;
    17   var p = null;
    19   function startTest() {
    20     p = document.getElementById('embedtest');
    21     ok(p.streamTest("neverending.sjs", false, null, null,
    22                     function(r, t) {
    23                       is(r, 2, "Stream should have failed");
    24                       urlnotified = true;
    25                     }, null, true), "neverending.sjs started successfully");
    27     setTimeout(removePlugin, 500);
    28   }
    30   function removePlugin() {
    31     document.body.removeChild(p); // Fires NPP_Destroy immediately
    32     SimpleTest.executeSoon(done);
    33   }
    35   function done() {
    36     ok(urlnotified, "NPP_URLNotify should be called if streams are active at NPP_Destroy");
    37     SimpleTest.finish();
    38   }
    40   </script>
    42   <p id="display"></p>
    44   <embed id="embedtest"
    45    style="width: 400px; height: 100px;" type="application/x-test"></embed>

mercurial