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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return resource; | 50 return resource; |
51 } | 51 } |
52 | 52 |
53 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, | 53 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, |
54 const ResourceLoaderOptions& options, | 54 const ResourceLoaderOptions& options, |
55 const String& charset) | 55 const String& charset) |
56 : TextResource(resourceRequest, | 56 : TextResource(resourceRequest, |
57 Script, | 57 Script, |
58 options, | 58 options, |
59 "application/javascript", | 59 "application/javascript", |
60 charset) {} | 60 charset), |
| 61 m_integrityDisposition(ScriptIntegrityDisposition::NotChecked) {} |
61 | 62 |
62 ScriptResource::~ScriptResource() {} | 63 ScriptResource::~ScriptResource() {} |
63 | 64 |
64 void ScriptResource::didAddClient(ResourceClient* client) { | 65 void ScriptResource::didAddClient(ResourceClient* client) { |
65 DCHECK(ScriptResourceClient::isExpectedType(client)); | 66 DCHECK(ScriptResourceClient::isExpectedType(client)); |
66 Resource::didAddClient(client); | 67 Resource::didAddClient(client); |
67 } | 68 } |
68 | 69 |
69 void ScriptResource::appendData(const char* data, size_t length) { | 70 void ScriptResource::appendData(const char* data, size_t length) { |
70 Resource::appendData(data, length); | 71 Resource::appendData(data, length); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void ScriptResource::destroyDecodedDataForFailedRevalidation() { | 105 void ScriptResource::destroyDecodedDataForFailedRevalidation() { |
105 m_script = AtomicString(); | 106 m_script = AtomicString(); |
106 } | 107 } |
107 | 108 |
108 bool ScriptResource::mimeTypeAllowedByNosniff() const { | 109 bool ScriptResource::mimeTypeAllowedByNosniff() const { |
109 return parseContentTypeOptionsHeader(response().httpHeaderField( | 110 return parseContentTypeOptionsHeader(response().httpHeaderField( |
110 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || | 111 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || |
111 MIMETypeRegistry::isSupportedJavaScriptMIMEType(httpContentType()); | 112 MIMETypeRegistry::isSupportedJavaScriptMIMEType(httpContentType()); |
112 } | 113 } |
113 | 114 |
| 115 void ScriptResource::setIntegrityDisposition( |
| 116 ScriptIntegrityDisposition disposition) { |
| 117 DCHECK_NE(disposition, ScriptIntegrityDisposition::NotChecked); |
| 118 m_integrityDisposition = disposition; |
| 119 } |
| 120 bool ScriptResource::mustRefetchDueToIntegrityMetadata( |
| 121 const FetchRequest& request) const { |
| 122 if (request.integrityMetadata().isEmpty()) |
| 123 return false; |
| 124 |
| 125 return !IntegrityMetadata::setsEqual(m_integrityMetadata, |
| 126 request.integrityMetadata()); |
| 127 } |
| 128 |
114 } // namespace blink | 129 } // namespace blink |
OLD | NEW |