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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void ScriptResource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, | 76 void ScriptResource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, |
77 WebProcessMemoryDump* memoryDump) const { | 77 WebProcessMemoryDump* memoryDump) const { |
78 Resource::onMemoryDump(levelOfDetail, memoryDump); | 78 Resource::onMemoryDump(levelOfDetail, memoryDump); |
79 const String name = getMemoryDumpName() + "/decoded_script"; | 79 const String name = getMemoryDumpName() + "/decoded_script"; |
80 auto dump = memoryDump->createMemoryAllocatorDump(name); | 80 auto dump = memoryDump->createMemoryAllocatorDump(name); |
81 dump->addScalar("size", "bytes", m_script.charactersSizeInBytes()); | 81 dump->addScalar("size", "bytes", m_script.charactersSizeInBytes()); |
82 memoryDump->addSuballocation( | 82 memoryDump->addSuballocation( |
83 dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); | 83 dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); |
84 } | 84 } |
85 | 85 |
86 NOINLINE const String& ScriptResource::script() { | 86 const String& ScriptResource::script() { |
87 // For investigating https://crbug.com/692856. | 87 DCHECK(isLoaded()); |
88 CHECK(isLoaded() || (isLoading() && hasRevalidated())); | |
89 CHECK(isLoaded() || (isLoading() && isCacheValidator())); | |
90 CHECK(isLoaded()); | |
91 | 88 |
92 if (m_script.isNull() && data()) { | 89 if (m_script.isNull() && data()) { |
93 String script = decodedText(); | 90 String script = decodedText(); |
94 clearData(); | 91 clearData(); |
95 setDecodedSize(script.charactersSizeInBytes()); | 92 setDecodedSize(script.charactersSizeInBytes()); |
96 m_script = AtomicString(script); | 93 m_script = AtomicString(script); |
97 } | 94 } |
98 | 95 |
99 return m_script; | 96 return m_script; |
100 } | 97 } |
101 | 98 |
102 void ScriptResource::destroyDecodedDataForFailedRevalidation() { | 99 void ScriptResource::destroyDecodedDataForFailedRevalidation() { |
103 m_script = AtomicString(); | 100 m_script = AtomicString(); |
104 } | 101 } |
105 | 102 |
106 // static | 103 // static |
107 bool ScriptResource::mimeTypeAllowedByNosniff( | 104 bool ScriptResource::mimeTypeAllowedByNosniff( |
108 const ResourceResponse& response) { | 105 const ResourceResponse& response) { |
109 return parseContentTypeOptionsHeader(response.httpHeaderField( | 106 return parseContentTypeOptionsHeader(response.httpHeaderField( |
110 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || | 107 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || |
111 MIMETypeRegistry::isSupportedJavaScriptMIMEType( | 108 MIMETypeRegistry::isSupportedJavaScriptMIMEType( |
112 response.httpContentType()); | 109 response.httpContentType()); |
113 } | 110 } |
114 | 111 |
115 } // namespace blink | 112 } // namespace blink |
OLD | NEW |