Changeset 290189 in webkit
- Timestamp:
- Feb 18, 2022 5:02:27 PM (2 years ago)
- Location:
- trunk/Source
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r290188 r290189 1 2022-02-18 Per Arne Vollan <pvollan@apple.com> 2 3 Move content filtering to Networking process 4 https://bugs.webkit.org/show_bug.cgi?id=233760 5 <rdar://problem/86150702> 6 7 Reviewed by Brent Fulgham. 8 9 Remove content filtering from DocumentLoader when the feature is enabled, since this takes place in the WebContent process. 10 Modify the ContentFilter class by removing use of the types CachedResoure and CachedRawResource, since objects of these 11 types are not available in the Networking process. Parameters with these types are replaced with URL parameters. 12 The new behavior is behind a feature flag, which is not enabled in this patch. 13 14 * WebCore.xcodeproj/project.pbxproj: 15 * loader/ContentFilter.cpp: 16 (WebCore::ContentFilter::startFilteringMainResource): 17 (WebCore::ContentFilter::stopFilteringMainResource): 18 (WebCore::ContentFilter::continueAfterResponseReceived): 19 (WebCore::ContentFilter::continueAfterDataReceived): 20 (WebCore::ContentFilter::continueAfterNotifyFinished): 21 (WebCore::ContentFilter::didDecide): 22 (WebCore::ContentFilter::deliverResourceData): 23 (WebCore::ContentFilter::url): 24 (WebCore::ContentFilter::deliverStoredResourceData): 25 * loader/ContentFilter.h: 26 (WebCore::ContentFilter::blockedError const): 27 (WebCore::ContentFilter::isAllowed const): 28 (WebCore::ContentFilter::responseReceived const): 29 * loader/ContentFilterClient.h: 30 * loader/DocumentLoader.cpp: 31 (WebCore::DocumentLoader::notifyFinished): 32 (WebCore::DocumentLoader::willSendRequest): 33 (WebCore::DocumentLoader::responseReceived): 34 (WebCore::DocumentLoader::dataReceived): 35 (WebCore::DocumentLoader::detachFromFrame): 36 (WebCore::DocumentLoader::startLoadingMainResource): 37 (WebCore::DocumentLoader::clearMainResource): 38 (WebCore::DocumentLoader::becomeMainResourceClient): 39 (WebCore::DocumentLoader::contentFilterDidBlock): 40 (WebCore::DocumentLoader::handleContentFilterDidBlock): 41 (WebCore::DocumentLoader::handleContentFilterProvisionalLoadFailure): 42 (WebCore::DocumentLoader::contentFilterWillHandleProvisionalLoadFailure): 43 (WebCore::DocumentLoader::contentFilterHandleProvisionalLoadFailure): 44 * loader/DocumentLoader.h: 45 * loader/FrameLoader.cpp: 46 (WebCore::FrameLoader::dispatchDidFailProvisionalLoad): 47 * loader/PolicyChecker.cpp: 48 (WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy): 49 * loader/SubstituteData.h: 50 (WebCore::SubstituteData::encode const): 51 (WebCore::SubstituteData::decode): 52 * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm: 53 (WebCore::ContentFilterUnblockHandler::canHandleRequest const): 54 1 55 2022-02-18 Mark Lam <mark.lam@apple.com> 2 56 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r290188 r290189 3369 3369 A14832CF187F684700DA63A6 /* WebCoreThreadSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3370 3370 A1491DA31F859D870095F5D4 /* PaymentSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A1491DA21F859D870095F5D4 /* PaymentSession.h */; }; 3371 A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A149786D1ABAF33800CEF7E4 /* ContentFilter.h */; };3371 A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A149786D1ABAF33800CEF7E4 /* ContentFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3372 3372 A14978711ABAF3A500CEF7E4 /* PlatformContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3373 3373 A14BB0A01F9813B800605A35 /* MockPayment.h in Headers */ = {isa = PBXBuildFile; fileRef = A14BB09E1F9813B800605A35 /* MockPayment.h */; }; -
trunk/Source/WebCore/loader/ContentFilter.cpp
r287687 r290189 114 114 } 115 115 116 void ContentFilter::startFilteringMainResource(CachedRawResource& resource) 116 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 117 void ContentFilter::startFilteringMainResource(const URL& url) 117 118 { 118 119 if (m_state != State::Stopped) 119 120 return; 120 121 121 LOG(ContentFiltering, "ContentFilter will start filtering main resource at <%s>.\n", resource.url().string().ascii().data()); 122 LOG(ContentFiltering, "ContentFilter will start filtering main resource at <%{sensitive}s>.\n", url.string().ascii().data()); 123 m_state = State::Filtering; 124 ASSERT(m_mainResourceURL.isEmpty()); 125 m_mainResourceURL = url; 126 } 127 #else 128 void ContentFilter::startFilteringMainResource(CachedRawResource& resource) 129 { 130 if (m_state != State::Stopped) 131 return; 132 133 LOG(ContentFiltering, "ContentFilter will start filtering main resource at <%{sensitive}s>.\n", resource.url().string().ascii().data()); 122 134 m_state = State::Filtering; 123 135 ASSERT(!m_mainResource); 124 136 m_mainResource = &resource; 125 137 } 138 #endif 126 139 127 140 void ContentFilter::stopFilteringMainResource() … … 129 142 if (m_state != State::Blocked) 130 143 m_state = State::Stopped; 144 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 145 m_mainResourceURL = URL(); 146 #else 131 147 m_mainResource = nullptr; 148 #endif 132 149 } 133 150 … … 143 160 } 144 161 162 m_responseReceived = true; 163 145 164 return m_state != State::Blocked; 146 165 } 147 166 167 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 168 bool ContentFilter::continueAfterDataReceived(const SharedBuffer& data, size_t encodedDataLength) 169 #else 148 170 bool ContentFilter::continueAfterDataReceived(const SharedBuffer& data) 171 #endif 149 172 { 150 173 Ref<ContentFilterClient> protectedClient { m_client }; 151 174 152 175 if (m_state == State::Filtering) { 153 LOG(ContentFiltering, "ContentFilter received %zu bytes of data from <%s>.\n", data.size(), m_mainResource->url().string().ascii().data()); 176 LOG(ContentFiltering, "ContentFilter received %zu bytes of data from <%{sensitive}s>.\n", data.size(), url().string().ascii().data()); 177 154 178 forEachContentFilterUntilBlocked([data = Ref { data }](auto& contentFilter) { 155 179 contentFilter.addData(data); 156 180 }); 157 158 if (m_state == State::Allowed) 159 deliverResourceData(*m_mainResource); 181 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 182 if (m_state == State::Allowed) { 183 deliverStoredResourceData(); 184 deliverResourceData(data, encodedDataLength); 185 } else 186 m_buffers.append(ResourceDataItem { RefPtr { &data }, encodedDataLength }); 187 #else 188 if (m_state == State::Allowed) { 189 ASSERT(m_mainResource->dataBufferingPolicy() == DataBufferingPolicy::BufferData); 190 if (auto* buffer = m_mainResource->resourceBuffer()) 191 deliverResourceData(buffer->makeContiguous()); 192 } 193 #endif 160 194 return false; 161 195 } … … 164 198 } 165 199 200 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 201 bool ContentFilter::continueAfterNotifyFinished(const URL& resourceURL) 202 #else 166 203 bool ContentFilter::continueAfterNotifyFinished(CachedResource& resource) 167 { 204 #endif 205 { 206 Ref<ContentFilterClient> protectedClient { m_client }; 207 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 208 ASSERT_UNUSED(resourceURL, resourceURL == m_mainResourceURL); 209 #else 168 210 ASSERT_UNUSED(resource, &resource == m_mainResource); 169 Ref<ContentFilterClient> protectedClient { m_client };170 171 211 if (m_mainResource->errorOccurred()) 172 212 return true; 213 #endif 173 214 174 215 if (m_state == State::Filtering) { 175 LOG(ContentFiltering, "ContentFilter will finish filtering main resource at <% s>.\n", m_mainResource->url().string().ascii().data());216 LOG(ContentFiltering, "ContentFilter will finish filtering main resource at <%{sensitive}s>.\n", url().string().ascii().data()); 176 217 forEachContentFilterUntilBlocked([](PlatformContentFilter& contentFilter) { 177 218 contentFilter.finishedAddingData(); … … 180 221 if (m_state != State::Blocked) { 181 222 m_state = State::Allowed; 182 deliverResourceData(*m_mainResource); 223 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 224 deliverStoredResourceData(); 225 #else 226 if (auto* buffer = m_mainResource->resourceBuffer()) { 227 ASSERT(m_mainResource->dataBufferingPolicy() == DataBufferingPolicy::BufferData); 228 deliverResourceData(buffer->makeContiguous()); 229 } 230 #endif 183 231 } 184 232 … … 220 268 ASSERT(m_state != State::Blocked); 221 269 ASSERT(state == State::Allowed || state == State::Blocked); 222 LOG(ContentFiltering, "ContentFilter decided load should be %s for main resource at <%s>.\n", state == State::Allowed ? "allowed" : "blocked", m_mainResource ? m_mainResource->url().string().ascii().data() : ""); 270 #if !LOG_DISABLED 271 LOG(ContentFiltering, "ContentFilter decided load should be %s for main resource at <%{sensitive}s>.\n", state == State::Allowed ? "allowed" : "blocked", url().string().ascii().data()); 272 #endif // !LOG_DISABLED 223 273 m_state = state; 224 274 if (m_state != State::Blocked) … … 229 279 } 230 280 231 void ContentFilter::deliverResourceData( CachedResource& resource)281 void ContentFilter::deliverResourceData(const SharedBuffer& buffer, size_t encodedDataLength) 232 282 { 233 283 ASSERT(m_state == State::Allowed); 234 ASSERT(resource.dataBufferingPolicy() == DataBufferingPolicy::BufferData); 235 if (auto* resourceBuffer = resource.resourceBuffer()) 236 m_client.dataReceivedThroughContentFilter(resourceBuffer->makeContiguous()); 284 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 285 m_client.dataReceivedThroughContentFilter(buffer, encodedDataLength); 286 #else 287 UNUSED_PARAM(encodedDataLength); 288 m_client.dataReceivedThroughContentFilter(buffer); 289 #endif 290 } 291 292 URL ContentFilter::url() 293 { 294 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 295 return m_mainResourceURL; 296 #else 297 if (m_mainResource) 298 return m_mainResource->url(); 299 return URL(); 300 #endif 237 301 } 238 302 … … 246 310 } 247 311 312 #if !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 248 313 bool ContentFilter::continueAfterSubstituteDataRequest(const DocumentLoader& activeLoader, const SubstituteData& substituteData) 249 314 { … … 260 325 return true; 261 326 } 327 #endif 262 328 263 329 bool ContentFilter::willHandleProvisionalLoadFailure(const ResourceError& error) const … … 284 350 } 285 351 352 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 353 void ContentFilter::deliverStoredResourceData() 354 { 355 for (auto& buffer : m_buffers) 356 deliverResourceData(*buffer.buffer, buffer.encodedDataLength); 357 m_buffers.clear(); 358 } 359 #endif 360 286 361 } // namespace WebCore 287 362 -
trunk/Source/WebCore/loader/ContentFilter.h
r287687 r290189 51 51 template <typename T> static void addType() { types().append(type<T>()); } 52 52 53 static std::unique_ptr<ContentFilter> create(ContentFilterClient&);54 ~ContentFilter();53 WEBCORE_EXPORT static std::unique_ptr<ContentFilter> create(ContentFilterClient&); 54 WEBCORE_EXPORT ~ContentFilter(); 55 55 56 56 static const char* urlScheme() { return "x-apple-content-filter"; } 57 57 58 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 59 WEBCORE_EXPORT void startFilteringMainResource(const URL&); 60 #else 58 61 void startFilteringMainResource(CachedRawResource&); 59 void stopFilteringMainResource(); 62 #endif 63 WEBCORE_EXPORT void stopFilteringMainResource(); 60 64 61 bool continueAfterWillSendRequest(ResourceRequest&, const ResourceResponse&); 62 bool continueAfterResponseReceived(const ResourceResponse&); 65 WEBCORE_EXPORT bool continueAfterWillSendRequest(ResourceRequest&, const ResourceResponse&); 66 WEBCORE_EXPORT bool continueAfterResponseReceived(const ResourceResponse&); 67 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 68 WEBCORE_EXPORT bool continueAfterDataReceived(const SharedBuffer&, size_t encodedDataLength); 69 WEBCORE_EXPORT bool continueAfterNotifyFinished(const URL& resourceURL); 70 #else 63 71 bool continueAfterDataReceived(const SharedBuffer&); 64 72 bool continueAfterNotifyFinished(CachedResource&); 73 #endif 65 74 66 75 static bool continueAfterSubstituteDataRequest(const DocumentLoader& activeLoader, const SubstituteData&); 67 76 bool willHandleProvisionalLoadFailure(const ResourceError&) const; 68 void handleProvisionalLoadFailure(const ResourceError&);77 WEBCORE_EXPORT void handleProvisionalLoadFailure(const ResourceError&); 69 78 79 const ResourceError& blockedError() const { return m_blockedError; } 80 bool isAllowed() const { return m_state == State::Allowed; } 81 bool responseReceived() const { return m_responseReceived; } 82 70 83 private: 71 84 using State = PlatformContentFilter::State; … … 83 96 template <typename Function> void forEachContentFilterUntilBlocked(Function&&); 84 97 void didDecide(State); 85 void deliverResourceData(CachedResource&); 86 98 void deliverResourceData(const SharedBuffer&, size_t encodedDataLength = 0); 99 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 100 void deliverStoredResourceData(); 101 #endif 102 103 URL url(); 104 87 105 Container m_contentFilters; 88 106 ContentFilterClient& m_client; 107 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 108 URL m_mainResourceURL; 109 struct ResourceDataItem { 110 RefPtr<const SharedBuffer> buffer; 111 size_t encodedDataLength; 112 }; 113 114 Vector<ResourceDataItem> m_buffers; 115 #else 89 116 CachedResourceHandle<CachedRawResource> m_mainResource; 117 #endif 90 118 const PlatformContentFilter* m_blockingContentFilter { nullptr }; 91 119 State m_state { State::Stopped }; 92 120 ResourceError m_blockedError; 93 121 bool m_isLoadingBlockedPage { false }; 122 bool m_responseReceived { false }; 94 123 }; 95 124 -
trunk/Source/WebCore/loader/ContentFilterClient.h
r287684 r290189 43 43 virtual void deref() const = 0; 44 44 45 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 46 virtual void dataReceivedThroughContentFilter(const SharedBuffer&, size_t) = 0; 47 #else 45 48 virtual void dataReceivedThroughContentFilter(const SharedBuffer&) = 0; 49 #endif 46 50 virtual ResourceError contentFilterDidBlock(ContentFilterUnblockHandler, String&& unblockRequestDeniedScript) = 0; 47 51 virtual void cancelMainResourceLoadForContentFilter(const ResourceError&) = 0; -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r290167 r290189 420 420 { 421 421 ASSERT(isMainThread()); 422 #if ENABLE(CONTENT_FILTERING) 422 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 423 423 if (m_contentFilter && !m_contentFilter->continueAfterNotifyFinished(resource)) 424 424 return; … … 711 711 } 712 712 713 #if ENABLE(CONTENT_FILTERING) 713 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 714 714 if (m_contentFilter && !m_contentFilter->continueAfterWillSendRequest(newRequest, redirectResponse)) 715 715 return completionHandler(WTFMove(newRequest)); … … 903 903 CompletionHandlerCallingScope completionHandlerCaller(WTFMove(completionHandler)); 904 904 905 #if ENABLE(CONTENT_FILTERING) 905 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 906 906 if (m_contentFilter && !m_contentFilter->continueAfterResponseReceived(response)) 907 907 return; … … 1323 1323 void DocumentLoader::dataReceived(const SharedBuffer& buffer) 1324 1324 { 1325 #if ENABLE(CONTENT_FILTERING) 1325 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1326 1326 if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(buffer)) 1327 1327 return; … … 1464 1464 if (m_mainResource && m_mainResource->hasClient(*this)) 1465 1465 m_mainResource->removeClient(*this); 1466 #if ENABLE(CONTENT_FILTERING) 1466 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1467 1467 if (m_contentFilter) 1468 1468 m_contentFilter->stopFilteringMainResource(); … … 2026 2026 } 2027 2027 2028 #if ENABLE(CONTENT_FILTERING) 2028 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2029 2029 m_contentFilter = !m_substituteData.isValid() ? ContentFilter::create(*this) : nullptr; 2030 2030 #endif … … 2231 2231 if (m_mainResource && m_mainResource->hasClient(*this)) 2232 2232 m_mainResource->removeClient(*this); 2233 #if ENABLE(CONTENT_FILTERING) 2233 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2234 2234 if (m_contentFilter) 2235 2235 m_contentFilter->stopFilteringMainResource(); … … 2358 2358 void DocumentLoader::becomeMainResourceClient() 2359 2359 { 2360 #if ENABLE(CONTENT_FILTERING) 2360 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2361 2361 if (m_contentFilter) 2362 2362 m_contentFilter->startFilteringMainResource(*m_mainResource); … … 2415 2415 } 2416 2416 2417 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2418 void DocumentLoader::dataReceivedThroughContentFilter(const SharedBuffer& buffer) 2419 { 2420 dataReceived(buffer); 2421 } 2422 2423 void DocumentLoader::cancelMainResourceLoadForContentFilter(const ResourceError& error) 2424 { 2425 cancelMainResourceLoad(error); 2426 } 2427 2428 ResourceError DocumentLoader::contentFilterDidBlock(ContentFilterUnblockHandler unblockHandler, String&& unblockRequestDeniedScript) 2429 { 2430 return handleContentFilterDidBlock(unblockHandler, WTFMove(unblockRequestDeniedScript)); 2431 } 2432 2433 void DocumentLoader::handleProvisionalLoadFailureFromContentFilter(const URL& blockedPageURL, SubstituteData& substituteData) 2434 { 2435 frameLoader()->load(FrameLoadRequest(*frame(), blockedPageURL, substituteData)); 2436 } 2437 #endif // ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2438 2417 2439 #if ENABLE(CONTENT_FILTERING) 2418 void DocumentLoader::dataReceivedThroughContentFilter(const SharedBuffer& buffer) 2419 { 2420 dataReceived(buffer); 2421 } 2422 2423 void DocumentLoader::cancelMainResourceLoadForContentFilter(const ResourceError& error) 2424 { 2425 cancelMainResourceLoad(error); 2426 } 2427 2428 void DocumentLoader::handleProvisionalLoadFailureFromContentFilter(const URL& blockedPageURL, SubstituteData& substituteData) 2429 { 2430 frameLoader()->load(FrameLoadRequest(*frame(), blockedPageURL, substituteData)); 2431 } 2432 2433 ResourceError DocumentLoader::contentFilterDidBlock(ContentFilterUnblockHandler unblockHandler, String&& unblockRequestDeniedScript) 2440 ResourceError DocumentLoader::handleContentFilterDidBlock(ContentFilterUnblockHandler unblockHandler, String&& unblockRequestDeniedScript) 2434 2441 { 2435 2442 unblockHandler.setUnreachableURL(documentURL()); … … 2441 2448 } 2442 2449 frameLoader()->client().contentFilterDidBlockLoad(WTFMove(unblockHandler)); 2443 return frameLoader()->blockedByContentFilterError(request()); 2444 } 2450 auto error = frameLoader()->blockedByContentFilterError(request()); 2451 2452 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2453 m_blockedByContentFilter = true; 2454 m_blockedError = error; 2455 #endif 2456 2457 return error; 2458 } 2459 2460 void DocumentLoader::handleContentFilterProvisionalLoadFailure(const URL& blockedPageURL, const SubstituteData& substituteData) 2461 { 2462 frameLoader()->load(FrameLoadRequest(*frame(), blockedPageURL, substituteData)); 2463 } 2464 2465 bool DocumentLoader::contentFilterWillHandleProvisionalLoadFailure(const ResourceError& error) 2466 { 2467 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2468 return m_blockedByContentFilter && m_blockedError.errorCode() == error.errorCode() && m_blockedError.domain() == error.domain(); 2469 #else 2470 return m_contentFilter && m_contentFilter->willHandleProvisionalLoadFailure(error); 2471 #endif 2472 } 2473 2474 void DocumentLoader::contentFilterHandleProvisionalLoadFailure(const ResourceError& error) 2475 { 2476 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 2477 UNUSED_PARAM(error); 2478 #else 2479 if (m_contentFilter) 2480 m_contentFilter->handleProvisionalLoadFailure(error); 2481 #endif 2482 } 2483 2445 2484 #endif // ENABLE(CONTENT_FILTERING) 2446 2485 -
trunk/Source/WebCore/loader/DocumentLoader.h
r289134 r290189 160 160 , public FrameDestructionObserver 161 161 , public ContentSecurityPolicyClient 162 #if ENABLE(CONTENT_FILTERING) 162 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 163 163 , public ContentFilterClient 164 164 #endif … … 403 403 404 404 #if ENABLE(CONTENT_FILTERING) 405 #if !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 405 406 ContentFilter* contentFilter() const { return m_contentFilter.get(); } 406 407 void ref() const final { RefCounted<DocumentLoader>::ref(); } 407 408 void deref() const final { RefCounted<DocumentLoader>::deref(); } 408 409 #endif 410 WEBCORE_EXPORT ResourceError handleContentFilterDidBlock(ContentFilterUnblockHandler, String&& unblockRequestDeniedScript); 411 WEBCORE_EXPORT void handleContentFilterProvisionalLoadFailure(const URL& blockedPageURL, const SubstituteData&); 412 #endif 409 413 410 414 void startIconLoading(); … … 451 455 bool isContinuingLoadAfterProvisionalLoadStarted() const { return m_isContinuingLoadAfterProvisionalLoadStarted; } 452 456 void setIsContinuingLoadAfterProvisionalLoadStarted(bool isContinuingLoadAfterProvisionalLoadStarted) { m_isContinuingLoadAfterProvisionalLoadStarted = isContinuingLoadAfterProvisionalLoadStarted; } 457 458 #if ENABLE(CONTENT_FILTERING) 459 bool contentFilterWillHandleProvisionalLoadFailure(const ResourceError&); 460 void contentFilterHandleProvisionalLoadFailure(const ResourceError&); 461 #endif 453 462 454 463 protected: … … 504 513 void responseReceived(const ResourceResponse&, CompletionHandler<void()>&&); 505 514 506 #if ENABLE(CONTENT_FILTERING) 515 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 507 516 // ContentFilterClient 508 517 WEBCORE_EXPORT void dataReceivedThroughContentFilter(const SharedBuffer&) final; … … 656 665 657 666 #if ENABLE(CONTENT_FILTERING) 667 #if !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 658 668 std::unique_ptr<ContentFilter> m_contentFilter; 669 #else 670 bool m_blockedByContentFilter { false }; 671 ResourceError m_blockedError; 672 #endif 659 673 #endif 660 674 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r289203 r290189 2454 2454 2455 2455 #if ENABLE(CONTENT_FILTERING) 2456 auto contentFilter = provisionalDocumentLoader.contentFilter();2457 2456 auto contentFilterWillContinueLoading = false; 2458 2457 #endif … … 2462 2461 willContinueLoading = WillContinueLoading::Yes; 2463 2462 #if ENABLE(CONTENT_FILTERING) 2464 if ( contentFilter && contentFilter->willHandleProvisionalLoadFailure(error)) {2463 if (provisionalDocumentLoader.contentFilterWillHandleProvisionalLoadFailure(error)) { 2465 2464 willContinueLoading = WillContinueLoading::Yes; 2466 2465 contentFilterWillContinueLoading = true; … … 2472 2471 #if ENABLE(CONTENT_FILTERING) 2473 2472 if (contentFilterWillContinueLoading) 2474 contentFilter->handleProvisionalLoadFailure(error);2473 provisionalDocumentLoader.contentFilterHandleProvisionalLoadFailure(error); 2475 2474 #endif 2476 2475 -
trunk/Source/WebCore/loader/PolicyChecker.cpp
r289549 r290189 142 142 if (substituteData.isValid() && !substituteData.failingURL().isEmpty()) { 143 143 bool shouldContinue = true; 144 #if ENABLE(CONTENT_FILTERING) 144 #if ENABLE(CONTENT_FILTERING) && !ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 145 145 if (auto loader = m_frame.loader().activeDocumentLoader()) 146 146 shouldContinue = ContentFilter::continueAfterSubstituteDataRequest(*loader, substituteData); -
trunk/Source/WebCore/loader/SubstituteData.h
r287021 r290189 60 60 const URL& failingURL() const { return m_failingURL; } 61 61 const ResourceResponse& response() const { return m_response; } 62 62 63 template<class Encoder> void encode(Encoder&) const; 64 template<class Decoder> static std::optional<SubstituteData> decode(Decoder&); 65 63 66 private: 64 67 RefPtr<FragmentedSharedBuffer> m_content; … … 68 71 }; 69 72 73 template<class Encoder> 74 void SubstituteData::encode(Encoder& encoder) const 75 { 76 encoder << m_content << m_failingURL << m_response << m_shouldRevealToSessionHistory; 77 } 78 79 template<class Decoder> 80 std::optional<SubstituteData> SubstituteData::decode(Decoder& decoder) 81 { 82 std::optional<RefPtr<FragmentedSharedBuffer>> content; 83 decoder >> content; 84 if (!content) 85 return std::nullopt; 86 87 std::optional<URL> failingURL; 88 decoder >> failingURL; 89 if (!failingURL) 90 return std::nullopt; 91 92 std::optional<ResourceResponse> response; 93 decoder >> response; 94 if (!response) 95 return std::nullopt; 96 97 std::optional<SessionHistoryVisibility> shouldRevealToSessionHistory; 98 decoder >> shouldRevealToSessionHistory; 99 if (!shouldRevealToSessionHistory) 100 return std::nullopt; 101 102 return { { WTFMove(*content), *failingURL, *response, *shouldRevealToSessionHistory } }; 103 } 104 70 105 } // namespace WebCore -
trunk/Source/WebKit/ChangeLog
r290187 r290189 1 2022-02-18 Per Arne Vollan <pvollan@apple.com> 2 3 Move content filtering to Networking process 4 https://bugs.webkit.org/show_bug.cgi?id=233760 5 <rdar://problem/86150702> 6 7 Reviewed by Brent Fulgham. 8 9 Move content filtering from the DocumentLoader class in the WebProcess to the NetworkResourceLoader class in the 10 Networking process. The NetworkResourceLoader is now a client of the content filter, and will send messages 11 to the DocumentLoader in the WebProcess to cancel the load when the content filter decided to block the load. 12 If the content filter is providing replacement data, this will also be sent over IPC to the WebProcess. 13 Data is not being sent to the WebProcess until the content filter has decided to allow the load, if content 14 filtering is enabled. 15 16 * NetworkProcess/NetworkResourceLoader.cpp: 17 (WebKit::NetworkResourceLoader::start): 18 (WebKit::NetworkResourceLoader::startContentFiltering): 19 (WebKit::NetworkResourceLoader::didReceiveResponse): 20 (WebKit::NetworkResourceLoader::didFinishLoading): 21 (WebKit::NetworkResourceLoader::willSendRedirectedRequest): 22 (WebKit::NetworkResourceLoader::bufferingTimerFired): 23 (WebKit::NetworkResourceLoader::sendBuffer): 24 (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): 25 (WebKit::NetworkResourceLoader::sendResultForCacheEntry): 26 (WebKit::NetworkResourceLoader::dataReceivedThroughContentFilter): 27 (WebKit::NetworkResourceLoader::contentFilterDidBlock): 28 (WebKit::NetworkResourceLoader::cancelMainResourceLoadForContentFilter): 29 (WebKit::NetworkResourceLoader::handleProvisionalLoadFailureFromContentFilter): 30 * NetworkProcess/NetworkResourceLoader.h: 31 * UIProcess/Network/NetworkProcessProxy.cpp: 32 (WebKit::NetworkProcessProxy::reloadAfterUnblockedContentFilter): 33 * UIProcess/Network/NetworkProcessProxy.h: 34 * UIProcess/Network/NetworkProcessProxy.messages.in: 35 * WebProcess/Network/WebResourceLoader.cpp: 36 (WebKit::WebResourceLoader::contentFilterDidBlockLoad): 37 (WebKit::WebResourceLoader::cancelMainResourceLoadForContentFilter): 38 (WebKit::WebResourceLoader::handleProvisionalLoadFailureFromContentFilter): 39 (WebKit::WebResourceLoader::reload): 40 * WebProcess/Network/WebResourceLoader.h: 41 * WebProcess/Network/WebResourceLoader.messages.in: 42 1 43 2022-02-18 Per Arne Vollan <pvollan@apple.com> 2 44 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
r289134 r290189 68 68 #endif 69 69 70 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 71 #include <WebCore/ContentFilter.h> 72 #include <WebCore/ContentFilterUnblockHandler.h> 73 #endif 74 70 75 #define LOADER_RELEASE_LOG(fmt, ...) RELEASE_LOG(Network, "%p - [pageProxyID=%" PRIu64 ", webPageID=%" PRIu64 ", frameID=%" PRIu64 ", resourceID=%" PRIu64 ", isMainResource=%d, destination=%u, isSynchronous=%d] NetworkResourceLoader::" fmt, this, m_parameters.webPageProxyID.toUInt64(), m_parameters.webPageID.toUInt64(), m_parameters.webFrameID.toUInt64(), m_parameters.identifier.toUInt64(), isMainResource(), static_cast<unsigned>(m_parameters.options.destination), isSynchronous(), ##__VA_ARGS__) 71 76 #define LOADER_RELEASE_LOG_ERROR(fmt, ...) RELEASE_LOG_ERROR(Network, "%p - [pageProxyID=%" PRIu64 ", webPageID=%" PRIu64 ", frameID=%" PRIu64 ", resourceID=%" PRIu64 ", isMainResource=%d, destination=%u, isSynchronous=%d] NetworkResourceLoader::" fmt, this, m_parameters.webPageProxyID.toUInt64(), m_parameters.webPageID.toUInt64(), m_parameters.webFrameID.toUInt64(), m_parameters.identifier.toUInt64(), isMainResource(), static_cast<unsigned>(m_parameters.options.destination), isSynchronous(), ##__VA_ARGS__) … … 188 193 m_wasStarted = true; 189 194 195 auto newRequest = ResourceRequest { originalRequest() }; 196 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 197 startContentFiltering(newRequest); 198 #endif 199 190 200 if (m_networkLoadChecker) { 191 m_networkLoadChecker->check(ResourceRequest { originalRequest()}, this, [this, weakThis = WeakPtr { *this }] (auto&& result) {201 m_networkLoadChecker->check(ResourceRequest { newRequest }, this, [this, weakThis = WeakPtr { *this }] (auto&& result) { 192 202 if (!weakThis) 193 203 return; … … 218 228 } 219 229 // FIXME: Remove that code path once m_networkLoadChecker is used for all network loads. 220 if (canUseCache( originalRequest())) {230 if (canUseCache(newRequest)) { 221 231 retrieveCacheEntry(originalRequest()); 222 232 return; 223 233 } 224 234 225 startNetworkLoad(ResourceRequest { originalRequest() }, FirstLoad::Yes); 226 } 235 startNetworkLoad(ResourceRequest { newRequest }, FirstLoad::Yes); 236 } 237 238 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 239 void NetworkResourceLoader::startContentFiltering(ResourceRequest& request) 240 { 241 if (!isMainResource()) 242 return; 243 m_contentFilter = ContentFilter::create(*this); 244 if (!m_contentFilter->continueAfterWillSendRequest(request, ResourceResponse())) 245 return; 246 m_contentFilter->startFilteringMainResource(request.url()); 247 } 248 #endif 227 249 228 250 void NetworkResourceLoader::retrieveCacheEntry(const ResourceRequest& request) … … 693 715 LOADER_RELEASE_LOG("didReceiveResponse: (httpStatusCode=%d, MIMEType=%" PUBLIC_LOG_STRING ", expectedContentLength=%" PRId64 ", hasCachedEntryForValidation=%d, hasNetworkLoadChecker=%d)", receivedResponse.httpStatusCode(), receivedResponse.mimeType().utf8().data(), receivedResponse.expectedContentLength(), !!m_cacheEntryForValidation, !!m_networkLoadChecker); 694 716 717 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 718 if (m_contentFilter && !m_contentFilter->continueAfterResponseReceived(receivedResponse)) 719 return completionHandler(PolicyAction::Ignore); 720 #endif 721 695 722 if (isMainResource()) 696 723 didReceiveMainResourceResponse(receivedResponse); … … 905 932 sendBuffer(*m_bufferedData.get(), -1); 906 933 } 934 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 935 if (m_contentFilter) { 936 m_contentFilter->continueAfterNotifyFinished(m_parameters.request.url()); 937 m_contentFilter->stopFilteringMainResource(); 938 } 939 #endif 940 907 941 send(Messages::WebResourceLoader::DidFinishResourceLoad(networkLoadMetrics)); 908 942 } … … 994 1028 m_firstResponseURL = redirectResponse.url(); 995 1029 1030 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1031 if (m_contentFilter && !m_contentFilter->continueAfterWillSendRequest(request, redirectResponse)) 1032 return; 1033 #endif 1034 996 1035 std::optional<WebCore::PrivateClickMeasurement::AttributionTriggerData> privateClickMeasurementAttributionTriggerData; 997 1036 if (!sessionID().isEphemeral()) { … … 1252 1291 return; 1253 1292 1293 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1294 auto sharedBuffer = m_bufferedData.takeAsContiguous(); 1295 bool shouldFilter = m_contentFilter && !m_contentFilter->continueAfterDataReceived(sharedBuffer, m_bufferedDataEncodedDataLength); 1296 if (!shouldFilter) 1297 send(Messages::WebResourceLoader::DidReceiveData(IPC::SharedBufferCopy(sharedBuffer.get()), m_bufferedDataEncodedDataLength)); 1298 #else 1254 1299 send(Messages::WebResourceLoader::DidReceiveData(IPC::SharedBufferCopy(*m_bufferedData.get()), m_bufferedDataEncodedDataLength)); 1255 1300 #endif 1256 1301 m_bufferedData.empty(); 1257 1302 m_bufferedDataEncodedDataLength = 0; … … 1261 1306 { 1262 1307 ASSERT(!isSynchronous()); 1308 1309 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1310 if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(buffer.makeContiguous(), encodedDataLength)) 1311 return; 1312 #endif 1263 1313 1264 1314 send(Messages::WebResourceLoader::DidReceiveData(IPC::SharedBufferCopy(buffer), encodedDataLength)); … … 1308 1358 auto response = entry->response(); 1309 1359 1360 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1361 if (m_contentFilter && !m_contentFilter->responseReceived() && !m_contentFilter->continueAfterResponseReceived(response)) 1362 return; 1363 #endif 1364 1310 1365 if (isMainResource()) 1311 1366 didReceiveMainResourceResponse(response); … … 1359 1414 #if ENABLE(SHAREABLE_RESOURCE) 1360 1415 if (!entry->shareableResourceHandle().isNull()) { 1416 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1417 if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(entry->buffer()->makeContiguous(), entry->buffer()->size())) { 1418 m_contentFilter->continueAfterNotifyFinished(m_parameters.request.url()); 1419 m_contentFilter->stopFilteringMainResource(); 1420 return; 1421 } 1422 #endif 1361 1423 send(Messages::WebResourceLoader::DidReceiveResource(entry->shareableResourceHandle())); 1362 1424 return; … … 1382 1444 1383 1445 sendBuffer(*entry->buffer(), entry->buffer()->size()); 1446 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1447 if (m_contentFilter) { 1448 m_contentFilter->continueAfterNotifyFinished(m_parameters.request.url()); 1449 m_contentFilter->stopFilteringMainResource(); 1450 } 1451 #endif 1384 1452 send(Messages::WebResourceLoader::DidFinishResourceLoad(networkLoadMetrics)); 1385 1453 } … … 1698 1766 } 1699 1767 1768 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1769 void NetworkResourceLoader::dataReceivedThroughContentFilter(const SharedBuffer& buffer, size_t encodedDataLength) 1770 { 1771 send(Messages::WebResourceLoader::DidReceiveData(IPC::SharedBufferCopy(buffer), encodedDataLength)); 1772 } 1773 1774 WebCore::ResourceError NetworkResourceLoader::contentFilterDidBlock(WebCore::ContentFilterUnblockHandler unblockHandler, String&& unblockRequestDeniedScript) 1775 { 1776 send(Messages::WebResourceLoader::ContentFilterDidBlockLoad(unblockHandler, unblockRequestDeniedScript)); 1777 if (!unblockHandler.needsUIProcess()) { 1778 unblockHandler.requestUnblockAsync([this, protectedThis = Ref { *this }](bool unblocked) { 1779 if (!unblocked) 1780 return; 1781 m_connection->networkProcess().parentProcessConnection()->send(Messages::NetworkProcessProxy::ReloadAfterUnblockedContentFilter(m_parameters.webPageProxyID), 0); 1782 }); 1783 } 1784 return WebKit::blockedByContentFilterError(m_parameters.request); 1785 } 1786 1787 void NetworkResourceLoader::cancelMainResourceLoadForContentFilter(const WebCore::ResourceError& error) 1788 { 1789 RELEASE_ASSERT(m_contentFilter); 1790 m_contentFilter->handleProvisionalLoadFailure(error); 1791 } 1792 1793 void NetworkResourceLoader::handleProvisionalLoadFailureFromContentFilter(const URL& blockedPageURL, WebCore::SubstituteData& substituteData) 1794 { 1795 if (substituteData.isValid()) 1796 send(Messages::WebResourceLoader::HandleProvisionalLoadFailureFromContentFilter(blockedPageURL, substituteData)); 1797 else { 1798 RELEASE_ASSERT(m_contentFilter); 1799 auto& error = m_contentFilter->blockedError(); 1800 send(Messages::WebResourceLoader::CancelMainResourceLoadForContentFilter(error)); 1801 } 1802 } 1803 #endif // ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 1804 1700 1805 } // namespace WebKit 1701 1806 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.h
r289134 r290189 35 35 #include "NetworkResourceLoadParameters.h" 36 36 #include "PrivateRelayed.h" 37 #include <WebCore/ContentFilterClient.h> 37 38 #include <WebCore/ContentSecurityPolicyClient.h> 38 39 #include <WebCore/CrossOriginAccessControl.h> … … 46 47 namespace WebCore { 47 48 class BlobDataFileReference; 49 class ContentFilter; 48 50 class FormData; 49 51 class NetworkStorageSession; … … 73 75 , public WebCore::ContentSecurityPolicyClient 74 76 , public WebCore::CrossOriginAccessControlCheckDisabler 77 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 78 , public WebCore::ContentFilterClient 79 #endif 75 80 , public CanMakeWeakPtr<NetworkResourceLoader> { 76 81 public: … … 93 98 void didReceiveNetworkResourceLoaderMessage(IPC::Connection&, IPC::Decoder&); 94 99 95 void continueWillSendRequest(WebCore::ResourceRequest&& newRequest, bool isAllowedToAskUserForCredentials);100 void continueWillSendRequest(WebCore::ResourceRequest&&, bool isAllowedToAskUserForCredentials); 96 101 97 102 void setResponse(WebCore::ResourceResponse&& response) { m_response = WTFMove(response); } … … 156 161 bool isAppInitiated(); 157 162 163 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 164 void ref() const final { RefCounted<NetworkResourceLoader>::ref(); } 165 void deref() const final { RefCounted<NetworkResourceLoader>::deref(); } 166 #endif 167 158 168 private: 159 169 NetworkResourceLoader(NetworkResourceLoadParameters&&, NetworkConnectionToWebProcess&, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoadDelayedReply&&); … … 162 172 IPC::Connection* messageSenderConnection() const override; 163 173 uint64_t messageSenderDestinationID() const override { return m_parameters.identifier.toUInt64(); } 174 175 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 176 // ContentFilterClient 177 void dataReceivedThroughContentFilter(const WebCore::SharedBuffer&, size_t) final; 178 WebCore::ResourceError contentFilterDidBlock(WebCore::ContentFilterUnblockHandler, String&& unblockRequestDeniedScript) final; 179 void cancelMainResourceLoadForContentFilter(const WebCore::ResourceError&) final; 180 void handleProvisionalLoadFailureFromContentFilter(const URL& blockedPageURL, WebCore::SubstituteData&) final; 181 #endif 164 182 165 183 bool canUseCache(const WebCore::ResourceRequest&) const; … … 220 238 221 239 ResourceLoadInfo resourceLoadInfo(); 240 241 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 242 void startContentFiltering(WebCore::ResourceRequest&); 243 #endif 222 244 223 245 const NetworkResourceLoadParameters m_parameters; … … 265 287 URL m_firstResponseURL; // First URL in response's URL list (https://fetch.spec.whatwg.org/#concept-response-url-list). 266 288 std::optional<WebCore::CrossOriginOpenerPolicyEnforcementResult> m_currentCoopEnforcementResult; 289 290 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 291 std::unique_ptr<WebCore::ContentFilter> m_contentFilter; 292 #endif 293 267 294 PrivateRelayed m_privateRelayed { PrivateRelayed::No }; 268 295 }; -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r290026 r290189 29 29 #include "APIContentRuleList.h" 30 30 #include "APICustomProtocolManagerClient.h" 31 #include "APINavigation.h" 31 32 #include "AuthenticationChallengeProxy.h" 32 33 #include "AuthenticationManager.h" … … 605 606 } 606 607 608 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 609 void NetworkProcessProxy::reloadAfterUnblockedContentFilter(WebPageProxyIdentifier pageID) 610 { 611 if (auto* page = WebProcessProxy::webPage(pageID)) 612 page->reload({ }); 613 } 614 #endif 615 607 616 #if ENABLE(INTELLIGENT_TRACKING_PREVENTION) 608 617 void NetworkProcessProxy::dumpResourceLoadStatistics(PAL::SessionID sessionID, CompletionHandler<void(String)>&& completionHandler) -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r289508 r290189 255 255 void resourceLoadDidCompleteWithError(WebPageProxyIdentifier, ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceError&&); 256 256 257 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 258 void reloadAfterUnblockedContentFilter(WebPageProxyIdentifier); 259 #endif 260 257 261 #if ENABLE(APP_BOUND_DOMAINS) 258 262 void hasAppBoundSession(PAL::SessionID, CompletionHandler<void(bool)>&&); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r289508 r290189 77 77 ResourceLoadDidReceiveResponse(WebKit::WebPageProxyIdentifier pageIdentifier, struct WebKit::ResourceLoadInfo resourceLoadInfo, WebCore::ResourceResponse response) 78 78 ResourceLoadDidCompleteWithError(WebKit::WebPageProxyIdentifier pageIdentifier, struct WebKit::ResourceLoadInfo resourceLoadInfo, WebCore::ResourceResponse response, WebCore::ResourceError error) 79 80 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 81 ReloadAfterUnblockedContentFilter(WebKit::WebPageProxyIdentifier pageIdentifier) 82 #endif 79 83 80 84 TriggerBrowsingContextGroupSwitchForNavigation(WebKit::WebPageProxyIdentifier pageIdentifier, uint64_t navigationID, enum:uint8_t WebCore::BrowsingContextGroupSwitchDecision browsingContextGroupSwitchDecision, WebCore::RegistrableDomain responseDomain, WebKit::NetworkResourceLoadIdentifier existingNetworkResourceLoadIdentifierToResume) -> (bool success) Async -
trunk/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp
r289134 r290189 55 55 #include <WebCore/ResourceLoader.h> 56 56 #include <WebCore/SubresourceLoader.h> 57 #include <WebCore/SubstituteData.h> 57 58 #include <wtf/CompletionHandler.h> 58 59 … … 350 351 #endif 351 352 353 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 354 void WebResourceLoader::contentFilterDidBlockLoad(const WebCore::ContentFilterUnblockHandler& unblockHandler, String&& unblockRequestDeniedScript) 355 { 356 if (!m_coreLoader || !m_coreLoader->documentLoader()) 357 return; 358 m_coreLoader->documentLoader()->handleContentFilterDidBlock(unblockHandler, WTFMove(unblockRequestDeniedScript)); 359 } 360 361 void WebResourceLoader::cancelMainResourceLoadForContentFilter(const WebCore::ResourceError& error) 362 { 363 if (!m_coreLoader || !m_coreLoader->documentLoader()) 364 return; 365 m_coreLoader->documentLoader()->cancelMainResourceLoad(error); 366 } 367 368 void WebResourceLoader::handleProvisionalLoadFailureFromContentFilter(const URL& blockedPageURL, const WebCore::SubstituteData& substituteData) 369 { 370 if (!m_coreLoader || !m_coreLoader->documentLoader() || !substituteData.isValid()) 371 return; 372 m_coreLoader->documentLoader()->handleContentFilterProvisionalLoadFailure(blockedPageURL, substituteData); 373 } 374 #endif // ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 375 352 376 } // namespace WebKit 353 377 -
trunk/Source/WebKit/WebProcess/Network/WebResourceLoader.h
r289018 r290189 44 44 45 45 namespace WebCore { 46 class ContentFilterUnblockHandler; 46 47 class NetworkLoadMetrics; 47 48 class ResourceError; … … 49 50 class ResourceRequest; 50 51 class ResourceResponse; 52 class SubstituteData; 51 53 enum class MainFrameMainResource : bool; 52 54 } … … 100 102 #endif 101 103 104 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 105 void contentFilterDidBlockLoad(const WebCore::ContentFilterUnblockHandler&, String&& unblockRequestDeniedScript); 106 void cancelMainResourceLoadForContentFilter(const WebCore::ResourceError&); 107 void handleProvisionalLoadFailureFromContentFilter(const URL& blockedPageURL, const WebCore::SubstituteData&); 108 #endif 109 102 110 RefPtr<WebCore::ResourceLoader> m_coreLoader; 103 111 TrackingParameters m_trackingParameters; -
trunk/Source/WebKit/WebProcess/Network/WebResourceLoader.messages.in
r289018 r290189 38 38 DidReceiveResource(WebKit::ShareableResource::Handle resource) 39 39 #endif 40 41 #if ENABLE(CONTENT_FILTERING_IN_NETWORKING_PROCESS) 42 ContentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler unblockHandler, String unblockRequestDeniedScript) 43 CancelMainResourceLoadForContentFilter(WebCore::ResourceError error) 44 HandleProvisionalLoadFailureFromContentFilter(URL blockedPageURL, WebCore::SubstituteData substituteData) 45 #endif 46 40 47 }
Note: See TracChangeset
for help on using the changeset viewer.