1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/mochitest/test_streamatclose.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +<html> 1.5 +<head> 1.6 + <title>Stream open at NPP_Destroy</title> 1.7 + <script type="text/javascript" 1.8 + src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="utils.js"></script> 1.10 + <link rel="stylesheet" type="text/css" 1.11 + href="/tests/SimpleTest/test.css"> 1.12 + 1.13 +<body onload="startTest()"> 1.14 + <script type="text/javascript"> 1.15 + SimpleTest.waitForExplicitFinish(); 1.16 + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); 1.17 + 1.18 + var urlnotified = false; 1.19 + 1.20 + var p = null; 1.21 + 1.22 + function startTest() { 1.23 + p = document.getElementById('embedtest'); 1.24 + ok(p.streamTest("neverending.sjs", false, null, null, 1.25 + function(r, t) { 1.26 + is(r, 2, "Stream should have failed"); 1.27 + urlnotified = true; 1.28 + }, null, true), "neverending.sjs started successfully"); 1.29 + 1.30 + setTimeout(removePlugin, 500); 1.31 + } 1.32 + 1.33 + function removePlugin() { 1.34 + document.body.removeChild(p); // Fires NPP_Destroy immediately 1.35 + SimpleTest.executeSoon(done); 1.36 + } 1.37 + 1.38 + function done() { 1.39 + ok(urlnotified, "NPP_URLNotify should be called if streams are active at NPP_Destroy"); 1.40 + SimpleTest.finish(); 1.41 + } 1.42 + 1.43 + </script> 1.44 + 1.45 + <p id="display"></p> 1.46 + 1.47 + <embed id="embedtest" 1.48 + style="width: 400px; height: 100px;" type="application/x-test"></embed> 1.49 \ No newline at end of file