HTML form validation bubble should be dismissed on navigation
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Dec 2016 23:00:48 +0000 (23:00 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Dec 2016 23:00:48 +0000 (23:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165960
<rdar://problem/29668086>

Reviewed by Simon Fraser.

Source/WebKit/mac:

Dismiss HTML form validation bubble on top-level navigation on Mac WK1.

* WebView/WebView.mm:
(-[WebView _didStartProvisionalLoadForFrame:]):

Source/WebKit2:

Dismiss HTML form validation bubble on top-level navigation on WK2.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):

LayoutTests:

Add layout test coverage.

* http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt: Added.
* http/tests/navigation/navigation-dismisses-validation-bubbles.html: Added.
* http/tests/navigation/resources/check-validation-bubble-not-visible.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209941 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html [new file with mode: 0644]
LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html [new file with mode: 0644]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp

index 44b863a..a0f4a64 100644 (file)
@@ -1,3 +1,17 @@
+2016-12-16  Chris Dumez  <cdumez@apple.com>
+
+        HTML form validation bubble should be dismissed on navigation
+        https://bugs.webkit.org/show_bug.cgi?id=165960
+        <rdar://problem/29668086>
+
+        Reviewed by Simon Fraser.
+
+        Add layout test coverage.
+
+        * http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt: Added.
+        * http/tests/navigation/navigation-dismisses-validation-bubbles.html: Added.
+        * http/tests/navigation/resources/check-validation-bubble-not-visible.html: Added.
+
 2016-12-16  Ryan Haddad  <ryanhaddad@apple.com>
 
         Move the skip expectation for fast/visual-viewport/ios/zoomed-focus-in-fixed.html to ios-simulator-wk2.
diff --git a/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt b/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles-expected.txt
new file mode 100644 (file)
index 0000000..fd4a430
--- /dev/null
@@ -0,0 +1 @@
+PASS: The HTML validation bubble is no longer visible after navigating
diff --git a/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html b/LayoutTests/http/tests/navigation/navigation-dismisses-validation-bubbles.html
new file mode 100644 (file)
index 0000000..e961832
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<body>
+<form>
+<input id="testInput" type="text" required>
+<input id="testSubmit" type="submit">
+</form>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+document.getElementById("testSubmit").onclick = function() {
+    setTimeout(function() {
+        window.location = "resources/check-validation-bubble-not-visible.html";
+    }, 0);
+}
+
+onload = function() {
+    document.getElementById("testSubmit").click();
+};
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html b/LayoutTests/http/tests/navigation/resources/check-validation-bubble-not-visible.html
new file mode 100644 (file)
index 0000000..a6f3d84
--- /dev/null
@@ -0,0 +1,24 @@
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function getValidationBubbleContents()
+{
+    return `
+    (function() {
+        return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
+    })();`
+}
+testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+    validationBubbleContents = JSON.parse(result).validationBubble;
+    if (validationBubbleContents.message === "")
+        document.body.innerHTML = "PASS: The HTML validation bubble is no longer visible after navigating";
+    else
+        document.body.innerHTML = "FAIL: The HTML validation bubble is still visible after navigating";
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+});
+</script>
index a031526..0457003 100644 (file)
@@ -1,3 +1,16 @@
+2016-12-16  Chris Dumez  <cdumez@apple.com>
+
+        HTML form validation bubble should be dismissed on navigation
+        https://bugs.webkit.org/show_bug.cgi?id=165960
+        <rdar://problem/29668086>
+
+        Reviewed by Simon Fraser.
+
+        Dismiss HTML form validation bubble on top-level navigation on Mac WK1.
+
+        * WebView/WebView.mm:
+        (-[WebView _didStartProvisionalLoadForFrame:]):
+
 2016-12-15  Darin Adler  <darin@apple.com>
 
         Use asString instead of toWTFString, toString, or getString when we already checked isString
index 1706416..3437f10 100644 (file)
@@ -3286,6 +3286,8 @@ static inline IMP getMethod(id o, SEL s)
         [self _didChangeValueForKey: _WebIsLoadingKey];
 
         [self _willChangeValueForKey: _WebMainFrameURLKey];
+
+        [self hideFormValidationMessage];
     }
 
     [NSApp setWindowsNeedUpdate:YES];
index b73c209..b9e311f 100644 (file)
@@ -1,3 +1,16 @@
+2016-12-16  Chris Dumez  <cdumez@apple.com>
+
+        HTML form validation bubble should be dismissed on navigation
+        https://bugs.webkit.org/show_bug.cgi?id=165960
+        <rdar://problem/29668086>
+
+        Reviewed by Simon Fraser.
+
+        Dismiss HTML form validation bubble on top-level navigation on WK2.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
+
 2016-12-16  Jer Noble  <jer.noble@apple.com>
 
         Small refactor: Use HashCountedSet rather than HashMap<..., int> to store client counts in WebPlaybackSessionManager{,Proxy}.
index c93fd74..2c8d52d 100644 (file)
@@ -3169,8 +3169,10 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t na
     if (frame->isMainFrame() && navigationID)
         navigation = &navigationState().navigation(navigationID);
 
-    if (frame->isMainFrame())
+    if (frame->isMainFrame()) {
         m_pageLoadState.didStartProvisionalLoad(transaction, url, unreachableURL);
+        hideValidationMessage();
+    }
 
     frame->setUnreachableURL(unreachableURL);
     frame->didStartProvisionalLoad(url);