dom/plugins/test/mochitest/test_src_url_change.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:9d576af293bb
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Test changing src attribute</title>
5 <script type="text/javascript" src="/MochiKit/packed.js"></script>
6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
7 <script type="text/javascript" src="utils.js"></script>
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 </head>
10 <body onload="runTests()">
11 <script type="application/javascript;version=1.8">
12 SimpleTest.waitForExplicitFinish();
13 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
14
15 var destroyed = false;
16 function onDestroy() {
17 destroyed = true;
18 }
19
20 function runTests() {
21 p = document.getElementById('plugin1');
22
23 p.startWatchingInstanceCount();
24 p.callOnDestroy(onDestroy);
25
26 p.setAttribute("src", "loremipsum.txt");
27
28 is(destroyed, true, "Instance should have been destroyed.");
29 is(p.getInstanceCount(), 1, "One new instance should have been created.");
30
31 p.stopWatchingInstanceCount();
32
33 SimpleTest.finish();
34 }
35 </script>
36
37 <p id="display"></p>
38
39 <embed id="plugin1" src="about:blank" type="application/x-test" width="200" height="200"></embed>
40 </body>
41 </html>
42

mercurial