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 23 matching lines...) Expand all Loading... |
34 #include "platform/loader/fetch/ResourceClientWalker.h" | 34 #include "platform/loader/fetch/ResourceClientWalker.h" |
35 #include "platform/loader/fetch/ResourceFetcher.h" | 35 #include "platform/loader/fetch/ResourceFetcher.h" |
36 #include "platform/network/mime/MIMETypeRegistry.h" | 36 #include "platform/network/mime/MIMETypeRegistry.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 ScriptResource* ScriptResource::fetch(FetchRequest& request, | 40 ScriptResource* ScriptResource::fetch(FetchRequest& request, |
41 ResourceFetcher* fetcher) { | 41 ResourceFetcher* fetcher) { |
42 DCHECK_EQ(request.resourceRequest().frameType(), | 42 DCHECK_EQ(request.resourceRequest().frameType(), |
43 WebURLRequest::FrameTypeNone); | 43 WebURLRequest::FrameTypeNone); |
44 request.mutableResourceRequest().setRequestContext( | 44 request.setRequestContext(WebURLRequest::RequestContextScript); |
45 WebURLRequest::RequestContextScript); | |
46 ScriptResource* resource = toScriptResource( | 45 ScriptResource* resource = toScriptResource( |
47 fetcher->requestResource(request, ScriptResourceFactory())); | 46 fetcher->requestResource(request, ScriptResourceFactory())); |
48 if (resource && !request.integrityMetadata().isEmpty()) | 47 if (resource && !request.integrityMetadata().isEmpty()) |
49 resource->setIntegrityMetadata(request.integrityMetadata()); | 48 resource->setIntegrityMetadata(request.integrityMetadata()); |
50 return resource; | 49 return resource; |
51 } | 50 } |
52 | 51 |
53 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, | 52 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, |
54 const ResourceLoaderOptions& options, | 53 const ResourceLoaderOptions& options, |
55 const String& charset) | 54 const String& charset) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // static | 102 // static |
104 bool ScriptResource::mimeTypeAllowedByNosniff( | 103 bool ScriptResource::mimeTypeAllowedByNosniff( |
105 const ResourceResponse& response) { | 104 const ResourceResponse& response) { |
106 return parseContentTypeOptionsHeader(response.httpHeaderField( | 105 return parseContentTypeOptionsHeader(response.httpHeaderField( |
107 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || | 106 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || |
108 MIMETypeRegistry::isSupportedJavaScriptMIMEType( | 107 MIMETypeRegistry::isSupportedJavaScriptMIMEType( |
109 response.httpContentType()); | 108 response.httpContentType()); |
110 } | 109 } |
111 | 110 |
112 } // namespace blink | 111 } // namespace blink |
OLD | NEW |