OLD | NEW |
| (Empty) |
1 <html> | |
2 <script> | |
3 // A simple script object with a member function that takes | |
4 // an NPObject as an argument | |
5 FactoryFunction = function() { | |
6 var TestObject = function() { | |
7 }; | |
8 | |
9 TestObject.prototype.createObject = function(plugin) { | |
10 var new_object = plugin.testCloneObject(); | |
11 return new_object; | |
12 }; | |
13 | |
14 var s = new TestObject(); | |
15 return s; | |
16 }; | |
17 | |
18 function new_script_object() { | |
19 return FactoryFunction(); | |
20 } | |
21 | |
22 function runTest() | |
23 { | |
24 if (window.testRunner) | |
25 testRunner.dumpAsText(); | |
26 | |
27 var plugin = document.getElementById("testPlugin"); | |
28 var returned_object = plugin.testScriptObjectInvoke("new_script_object", "cr
eateObject"); | |
29 | |
30 // Make sure the cloned object outlives the plugin. | |
31 /* FIXME(joshia): Enable this and fix the NPObject cleanup so that | |
32 it works in single process mode. | |
33 plugin.parentNode.removeChild(plugin); | |
34 try { | |
35 returned_object.property; | |
36 } catch (e) { | |
37 if (e instanceof ReferenceError) | |
38 document.getElementById("result").innerHTML = "SUCCESS"; | |
39 } | |
40 */ | |
41 | |
42 document.getElementById("result").innerHTML = "SUCCESS"; | |
43 } | |
44 </script> | |
45 | |
46 <body onload="runTest();"> | |
47 <pre> | |
48 Test proper tracking of script NPObjects | |
49 | |
50 Test 1: Ensure that script NPObjects are properly tracked (i.e. added to | |
51 the live objects map in V8). | |
52 | |
53 Test 2: Test tracking of derived NPObjects by invoking a method on a | |
54 script object and passing it an internally created NPObject. | |
55 | |
56 <div id="result">FAILURE</div> | |
57 <embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" hei
ght="200"></embed> | |
58 </body> | |
59 </html> | |
OLD | NEW |