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

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: Updated to ToT 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
Index: Source/core/html/parser/HTMLResourcePreloader.cpp
diff --git a/Source/core/html/parser/HTMLResourcePreloader.cpp b/Source/core/html/parser/HTMLResourcePreloader.cpp
index e79c9985c63ba87f50dc97376742cee189a619da..e79fd161a9d1e37f2973830f83ae2f80b7bcc82f 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/CachedResourceInitiatorInfo.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());
}

Powered by Google App Engine
This is Rietveld 408576698