| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 PassRefPtr<MHTMLArchive> MHTMLArchive::create() | 93 PassRefPtr<MHTMLArchive> MHTMLArchive::create() |
| 94 { | 94 { |
| 95 return adoptRef(new MHTMLArchive); | 95 return adoptRef(new MHTMLArchive); |
| 96 } | 96 } |
| 97 | 97 |
| 98 PassRefPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, SharedBuffer* dat
a) | 98 PassRefPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, SharedBuffer* dat
a) |
| 99 { | 99 { |
| 100 // For security reasons we only load MHTML pages from local URLs. | 100 // For security reasons we only load MHTML pages from local URLs. |
| 101 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol())) | 101 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol())) |
| 102 return 0; | 102 return nullptr; |
| 103 | 103 |
| 104 MHTMLParser parser(data); | 104 MHTMLParser parser(data); |
| 105 RefPtr<MHTMLArchive> mainArchive = parser.parseArchive(); | 105 RefPtr<MHTMLArchive> mainArchive = parser.parseArchive(); |
| 106 if (!mainArchive) | 106 if (!mainArchive) |
| 107 return 0; // Invalid MHTML file. | 107 return nullptr; // Invalid MHTML file. |
| 108 | 108 |
| 109 // Since MHTML is a flat format, we need to make all frames aware of all res
ources. | 109 // Since MHTML is a flat format, we need to make all frames aware of all res
ources. |
| 110 for (size_t i = 0; i < parser.frameCount(); ++i) { | 110 for (size_t i = 0; i < parser.frameCount(); ++i) { |
| 111 RefPtr<MHTMLArchive> archive = parser.frameAt(i); | 111 RefPtr<MHTMLArchive> archive = parser.frameAt(i); |
| 112 for (size_t j = 1; j < parser.frameCount(); ++j) { | 112 for (size_t j = 1; j < parser.frameCount(); ++j) { |
| 113 if (i != j) | 113 if (i != j) |
| 114 archive->addSubframeArchive(parser.frameAt(j)); | 114 archive->addSubframeArchive(parser.frameAt(j)); |
| 115 } | 115 } |
| 116 for (size_t j = 0; j < parser.subResourceCount(); ++j) | 116 for (size_t j = 0; j < parser.subResourceCount(); ++j) |
| 117 archive->addSubresource(parser.subResourceAt(j)); | 117 archive->addSubresource(parser.subResourceAt(j)); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 for (Vector<RefPtr<MHTMLArchive> >::iterator it = m_subframeArchives.begin()
; it != m_subframeArchives.end(); ++it) { | 225 for (Vector<RefPtr<MHTMLArchive> >::iterator it = m_subframeArchives.begin()
; it != m_subframeArchives.end(); ++it) { |
| 226 if (!clearedArchives->contains(*it)) { | 226 if (!clearedArchives->contains(*it)) { |
| 227 clearedArchives->append(*it); | 227 clearedArchives->append(*it); |
| 228 (*it)->clearAllSubframeArchivesImpl(clearedArchives); | 228 (*it)->clearAllSubframeArchivesImpl(clearedArchives); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 m_subframeArchives.clear(); | 231 m_subframeArchives.clear(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } | 234 } |
| OLD | NEW |