+2007-09-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Split out mac specific tests from plugins/bindings-test.html into its own test.
+
+ * platform/mac/plugins/bindings-test-objc-expected.txt: Added.
+ * platform/mac/plugins/bindings-test-objc.html: Copied from plugins/bindings-test.html.
+ * platform/win/Skipped:
+ * plugins/bindings-test-expected.txt:
+ * plugins/bindings-test.html:
+
2007-09-05 Oliver Hunt <oliver@apple.com>
Reviewed by Adam and Niko.
--- /dev/null
+ALERT: typeof(objCPlugin)=object
+ALERT: objCPlugin()=TypeError
+ALERT: typeof(objCPluginFunction)=function
+ALERT: objCPluginFunction()=test
+ALERT: hello = hello (same)
+ALERT: string = string (same)
+ALERT: 42 = 42 (same)
+ALERT: number = number (same)
+ALERT: null = undefined (same)
+ALERT: object = undefined (different)
+ALERT: undefined = undefined (same)
+ALERT: undefined = undefined (same)
+ALERT: one,two = one,two (same)
+ALERT: object = object (same)
+ALERT: String Hello == Hello
+ALERT: String Not Hello != Hello
+This page tests invoking as functions JavaScript objects that are provided by objective-c plugins.
+
+
--- /dev/null
+<html>
+<head>
+<script>
+function doTest()
+{
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ if (window.objCPlugin) {
+ // Type should be "object"
+ alert("typeof(objCPlugin)=" + typeof(objCPlugin));
+
+ // Calling objCPlugin() should raise an exception.
+ var result;
+ try {
+ result = objCPlugin();
+ } catch (e) {
+ result = e.name;
+ }
+ alert("objCPlugin()=" + result);
+ }
+
+ if (window.objCPluginFunction) {
+ // Type should be "function"
+ alert("typeof(objCPluginFunction)=" + typeof(objCPluginFunction));
+
+ // Calling objCPluginFunction() should return "test"
+ var result;
+ try {
+ result = objCPluginFunction();
+ } catch (e) {
+ result = e.name;
+ }
+ alert("objCPluginFunction()=" + result);
+
+ function echoTest(arg) {
+ var echo = objCPlugin.echo(arg);
+ var sameVal = (arg == echo) ? "same" : "different";
+ var sameType = (typeof(arg) == typeof(echo)) ? "same" : "different";
+
+ alert(arg + " = " + echo + " (" + sameVal + ")");
+ alert(typeof(arg) + " = " + typeof(echo) + " (" + sameType + ")");
+ }
+
+ // Test the echo function
+ echoTest("hello");
+ echoTest(42);
+ echoTest(null);
+ echoTest(undefined);
+ echoTest(new Array("one", "two"));
+
+ // Test exceptions
+ function exceptionTest(arg) {
+ try {
+ objCPlugin.throwIfArgumentIsNotHello(arg);
+ } catch (e) {
+ alert("String " + arg + " != Hello");
+ return;
+ }
+
+ alert("String " + arg + " == Hello");
+ }
+
+ exceptionTest("Hello");
+ exceptionTest("Not Hello");
+ }
+}
+</script>
+</head>
+<body onload="doTest();">
+<p>This page tests invoking as functions JavaScript objects that are provided by objective-c plugins.</p>
+<embed id="testCPlugin" type="application/x-webkit-test-netscape"></embed>
+</body>
+</html>
http/tests/security/local-image-from-remote.html
# No built-in plugin in DRT <rdar://problem/5074411>
-plugins/bindings-test.html
plugins/call-as-function-test.html
plugins/embed-attributes-setting.html
plugins/get-url-that-the-resource-load-delegate-will-disallow.html
ALERT: typeof(objCPlugin)=object
ALERT: objCPlugin()=TypeError
-ALERT: typeof(objCPluginFunction)=function
-ALERT: objCPluginFunction()=test
-ALERT: hello = hello (same)
-ALERT: string = string (same)
-ALERT: 42 = 42 (same)
-ALERT: number = number (same)
-ALERT: null = undefined (same)
-ALERT: object = undefined (different)
-ALERT: undefined = undefined (same)
-ALERT: undefined = undefined (same)
-ALERT: one,two = one,two (same)
-ALERT: object = object (same)
-ALERT: String Hello == Hello
-ALERT: String Not Hello != Hello
-ALERT: typeof(cPlugin)=function
-ALERT: cPlugin()=1
-ALERT: typeof(cPlugin)=object
-ALERT: cPlugin()=TypeError
This page tests invoking as functions JavaScript objects that are provided by plugins.
}
alert("objCPlugin()=" + result);
}
-
- if (window.objCPluginFunction) {
- // Type should be "function"
- alert("typeof(objCPluginFunction)=" + typeof(objCPluginFunction));
-
- // Calling objCPluginFunction() should return "test"
- var result;
- try {
- result = objCPluginFunction();
- } catch (e) {
- result = e.name;
- }
- alert("objCPluginFunction()=" + result);
-
- function echoTest(arg) {
- var echo = objCPlugin.echo(arg);
- var sameVal = (arg == echo) ? "same" : "different";
- var sameType = (typeof(arg) == typeof(echo)) ? "same" : "different";
-
- alert(arg + " = " + echo + " (" + sameVal + ")");
- alert(typeof(arg) + " = " + typeof(echo) + " (" + sameType + ")");
- }
-
- // Test the echo function
- echoTest("hello");
- echoTest(42);
- echoTest(null);
- echoTest(undefined);
- echoTest(new Array("one", "two"));
-
- // Test exceptions
- function exceptionTest(arg) {
- try {
- objCPlugin.throwIfArgumentIsNotHello(arg);
- } catch (e) {
- alert("String " + arg + " != Hello");
- return;
- }
-
- alert("String " + arg + " == Hello");
- }
-
- exceptionTest("Hello");
- exceptionTest("Not Hello");
- }
-
- // Test the C plugin
- var cPlugin = document.getElementById("testCPlugin");
- if (cPlugin) {
- // Type should be "function"
- alert("typeof(cPlugin)=" + typeof(cPlugin));
-
- // Calling cPlugin() should return 1
- var result;
- try {
- result = cPlugin();
- } catch (e) {
- result = e.name;
- }
- alert("cPlugin()=" + result);
-
- // Special function that removes cPlugin's default method implementation. The runtime should consider
- // cPlugin an "object" if it has no default method.
- cPlugin.removeDefaultMethod();
-
- // Type should be "object"
- alert("typeof(cPlugin)=" + typeof(cPlugin));
-
- // Calling cPlugin() now should raise an exception
- var result;
- try {
- result = cPlugin();
- } catch (e) {
- result = e.name;
- }
- alert("cPlugin()=" + result);
- }
}
</script>
</head>