Title: [245934] branches/safari-607-branch
Revision
245934
Author
[email protected]
Date
2019-05-30 17:30:39 -0700 (Thu, 30 May 2019)

Log Message

Apply patch. rdar://problem/50753927

    Add test coverage for <rdar://problem/49731231> https://bugs.webkit.org/show_bug.cgi?id=196730 <rdar://problem/49731231>

    Reviewed by Ryosuke Niwa.

    Tools:

    Add support for testRunner.abortModal() in macOS's WebKitTestRunner in order
    to match DumpRenderTree.

    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
    (WTR::TestRunner::abortModal):
    * WebKitTestRunner/InjectedBundle/TestRunner.h:
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::runModal):
    * WebKitTestRunner/TestController.h:
    * WebKitTestRunner/TestInvocation.cpp:
    (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
    * WebKitTestRunner/gtk/TestControllerGtk.cpp:
    (WTR::TestController::abortModal):
    * WebKitTestRunner/ios/TestControllerIOS.mm:
    (WTR::TestController::abortModal):
    * WebKitTestRunner/mac/TestControllerMac.mm:
    (WTR::TestController::abortModal):
    * WebKitTestRunner/win/TestControllerWin.cpp:
    (WTR::TestController::abortModal):

    LayoutTests:

    * http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt: Added.
    * http/tests/security/showModalDialog-sync-cross-origin-page-load.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-607-branch/LayoutTests/ChangeLog (245933 => 245934)


--- branches/safari-607-branch/LayoutTests/ChangeLog	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/LayoutTests/ChangeLog	2019-05-31 00:30:39 UTC (rev 245934)
@@ -1,5 +1,54 @@
 2019-05-30  Kocsen Chung  <[email protected]>
 
+        Apply patch. rdar://problem/50753927
+
+    Add test coverage for <rdar://problem/49731231> https://bugs.webkit.org/show_bug.cgi?id=196730 <rdar://problem/49731231>
+    
+    Reviewed by Ryosuke Niwa.
+    
+    Tools:
+    
+    Add support for testRunner.abortModal() in macOS's WebKitTestRunner in order
+    to match DumpRenderTree.
+    
+    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+    (WTR::TestRunner::abortModal):
+    * WebKitTestRunner/InjectedBundle/TestRunner.h:
+    * WebKitTestRunner/TestController.cpp:
+    (WTR::TestController::runModal):
+    * WebKitTestRunner/TestController.h:
+    * WebKitTestRunner/TestInvocation.cpp:
+    (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+    * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+    (WTR::TestController::abortModal):
+    * WebKitTestRunner/ios/TestControllerIOS.mm:
+    (WTR::TestController::abortModal):
+    * WebKitTestRunner/mac/TestControllerMac.mm:
+    (WTR::TestController::abortModal):
+    * WebKitTestRunner/win/TestControllerWin.cpp:
+    (WTR::TestController::abortModal):
+    
+    LayoutTests:
+    
+    * http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt: Added.
+    * http/tests/security/showModalDialog-sync-cross-origin-page-load.html: Added.
+    
+    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@244898 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-02  Chris Dumez  <[email protected]>
+
+            Add test coverage for <rdar://problem/49731231>
+            https://bugs.webkit.org/show_bug.cgi?id=196730
+            <rdar://problem/49731231>
+
+            Reviewed by Ryosuke Niwa.
+
+            * http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt: Added.
+            * http/tests/security/showModalDialog-sync-cross-origin-page-load.html: Added.
+
+2019-05-30  Kocsen Chung  <[email protected]>
+
         Cherry-pick r245664. rdar://problem/51264774
 
     Subselectors not searched when determining property whitelist for selector

Added: branches/safari-607-branch/LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt (0 => 245934)


--- branches/safari-607-branch/LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt	                        (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt	2019-05-31 00:30:39 UTC (rev 245934)
@@ -0,0 +1,2 @@
+This test passes if it does not alert the fail.html's content when clicking the button.
+  

Added: branches/safari-607-branch/LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load.html (0 => 245934)


--- branches/safari-607-branch/LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load.html	                        (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load.html	2019-05-31 00:30:39 UTC (rev 245934)
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<body>
+<b>This test passes if it does not alert the fail.html's content when clicking the button.</b><br>
+<input id="testButton" type="button" value="Click me"></input>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.waitUntilDone();
+}
+
+let counter = 0;
+function run() {
+  if (++counter == 2) {
+    parent_frame = frame.contentDocument.querySelector("iframe");
+    frame1 = parent_frame.appendChild(document.createElement("iframe"));
+    frame2 = parent_frame.appendChild(document.createElement("iframe"));
+    frame1.src = ""
+  }
+}
+
+let child_counter = 0;
+function runChild() {
+  if (++child_counter == 2) {
+    parent_frame.appendChild(frame2);
+
+    a = frame2.contentDocument.createElement("a");
+    a.href = ""
+    a.click();
+    
+    showModalDialog(URL.createObjectURL(new Blob([`
+      <script>
+        let intervalID = setInterval(() => {
+          try {
+            opener.frame.document.foo;
+          } catch (e) {
+            clearInterval(intervalID);
+
+            window.close();
+            if (window.testRunner)
+              testRunner.abortModal();
+          }
+        }, 100);
+      </scr` + "ipt>"], {type: "text/html"})));
+    frame2.src = ""
+  }
+}
+
+testButton._onclick_ = _ => {
+  frame = document.body.appendChild(document.createElement("iframe"));
+  frame.contentWindow.location = `_javascript_:'<b><p><iframe`
+      + ` src=""
+  setTimeout(() => {
+        setTimeout(() => {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }, 0);
+}
+
+cache_frame = document.body.appendChild(document.createElement("iframe"));
+cache_frame.src = ""
+cache_frame.style.display = "none";
+
+_onload_ = function() {
+    if (!window.internals)
+       return;
+
+    internals.withUserGesture(() => {
+        testButton.click();
+    });
+}
+</script>
+</body>
+</html>

Modified: branches/safari-607-branch/Tools/ChangeLog (245933 => 245934)


--- branches/safari-607-branch/Tools/ChangeLog	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-05-31 00:30:39 UTC (rev 245934)
@@ -1,3 +1,70 @@
+2019-05-30  Kocsen Chung  <[email protected]>
+
+        Apply patch. rdar://problem/50753927
+
+    Add test coverage for <rdar://problem/49731231> https://bugs.webkit.org/show_bug.cgi?id=196730 <rdar://problem/49731231>
+    
+    Reviewed by Ryosuke Niwa.
+    
+    Tools:
+    
+    Add support for testRunner.abortModal() in macOS's WebKitTestRunner in order
+    to match DumpRenderTree.
+    
+    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+    (WTR::TestRunner::abortModal):
+    * WebKitTestRunner/InjectedBundle/TestRunner.h:
+    * WebKitTestRunner/TestController.cpp:
+    (WTR::TestController::runModal):
+    * WebKitTestRunner/TestController.h:
+    * WebKitTestRunner/TestInvocation.cpp:
+    (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+    * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+    (WTR::TestController::abortModal):
+    * WebKitTestRunner/ios/TestControllerIOS.mm:
+    (WTR::TestController::abortModal):
+    * WebKitTestRunner/mac/TestControllerMac.mm:
+    (WTR::TestController::abortModal):
+    * WebKitTestRunner/win/TestControllerWin.cpp:
+    (WTR::TestController::abortModal):
+    
+    LayoutTests:
+    
+    * http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt: Added.
+    * http/tests/security/showModalDialog-sync-cross-origin-page-load.html: Added.
+    
+    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@244898 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-02  Chris Dumez  <[email protected]>
+
+            Add test coverage for <rdar://problem/49731231>
+            https://bugs.webkit.org/show_bug.cgi?id=196730
+            <rdar://problem/49731231>
+
+            Reviewed by Ryosuke Niwa.
+
+            Add support for testRunner.abortModal() in macOS's WebKitTestRunner in order
+            to match DumpRenderTree.
+
+            * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+            * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+            (WTR::TestRunner::abortModal):
+            * WebKitTestRunner/InjectedBundle/TestRunner.h:
+            * WebKitTestRunner/TestController.cpp:
+            (WTR::TestController::runModal):
+            * WebKitTestRunner/TestController.h:
+            * WebKitTestRunner/TestInvocation.cpp:
+            (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+            * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+            (WTR::TestController::abortModal):
+            * WebKitTestRunner/ios/TestControllerIOS.mm:
+            (WTR::TestController::abortModal):
+            * WebKitTestRunner/mac/TestControllerMac.mm:
+            (WTR::TestController::abortModal):
+            * WebKitTestRunner/win/TestControllerWin.cpp:
+            (WTR::TestController::abortModal):
+
 2019-05-30  Ryan Haddad  <[email protected]>
 
         Cherry-pick r245880. rdar://problem/50625279

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-05-31 00:30:39 UTC (rev 245934)
@@ -329,6 +329,9 @@
     // Open panel
     void setOpenPanelFiles(object filesArray);
 
+    // Modal alerts
+    void abortModal();
+
     void setWebRTCMDNSICECandidatesEnabled(boolean value);
     void setWebRTCUnifiedPlanEnabled(boolean value);
     void setCustomUserAgent(DOMString userAgent);

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2019-05-31 00:30:39 UTC (rev 245934)
@@ -2685,4 +2685,10 @@
     return WKBooleanGetValue(adoptWK(static_cast<WKBooleanRef>(returnData)).get());
 }
 
+void TestRunner::abortModal()
+{
+    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("AbortModal"));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
+}
+
 } // namespace WTR

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-05-31 00:30:39 UTC (rev 245934)
@@ -448,6 +448,9 @@
     // Open panel
     void setOpenPanelFiles(JSValueRef);
 
+    // Modal alerts
+    void abortModal();
+
     void terminateNetworkProcess();
     void terminateServiceWorkerProcess();
 

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/TestController.cpp (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/TestController.cpp	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/TestController.cpp	2019-05-31 00:30:39 UTC (rev 245934)
@@ -204,9 +204,9 @@
 void TestController::runModal(WKPageRef page, const void* clientInfo)
 {
     PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
-    view->setWindowIsKey(false);
+    TestController::singleton().mainWebView()->setWindowIsKey(false);
     runModal(view);
-    view->setWindowIsKey(true);
+    TestController::singleton().mainWebView()->setWindowIsKey(true);
 }
 
 static void closeOtherPage(WKPageRef page, const void* clientInfo)

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/TestController.h (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/TestController.h	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/TestController.h	2019-05-31 00:30:39 UTC (rev 245934)
@@ -278,6 +278,8 @@
     UIKeyboardInputMode *overriddenKeyboardInputMode() const { return m_overriddenKeyboardInputMode.get(); }
 #endif
 
+    void abortModal();
+
     bool isDoingMediaCapture() const;
 
 private:

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/TestInvocation.cpp (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/TestInvocation.cpp	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/TestInvocation.cpp	2019-05-31 00:30:39 UTC (rev 245934)
@@ -1521,6 +1521,11 @@
         return result;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "AbortModal")) {
+        TestController::singleton().abortModal();
+        return nullptr;
+    }
+
     ASSERT_NOT_REACHED();
     return nullptr;
 }

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp	2019-05-31 00:30:39 UTC (rev 245934)
@@ -124,6 +124,10 @@
     // FIXME: Need to implement this to test showModalDialog.
 }
 
+void TestController::abortModal()
+{
+}
+
 WKContextRef TestController::platformContext()
 {
     return m_context.get();

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2019-05-31 00:30:39 UTC (rev 245934)
@@ -191,6 +191,10 @@
 //    [[UIApplication sharedApplication] runModalForWindow:window];
 }
 
+void TestController::abortModal()
+{
+}
+
 const char* TestController::platformLibraryPathForTesting()
 {
     return [[@"~/Library/Application Support/WebKitTestRunner" stringByExpandingTildeInPath] UTF8String];

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/mac/TestControllerMac.mm (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2019-05-31 00:30:39 UTC (rev 245934)
@@ -351,6 +351,11 @@
     [NSApp runModalForWindow:window];
 }
 
+void TestController::abortModal()
+{
+    [NSApp abortModal];
+}
+
 const char* TestController::platformLibraryPathForTesting()
 {
     return [[@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath] UTF8String];

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/win/TestControllerWin.cpp (245933 => 245934)


--- branches/safari-607-branch/Tools/WebKitTestRunner/win/TestControllerWin.cpp	2019-05-31 00:30:35 UTC (rev 245933)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/win/TestControllerWin.cpp	2019-05-31 00:30:39 UTC (rev 245934)
@@ -197,6 +197,11 @@
     notImplemented();
 }
 
+void TestController::abortModal()
+{
+    notImplemented();
+}
+
 WKContextRef TestController::platformContext()
 {
     return m_context.get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to