6 if (window.layoutTestController)
7 layoutTestController.dumpAsText();
9 if (window.objCPlugin) {
10 // Type should be "object"
11 alert("typeof(objCPlugin)=" + typeof(objCPlugin));
13 // Calling objCPlugin() should raise an exception.
16 result = objCPlugin();
20 alert("objCPlugin()=" + result);
23 if (window.objCPluginFunction) {
24 // Type should be "function"
25 alert("typeof(objCPluginFunction)=" + typeof(objCPluginFunction));
27 // Calling objCPluginFunction() should return "test"
30 result = objCPluginFunction();
34 alert("objCPluginFunction()=" + result);
36 function echoTest(arg) {
37 var echo = objCPlugin.echo(arg);
38 var sameVal = (arg == echo) ? "same" : "different";
39 var sameType = (typeof(arg) == typeof(echo)) ? "same" : "different";
41 alert(arg + " = " + echo + " (" + sameVal + ")");
42 alert(typeof(arg) + " = " + typeof(echo) + " (" + sameType + ")");
45 // Test the echo function
50 echoTest(new Array("one", "two"));
53 function exceptionTest(arg) {
55 objCPlugin.throwIfArgumentIsNotHello(arg);
57 alert("String " + arg + " != Hello");
61 alert("String " + arg + " == Hello");
64 exceptionTest("Hello");
65 exceptionTest("Not Hello");
69 var cPlugin = document.getElementById("testCPlugin");
71 // Type should be "function"
72 alert("typeof(cPlugin)=" + typeof(cPlugin));
74 // Calling cPlugin() should return 1
81 alert("cPlugin()=" + result);
83 // Special function that removes cPlugin's default method implementation. The runtime should consider
84 // cPlugin an "object" if it has no default method.
85 cPlugin.removeDefaultMethod();
87 // Type should be "object"
88 alert("typeof(cPlugin)=" + typeof(cPlugin));
90 // Calling cPlugin() now should raise an exception
97 alert("cPlugin()=" + result);
102 <body onload="doTest();">
103 <p>This page tests invoking as functions JavaScript objects that are provided by plugins.</p>
104 <embed id="testCPlugin" type="application/x-webkit-test-netscape"></embed>