haikuwebkit/LayoutTests/contentfiltering/block-after-will-send-reque...

9 lines
270 B
HTML
Raw Permalink Normal View History

[Content Filtering] Tell the filter about requests and redirects https://bugs.webkit.org/show_bug.cgi?id=143414 rdar://problem/19239549 Reviewed by Darin Adler. Source/WebCore: Tests: contentfiltering/allow-after-will-send-request.html contentfiltering/block-after-will-send-request.html http/tests/contentfiltering/allow-after-redirect.html http/tests/contentfiltering/block-after-redirect.html NEFilterSource supports making filter decisions based on NSURLRequests, so this patch adds support for telling ContentFilter about the original main resource request as well as redirect requests. * bindings/js/JSMockContentFilterSettingsCustom.cpp: Updated decisionPoint values to include AfterWillSendRequest and AfterRedirect. (WebCore::JSMockContentFilterSettings::decisionPoint): (WebCore::JSMockContentFilterSettings::setDecisionPoint): * loader/ContentFilter.cpp: (WebCore::ContentFilter::willSendRequest): Called willSendRequest() on each filter using forEachContentFilterUntilBlocked(). (WebCore::ContentFilter::redirectReceived): Called willSendRequest(). * loader/ContentFilter.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Called ContentFilter::willSendRequest() if there is a content filter. Asserted that this is not a redirect, and that ContentFilter does not set the request to null. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequest): Called redirectReceived() instead of willSendRequest(). * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects. (WebCore::CachedRawResource::willSendRequest): Deleted. * loader/cache/CachedRawResource.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects. (WebCore::CachedResource::willSendRequest): Deleted. * loader/cache/CachedResource.h: * platform/PlatformContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): Called responseReceived() if there was a redirectResponse. Then called -[NEFilterSource willSendRequest:decisionHandler:]. * platform/cocoa/ParentalControlsContentFilter.h: * platform/spi/cocoa/NEFilterSourceSPI.h: Added a #define for NEFilterSourceOptionsPageData. * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): Added support for willSendRequest. * testing/MockContentFilter.h: Added decision points for AfterWillSendRequest and AfterRedirect. * testing/MockContentFilterSettings.h: * testing/MockContentFilterSettings.idl: LayoutTests: * contentfiltering/allow-after-will-send-request-expected.html: Added. * contentfiltering/allow-after-will-send-request.html: Added. * contentfiltering/block-after-will-send-request-expected.html: Added. * contentfiltering/block-after-will-send-request.html: Added. * http/tests/contentfiltering/allow-after-redirect-expected.html: Added. * http/tests/contentfiltering/allow-after-redirect.html: Added. * http/tests/contentfiltering/block-after-redirect-expected.html: Added. * http/tests/contentfiltering/block-after-redirect.html: Added. * http/tests/contentfiltering/resources/fail.html: Added. * http/tests/contentfiltering/resources/pass.html: Added. Canonical link: https://commits.webkit.org/161461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-04-06 00:23:46 +00:00
<!DOCTYPE html>
<script src="resources/contentfiltering.js"></script>
<script>
if (window.internals) {
var settings = window.internals.mockContentFilterSettings;
[WebIDL] Remove custom bindings for MockContentFilterSettings https://bugs.webkit.org/show_bug.cgi?id=174606 Patch by Sam Weinig <sam@webkit.org> on 2017-07-18 Reviewed by Andy Estes. Source/WebCore: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSMockContentFilterSettingsCustom.cpp: Removed. Remove JSMockContentFilterSettingsCustom. * testing/MockContentFilterSettings.h: * testing/MockContentFilterSettings.idl: Switch from constants to IDL enums to make the bindings and tests simpler. LayoutTests: * contentfiltering/allow-after-add-data.html: * contentfiltering/allow-after-finished-adding-data.html: * contentfiltering/allow-after-response.html: * contentfiltering/allow-after-will-send-request.html: * contentfiltering/allow-empty-document.html: * contentfiltering/allow-media-document.html: * contentfiltering/allow-never.html: * contentfiltering/block-after-add-data-then-allow-unblock.html: * contentfiltering/block-after-add-data-then-deny-unblock.html: * contentfiltering/block-after-add-data.html: * contentfiltering/block-after-finished-adding-data-then-allow-unblock.html: * contentfiltering/block-after-finished-adding-data-then-deny-unblock.html: * contentfiltering/block-after-finished-adding-data.html: * contentfiltering/block-after-response-then-allow-unblock.html: * contentfiltering/block-after-response-then-deny-unblock.html: * contentfiltering/block-after-response.html: * contentfiltering/block-after-will-send-request-then-allow-unblock.html: * contentfiltering/block-after-will-send-request-then-deny-unblock.html: * contentfiltering/block-after-will-send-request.html: * contentfiltering/block-never.html: * contentfiltering/modify-request-url.html: * contentfiltering/resources/contentfiltering.js: * http/tests/contentfiltering/allow-after-redirect.html: * http/tests/contentfiltering/block-after-redirect.html: * http/tests/contentfiltering/load-substitute-data-from-appcache.html: * http/tests/contentfiltering/modify-redirect-request-url.html: Update tests to use new MockContentFilterSettings enums rather than constants. Canonical link: https://commits.webkit.org/191434@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 20:14:31 +00:00
testContentFiltering(/* decisionPoint */"afterWillSendRequest", /* decision */"block");
[Content Filtering] Tell the filter about requests and redirects https://bugs.webkit.org/show_bug.cgi?id=143414 rdar://problem/19239549 Reviewed by Darin Adler. Source/WebCore: Tests: contentfiltering/allow-after-will-send-request.html contentfiltering/block-after-will-send-request.html http/tests/contentfiltering/allow-after-redirect.html http/tests/contentfiltering/block-after-redirect.html NEFilterSource supports making filter decisions based on NSURLRequests, so this patch adds support for telling ContentFilter about the original main resource request as well as redirect requests. * bindings/js/JSMockContentFilterSettingsCustom.cpp: Updated decisionPoint values to include AfterWillSendRequest and AfterRedirect. (WebCore::JSMockContentFilterSettings::decisionPoint): (WebCore::JSMockContentFilterSettings::setDecisionPoint): * loader/ContentFilter.cpp: (WebCore::ContentFilter::willSendRequest): Called willSendRequest() on each filter using forEachContentFilterUntilBlocked(). (WebCore::ContentFilter::redirectReceived): Called willSendRequest(). * loader/ContentFilter.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Called ContentFilter::willSendRequest() if there is a content filter. Asserted that this is not a redirect, and that ContentFilter does not set the request to null. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequest): Called redirectReceived() instead of willSendRequest(). * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects. (WebCore::CachedRawResource::willSendRequest): Deleted. * loader/cache/CachedRawResource.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects. (WebCore::CachedResource::willSendRequest): Deleted. * loader/cache/CachedResource.h: * platform/PlatformContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.h: * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::willSendRequest): Called responseReceived() if there was a redirectResponse. Then called -[NEFilterSource willSendRequest:decisionHandler:]. * platform/cocoa/ParentalControlsContentFilter.h: * platform/spi/cocoa/NEFilterSourceSPI.h: Added a #define for NEFilterSourceOptionsPageData. * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::willSendRequest): Added support for willSendRequest. * testing/MockContentFilter.h: Added decision points for AfterWillSendRequest and AfterRedirect. * testing/MockContentFilterSettings.h: * testing/MockContentFilterSettings.idl: LayoutTests: * contentfiltering/allow-after-will-send-request-expected.html: Added. * contentfiltering/allow-after-will-send-request.html: Added. * contentfiltering/block-after-will-send-request-expected.html: Added. * contentfiltering/block-after-will-send-request.html: Added. * http/tests/contentfiltering/allow-after-redirect-expected.html: Added. * http/tests/contentfiltering/allow-after-redirect.html: Added. * http/tests/contentfiltering/block-after-redirect-expected.html: Added. * http/tests/contentfiltering/block-after-redirect.html: Added. * http/tests/contentfiltering/resources/fail.html: Added. * http/tests/contentfiltering/resources/pass.html: Added. Canonical link: https://commits.webkit.org/161461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-04-06 00:23:46 +00:00
}
</script>