| <!DOCTYPE html> |
| <html> |
| <title>Event handlers in isolated worlds for user gesture generated events should should the same permissions as handlers within the page</title> |
| <script> |
| |
| // This test is meaningless without a testRunner. |
| if (window.testRunner && window.eventSender) { |
| |
| testRunner.setCanOpenWindows(true); |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| |
| function newTest(title) |
| { |
| document.getElementById("log").innerHTML += "<br>" + title + ": "; |
| } |
| |
| function pass() |
| { |
| document.getElementById("log").innerHTML += "PASS\n"; |
| testRunner.notifyDone(); |
| } |
| |
| // (This function is run within an isolated world) |
| function userGestureEventListener() |
| { |
| // Register an event handler that will try to perform an action that can only be initiated by a user gesture (opening a window). |
| document.getElementById("button1").onclick = function() |
| { |
| window.open("resources/userGestureEvents-second-window.html", "resources/userGestureEvents-second-window.html"); |
| } |
| } |
| |
| function runTestInWorld(worldId, funcName) |
| { |
| testRunner.evaluateScriptInIsolatedWorld(worldId, String(eval(funcName)) + "\n" + funcName + "();"); |
| } |
| |
| function runTest() |
| { |
| newTest("Event handlers in isolated worlds for user gesture generated events should should the same permissions as handlers within the page."); |
| runTestInWorld(1, "userGestureEventListener"); |
| |
| // Click somewhere on the button! |
| var testDiv = document.getElementById("test"); |
| eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| |
| } else |
| document.getElementById("log").innerHTML += "FAIL\n"; |
| </script> |
| <body onload="runTest()"> |
| <div id="test"><button id='button1'>Click Me</button></div> |
| <div id="log"></div> |
| </body> |
| </html> |