Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 } | 62 } |
| 63 return stringBuilder.toString(); | 63 return stringBuilder.toString(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 MHTMLArchive::MHTMLArchive() | 66 MHTMLArchive::MHTMLArchive() |
| 67 { | 67 { |
| 68 } | 68 } |
| 69 | 69 |
| 70 MHTMLArchive* MHTMLArchive::create(const KURL& url, PassRefPtr<SharedBuffer> dat a) | 70 MHTMLArchive* MHTMLArchive::create(const KURL& url, PassRefPtr<SharedBuffer> dat a) |
| 71 { | 71 { |
| 72 // MHTML pages can only be loaded from local URLs and http/https URLs. | 72 // MHTML pages can only be loaded from local URLs, http/https URLs, and cont ent URLs(Android specific). |
| 73 // The latter is now allowed due to full sandboxing enforcement on MHTML pag es. | 73 // The latter is now allowed due to full sandboxing enforcement on MHTML pag es. |
| 74 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && !url.pro tocolIsInHTTPFamily()) | 74 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && !url.pro tocolIsInHTTPFamily() |
| 75 #if (DE_OS == DE_OS_ANDROID) | |
|
jianli
2016/08/17 01:12:49
I don't think this is a correct check. You should
Vivian
2016/08/17 17:27:18
Done.
| |
| 76 && !url.protocolIs("content") | |
| 77 #endif | |
| 78 ) | |
| 75 return nullptr; | 79 return nullptr; |
| 76 | 80 |
| 77 MHTMLParser parser(data); | 81 MHTMLParser parser(data); |
| 78 HeapVector<Member<ArchiveResource>> resources = parser.parseArchive(); | 82 HeapVector<Member<ArchiveResource>> resources = parser.parseArchive(); |
| 79 if (resources.isEmpty()) | 83 if (resources.isEmpty()) |
| 80 return nullptr; // Invalid MHTML file. | 84 return nullptr; // Invalid MHTML file. |
| 81 | 85 |
| 82 MHTMLArchive* archive = new MHTMLArchive; | 86 MHTMLArchive* archive = new MHTMLArchive; |
| 83 // The first document suitable resource is the main resource of the top fram e. | 87 // The first document suitable resource is the main resource of the top fram e. |
| 84 for (size_t i = 0; i < resources.size(); ++i) { | 88 for (size_t i = 0; i < resources.size(); ++i) { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 return m_subresources.get(url.getString()); | 242 return m_subresources.get(url.getString()); |
| 239 } | 243 } |
| 240 | 244 |
| 241 DEFINE_TRACE(MHTMLArchive) | 245 DEFINE_TRACE(MHTMLArchive) |
| 242 { | 246 { |
| 243 visitor->trace(m_mainResource); | 247 visitor->trace(m_mainResource); |
| 244 visitor->trace(m_subresources); | 248 visitor->trace(m_subresources); |
| 245 } | 249 } |
| 246 | 250 |
| 247 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |