• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2
3<head>
4<script src="npapi.js"></script>
5</head>
6
7
8<body>
9<div id="statusPanel" style="border: 1px solid red; width: 100%">
10Test running....
11</div>
12
13
14NPObject Lifetime test<p>
15
16Tests the case where a plugin holds on to an NPObject reference
17to another plugin in a different frame in the page and whether
18the npobject is callable when the frame is destroyed.
19
20<div ID=npobject_lifetime_test_instance2>
21<iframe src="npobject_lifetime_test_second_instance.html" name="plugin_frame">
22</iframe>
23</div>
24
25<embed	type="application/vnd.npapi-test"
26	src="foo"
27	name="npobject_lifetime_test"
28	id="1"
29	mode="np_embed">
30
31<script>
32
33function GetSecondPluginInstance() {
34  var plugin_frame = window.frames["plugin_frame"];
35  if (!plugin_frame) {
36    alert("failed to find frame in frames list");
37    return;
38  }
39
40  var plugin = plugin_frame.document.getElementById(2);
41  if (!plugin) {
42    alert("Failed to locate second plugin");
43    return;
44  }
45  return plugin;
46}
47
48function DeleteSecondPluginInstance() {
49  var frame_div = document.getElementById("npobject_lifetime_test_instance2");
50  if (frame_div.parentNode && frame_div.parentNode.removeChild) {
51    frame_div.parentNode.removeChild(frame_div);
52  }
53}
54</script>
55
56</body>
57</html>
58
59