| 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 const String& ScriptResource::script() { | 86 NOINLINE const String& ScriptResource::script() { |
| 87 DCHECK(isLoaded()); | 87 // For investigating https://crbug.com/692856. |
| 88 CHECK(isLoaded() || (isLoading() && hasRevalidated())); |
| 89 CHECK(isLoaded() || (isLoading() && isCacheValidator())); |
| 90 CHECK(isLoaded()); |
| 88 | 91 |
| 89 if (m_script.isNull() && data()) { | 92 if (m_script.isNull() && data()) { |
| 90 String script = decodedText(); | 93 String script = decodedText(); |
| 91 clearData(); | 94 clearData(); |
| 92 setDecodedSize(script.charactersSizeInBytes()); | 95 setDecodedSize(script.charactersSizeInBytes()); |
| 93 m_script = AtomicString(script); | 96 m_script = AtomicString(script); |
| 94 } | 97 } |
| 95 | 98 |
| 96 return m_script; | 99 return m_script; |
| 97 } | 100 } |
| 98 | 101 |
| 99 void ScriptResource::destroyDecodedDataForFailedRevalidation() { | 102 void ScriptResource::destroyDecodedDataForFailedRevalidation() { |
| 100 m_script = AtomicString(); | 103 m_script = AtomicString(); |
| 101 } | 104 } |
| 102 | 105 |
| 103 // static | 106 // static |
| 104 bool ScriptResource::mimeTypeAllowedByNosniff( | 107 bool ScriptResource::mimeTypeAllowedByNosniff( |
| 105 const ResourceResponse& response) { | 108 const ResourceResponse& response) { |
| 106 return parseContentTypeOptionsHeader(response.httpHeaderField( | 109 return parseContentTypeOptionsHeader(response.httpHeaderField( |
| 107 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || | 110 HTTPNames::X_Content_Type_Options)) != ContentTypeOptionsNosniff || |
| 108 MIMETypeRegistry::isSupportedJavaScriptMIMEType( | 111 MIMETypeRegistry::isSupportedJavaScriptMIMEType( |
| 109 response.httpContentType()); | 112 response.httpContentType()); |
| 110 } | 113 } |
| 111 | 114 |
| 112 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |