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

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

Issue 1279163005: Initial Fetch integration for Subresource Integrity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add integration with FetchFormDataConsumerHandle Created 5 years, 4 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: Source/modules/fetch/Request.cpp
diff --git a/Source/modules/fetch/Request.cpp b/Source/modules/fetch/Request.cpp
index 97ce6fd3deec319ced9f9a1293ae92fbadbf2881..e4e27814c9977f06d587777d7757b4de615d931f 100644
--- a/Source/modules/fetch/Request.cpp
+++ b/Source/modules/fetch/Request.cpp
@@ -42,6 +42,7 @@ FetchRequestData* createCopyOfFetchRequestDataForFetch(ScriptState* scriptState,
request->setMode(original->mode());
request->setCredentials(original->credentials());
request->setRedirect(original->redirect());
+ request->setIntegrity(original->integrity());
// FIXME: Set cache mode.
// TODO(yhirano): Set redirect mode.
return request;
@@ -159,9 +160,12 @@ Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req
// TODO(horo): "22. If |init|'s redirect member is present, set |request|'s
// redirect mode to it."
- // TODO(jww): "23. If |init|'s integrity member is present, set |request|'s
+ // "If |init|'s integrity member is present, set |request|'s
// integrity metadata to it."
yhirano 2015/08/19 10:42:36 -empty line
jww 2015/08/19 16:43:40 Done.
+ if (!init.integrity.isNull())
+ request->setIntegrity(init.integrity);
+
// "24. If |init|'s method member is present, let |method| be it and run
// these substeps:"
if (!init.method.isNull()) {
@@ -201,7 +205,13 @@ Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req
exceptionState.throwTypeError("'" + r->request()->method() + "' is unsupported in no-cors mode.");
return nullptr;
}
- // "Set |r|'s Headers object's guard to |request-no-CORS|.
+ // "2. If |request|'s integrity metadata is not the empty string, throw
+ // a TypeError."
+ if (!request->integrity().isEmpty()) {
+ exceptionState.throwTypeError("The integrity attribute is unsupported in no-cors mode.");
+ return nullptr;
+ }
+ // "3. Set |r|'s Headers object's guard to |request-no-CORS|.
r->headers()->setGuard(Headers::RequestNoCORSGuard);
}
// "30. Fill |r|'s Headers object with |headers|. Rethrow any exceptions."
@@ -479,6 +489,11 @@ String Request::redirect() const
return "";
}
+String Request::integrity() const
+{
+ return m_request->integrity();
+}
+
Request* Request::clone(ExceptionState& exceptionState)
{
if (bodyUsed()) {

Powered by Google App Engine
This is Rietveld 408576698