haikuwebkit/LayoutTests/webarchive/loading/missing-data.html

18 lines
507 B
HTML
Raw Permalink Normal View History

<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
Disallow loading webarchives as iframes https://bugs.webkit.org/show_bug.cgi?id=191728 <rdar://problem/45524528> Reviewed by Youenn Fablet. Source/WebCore: Disallow loading webarchives as iframes. We don't allow loading remote webarchives. Now, this policy is hardened to disallow loading webarchives as iframes for local documents as well. To allow old tests still be able to run, a flag is added to always allow loading local webarchives in document. The flag can be set via window.internals. Tests: webarchive/loading/test-loading-archive-subresource.html webarchive/loading/test-loading-top-archive.html * dom/Document.h: (WebCore::Document::setAlwaysAllowLocalWebarchive): (WebCore::Document::alwaysAllowLocalWebarchive): * loader/DocumentLoader.cpp: (WebCore::disallowWebArchive): (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::isRemoteWebArchive): Deleted. * testing/Internals.cpp: (WebCore::Internals::setAlwaysAllowLocalWebarchive const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::unableToImplementPolicy): Add a check to prevent null pointer dereference. LayoutTests: * platform/mac-wk1/webarchive/loading/test-loading-archive-subresource-expected.txt: Added. * platform/mac/fast/loader/webarchive-encoding-respected.html: * webarchive/loading/cache-expired-subresource.html: * webarchive/loading/mainresource-null-mimetype-crash.html: * webarchive/loading/missing-data.html: * webarchive/loading/resources/test-loading-archive-main.webarchive: Copied from LayoutTests/webarchive/loading/test-loading-archive.html. * webarchive/loading/test-loading-archive-subresource-expected.txt: Added. * webarchive/loading/test-loading-archive-subresource-null-mimetype.html: * webarchive/loading/test-loading-archive-subresource.html: Copied from LayoutTests/webarchive/loading/test-loading-archive.html. * webarchive/loading/test-loading-archive.html: * webarchive/loading/test-loading-top-archive-expected.txt: Added. * webarchive/loading/test-loading-top-archive.html: Added. Canonical link: https://commits.webkit.org/206722@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-27 19:38:18 +00:00
if (window.internals)
Further restricting webarchive loads https://bugs.webkit.org/show_bug.cgi?id=194567 <rdar://problem/47610130> Reviewed by Youenn Fablet. Source/WebCore: This patch futher restricts main frame webarchive loads to the followings: 1) loaded by clients; 2) loaded by drag; 3) reloaded from any of the previous two. It moves setAlwaysAllowLocalWebarchive, which is used for testing only, from Document to FrameLoader such that the option is remembered during redirections. Covered by API tests. * dom/Document.h: (WebCore::Document::setAlwaysAllowLocalWebarchive): Deleted. (WebCore::Document::alwaysAllowLocalWebarchive const): Deleted. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::disallowWebArchive const): * loader/DocumentLoader.h: (WebCore::DocumentLoader::setAllowsWebArchiveForMainFrame): (WebCore::DocumentLoader::allowsWebArchiveForMainFrame): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setIsRequestFromClientOrUserInput): (WebCore::FrameLoadRequest::isRequestFromClientOrUserInput): * loader/FrameLoader.cpp: (WebCore::FrameLoader::load): (WebCore::FrameLoader::reload): * loader/FrameLoader.h: (WebCore::FrameLoader::setAlwaysAllowLocalWebarchive): (WebCore::FrameLoader::alwaysAllowLocalWebarchive const): * page/DragController.cpp: (WebCore::DragController::performDragOperation): * testing/Internals.cpp: (WebCore::Internals::setAlwaysAllowLocalWebarchive const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): Set a flag to indicate a load is started from clients. Tools: Besides adding API tests, this patch also enhances DragAndDropSimulator to allow navigations on drop. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/mac/LoadWebArchive.mm: Added. (-[TestLoadWebArchiveNavigationDelegate webView:didFinishNavigation:]): (-[TestLoadWebArchiveNavigationDelegate webView:didFailProvisionalNavigation:withError:]): (-[TestLoadWebArchiveNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/mac/helloworld.webarchive: Added. * TestWebKitAPI/Tests/mac/load-web-archive-1.html: Added. * TestWebKitAPI/Tests/mac/load-web-archive-2.html: Added. * TestWebKitAPI/cocoa/DragAndDropSimulator.h: * TestWebKitAPI/mac/DragAndDropSimulatorMac.mm: (-[DragAndDropSimulator initWithWebViewFrame:configuration:]): (-[DragAndDropSimulator _webView:dragDestinationActionMaskForDraggingInfo:]): LayoutTests: * platform/mac/fast/loader/webarchive-encoding-respected.html: * webarchive/loading/cache-expired-subresource.html: * webarchive/loading/javascript-url-iframe-crash.html: * webarchive/loading/mainresource-null-mimetype-crash.html: * webarchive/loading/missing-data.html: * webarchive/loading/object.html: * webarchive/loading/test-loading-archive-subresource-null-mimetype.html: * webarchive/loading/test-loading-archive-subresource.html: * webarchive/loading/test-loading-archive.html: * webarchive/loading/test-loading-top-archive.html: * webarchive/loading/video-in-webarchive.html: Canonical link: https://commits.webkit.org/209026@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-13 23:07:13 +00:00
internals.setAlwaysAllowLocalWebarchive(true);
onload = function() {
frame = document.createElement("iframe");
frame.src = "resources/missing-data.webarchive";
frame.onload = function() {
if (window.testRunner)
testRunner.notifyDone();
}
document.body.appendChild(frame);
}
</script>