Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-isolated-world.html
blob8f61549735258148649d16b1f92dc357aa1a4692
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 window.jsTestIsAsync = true;
9 description("Tests that properties of various events do not leak between isolated worlds (bug 85158).");
11 function addListener(eventType, prop) {
12 document.addEventListener(eventType, function(event) {
13 documentObject = event[prop];
15 // Object passed into isolated world should be undefined.
16 shouldBeNull("documentObject");
18 // The property defined in the isolated world should be undefined.
19 shouldBeUndefined("document.pageDefinedVar");
21 window.postMessage("done", "*");
22 });
25 function sendDocumentObject(eventType, prop) {
26 var newEvent = eval("new " + eventType + "('" + eventType + "', { " + prop + ": document })");
27 document.dispatchEvent(newEvent);
30 function runScript(eventType, prop) {
31 // Final string should have the form:
32 // document.pageDefinedVar = 1; (function sendDocumentObject(eventType, prop) {...})(...);
33 // When evaluated in the isolated world, should initiate the event with the
34 // document object as the specificed property value.
35 var script = "document.pageDefinedVar = 1; " +
36 "(" + sendDocumentObject.toString() + ")('" + eventType + "', '" + prop + "');";
37 addListener(eventType, prop);
38 testRunner.evaluateScriptInIsolatedWorld(1, script);
41 // Run the tests whenever a notification arrives, which indicates that the
42 // previous test has finished.
43 window.addEventListener("message", function(message) {
44 runNextTest();
45 }, false);
47 // The events that we want to test, with the properties that each one uses.
48 var events = [
49 { eventType: "CustomEvent", prop: "detail" },
50 { eventType: "MessageEvent", prop: "data" },
51 { eventType: "PopStateEvent", prop: "state" }
54 function runNextTest () {
55 var evt = events.pop();
56 if (!evt) {
57 finishJSTest();
58 return;
61 runScript(evt.eventType, evt.prop);
64 // This test is meaningless without testRunner.
65 if (window.testRunner) {
66 runNextTest();
68 </script>
69 </body>
70 </html>