Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Unified Diff: third_party/WebKit/Source/modules/fetch/Request.cpp

Issue 2815313002: Reland of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/fetch/Request.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/Request.cpp b/third_party/WebKit/Source/modules/fetch/Request.cpp
index 4890e3fe05f4cd9683ff21f47e0014b500a8a871..7df101f365a69f01d051607b884ee78bc59d2879 100644
--- a/third_party/WebKit/Source/modules/fetch/Request.cpp
+++ b/third_party/WebKit/Source/modules/fetch/Request.cpp
@@ -35,11 +35,12 @@
request->SetUnsafeRequestFlag(true);
// FIXME: Set client.
DOMWrapperWorld& world = script_state->World();
- if (world.IsIsolatedWorld())
+ if (world.IsIsolatedWorld()) {
request->SetOrigin(world.IsolatedWorldSecurityOrigin());
- else
+ } else {
request->SetOrigin(
- script_state->GetExecutionContext()->GetSecurityOrigin());
+ ExecutionContext::From(script_state)->GetSecurityOrigin());
+ }
// FIXME: Set ForceOriginHeaderFlag.
request->SetSameOriginDataURLFlag(true);
request->SetReferrer(original->GetReferrer());
@@ -75,7 +76,7 @@
// and a new request otherwise."
RefPtr<SecurityOrigin> origin =
- script_state->GetExecutionContext()->GetSecurityOrigin();
+ ExecutionContext::From(script_state)->GetSecurityOrigin();
// TODO(yhirano): Implement the following steps:
// - "Let |window| be client."
@@ -109,7 +110,7 @@
if (!input_request) {
// "Let |parsedURL| be the result of parsing |input| with |baseURL|."
KURL parsed_url =
- script_state->GetExecutionContext()->CompleteURL(input_string);
+ ExecutionContext::From(script_state)->CompleteURL(input_string);
// "If |parsedURL| is failure, throw a TypeError."
if (!parsed_url.IsValid()) {
exception_state.ThrowTypeError("Failed to parse URL from " +
@@ -178,8 +179,8 @@
} else {
// "Let |parsedReferrer| be the result of parsing |referrer| with
// |baseURL|."
- KURL parsed_referrer = script_state->GetExecutionContext()->CompleteURL(
- init.referrer.referrer);
+ KURL parsed_referrer = ExecutionContext::From(script_state)
+ ->CompleteURL(init.referrer.referrer);
if (!parsed_referrer.IsValid()) {
// "If |parsedReferrer| is failure, throw a TypeError."
exception_state.ThrowTypeError("Referrer '" + init.referrer.referrer +
@@ -452,7 +453,7 @@
const String& input,
const Dictionary& init,
ExceptionState& exception_state) {
- RequestInit request_init(script_state->GetExecutionContext(), init,
+ RequestInit request_init(ExecutionContext::From(script_state), init,
exception_state);
return CreateRequestWithRequestOrString(script_state, nullptr, input,
request_init, exception_state);
@@ -468,7 +469,7 @@
Request* input,
const Dictionary& init,
ExceptionState& exception_state) {
- RequestInit request_init(script_state->GetExecutionContext(), init,
+ RequestInit request_init(ExecutionContext::From(script_state), init,
exception_state);
return CreateRequestWithRequestOrString(script_state, input, String(),
request_init, exception_state);
@@ -488,7 +489,7 @@
Request::Request(ScriptState* script_state,
FetchRequestData* request,
Headers* headers)
- : Body(script_state->GetExecutionContext()),
+ : Body(ExecutionContext::From(script_state)),
request_(request),
headers_(headers) {
RefreshBody(script_state);
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchRequestData.cpp ('k') | third_party/WebKit/Source/modules/fetch/Response.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698