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.layoutTestController) | |
25 layoutTestController.dumpAsText(); | |
26 | |
27 var plugin = document.getElementById("testPlugin"); | |
28 var returned_object = plugin.testScriptObjectInvoke("new_script_object", "cr
eateObject", plugin); | |
29 | |
30 /* Bug# 1175346 - This will crash in single process mode (or test shell) | |
31 TODO(joshia): Enable this and fix the NPObject cleanup so that | |
32 it works in single process mode. | |
33 plugin.parentNode.removeChild(plugin); | |
34 | |
35 try { | |
36 returned_object.property; | |
37 } catch (e) { | |
38 if (e instanceof ReferenceError) | |
39 document.getElementById("result").innerHTML = "SUCCESS"; | |
40 } | |
41 */ | |
42 | |
43 document.getElementById("result").innerHTML = "SUCCESS"; | |
44 } | |
45 </script> | |
46 | |
47 <body onload="runTest();"> | |
48 <pre> | |
49 Test proper tracking of script NPObjects | |
50 | |
51 Test 1: Ensure that script NPObjects are properly tracked (i.e. added to | |
52 the live objects map in V8). | |
53 | |
54 Test 2: Test tracking of derived NPObjects by invoking a method on a | |
55 script object and passing it an internally created NPObject. | |
56 | |
57 <div id="result">FAILURE</div> | |
58 <embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" hei
ght="200"></embed> | |
59 </body> | |
60 </html> | |
OLD | NEW |