Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Some tests to verify forbidden frame navigation time out
https://bugs.webkit.org/show_bug.cgi?id=173657 Patch by Frederic Wang <fwang@igalia.com> on 2017-06-27 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2-expected.txt: Update the text expectation to PASS. * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation_by_user_activation_without_user_gesture-expected.txt: Ditto. * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_ancestor-1-expected.txt: Ditto. * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3-expected.txt: Add the security error until bug 173162 is fixed. * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3-expected.txt: Ditto. Source/WebCore: Currently some tests try and perform a forbidden frame navigation and verify the corresponding console error. However, WebKit does not raise any exception for such error so the tests have to wait until the timeout limit to complete, which makes execution slow. This patch modifies the setters of window.location for which such error may happen in order to raise an exception so the tests behave as expected. No new tests, already covered by existing tests. * page/Location.cpp: Adjust Location::setLocation to return a security exception and pass it to the callers. (WebCore::Location::setHref): Adjust function to possibly return an exception. (WebCore::Location::setProtocol): Ditto. (WebCore::Location::setHost): Ditto. (WebCore::Location::setHostname): Ditto. (WebCore::Location::setPort): Ditto. (WebCore::Location::setPathname): Ditto. (WebCore::Location::setSearch): Ditto. (WebCore::Location::setHash): Ditto. (WebCore::Location::assign): Ditto. (WebCore::Location::setLocation): FrameLoader::findFrameForNavigation is really only used to verify whether navigating m_frame is permitted so it is more simple and clearer to do it directly. When navigation is not permitted, this function now raises a security exception. * page/Location.h: Modify some setters to return an ExceptionOr<void>. * page/Location.idl: Allow some setters to raise an exception. LayoutTests: * fast/frames/sandboxed-iframe-navigation-top-denied-expected.txt: Add the security error. * http/tests/security/frameNavigation/inactive-function-in-popup-navigate-child.html: Adjust the test to catch and dump the exception and complete immediately. * http/tests/security/frameNavigation/inactive-function-in-popup-navigate-child-expected.txt: Add the dumped security error exception. Canonical link: https://commits.webkit.org/190712@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
14 changed files
with
121 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
CONSOLE MESSAGE: Unsafe JavaScript attempt to initiate navigation for frame with URL 'navigate-top-to-fail.html'. The frame attempting navigation of the top-level window is sandboxed, but the 'allow-top-navigation' flag is not set. | ||
|
||
CONSOLE MESSAGE: SecurityError (DOM Exception 18): The operation is insecure. | ||
This test verifies that a sandboxed IFrame cannot navigate the top-level frame without allow-top-navigation. This test passes if the navigation does not occur. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters