http/tests/security/sandboxed-iframe-invalid.html is flaky on Mac
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Aug 2013 03:44:57 +0000 (03:44 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Aug 2013 03:44:57 +0000 (03:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85522

Reviewed by Andy Estes.

Source/WebCore:

Drive-by FIXMEs and trivial fixes for WebCore issues I noticed while working
on this bug. No behavior change expected.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::submitForm):
(WebCore::FrameLoader::findFrameForNavigation):
* loader/NavigationScheduler.cpp:
(WebCore::ScheduledFormSubmission::fire):

Tools:

* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate webView:addMessageToConsole:withSource:]): Don't print console messages
when already done with a test. We already had this check in all UI delegate functions,
except for -webView:addMessageToConsole:withSource: somehow.

LayoutTests:

* http/tests/security/sandboxed-iframe-form-top-expected.txt: Console logging got
improved while this test was marked as skipped or flaky, updating the results.

* platform/mac/TestExpectations: Removed sandboxed-iframe-form-top.html, this test
no longer leaks output into later ones. The test was erroneously marked as flaky
instead of skipped, but now it's good.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/security/sandboxed-iframe-form-top-expected.txt
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/NavigationScheduler.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/UIDelegate.mm

index fc8eb24..92e8999 100644 (file)
@@ -1,3 +1,17 @@
+2013-08-12  Alexey Proskuryakov  <ap@apple.com>
+
+        http/tests/security/sandboxed-iframe-invalid.html is flaky on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=85522
+
+        Reviewed by Andy Estes.
+
+        * http/tests/security/sandboxed-iframe-form-top-expected.txt: Console logging got
+        improved while this test was marked as skipped or flaky, updating the results.
+
+        * platform/mac/TestExpectations: Removed sandboxed-iframe-form-top.html, this test
+        no longer leaks output into later ones. The test was erroneously marked as flaky
+        instead of skipped, but now it's good.
+
 2013-08-12  Ryuan Choi  <ryuan.choi@samsung.com>
 
         [EFL] Unreviewed gardening.
index f72de46..ade991e 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate a navigation change for frame with URL http://127.0.0.1:8000/security/sandboxed-iframe-form-top.html from frame with URL http://127.0.0.1:8000/security/resources/sandboxed-iframe-form-top.html.
+CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL 'http://127.0.0.1:8000/security/sandboxed-iframe-form-top.html' from frame with URL 'http://127.0.0.1:8000/security/resources/sandboxed-iframe-form-top.html'. The frame attempting navigation of the top-level window is sandboxed, but the 'allow-top-navigation' flag is not set.
 
 This tests passes if the sandboxed frame cannot navigate the top frame.
 
index 416ba74..e598997 100644 (file)
@@ -621,8 +621,6 @@ webkit.org/b/84357 media/audio-repaint.html [ Failure ]
 # Requires ENABLE(MEDIA_CAPTURE)
 fast/forms/file/file-input-capture.html
 
-webkit.org/b/85522 http/tests/security/sandboxed-iframe-form-top.html [ Pass Failure ]
-
 webkit.org/b/85523 fullscreen/full-screen-iframe-legacy.html [ Pass Failure ]
 
 webkit.org/b/85525 media/video-played-reset.html [ Pass Failure ]
index 1776bea..c672f5d 100644 (file)
@@ -1,3 +1,19 @@
+2013-08-12  Alexey Proskuryakov  <ap@apple.com>
+
+        http/tests/security/sandboxed-iframe-invalid.html is flaky on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=85522
+
+        Reviewed by Andy Estes.
+
+        Drive-by FIXMEs and trivial fixes for WebCore issues I noticed while working
+        on this bug. No behavior change expected.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::submitForm):
+        (WebCore::FrameLoader::findFrameForNavigation):
+        * loader/NavigationScheduler.cpp:
+        (WebCore::ScheduledFormSubmission::fire):
+
 2013-08-13  Ryosuke Niwa  <rniwa@webkit.org>
 
         Fix variable name |end| -> |size| in EventTarget::fireEventListeners
index 8e90181..bddd460 100644 (file)
@@ -356,6 +356,12 @@ void FrameLoader::submitForm(PassRefPtr<FormSubmission> submission)
         if (!DOMWindow::allowPopUp(m_frame) && !ScriptController::processingUserGesture())
             return;
 
+        // FIXME: targetFrame can be 0 for two distinct reasons:
+        // 1. The frame was not found by name, so we should try opening a new window.
+        // 2. The frame was found, but navigating it was not allowed, e.g. by HTML5 sandbox or by origin checks.
+        // Continuing form submission makes no sense in the latter case.
+        // There is a repeat check after timer fires, so this is not a correctness issue.
+
         targetFrame = m_frame;
     } else
         submission->clearTarget();
@@ -3088,15 +3094,12 @@ Frame* FrameLoader::findFrameForNavigation(const AtomicString& name, Document* a
         ASSERT(frame != m_frame);
     }
 
-    if (activeDocument) {
-        if (!activeDocument->canNavigate(frame))
-            return 0;
-    } else {
-        // FIXME: Eventually all callers should supply the actual activeDocument
-        // so we can call canNavigate with the right document.
-        if (!m_frame->document()->canNavigate(frame))
-            return 0;
-    }
+    // FIXME: Eventually all callers should supply the actual activeDocument so we can call canNavigate with the right document.
+    if (!activeDocument)
+        activeDocument = m_frame->document();
+
+    if (!activeDocument->canNavigate(frame))
+        return 0;
 
     return frame;
 }
index b7474c9..5be73e1 100644 (file)
@@ -232,7 +232,7 @@ public:
         Document* requestingDocument = m_submission->state()->sourceDocument();
         if (!requestingDocument->canNavigate(frame))
             return;
-        FrameLoadRequest frameRequest(requestingDocument->document()->securityOrigin());
+        FrameLoadRequest frameRequest(requestingDocument->securityOrigin());
         m_submission->populateFrameLoadRequest(frameRequest);
         frame->loader()->loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer);
     }
index b5c8259..29997af 100644 (file)
@@ -1,5 +1,17 @@
 2013-08-12  Alexey Proskuryakov  <ap@apple.com>
 
+        http/tests/security/sandboxed-iframe-invalid.html is flaky on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=85522
+
+        Reviewed by Andy Estes.
+
+        * DumpRenderTree/mac/UIDelegate.mm:
+        (-[UIDelegate webView:addMessageToConsole:withSource:]): Don't print console messages
+        when already done with a test. We already had this check in all UI delegate functions,
+        except for -webView:addMessageToConsole:withSource: somehow.
+
+2013-08-12  Alexey Proskuryakov  <ap@apple.com>
+
         https://bugs.webkit.org/show_bug.cgi?id=119693
         [Mac] security/contentSecurityPolicy/connect-src-websocket-blocked.html is flaky
         because of connect-src-websocket-allowed.html
index 3473d17..0ceac74 100644 (file)
@@ -60,6 +60,9 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
 
 - (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary withSource:(NSString *)source
 {
+    if (done)
+        return;
+
     NSString *message = [dictionary objectForKey:@"message"];
     NSNumber *lineNumber = [dictionary objectForKey:@"lineNumber"];