1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/mochitest/test_newstreamondestroy.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +<head> 1.5 + <title>NPN_GetURL called from NPP_Destroy</title> 1.6 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.7 + <script type="application/javascript" src="utils.js"></script> 1.8 + 1.9 + <link rel="stylesheet" type="text/css" 1.10 + href="/tests/SimpleTest/test.css"> 1.11 + 1.12 +<body onload="runTest()"> 1.13 + <script class="testbody" type="application/javascript"> 1.14 + SimpleTest.waitForExplicitFinish(); 1.15 + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); 1.16 + 1.17 + function runTest() { 1.18 + var p = document.getElementById('plugin1'); 1.19 + var destroyed = false; 1.20 + p.callOnDestroy(function() { 1.21 + destroyed = true; 1.22 + ok(!p.streamTest('loremipsum.txt', false, null, null, 1.23 + function(r, t) { 1.24 + ok(false, "get-during-destroy should have failed"); 1.25 + }, null, true), "NPN_GetURLNotify should fail during NPP_Destroy"); 1.26 + }); 1.27 + document.body.removeChild(p); 1.28 + 1.29 + setTimeout(function() { 1.30 + ok(destroyed, "callback was fired as expected"); 1.31 + SimpleTest.finish(); 1.32 + }, 1000); 1.33 + } 1.34 + </script> 1.35 + 1.36 + <p id="display"></p> 1.37 + 1.38 + <embed id="plugin1" type="application/x-test"></embed>