Chromium Code Reviews| Index: Source/core/html/parser/HTMLResourcePreloader.cpp |
| diff --git a/Source/core/html/parser/HTMLResourcePreloader.cpp b/Source/core/html/parser/HTMLResourcePreloader.cpp |
| index 0c1a17a714b774cd81fb305678fd725c4e7905de..2a6aee2e4be463aed888f5b195376df9c6b441b7 100644 |
| --- a/Source/core/html/parser/HTMLResourcePreloader.cpp |
| +++ b/Source/core/html/parser/HTMLResourcePreloader.cpp |
| @@ -26,12 +26,12 @@ |
| #include "config.h" |
| #include "core/html/parser/HTMLResourcePreloader.h" |
| +#include "core/css/MediaList.h" |
| +#include "core/css/MediaQueryEvaluator.h" |
| #include "core/dom/Document.h" |
| +#include "core/html/HTMLImport.h" |
| #include "core/loader/cache/CachedResourceInitiatorInfo.h" |
| #include "core/loader/cache/CachedResourceLoader.h" |
| - |
| -#include "core/css/MediaList.h" |
| -#include "core/css/MediaQueryEvaluator.h" |
| #include "core/rendering/RenderObject.h" |
| namespace WebCore { |
| @@ -82,14 +82,17 @@ static bool mediaAttributeMatches(Frame* frame, RenderStyle* renderStyle, const |
| void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload) |
| { |
| - ASSERT(m_document->frame()); |
| - ASSERT(m_document->renderer()); |
| - ASSERT(m_document->renderer()->style()); |
| - if (!preload->media().isEmpty() && !mediaAttributeMatches(m_document->frame(), m_document->renderer()->style(), preload->media())) |
| + Document* executingDocument = m_document->import() ? m_document->import()->master() : m_document; |
|
abarth-chromium
2013/07/19 07:55:55
What if the document that's imported itself import
|
| + Document* loadingDocument = m_document; |
| + |
| + ASSERT(executingDocument->frame()); |
| + ASSERT(executingDocument->renderer()); |
| + ASSERT(executingDocument->renderer()->style()); |
| + if (!preload->media().isEmpty() && !mediaAttributeMatches(executingDocument->frame(), executingDocument->renderer()->style(), preload->media())) |
| return; |
| - CachedResourceRequest request = preload->resourceRequest(m_document); |
| - m_document->cachedResourceLoader()->preload(preload->resourceType(), request, preload->charset()); |
| + CachedResourceRequest request = preload->resourceRequest(loadingDocument); |
| + loadingDocument->cachedResourceLoader()->preload(preload->resourceType(), request, preload->charset()); |
| } |