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

Unified Diff: Source/core/html/imports/HTMLImportStateResolver.cpp

Issue 289993004: HTML Imports: Take care of cycles according to the spec. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/imports/HTMLImportLoader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/imports/HTMLImportStateResolver.cpp
diff --git a/Source/core/html/imports/HTMLImportStateResolver.cpp b/Source/core/html/imports/HTMLImportStateResolver.cpp
index bd083ad51017512e6f430a5ad1c36a2eb6e6165f..df03643504e0a68fd7e00a2fe6c8146dd02f41de 100644
--- a/Source/core/html/imports/HTMLImportStateResolver.cpp
+++ b/Source/core/html/imports/HTMLImportStateResolver.cpp
@@ -32,6 +32,7 @@
#include "core/html/imports/HTMLImportStateResolver.h"
#include "core/html/imports/HTMLImport.h"
+#include "core/html/imports/HTMLImportChild.h"
namespace WebCore {
@@ -39,6 +40,8 @@ inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import)
{
if (!import->isSync())
return false;
+ if (!toHTMLImportChild(import)->isFirst())
+ return false;
if (!import->loader())
return true;
return !import->state().isReady();
@@ -46,9 +49,12 @@ inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import)
inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const
{
- for (const HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->parent()) {
- if (ancestor->previous() && isBlockingFollowers(ancestor->previous()))
- return true;
+ // FIXME: Memoize to make this faster.
+ for (HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->parent()) {
+ for (HTMLImport* predecessor = ancestor->previous(); predecessor; predecessor = predecessor->previous()) {
+ if (isBlockingFollowers(predecessor))
+ return true;
+ }
}
for (HTMLImport* child = m_import->firstChild(); child; child = child->next()) {
« no previous file with comments | « Source/core/html/imports/HTMLImportLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698