Commit e08a54a3 authored by Takeshi Yoshino's avatar Takeshi Yoshino Committed by Commit Bot

Remove SetFirstPartyCookieAndRequestorOrigin from FetchContext

It doesn't need to be a part of the interface. Each implementation of
the interface can just have their implementation as their private
method.

Change-Id: I7acac5e71c70534998345147dba487394fc2737b
Reviewed-on: https://chromium-review.googlesource.com/897317Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533978}
parent 45c0dd63
...@@ -142,7 +142,6 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext { ...@@ -142,7 +142,6 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext {
const ClientHintsPreferences&, const ClientHintsPreferences&,
const FetchParameters::ResourceWidth&, const FetchParameters::ResourceWidth&,
ResourceRequest&) override; ResourceRequest&) override;
void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override;
// Exposed for testing. // Exposed for testing.
void ModifyRequestForCSP(ResourceRequest&); void ModifyRequestForCSP(ResourceRequest&);
...@@ -173,6 +172,8 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext { ...@@ -173,6 +172,8 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext {
ResourceLoadPriority) const override; ResourceLoadPriority) const override;
private: private:
friend class FrameFetchContextTest;
struct FrozenState; struct FrozenState;
static ResourceFetcher* CreateFetcher(DocumentLoader*, Document*); static ResourceFetcher* CreateFetcher(DocumentLoader*, Document*);
...@@ -235,6 +236,7 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext { ...@@ -235,6 +236,7 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext {
// the |ContentSettingsClient| with the list of client hints and the // the |ContentSettingsClient| with the list of client hints and the
// persistence duration. // persistence duration.
void ParseAndPersistClientHints(const ResourceResponse&); void ParseAndPersistClientHints(const ResourceResponse&);
void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&);
Member<DocumentLoader> document_loader_; Member<DocumentLoader> document_loader_;
Member<Document> document_; Member<Document> document_;
......
...@@ -156,6 +156,12 @@ class FrameFetchContextTest : public ::testing::Test { ...@@ -156,6 +156,12 @@ class FrameFetchContextTest : public ::testing::Test {
return child_fetch_context; return child_fetch_context;
} }
// Call the method for the actual test cases as only this fixture is specified
// as a friend class.
void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest& request) {
fetch_context->SetFirstPartyCookieAndRequestorOrigin(request);
}
std::unique_ptr<DummyPageHolder> dummy_page_holder; std::unique_ptr<DummyPageHolder> dummy_page_holder;
// We don't use the DocumentLoader directly in any tests, but need to keep it // We don't use the DocumentLoader directly in any tests, but need to keep it
// around as long as the ResourceFetcher and Document live due to indirect // around as long as the ResourceFetcher and Document live due to indirect
...@@ -907,7 +913,7 @@ TEST_F(FrameFetchContextTest, SetFirstPartyCookieAndRequestorOrigin) { ...@@ -907,7 +913,7 @@ TEST_F(FrameFetchContextTest, SetFirstPartyCookieAndRequestorOrigin) {
} }
// Compare the populated |requestorOrigin| against |test.serializedOrigin| // Compare the populated |requestorOrigin| against |test.serializedOrigin|
fetch_context->SetFirstPartyCookieAndRequestorOrigin(request); SetFirstPartyCookieAndRequestorOrigin(request);
if (strlen(test.serialized_origin) == 0) { if (strlen(test.serialized_origin) == 0) {
EXPECT_TRUE(!request.RequestorOrigin()); EXPECT_TRUE(!request.RequestorOrigin());
} else { } else {
...@@ -1455,7 +1461,7 @@ TEST_F(FrameFetchContextTest, ...@@ -1455,7 +1461,7 @@ TEST_F(FrameFetchContextTest,
dummy_page_holder = nullptr; dummy_page_holder = nullptr;
fetch_context->SetFirstPartyCookieAndRequestorOrigin(request); SetFirstPartyCookieAndRequestorOrigin(request);
EXPECT_EQ(document_url, request.SiteForCookies()); EXPECT_EQ(document_url, request.SiteForCookies());
EXPECT_EQ(origin, request.RequestorOrigin()); EXPECT_EQ(origin, request.RequestorOrigin());
......
...@@ -103,7 +103,6 @@ class WorkerFetchContext final : public BaseFetchContext { ...@@ -103,7 +103,6 @@ class WorkerFetchContext final : public BaseFetchContext {
const ClientHintsPreferences&, const ClientHintsPreferences&,
const FetchParameters::ResourceWidth&, const FetchParameters::ResourceWidth&,
ResourceRequest&) override; ResourceRequest&) override;
void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) override;
scoped_refptr<base::SingleThreadTaskRunner> GetLoadingTaskRunner() override; scoped_refptr<base::SingleThreadTaskRunner> GetLoadingTaskRunner() override;
void Trace(blink::Visitor*) override; void Trace(blink::Visitor*) override;
...@@ -112,6 +111,8 @@ class WorkerFetchContext final : public BaseFetchContext { ...@@ -112,6 +111,8 @@ class WorkerFetchContext final : public BaseFetchContext {
WorkerFetchContext(WorkerOrWorkletGlobalScope&, WorkerFetchContext(WorkerOrWorkletGlobalScope&,
std::unique_ptr<WebWorkerFetchContext>); std::unique_ptr<WebWorkerFetchContext>);
void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&);
Member<WorkerOrWorkletGlobalScope> global_scope_; Member<WorkerOrWorkletGlobalScope> global_scope_;
std::unique_ptr<WebWorkerFetchContext> web_context_; std::unique_ptr<WebWorkerFetchContext> web_context_;
std::unique_ptr<WebURLLoaderFactory> url_loader_factory_; std::unique_ptr<WebURLLoaderFactory> url_loader_factory_;
......
...@@ -119,6 +119,4 @@ void FetchContext::PopulateResourceRequest( ...@@ -119,6 +119,4 @@ void FetchContext::PopulateResourceRequest(
const FetchParameters::ResourceWidth&, const FetchParameters::ResourceWidth&,
ResourceRequest&) {} ResourceRequest&) {}
void FetchContext::SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&) {}
} // namespace blink } // namespace blink
...@@ -219,9 +219,6 @@ class PLATFORM_EXPORT FetchContext ...@@ -219,9 +219,6 @@ class PLATFORM_EXPORT FetchContext
const ClientHintsPreferences&, const ClientHintsPreferences&,
const FetchParameters::ResourceWidth&, const FetchParameters::ResourceWidth&,
ResourceRequest&); ResourceRequest&);
// Sets the first party for cookies and requestor origin using information
// stored in the FetchContext implementation.
virtual void SetFirstPartyCookieAndRequestorOrigin(ResourceRequest&);
virtual MHTMLArchive* Archive() const { return nullptr; } virtual MHTMLArchive* Archive() const { return nullptr; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment