Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1124)

Unified Diff: Source/core/html/parser/HTMLResourcePreloader.cpp

Issue 19762002: [HTML Imports] Let script of imported document running. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made a test more robust. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/parser/HTMLDocumentParser.cpp ('k') | Source/core/loader/cache/ResourceFetcher.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLResourcePreloader.cpp
diff --git a/Source/core/html/parser/HTMLResourcePreloader.cpp b/Source/core/html/parser/HTMLResourcePreloader.cpp
index 9e258ed44a6e51f5a800d5b37af5ffbb7b32fda1..7c4f8b438e8ce79f1d848bd223b650d897a54b88 100644
--- a/Source/core/html/parser/HTMLResourcePreloader.cpp
+++ b/Source/core/html/parser/HTMLResourcePreloader.cpp
@@ -27,9 +27,9 @@
#include "core/html/parser/HTMLResourcePreloader.h"
#include "core/dom/Document.h"
+#include "core/html/HTMLImport.h"
#include "core/loader/cache/FetchInitiatorInfo.h"
#include "core/loader/cache/ResourceFetcher.h"
-
#include "core/css/MediaList.h"
#include "core/css/MediaQueryEvaluator.h"
#include "core/rendering/RenderObject.h"
@@ -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;
+ 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;
FetchRequest request = preload->resourceRequest(m_document);
- m_document->fetcher()->preload(preload->resourceType(), request, preload->charset());
+ loadingDocument->fetcher()->preload(preload->resourceType(), request, preload->charset());
}
« no previous file with comments | « Source/core/html/parser/HTMLDocumentParser.cpp ('k') | Source/core/loader/cache/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698