Diff
Modified: trunk/Source/WebCore/ChangeLog (251860 => 251861)
--- trunk/Source/WebCore/ChangeLog 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/ChangeLog 2019-10-31 17:52:49 UTC (rev 251861)
@@ -1,3 +1,25 @@
+2019-10-31 Alex Christensen <[email protected]>
+
+ Use SecurityOriginData in NetworkProcess where possible without other changes
+ https://bugs.webkit.org/show_bug.cgi?id=203615
+
+ Reviewed by Brady Eidson.
+
+ * page/SecurityOrigin.cpp:
+ (WebCore::SecurityOrigin::SecurityOrigin):
+ (WebCore::SecurityOrigin::isolatedCopy const):
+ * page/SecurityOrigin.h:
+ * page/SecurityOriginData.h:
+ (WebCore::SecurityOriginData::encode const):
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::allowFrameAncestors const):
+ * page/csp/ContentSecurityPolicy.h:
+ * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+ (WebCore::urlFromOrigin):
+ (WebCore::checkFrameAncestors):
+ (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const):
+ * page/csp/ContentSecurityPolicyDirectiveList.h:
+
2019-10-31 Zalan Bujtas <[email protected]>
[LFC][IFC] Add expansion context to Line::Run
Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (251860 => 251861)
--- trunk/Source/WebCore/page/SecurityOrigin.cpp 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp 2019-10-31 17:52:49 UTC (rev 251861)
@@ -171,19 +171,19 @@
{
}
-SecurityOrigin::SecurityOrigin(const SecurityOrigin* other)
- : m_data { other->m_data.isolatedCopy() }
- , m_domain { other->m_domain.isolatedCopy() }
- , m_filePath { other->m_filePath.isolatedCopy() }
- , m_isUnique { other->m_isUnique }
- , m_universalAccess { other->m_universalAccess }
- , m_domainWasSetInDOM { other->m_domainWasSetInDOM }
- , m_canLoadLocalResources { other->m_canLoadLocalResources }
- , m_storageBlockingPolicy { other->m_storageBlockingPolicy }
- , m_enforcesFilePathSeparation { other->m_enforcesFilePathSeparation }
- , m_needsStorageAccessFromFileURLsQuirk { other->m_needsStorageAccessFromFileURLsQuirk }
- , m_isPotentiallyTrustworthy { other->m_isPotentiallyTrustworthy }
- , m_isLocal { other->m_isLocal }
+SecurityOrigin::SecurityOrigin(const SecurityOrigin& other)
+ : m_data { other.m_data.isolatedCopy() }
+ , m_domain { other.m_domain.isolatedCopy() }
+ , m_filePath { other.m_filePath.isolatedCopy() }
+ , m_isUnique { other.m_isUnique }
+ , m_universalAccess { other.m_universalAccess }
+ , m_domainWasSetInDOM { other.m_domainWasSetInDOM }
+ , m_canLoadLocalResources { other.m_canLoadLocalResources }
+ , m_storageBlockingPolicy { other.m_storageBlockingPolicy }
+ , m_enforcesFilePathSeparation { other.m_enforcesFilePathSeparation }
+ , m_needsStorageAccessFromFileURLsQuirk { other.m_needsStorageAccessFromFileURLsQuirk }
+ , m_isPotentiallyTrustworthy { other.m_isPotentiallyTrustworthy }
+ , m_isLocal { other.m_isLocal }
{
}
@@ -218,7 +218,7 @@
Ref<SecurityOrigin> SecurityOrigin::isolatedCopy() const
{
- return adoptRef(*new SecurityOrigin(this));
+ return adoptRef(*new SecurityOrigin(*this));
}
void SecurityOrigin::setDomainFromDOM(const String& newDomain)
Modified: trunk/Source/WebCore/page/SecurityOrigin.h (251860 => 251861)
--- trunk/Source/WebCore/page/SecurityOrigin.h 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/SecurityOrigin.h 2019-10-31 17:52:49 UTC (rev 251861)
@@ -221,7 +221,7 @@
private:
SecurityOrigin();
explicit SecurityOrigin(const URL&);
- explicit SecurityOrigin(const SecurityOrigin*);
+ explicit SecurityOrigin(const SecurityOrigin&);
// FIXME: Rename this function to something more semantic.
bool passesFileCheck(const SecurityOrigin&) const;
Modified: trunk/Source/WebCore/page/SecurityOriginData.h (251860 => 251861)
--- trunk/Source/WebCore/page/SecurityOriginData.h 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/SecurityOriginData.h 2019-10-31 17:52:49 UTC (rev 251861)
@@ -97,6 +97,7 @@
template<class Encoder>
void SecurityOriginData::encode(Encoder& encoder) const
{
+ ASSERT(!isEmpty());
encoder << protocol;
encoder << host;
encoder << port;
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (251860 => 251861)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2019-10-31 17:52:49 UTC (rev 251861)
@@ -508,7 +508,7 @@
return false;
}
-bool ContentSecurityPolicy::allowFrameAncestors(const Vector<RefPtr<SecurityOrigin>>& ancestorOrigins, const URL& url, bool overrideContentSecurityPolicy) const
+bool ContentSecurityPolicy::allowFrameAncestors(const Vector<SecurityOriginData>& ancestorOrigins, const URL& url, bool overrideContentSecurityPolicy) const
{
if (overrideContentSecurityPolicy)
return true;
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h (251860 => 251861)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h 2019-10-31 17:52:49 UTC (rev 251861)
@@ -99,7 +99,7 @@
bool allowPluginType(const String& type, const String& typeAttribute, const URL&, bool overrideContentSecurityPolicy = false) const;
bool allowFrameAncestors(const Frame&, const URL&, bool overrideContentSecurityPolicy = false) const;
- WEBCORE_EXPORT bool allowFrameAncestors(const Vector<RefPtr<SecurityOrigin>>& ancestorOrigins, const URL&, bool overrideContentSecurityPolicy = false) const;
+ WEBCORE_EXPORT bool allowFrameAncestors(const Vector<SecurityOriginData>& ancestorOrigins, const URL&, bool overrideContentSecurityPolicy = false) const;
WEBCORE_EXPORT bool overridesXFrameOptions() const;
enum class RedirectResponseReceived { No, Yes };
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (251860 => 251861)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp 2019-10-31 17:52:49 UTC (rev 251861)
@@ -79,6 +79,11 @@
return { URL { }, origin.toString() };
}
+static inline URL urlFromOrigin(const SecurityOriginData& origin)
+{
+ return { URL { }, origin.toString() };
+}
+
static inline bool checkFrameAncestors(ContentSecurityPolicySourceListDirective* directive, const Frame& frame)
{
if (!directive)
@@ -92,13 +97,13 @@
return true;
}
-static inline bool checkFrameAncestors(ContentSecurityPolicySourceListDirective* directive, const Vector<RefPtr<SecurityOrigin>>& ancestorOrigins)
+static inline bool checkFrameAncestors(ContentSecurityPolicySourceListDirective* directive, const Vector<SecurityOriginData>& ancestorOrigins)
{
if (!directive)
return true;
bool didReceiveRedirectResponse = false;
for (auto& origin : ancestorOrigins) {
- URL originURL = urlFromOrigin(*origin);
+ URL originURL = urlFromOrigin(origin);
if (!originURL.isValid() || !directive->allows(originURL, didReceiveRedirectResponse, ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No))
return false;
}
@@ -258,7 +263,7 @@
return m_frameAncestors.get();
}
-const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins(const Vector<RefPtr<SecurityOrigin>>& ancestorOrigins) const
+const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins(const Vector<SecurityOriginData>& ancestorOrigins) const
{
if (checkFrameAncestors(m_frameAncestors.get(), ancestorOrigins))
return nullptr;
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h (251860 => 251861)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h 2019-10-31 17:52:49 UTC (rev 251861)
@@ -62,7 +62,7 @@
const ContentSecurityPolicyDirective* violatedDirectiveForFormAction(const URL&, bool didReceiveRedirectResponse) const;
const ContentSecurityPolicyDirective* violatedDirectiveForFrame(const URL&, bool didReceiveRedirectResponse) const;
const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestor(const Frame&) const;
- const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestorOrigins(const Vector<RefPtr<SecurityOrigin>>&) const;
+ const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestorOrigins(const Vector<SecurityOriginData>&) const;
const ContentSecurityPolicyDirective* violatedDirectiveForImage(const URL&, bool didReceiveRedirectResponse) const;
#if ENABLE(APPLICATION_MANIFEST)
const ContentSecurityPolicyDirective* violatedDirectiveForManifest(const URL&, bool didReceiveRedirectResponse) const;
Modified: trunk/Source/WebKit/ChangeLog (251860 => 251861)
--- trunk/Source/WebKit/ChangeLog 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebKit/ChangeLog 2019-10-31 17:52:49 UTC (rev 251861)
@@ -1,5 +1,20 @@
2019-10-31 Alex Christensen <[email protected]>
+ Use SecurityOriginData in NetworkProcess where possible without other changes
+ https://bugs.webkit.org/show_bug.cgi?id=203615
+
+ Reviewed by Brady Eidson.
+
+ * NetworkProcess/NetworkResourceLoadParameters.cpp:
+ (WebKit::NetworkResourceLoadParameters::encode const):
+ * NetworkProcess/NetworkResourceLoadParameters.h:
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
+
+2019-10-31 Alex Christensen <[email protected]>
+
Expose more WKPreferences SPI
https://bugs.webkit.org/show_bug.cgi?id=203631
<rdar://problem/56717160>
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp (251860 => 251861)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp 2019-10-31 17:52:49 UTC (rev 251861)
@@ -92,7 +92,7 @@
if (sourceOrigin)
encoder << *sourceOrigin;
encoder << static_cast<bool>(topOrigin);
- if (sourceOrigin)
+ if (topOrigin)
encoder << *topOrigin;
encoder << options;
encoder << cspResponseHeaders;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h (251860 => 251861)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h 2019-10-31 17:52:49 UTC (rev 251861)
@@ -58,7 +58,7 @@
bool shouldRestrictHTTPResponseAccess { false };
WebCore::PreflightPolicy preflightPolicy { WebCore::PreflightPolicy::Consider };
bool shouldEnableCrossOriginResourcePolicy { false };
- Vector<RefPtr<WebCore::SecurityOrigin>> frameAncestorOrigins;
+ Vector<WebCore::SecurityOriginData> frameAncestorOrigins;
bool isHTTPSUpgradeEnabled { false };
#if ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (251860 => 251861)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2019-10-31 17:52:49 UTC (rev 251861)
@@ -410,11 +410,8 @@
return true;
case XFrameOptionsSameOrigin: {
auto origin = SecurityOrigin::create(url);
- auto topFrameOrigin = m_parameters.frameAncestorOrigins.last();
- if (!origin->isSameSchemeHostPort(*topFrameOrigin))
- return true;
for (auto& ancestorOrigin : m_parameters.frameAncestorOrigins) {
- if (!origin->isSameSchemeHostPort(*ancestorOrigin))
+ if (!origin->isSameSchemeHostPort(ancestorOrigin.securityOrigin()))
return true;
}
return false;
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (251860 => 251861)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2019-10-31 17:52:14 UTC (rev 251860)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2019-10-31 17:52:49 UTC (rev 251861)
@@ -336,9 +336,9 @@
loadParameters.shouldEnableCrossOriginResourcePolicy = RuntimeEnabledFeatures::sharedFeatures().crossOriginResourcePolicyEnabled() && !loadParameters.isMainFrameNavigation;
if (resourceLoader.options().mode == FetchOptions::Mode::Navigate) {
- Vector<RefPtr<SecurityOrigin>> frameAncestorOrigins;
+ Vector<SecurityOriginData> frameAncestorOrigins;
for (auto* frame = resourceLoader.frame()->tree().parent(); frame; frame = frame->tree().parent())
- frameAncestorOrigins.append(makeRefPtr(frame->document()->securityOrigin()));
+ frameAncestorOrigins.append(frame->document()->securityOrigin().data());
loadParameters.frameAncestorOrigins = WTFMove(frameAncestorOrigins);
}