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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ScriptResource.h

Issue 2689173002: Implement script MIME restrictions for X-Content-Type-Options: nosniff for Workers (Closed)
Patch Set: incorporated mkwst@'s comment Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void didAddClient(ResourceClient*) override; 66 void didAddClient(ResourceClient*) override;
67 void appendData(const char*, size_t) override; 67 void appendData(const char*, size_t) override;
68 68
69 void onMemoryDump(WebMemoryDumpLevelOfDetail, 69 void onMemoryDump(WebMemoryDumpLevelOfDetail,
70 WebProcessMemoryDump*) const override; 70 WebProcessMemoryDump*) const override;
71 71
72 void destroyDecodedDataForFailedRevalidation() override; 72 void destroyDecodedDataForFailedRevalidation() override;
73 73
74 const String& script(); 74 const String& script();
75 75
76 bool mimeTypeAllowedByNosniff() const; 76 static bool mimeTypeAllowedByNosniff(const ResourceResponse&);
77 77
78 private: 78 private:
79 class ScriptResourceFactory : public ResourceFactory { 79 class ScriptResourceFactory : public ResourceFactory {
80 public: 80 public:
81 ScriptResourceFactory() : ResourceFactory(Resource::Script) {} 81 ScriptResourceFactory() : ResourceFactory(Resource::Script) {}
82 82
83 Resource* create(const ResourceRequest& request, 83 Resource* create(const ResourceRequest& request,
84 const ResourceLoaderOptions& options, 84 const ResourceLoaderOptions& options,
85 const String& charset) const override { 85 const String& charset) const override {
86 return new ScriptResource(request, options, charset); 86 return new ScriptResource(request, options, charset);
87 } 87 }
88 }; 88 };
89 89
90 ScriptResource(const ResourceRequest&, 90 ScriptResource(const ResourceRequest&,
91 const ResourceLoaderOptions&, 91 const ResourceLoaderOptions&,
92 const String& charset); 92 const String& charset);
93 93
94 AtomicString m_script; 94 AtomicString m_script;
95 }; 95 };
96 96
97 DEFINE_RESOURCE_TYPE_CASTS(Script); 97 DEFINE_RESOURCE_TYPE_CASTS(Script);
98 98
99 } // namespace blink 99 } // namespace blink
100 100
101 #endif 101 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.cpp ('k') | third_party/WebKit/Source/core/loader/resource/ScriptResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698