Diff
Modified: trunk/LayoutTests/ChangeLog (210938 => 210939)
--- trunk/LayoutTests/ChangeLog 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/LayoutTests/ChangeLog 2017-01-19 23:04:37 UTC (rev 210939)
@@ -1,3 +1,19 @@
+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-19 Ryan Haddad <ryanhad...@apple.com>
Skipping three crashing pointer lock tests.
Added: trunk/LayoutTests/fast/forms/resources/form-validation-iframe.html (0 => 210939)
--- trunk/LayoutTests/fast/forms/resources/form-validation-iframe.html (rev 0)
+++ trunk/LayoutTests/fast/forms/resources/form-validation-iframe.html 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt (0 => 210939)
--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe-expected.txt 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/LayoutTests/fast/forms/validation-message-detached-iframe.html (0 => 210939)
--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe.html (rev 0)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe.html 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt (0 => 210939)
--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe2-expected.txt 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/LayoutTests/fast/forms/validation-message-detached-iframe2.html (0 => 210939)
--- trunk/LayoutTests/fast/forms/validation-message-detached-iframe2.html (rev 0)
+++ trunk/LayoutTests/fast/forms/validation-message-detached-iframe2.html 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/Source/WebCore/ChangeLog (210938 => 210939)
--- trunk/Source/WebCore/ChangeLog 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebCore/ChangeLog 2017-01-19 23:04:37 UTC (rev 210939)
@@ -1,5 +1,23 @@
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-19 Chris Dumez <cdu...@apple.com>
+
Implement per activity state CPU usage reporting using diagnostic logging
https://bugs.webkit.org/show_bug.cgi?id=167163
<rdar://problem/30058349>
Modified: trunk/Source/WebCore/dom/Document.cpp (210938 => 210939)
--- trunk/Source/WebCore/dom/Document.cpp 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-01-19 23:04:37 UTC (rev 210939)
@@ -180,6 +180,7 @@
#include "TextNodeTraversal.h"
#include "TransformSource.h"
#include "TreeWalker.h"
+#include "ValidationMessageClient.h"
#include "VisitedLinkState.h"
#include "WheelEvent.h"
#include "WindowFeatures.h"
@@ -2271,6 +2272,11 @@
page()->pointerLockController().documentDetached(*this);
#endif
+ if (auto* page = this->page()) {
+ if (auto* validationMessageClient = page->validationMessageClient())
+ validationMessageClient->documentDetached(*this);
+ }
+
InspectorInstrumentation::documentDetached(*this);
stopActiveDOMObjects();
Modified: trunk/Source/WebCore/page/ValidationMessageClient.h (210938 => 210939)
--- trunk/Source/WebCore/page/ValidationMessageClient.h 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebCore/page/ValidationMessageClient.h 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/Source/WebKit/mac/ChangeLog (210938 => 210939)
--- trunk/Source/WebKit/mac/ChangeLog 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-01-19 23:04:37 UTC (rev 210939)
@@ -1,3 +1,18 @@
+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-19 Myles C. Maxfield <mmaxfi...@apple.com>
[Cocoa] Variation fonts are erroneously disabled on iOS
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h (210938 => 210939)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.h 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm (210938 => 210939)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebValidationMessageClient.mm 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/Source/WebKit2/ChangeLog (210938 => 210939)
--- trunk/Source/WebKit2/ChangeLog 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-19 23:04:37 UTC (rev 210939)
@@ -1,5 +1,20 @@
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-19 Chris Dumez <cdu...@apple.com>
+
Implement per activity state CPU usage reporting using diagnostic logging
https://bugs.webkit.org/show_bug.cgi?id=167163
<rdar://problem/30058349>
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp (210938 => 210939)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h (210938 => 210939)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h 2017-01-19 22:58:46 UTC (rev 210938)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h 2017-01-19 23:04:37 UTC (rev 210939)
@@ -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;