| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Callback Function Objects Implementing handleEvent()</title> | |
| </head> | |
| <body> | |
| <p> | |
| When a JS callback is a function, it should be called. If the function has another function as | |
| its <code>handleEvent</code> property, that function should <em>not</em> be called. | |
| </p> | |
| <p id="console"></p> | |
| <script src="resources/js-test-pre.js"></script> | |
| <script type="text/javascript" charset="utf-8"> | |
| window.jsTestIsAsync = true; | |
| // This function should be called. | |
| var callback = function(event) { | |
| testPassed("The callback function was called directly."); | |
| finishJSTest(); | |
| }; | |
| // This function should not be called. | |
| callback.handleEvent = function(event) { | |
| testFailed("The callback function's handleEvent property was called instead of the function itself."); | |
| finishJSTest(); | |
| }; | |
| // Database is one of several uses of JS Callbacks | |
| var db = openDatabase("callback-function-with-handle-event-test", "", "Test for callback functions that implement a handleEvent() method.", 1); | |
| db.changeVersion(db.version, "1.0", callback); | |
| </script> | |
| <script src="resources/js-test-post.js"></script> | |
| </body> | |
| </html> |