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");
70 <body onload="doTest();">
71 <p>This page tests invoking as functions JavaScript objects that are provided by objective-c plugins.</p>
72 <embed id="testCPlugin" type="application/x-webkit-test-netscape"></embed>