| 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 30 matching lines...) Expand all Loading... |
| 41 { | 41 { |
| 42 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); | 42 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); |
| 43 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textScript); | 43 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textScript); |
| 44 ResourcePtr<ScriptResource> resource = toScriptResource(fetcher->requestReso
urce(request, ScriptResourceFactory())); | 44 ResourcePtr<ScriptResource> resource = toScriptResource(fetcher->requestReso
urce(request, ScriptResourceFactory())); |
| 45 if (resource && !request.integrityMetadata().isEmpty()) | 45 if (resource && !request.integrityMetadata().isEmpty()) |
| 46 resource->setIntegrityMetadata(request.integrityMetadata()); | 46 resource->setIntegrityMetadata(request.integrityMetadata()); |
| 47 return resource; | 47 return resource; |
| 48 } | 48 } |
| 49 | 49 |
| 50 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, const Str
ing& charset) | 50 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, const Str
ing& charset) |
| 51 : TextResource(resourceRequest, Script, "application/javascript", charset),
m_integrityChecked(false) | 51 : TextResource(resourceRequest, Script, "application/javascript", charset),
m_integrityDisposition(ScriptIntegrityDisposition::NotChecked) |
| 52 { | 52 { |
| 53 DEFINE_STATIC_LOCAL(const AtomicString, acceptScript, ("*/*", AtomicString::
ConstructFromLiteral)); | 53 DEFINE_STATIC_LOCAL(const AtomicString, acceptScript, ("*/*", AtomicString::
ConstructFromLiteral)); |
| 54 | 54 |
| 55 // It's javascript we want. | 55 // It's javascript we want. |
| 56 // But some websites think their scripts are <some wrong mimetype here> | 56 // But some websites think their scripts are <some wrong mimetype here> |
| 57 // and refuse to serve them if we only accept application/x-javascript. | 57 // and refuse to serve them if we only accept application/x-javascript. |
| 58 setAccept(acceptScript); | 58 setAccept(acceptScript); |
| 59 } | 59 } |
| 60 | 60 |
| 61 ScriptResource::~ScriptResource() | 61 ScriptResource::~ScriptResource() |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void ScriptResource::destroyDecodedDataForFailedRevalidation() | 111 void ScriptResource::destroyDecodedDataForFailedRevalidation() |
| 112 { | 112 { |
| 113 m_script = AtomicString(); | 113 m_script = AtomicString(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool ScriptResource::mimeTypeAllowedByNosniff() const | 116 bool ScriptResource::mimeTypeAllowedByNosniff() const |
| 117 { | 117 { |
| 118 return parseContentTypeOptionsHeader(m_response.httpHeaderField(HTTPNames::X
_Content_Type_Options)) != ContentTypeOptionsNosniff || MIMETypeRegistry::isSupp
ortedJavaScriptMIMEType(mimeType()); | 118 return parseContentTypeOptionsHeader(m_response.httpHeaderField(HTTPNames::X
_Content_Type_Options)) != ContentTypeOptionsNosniff || MIMETypeRegistry::isSupp
ortedJavaScriptMIMEType(mimeType()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ScriptResource::setIntegrityDisposition(ScriptIntegrityDisposition disposit
ion) |
| 122 { |
| 123 ASSERT(disposition != ScriptIntegrityDisposition::NotChecked); |
| 124 m_integrityDisposition = disposition; |
| 125 } |
| 121 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque
st) const | 126 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque
st) const |
| 122 { | 127 { |
| 123 if (request.integrityMetadata().isEmpty()) | 128 if (request.integrityMetadata().isEmpty()) |
| 124 return false; | 129 return false; |
| 125 | 130 |
| 126 return !IntegrityMetadata::setsEqual(m_integrityMetadata, request.integrityM
etadata()); | 131 return !IntegrityMetadata::setsEqual(m_integrityMetadata, request.integrityM
etadata()); |
| 127 } | 132 } |
| 128 | 133 |
| 129 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |