Changeset 244695 in webkit
- Timestamp:
- Apr 26, 2019, 10:03:15 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r244692 r244695 1 2019-04-26 Alex Christensen <achristensen@webkit.org> 2 3 Add ENABLE(CONTENT_EXTENSIONS) and namespace ContentExtensions to ResourceLoadInfo.h 4 https://bugs.webkit.org/show_bug.cgi?id=197165 5 6 Reviewed by Youenn Fablet. 7 8 No change in behavior. This will just make it harder for people working on the loader to mistake 9 these ContentExtension specific structures for other structures general to loading. 10 One such mistake was made in r244248. 11 12 * Modules/websockets/WebSocketChannel.cpp: 13 (WebCore::WebSocketChannel::connect): 14 * contentextensions/ContentExtensionsBackend.h: 15 * css/StyleSheetContents.cpp: 16 (WebCore::StyleSheetContents::subresourcesAllowReuse const): 17 * html/HTMLMediaElement.cpp: 18 (WebCore::HTMLMediaElement::loadResource): 19 * loader/FrameLoader.cpp: 20 (WebCore::FrameLoader::loadResourceSynchronously): 21 * loader/NetscapePlugInStreamLoader.cpp: 22 (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): 23 * loader/PingLoader.cpp: 24 (WebCore::processContentRuleListsForLoad): 25 (WebCore::PingLoader::loadImage): 26 (WebCore::PingLoader::sendPing): 27 (WebCore::PingLoader::sendViolationReport): 28 * loader/ResourceLoadInfo.cpp: 29 (WebCore::toResourceType): Deleted. 30 (WebCore::readResourceType): Deleted. 31 (WebCore::readLoadType): Deleted. 32 (WebCore::ResourceLoadInfo::isThirdParty const): Deleted. 33 (WebCore::ResourceLoadInfo::getResourceFlags const): Deleted. 34 * loader/ResourceLoadInfo.h: 35 * loader/ResourceLoader.cpp: 36 (WebCore::ResourceLoader::willSendRequestInternal): 37 * loader/ResourceLoader.h: 38 * loader/SubresourceLoader.cpp: 39 (WebCore::SubresourceLoader::SubresourceLoader): 40 * loader/cache/CachedResourceLoader.cpp: 41 (WebCore::CachedResourceLoader::requestResource): 42 * page/DOMWindow.cpp: 43 (WebCore::DOMWindow::open): 44 * page/UserContentProvider.cpp: 45 (WebCore::UserContentProvider::processContentRuleListsForLoad): 46 (WebCore::UserContentProvider::actionsForResourceLoad): 47 * page/UserContentProvider.h: 48 1 49 2019-04-26 Alex Christensen <achristensen@webkit.org> 2 50 -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp
r244391 r244695 90 90 if (auto* page = m_document->page()) { 91 91 if (auto* documentLoader = m_document->loader()) { 92 auto results = page->userContentProvider().processContentRuleListsForLoad(url, ResourceType::Raw, *documentLoader);92 auto results = page->userContentProvider().processContentRuleListsForLoad(url, ContentExtensions::ResourceType::Raw, *documentLoader); 93 93 if (results.summary.blockedLoad) { 94 94 Ref<WebSocketChannel> protectedThis(*this); -
trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h
r243319 r244695 39 39 class ResourceRequest; 40 40 41 struct ResourceLoadInfo;42 43 41 namespace ContentExtensions { 44 42 45 43 class CompiledContentExtension; 44 struct ResourceLoadInfo; 46 45 47 46 // The ContentExtensionsBackend is the internal model of all the content extensions. -
trunk/Source/WebCore/css/StyleSheetContents.cpp
r243319 r244695 513 513 if (page && documentLoader) { 514 514 const auto& request = resource.resourceRequest(); 515 auto results = page->userContentProvider().processContentRuleListsForLoad(request.url(), toResourceType(resource.type()), *documentLoader);515 auto results = page->userContentProvider().processContentRuleListsForLoad(request.url(), ContentExtensions::toResourceType(resource.type()), *documentLoader); 516 516 if (results.summary.blockedLoad || results.summary.madeHTTPS) 517 517 return true; -
trunk/Source/WebCore/dom/ExtensionStyleSheets.cpp
r239181 r244695 48 48 namespace WebCore { 49 49 50 #if ENABLE(CONTENT_EXTENSIONS) 50 51 using namespace ContentExtensions; 52 #endif 51 53 using namespace HTMLNames; 52 54 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r244440 r244695 1522 1522 #if ENABLE(CONTENT_EXTENSIONS) 1523 1523 if (auto documentLoader = makeRefPtr(frame->loader().documentLoader())) { 1524 if (page->userContentProvider().processContentRuleListsForLoad(url, ResourceType::Media, *documentLoader).summary.blockedLoad) {1524 if (page->userContentProvider().processContentRuleListsForLoad(url, ContentExtensions::ResourceType::Media, *documentLoader).summary.blockedLoad) { 1525 1525 mediaLoadingFailed(MediaPlayer::FormatError); 1526 1526 return; -
trunk/Source/WebCore/loader/FrameLoader.cpp
r244540 r244695 3070 3070 if (auto* page = m_frame.page()) { 3071 3071 if (m_documentLoader) { 3072 auto results = page->userContentProvider().processContentRuleListsForLoad(newRequest.url(), ResourceType::Raw, *m_documentLoader);3072 auto results = page->userContentProvider().processContentRuleListsForLoad(newRequest.url(), ContentExtensions::ResourceType::Raw, *m_documentLoader); 3073 3073 bool blockedLoad = results.summary.blockedLoad; 3074 3074 ContentExtensions::applyResultsToRequest(WTFMove(results), page, newRequest); -
trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
r233668 r244695 61 61 { 62 62 #if ENABLE(CONTENT_EXTENSIONS) 63 m_resourceType = ResourceType::PlugInStream;63 m_resourceType = ContentExtensions::ResourceType::PlugInStream; 64 64 #endif 65 65 } -
trunk/Source/WebCore/loader/PingLoader.cpp
r243319 r244695 58 58 namespace WebCore { 59 59 60 #if !ENABLE(CONTENT_EXTENSIONS)60 #if ENABLE(CONTENT_EXTENSIONS) 61 61 62 62 // Returns true if we should block the load. 63 static inline bool processContentRuleListsForLoad(const Frame&, ResourceRequest&, ResourceType) 64 { 65 return false; 66 } 67 68 #else 69 70 // Returns true if we should block the load. 71 static bool processContentRuleListsForLoad(const Frame& frame, ResourceRequest& request, ResourceType resourceType) 63 static bool processContentRuleListsForLoad(const Frame& frame, ResourceRequest& request, ContentExtensions::ResourceType resourceType) 72 64 { 73 65 auto* documentLoader = frame.loader().documentLoader(); … … 96 88 97 89 ResourceRequest request(url); 98 if (processContentRuleListsForLoad(frame, request, ResourceType::Image)) 99 return; 90 #if ENABLE(CONTENT_EXTENSIONS) 91 if (processContentRuleListsForLoad(frame, request, ContentExtensions::ResourceType::Image)) 92 return; 93 #endif 100 94 101 95 document.contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(request, ContentSecurityPolicy::InsecureRequestType::Load); … … 122 116 123 117 ResourceRequest request(pingURL); 124 if (processContentRuleListsForLoad(frame, request, ResourceType::Raw)) 125 return; 118 #if ENABLE(CONTENT_EXTENSIONS) 119 if (processContentRuleListsForLoad(frame, request, ContentExtensions::ResourceType::Raw)) 120 return; 121 #endif 126 122 127 123 auto& document = *frame.document(); … … 157 153 158 154 ResourceRequest request(reportURL); 159 if (processContentRuleListsForLoad(frame, request, ResourceType::Raw)) 160 return; 155 #if ENABLE(CONTENT_EXTENSIONS) 156 if (processContentRuleListsForLoad(frame, request, ContentExtensions::ResourceType::Raw)) 157 return; 158 #endif 161 159 162 160 auto& document = *frame.document(); -
trunk/Source/WebCore/loader/ResourceLoadInfo.cpp
r244428 r244695 30 30 #include "SecurityOrigin.h" 31 31 32 #if ENABLE(CONTENT_EXTENSIONS) 33 32 34 namespace WebCore { 35 namespace ContentExtensions { 33 36 34 37 ResourceType toResourceType(CachedResource::Type type) … … 128 131 } 129 132 133 } // namespace ContentExtensions 130 134 } // namespace WebCore 135 136 #endif // ENABLE(CONTENT_EXTENSIONS) -
trunk/Source/WebCore/loader/ResourceLoadInfo.h
r244428 r244695 26 26 #pragma once 27 27 28 #if ENABLE(CONTENT_EXTENSIONS) 29 28 30 #include "CachedResource.h" 29 31 #include <wtf/URL.h> 30 32 31 33 namespace WebCore { 34 namespace ContentExtensions { 32 35 33 36 enum class ResourceType : uint16_t { … … 78 81 }; 79 82 83 } // namespace ContentExtensions 80 84 } // namespace WebCore 85 86 #endif -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r244475 r244695 343 343 ASSERT(!m_reachedTerminalState); 344 344 #if ENABLE(CONTENT_EXTENSIONS) 345 ASSERT(m_resourceType != ResourceType::Invalid);345 ASSERT(m_resourceType != ContentExtensions::ResourceType::Invalid); 346 346 #endif 347 347 -
trunk/Source/WebCore/loader/ResourceLoader.h
r243476 r244695 245 245 #if ENABLE(CONTENT_EXTENSIONS) 246 246 protected: 247 ResourceType m_resourceType {ResourceType::Invalid };247 ContentExtensions::ResourceType m_resourceType { ContentExtensions::ResourceType::Invalid }; 248 248 #endif 249 249 }; -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r243682 r244695 99 99 #endif 100 100 #if ENABLE(CONTENT_EXTENSIONS) 101 m_resourceType = toResourceType(resource.type());101 m_resourceType = ContentExtensions::toResourceType(resource.type()); 102 102 #endif 103 103 m_canCrossOriginRequestsAskUserForCredentials = resource.type() == CachedResource::Type::MainResource || frame.settings().allowCrossOriginSubresourcesToAskForCredentials(); -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r244428 r244695 810 810 const auto& resourceRequest = request.resourceRequest(); 811 811 auto* page = frame()->page(); 812 auto results = page->userContentProvider().processContentRuleListsForLoad(resourceRequest.url(), toResourceType(type), *m_documentLoader);812 auto results = page->userContentProvider().processContentRuleListsForLoad(resourceRequest.url(), ContentExtensions::toResourceType(type), *m_documentLoader); 813 813 bool blockedLoad = results.summary.blockedLoad; 814 814 bool madeHTTPS = results.summary.madeHTTPS; -
trunk/Source/WebCore/page/DOMWindow.cpp
r244673 r244695 2367 2367 && firstFrame->mainFrame().document() 2368 2368 && firstFrame->mainFrame().document()->loader()) { 2369 auto results = firstFrame->page()->userContentProvider().processContentRuleListsForLoad(firstFrame->document()->completeURL(urlString), ResourceType::Popup, *firstFrame->mainFrame().document()->loader());2369 auto results = firstFrame->page()->userContentProvider().processContentRuleListsForLoad(firstFrame->document()->completeURL(urlString), ContentExtensions::ResourceType::Popup, *firstFrame->mainFrame().document()->loader()); 2370 2370 if (results.summary.blockedLoad) 2371 2371 return RefPtr<WindowProxy> { nullptr }; -
trunk/Source/WebCore/page/UserContentProvider.cpp
r243319 r244695 103 103 } 104 104 105 ContentRuleListResults UserContentProvider::processContentRuleListsForLoad(const URL& url, ResourceType resourceType, DocumentLoader& initiatingDocumentLoader)105 ContentRuleListResults UserContentProvider::processContentRuleListsForLoad(const URL& url, ContentExtensions::ResourceType resourceType, DocumentLoader& initiatingDocumentLoader) 106 106 { 107 107 if (!contentExtensionsEnabled(initiatingDocumentLoader)) … … 111 111 } 112 112 113 Vector<ContentExtensions::ActionsFromContentRuleList> UserContentProvider::actionsForResourceLoad(const ResourceLoadInfo& resourceLoadInfo, DocumentLoader& initiatingDocumentLoader)113 Vector<ContentExtensions::ActionsFromContentRuleList> UserContentProvider::actionsForResourceLoad(const ContentExtensions::ResourceLoadInfo& resourceLoadInfo, DocumentLoader& initiatingDocumentLoader) 114 114 { 115 115 if (!contentExtensionsEnabled(initiatingDocumentLoader)) -
trunk/Source/WebCore/page/UserContentProvider.h
r243319 r244695 47 47 class UserStyleSheet; 48 48 49 enum class ResourceType : uint16_t; 50 51 struct ResourceLoadInfo; 52 49 #if ENABLE(CONTENT_EXTENSIONS) 53 50 namespace ContentExtensions { 54 51 class ContentExtensionsBackend; 55 struct Action; 52 enum class ResourceType : uint16_t; 53 struct ResourceLoadInfo; 56 54 } 55 #endif 57 56 58 57 class UserContentProvider; … … 90 89 // FIXME: These don't really belong here. They should probably bundled up in the ContentExtensionsBackend 91 90 // which should always exist. 92 ContentRuleListResults processContentRuleListsForLoad(const URL&, ResourceType, DocumentLoader& initiatingDocumentLoader);93 Vector<ContentExtensions::ActionsFromContentRuleList> actionsForResourceLoad(const ResourceLoadInfo&, DocumentLoader& initiatingDocumentLoader);91 ContentRuleListResults processContentRuleListsForLoad(const URL&, ContentExtensions::ResourceType, DocumentLoader& initiatingDocumentLoader); 92 Vector<ContentExtensions::ActionsFromContentRuleList> actionsForResourceLoad(const ContentExtensions::ResourceLoadInfo&, DocumentLoader& initiatingDocumentLoader); 94 93 WEBCORE_EXPORT void forEachContentExtension(const Function<void(const String&, ContentExtensions::ContentExtension&)>&, DocumentLoader& initiatingDocumentLoader); 95 94 #endif -
trunk/Source/WebCore/style/StyleScope.cpp
r241018 r244695 55 55 namespace WebCore { 56 56 57 using namespace ContentExtensions;58 57 using namespace HTMLNames; 59 58 -
trunk/Tools/ChangeLog
r244693 r244695 1 2019-04-26 Alex Christensen <achristensen@webkit.org> 2 3 Add ENABLE(CONTENT_EXTENSIONS) and namespace ContentExtensions to ResourceLoadInfo.h 4 https://bugs.webkit.org/show_bug.cgi?id=197165 5 6 Reviewed by Youenn Fablet. 7 8 * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: 9 1 10 2019-04-26 Ryan Haddad <ryanhaddad@apple.com> 2 11 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp
r243319 r244695 68 68 } 69 69 70 namespace TestWebKitAPI { 70 71 using namespace WebCore; 71 72 namespace TestWebKitAPI { 72 using namespace WebCore::ContentExtensions; 73 73 74 74 class ContentExtensionTest : public testing::Test {
Note:
See TracChangeset
for help on using the changeset viewer.