Diff
Modified: trunk/LayoutTests/ChangeLog (204147 => 204148)
--- trunk/LayoutTests/ChangeLog 2016-08-04 22:34:26 UTC (rev 204147)
+++ trunk/LayoutTests/ChangeLog 2016-08-04 22:37:14 UTC (rev 204148)
@@ -1,3 +1,23 @@
+2016-08-04 Benjamin Poulain <benja...@webkit.org>
+
+ Add some extra test coverage for active touch event handler on subdocuments
+ https://bugs.webkit.org/show_bug.cgi?id=160276
+
+ Reviewed by Alex Christensen.
+
+ I wrote some tests while chasing a bug.
+ Documents are handled differently than other EventTarget. We had no test coverage
+ for that.
+
+ * fast/events/touch/ios/touch-event-listeners-on-detached-document-expected.txt: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-detached-document.html: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame-expected.txt: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame.html: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-subdocuments-expected.txt: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-subdocuments.html: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-template-document-expected.txt: Added.
+ * fast/events/touch/ios/touch-event-listeners-on-template-document.html: Added.
+
2016-08-04 Ryan Haddad <ryanhad...@apple.com>
Rebaseline http/tests/security/cross-frame-access-put.html after r204126.
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-detached-document-expected.txt (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-detached-document-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-detached-document-expected.txt 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,9 @@
+Check the lifecycle of a touch event handler of a document detached from the top document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-detached-document.html (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-detached-document.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-detached-document.html 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <style>
+ body {
+ margin: 0;
+ }
+ </style>
+ <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+ <script>
+ description("Check the lifecycle of a touch event handler of a document detached from the top document");
+
+ var detachedDocument = document.implementation.createHTMLDocument();
+ detachedDocument.addEventListener('touchstart', (event) => { debug("FAIL, this should not be called"); });
+ detachedDocument = undefined;
+ gc();
+ </script>
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame-expected.txt (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame-expected.txt 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,13 @@
+
+Check touch event listeners on sub-documents are correctly cleaned when the document is removed from the document.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+ Tapped (50, 50)
+PASS eventList is ['SecondLeveltouchstart']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame.html (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocument-then-detach-from-frame.html 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <style>
+ body {
+ margin: 0;
+ }
+ </style>
+ <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+ <iframe id="first-level-iframe" src="" width="300" height="300" frameBorder="0"></iframe>
+ <p id="description"></p>
+ <div id="console">
+ </div>
+ <script>
+ description("Check touch event listeners on sub-documents are correctly cleaned when the document is removed from the document.");
+ window.jsTestIsAsync = true;
+
+ function getTapScript(x, y)
+ {
+ return `
+ (function() {
+ uiController.singleTapAtPoint(${x}, ${y}, function() {
+ uiController.uiScriptComplete("Tapped (" + ${x} + ", " + ${y} + ")");
+ });
+ })();`
+ }
+
+ function runTest()
+ {
+ var firstLevelIframe = document.getElementById("first-level-iframe");
+ firstLevelIframe.contentDocument.write('<iframe id="second-level-iframe" src="" width="300" height="300" frameBorder="0"></iframe>');
+ var secondLevelIframe = firstLevelIframe.contentDocument.getElementById("second-level-iframe");
+
+ window.eventList = [];
+ firstLevelIframe.contentDocument.addEventListener('touchstart', (event) => { eventList.push("FirstLevel" + event.type); });
+ secondLevelIframe.contentDocument.addEventListener('touchstart', (event) => { eventList.push("SecondLevel" + event.type); });
+
+ testRunner.runUIScript(getTapScript(50, 50), function(result) {
+ debug(result);
+ shouldBe("eventList", "['SecondLeveltouchstart']");
+
+ var nestedDocument = secondLevelIframe.contentDocument;
+ // Navigate the iframe.
+ secondLevelIframe.addEventListener("load", () => {
+ nestedDocument = undefined;
+ gc();
+ setTimeout(finishJSTest, 0);
+ });
+ secondLevelIframe.src=""
+ secondLevelIframe = undefined;
+ gc();
+ });
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocuments-expected.txt (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocuments-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocuments-expected.txt 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,14 @@
+Check touch event listeners on sub-documents are correctly cleaned when the document is removed from the document.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+ Tapped (50, 50)
+PASS eventList is ['SecondLeveltouchstart']
+Tapped (50, 50)
+PASS eventList is ['SecondLeveltouchstart', 'FirstLeveltouchstart']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocuments.html (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocuments.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-subdocuments.html 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <style>
+ body {
+ margin: 0;
+ }
+ </style>
+ <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+ <iframe id="first-level-iframe" src="" width="300" height="300" frameBorder="0"></iframe>
+ <p id="description"></p>
+ <div id="console">
+ </div>
+ <script>
+ description("Check touch event listeners on sub-documents are correctly cleaned when the document is removed from the document.");
+ window.jsTestIsAsync = true;
+
+ function getTapScript(x, y)
+ {
+ return `
+ (function() {
+ uiController.singleTapAtPoint(${x}, ${y}, function() {
+ uiController.uiScriptComplete("Tapped (" + ${x} + ", " + ${y} + ")");
+ });
+ })();`
+ }
+
+ function runTest()
+ {
+ var firstLevelIframe = document.getElementById("first-level-iframe");
+ firstLevelIframe.contentDocument.write('<iframe id="second-level-iframe" src="" width="300" height="300" frameBorder="0"></iframe>');
+ var secondLevelIframe = firstLevelIframe.contentDocument.getElementById("second-level-iframe");
+
+ window.eventList = [];
+ firstLevelIframe.contentDocument.addEventListener('touchstart', (event) => { eventList.push("FirstLevel" + event.type); });
+ secondLevelIframe.contentDocument.addEventListener('touchstart', (event) => { eventList.push("SecondLevel" + event.type); });
+
+ testRunner.runUIScript(getTapScript(50, 50), function(result) {
+ debug(result);
+ shouldBe("eventList", "['SecondLeveltouchstart']");
+
+ secondLevelIframe.parentElement.removeChild(secondLevelIframe);
+ secondLevelIframe = undefined;
+ gc();
+
+ testRunner.runUIScript(getTapScript(50, 50), function(result) {
+ debug(result);
+ shouldBe("eventList", "['SecondLeveltouchstart', 'FirstLeveltouchstart']");
+
+ firstLevelIframe.parentElement.removeChild(firstLevelIframe);
+ firstLevelIframe = undefined;
+ gc();
+
+ finishJSTest();
+ });
+ });
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-template-document-expected.txt (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-template-document-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-template-document-expected.txt 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,11 @@
+Check touch event listener on the document of a template. This should not crash or make ASAN mad.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS I am making a note here: huge success
+Tapped (50, 50)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-template-document.html (0 => 204148)
--- trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-template-document.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touch-event-listeners-on-template-document.html 2016-08-04 22:37:14 UTC (rev 204148)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <style>
+ body {
+ margin: 0;
+ }
+ </style>
+ <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+ <div id="wrapper">
+ <template>
+ <div>FAIL: this should not be visible!</div>
+ </template>
+ </div>
+ <script>
+ description("Check touch event listener on the document of a template. This should not crash or make ASAN mad.");
+ window.jsTestIsAsync = true;
+
+
+ function getTapScript(x, y)
+ {
+ return `
+ (function() {
+ uiController.singleTapAtPoint(${x}, ${y}, function() {
+ uiController.uiScriptComplete("Tapped (" + ${x} + ", " + ${y} + ")");
+ });
+ })();`
+ }
+
+ function setup()
+ {
+ let template = document.getElementsByTagName("template")[0];
+ let templateDocument = template.content.firstChild.ownerDocument;
+ document.addEventListener('touchstart', () => { debug("PASS I am making a note here: huge success"); });
+ templateDocument.addEventListener('touchstart', () => { debug("FAIL this should not be called"); });
+ }
+
+ function runTest()
+ {
+ setup();
+ gc();
+
+ testRunner.runUIScript(getTapScript(50, 50), function(result) {
+ debug(result);
+ document.getElementById("wrapper").innerHTML = "";
+ gc();
+ finishJSTest();
+ });
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+ <script src=""
+</body>
+</html>