OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "platform/SharedBuffer.h" | 35 #include "platform/SharedBuffer.h" |
36 #include "platform/network/HTTPParsers.h" | 36 #include "platform/network/HTTPParsers.h" |
37 #include "public/platform/WebProcessMemoryDump.h" | 37 #include "public/platform/WebProcessMemoryDump.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 ResourcePtr<ScriptResource> ScriptResource::fetch(FetchRequest& request, Resourc
eFetcher* fetcher) | 41 ResourcePtr<ScriptResource> ScriptResource::fetch(FetchRequest& request, Resourc
eFetcher* fetcher) |
42 { | 42 { |
43 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); | 43 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); |
44 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textScript); | 44 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textScript); |
45 return toScriptResource(fetcher->requestResource(request, ScriptResourceFact
ory())); | 45 ResourcePtr<ScriptResource> resource = toScriptResource(fetcher->requestReso
urce(request, ScriptResourceFactory())); |
| 46 if (resource && !request.integrityMetadata().isEmpty()) |
| 47 resource->setIntegrityMetadata(request.integrityMetadata()); |
| 48 return resource; |
46 } | 49 } |
47 | 50 |
48 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, const Str
ing& charset) | 51 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, const Str
ing& charset) |
49 : TextResource(resourceRequest, Script, "application/javascript", charset),
m_integrityChecked(false) | 52 : TextResource(resourceRequest, Script, "application/javascript", charset),
m_integrityChecked(false) |
50 { | 53 { |
51 DEFINE_STATIC_LOCAL(const AtomicString, acceptScript, ("*/*", AtomicString::
ConstructFromLiteral)); | 54 DEFINE_STATIC_LOCAL(const AtomicString, acceptScript, ("*/*", AtomicString::
ConstructFromLiteral)); |
52 | 55 |
53 // It's javascript we want. | 56 // It's javascript we want. |
54 // But some websites think their scripts are <some wrong mimetype here> | 57 // But some websites think their scripts are <some wrong mimetype here> |
55 // and refuse to serve them if we only accept application/x-javascript. | 58 // and refuse to serve them if we only accept application/x-javascript. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 121 |
119 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque
st) const | 122 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque
st) const |
120 { | 123 { |
121 if (request.integrityMetadata().isEmpty()) | 124 if (request.integrityMetadata().isEmpty()) |
122 return false; | 125 return false; |
123 | 126 |
124 return !IntegrityMetadata::setsEqual(m_integrityMetadata, request.integrityM
etadata()); | 127 return !IntegrityMetadata::setsEqual(m_integrityMetadata, request.integrityM
etadata()); |
125 } | 128 } |
126 | 129 |
127 } // namespace blink | 130 } // namespace blink |
OLD | NEW |