Title: [210961] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (210960 => 210961)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-20 16:25:48 UTC (rev 210961)
@@ -1,3 +1,23 @@
+2017-01-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r210939. rdar://problem/29885052
+
+    2017-01-19  Chris Dumez  <cdu...@apple.com>
+
+            Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
+            https://bugs.webkit.org/show_bug.cgi?id=167215
+            <rdar://problem/29885052>
+
+            Reviewed by Andreas Kling.
+
+            Add layout test coverage.
+
+            * fast/forms/resources/form-validation-iframe.html: Added.
+            * fast/forms/validation-message-detached-iframe-expected.txt: Added.
+            * fast/forms/validation-message-detached-iframe.html: Added.
+            * fast/forms/validation-message-detached-iframe2-expected.txt: Added.
+            * fast/forms/validation-message-detached-iframe2.html: Added.
+
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r210862. rdar://problem/30055009

Added: branches/safari-603-branch/LayoutTests/fast/forms/resources/form-validation-iframe.html (0 => 210961)


--- branches/safari-603-branch/LayoutTests/fast/forms/resources/form-validation-iframe.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/resources/form-validation-iframe.html	2017-01-20 16:25:48 UTC (rev 210961)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+<form>
+  Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit">
+</form>
+</body>
+</html>

Added: branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt (0 => 210961)


--- branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt	2017-01-20 16:25:48 UTC (rev 210961)
@@ -0,0 +1,9 @@
+Tests that the form validation message goes away when its element's iframe gets detached.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS validationBubbleContents.message is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe.html (0 => 210961)


--- branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe.html	2017-01-20 16:25:48 UTC (rev 210961)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<iframe id="testFrame" src=""
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Tests that the form validation message goes away when its element's iframe gets detached.");
+jsTestIsAsync = true;
+
+function getValidationBubbleContents()
+{
+    return `
+    (function() {
+        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
+    })();`
+}
+
+_onload_ = function() {
+    var testFrame = document.getElementById("testFrame");
+    testFrame.contentDocument.getElementById("required_text_input_submit").click();
+
+    testFrame.remove();
+    testFrame = null;
+    gc();
+
+    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+        validationBubbleContents = JSON.parse(result).validationBubble;
+        shouldBeEqualToString("validationBubbleContents.message", "");
+        finishJSTest();
+    });
+}
+</script>
+<script src=""
+</body>
+<html>

Added: branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt (0 => 210961)


--- branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt	2017-01-20 16:25:48 UTC (rev 210961)
@@ -0,0 +1,9 @@
+Tests that the form validation message goes away when its element's iframe gets detached.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS validationBubbleContents.message is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe2.html (0 => 210961)


--- branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe2.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/forms/validation-message-detached-iframe2.html	2017-01-20 16:25:48 UTC (rev 210961)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<iframe id="testFrame1" srcdoc="<iframe id='testFrame2' src=''></iframe>"></iframe>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Tests that the form validation message goes away when its element's iframe gets detached.");
+jsTestIsAsync = true;
+
+function getValidationBubbleContents()
+{
+    return `
+    (function() {
+        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
+    })();`
+}
+
+_onload_ = function() {
+    var testFrame1 = document.getElementById("testFrame1");
+    testFrame1.contentDocument.getElementById("testFrame2").contentDocument.getElementById("required_text_input_submit").click();
+
+    testFrame1.remove();
+    testFrame1 = null;
+    gc();
+
+    testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+        validationBubbleContents = JSON.parse(result).validationBubble;
+        gc();
+        shouldBeEqualToString("validationBubbleContents.message", "");
+        finishJSTest();
+    });
+}
+</script>
+<script src=""
+</body>
+<html>

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (210960 => 210961)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-20 16:25:48 UTC (rev 210961)
@@ -1,3 +1,25 @@
+2017-01-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r210939. rdar://problem/29885052
+
+    2017-01-19  Chris Dumez  <cdu...@apple.com>
+
+            Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
+            https://bugs.webkit.org/show_bug.cgi?id=167215
+            <rdar://problem/29885052>
+
+            Reviewed by Andreas Kling.
+
+            Make sure HTML validation bubble gets dismissed when its associated
+            element's frame gets detached and that we do not crash.
+
+            Tests: fast/forms/validation-message-detached-iframe.html
+                   fast/forms/validation-message-detached-iframe2.html
+
+            * dom/Document.cpp:
+            (WebCore::Document::prepareForDestruction):
+            * page/ValidationMessageClient.h:
+
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r210888. rdar://problem/30068195

Modified: branches/safari-603-branch/Source/WebCore/dom/Document.cpp (210960 => 210961)


--- branches/safari-603-branch/Source/WebCore/dom/Document.cpp	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebCore/dom/Document.cpp	2017-01-20 16:25:48 UTC (rev 210961)
@@ -177,6 +177,7 @@
 #include "TextNodeTraversal.h"
 #include "TransformSource.h"
 #include "TreeWalker.h"
+#include "ValidationMessageClient.h"
 #include "VisitedLinkState.h"
 #include "WheelEvent.h"
 #include "WindowFeatures.h"
@@ -2287,6 +2288,11 @@
         page()->pointerLockController().documentDetached(*this);
 #endif
 
+    if (auto* page = this->page()) {
+        if (auto* validationMessageClient = page->validationMessageClient())
+            validationMessageClient->documentDetached(*this);
+    }
+
     InspectorInstrumentation::documentDetached(*this);
 
     stopActiveDOMObjects();

Modified: branches/safari-603-branch/Source/WebCore/page/ValidationMessageClient.h (210960 => 210961)


--- branches/safari-603-branch/Source/WebCore/page/ValidationMessageClient.h	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebCore/page/ValidationMessageClient.h	2017-01-20 16:25:48 UTC (rev 210961)
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class Document;
 class Element;
 
 class ValidationMessageClient {
@@ -49,6 +50,8 @@
     virtual bool isValidationMessageVisible(const Element& anchor) = 0;
 
     virtual void updateValidationBubbleStateIfNeeded() = 0;
+
+    virtual void documentDetached(Document&) = 0;
 };
 
 } // namespace WebCore

Modified: branches/safari-603-branch/Source/WebKit/mac/ChangeLog (210960 => 210961)


--- branches/safari-603-branch/Source/WebKit/mac/ChangeLog	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebKit/mac/ChangeLog	2017-01-20 16:25:48 UTC (rev 210961)
@@ -1,3 +1,22 @@
+2017-01-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r210939. rdar://problem/29885052
+
+    2017-01-19  Chris Dumez  <cdu...@apple.com>
+
+            Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
+            https://bugs.webkit.org/show_bug.cgi?id=167215
+            <rdar://problem/29885052>
+
+            Reviewed by Andreas Kling.
+
+            Make sure HTML validation bubble gets dismissed when its associated
+            element's frame gets detached and that we do not crash.
+
+            * WebCoreSupport/WebValidationMessageClient.h:
+            * WebCoreSupport/WebValidationMessageClient.mm:
+            (WebValidationMessageClient::documentDetached):
+
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r210822. rdar://problem/15607819

Modified: branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h (210960 => 210961)


--- branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h	2017-01-20 16:25:48 UTC (rev 210961)
@@ -40,6 +40,7 @@
     ~WebValidationMessageClient();
 
     // ValidationMessageClient API.
+    void documentDetached(WebCore::Document&) final;
     void showValidationMessage(const WebCore::Element& anchor, const String& message) final;
     void hideValidationMessage(const WebCore::Element& anchor) final;
     bool isValidationMessageVisible(const WebCore::Element& anchor) final;

Modified: branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm (210960 => 210961)


--- branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm	2017-01-20 16:25:48 UTC (rev 210961)
@@ -42,6 +42,14 @@
         hideValidationMessage(*m_currentAnchor);
 }
 
+void WebValidationMessageClient::documentDetached(Document& document)
+{
+    if (!m_currentAnchor)
+        return;
+    if (&m_currentAnchor->document() == &document)
+        hideValidationMessage(*m_currentAnchor);
+}
+
 void WebValidationMessageClient::showValidationMessage(const Element& anchor, const String& message)
 {
     if (m_currentAnchor)

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (210960 => 210961)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-01-20 16:25:48 UTC (rev 210961)
@@ -1,3 +1,22 @@
+2017-01-20  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r210939. rdar://problem/29885052
+
+    2017-01-19  Chris Dumez  <cdu...@apple.com>
+
+            Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
+            https://bugs.webkit.org/show_bug.cgi?id=167215
+            <rdar://problem/29885052>
+
+            Reviewed by Andreas Kling.
+
+            Make sure HTML validation bubble gets dismissed when its associated
+            element's frame gets detached and that we do not crash.
+
+            * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
+            (WebKit::WebValidationMessageClient::documentDetached):
+            * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
+
 2017-01-18  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r210861. rdar://problem/30015304

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp (210960 => 210961)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp	2017-01-20 16:25:48 UTC (rev 210961)
@@ -46,6 +46,14 @@
         hideValidationMessage(*m_currentAnchor);
 }
 
+void WebValidationMessageClient::documentDetached(Document& document)
+{
+    if (!m_currentAnchor)
+        return;
+    if (&m_currentAnchor->document() == &document)
+        hideValidationMessage(*m_currentAnchor);
+}
+
 void WebValidationMessageClient::showValidationMessage(const Element& anchor, const String& message)
 {
     if (m_currentAnchor)

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h (210960 => 210961)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h	2017-01-20 16:25:41 UTC (rev 210960)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h	2017-01-20 16:25:48 UTC (rev 210961)
@@ -38,6 +38,7 @@
     ~WebValidationMessageClient();
 
     // ValidationMessageClient API.
+    void documentDetached(WebCore::Document&) final;
     void showValidationMessage(const WebCore::Element& anchor, const String& message) final;
     void hideValidationMessage(const WebCore::Element& anchor) final;
     bool isValidationMessageVisible(const WebCore::Element& anchor) final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to