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

Side by Side Diff: Source/core/html/imports/HTMLImportChild.cpp

Issue 249563003: REGRESSION(r171966): Custom elements in async imports don't get upgrade. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/imports/HTMLImport.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 ensureLoader(); 89 ensureLoader();
90 } 90 }
91 91
92 void HTMLImportChild::didFinish() 92 void HTMLImportChild::didFinish()
93 { 93 {
94 if (m_client) 94 if (m_client)
95 m_client->didFinish(); 95 m_client->didFinish();
96 } 96 }
97 97
98 static bool hasAsyncImportAncestor(HTMLImport* import)
99 {
100 for (HTMLImport* i = import; i; i = i->parent()) {
101 if (!i->isSync())
102 return true;
103 }
104
105 return false;
106 }
107
108 void HTMLImportChild::didFinishLoading() 98 void HTMLImportChild::didFinishLoading()
109 { 99 {
110 clearResource(); 100 clearResource();
111 stateWillChange(); 101 stateWillChange();
112 if (m_customElementMicrotaskStep) 102 if (m_customElementMicrotaskStep)
113 CustomElementMicrotaskDispatcher::instance().importDidFinish(m_customEle mentMicrotaskStep.get()); 103 CustomElementMicrotaskDispatcher::instance().importDidFinish(m_customEle mentMicrotaskStep.get());
114 // FIXME(crbug.com/365956):
115 // This is needed because async import currently never consumes the queue an d
116 // it prevents the children of such an async import from finishing.
117 // Their steps are never processed.
118 // Although this is clearly not the right fix,
119 // https://codereview.chromium.org/249563003/ should get rid of this part.
120 if (hasAsyncImportAncestor(this))
121 didFinishUpgradingCustomElements();
122 } 104 }
123 105
124 void HTMLImportChild::didFinishUpgradingCustomElements() 106 void HTMLImportChild::didFinishUpgradingCustomElements()
125 { 107 {
126 stateWillChange(); 108 stateWillChange();
127 m_customElementMicrotaskStep.clear(); 109 m_customElementMicrotaskStep.clear();
128 } 110 }
129 111
130 bool HTMLImportChild::isLoaded() const 112 bool HTMLImportChild::isLoaded() const
131 { 113 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void HTMLImportChild::ensureLoader() 153 void HTMLImportChild::ensureLoader()
172 { 154 {
173 if (m_loader) 155 if (m_loader)
174 return; 156 return;
175 157
176 if (HTMLImportChild* found = toHTMLImportsController(root())->findLinkFor(m_ url, this)) 158 if (HTMLImportChild* found = toHTMLImportsController(root())->findLinkFor(m_ url, this))
177 shareLoader(found); 159 shareLoader(found);
178 else 160 else
179 createLoader(); 161 createLoader();
180 162
181 if (isSync() && !isDone()) { 163 if (!isDone() && !formsCycle()) {
182 ASSERT(!m_customElementMicrotaskStep); 164 ASSERT(!m_customElementMicrotaskStep);
183 m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->wea kPtr(); 165 m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->wea kPtr();
184 } 166 }
185 } 167 }
186 168
187 void HTMLImportChild::createLoader() 169 void HTMLImportChild::createLoader()
188 { 170 {
189 ASSERT(!m_loader); 171 ASSERT(!m_loader);
190 m_loader = toHTMLImportsController(root())->createLoader(); 172 m_loader = toHTMLImportsController(root())->createLoader();
191 m_loader->addImport(this); 173 m_loader->addImport(this);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 HTMLImport::showThis(); 220 HTMLImport::showThis();
239 fprintf(stderr, " loader=%p step=%p sync=%s url=%s", 221 fprintf(stderr, " loader=%p step=%p sync=%s url=%s",
240 m_loader, 222 m_loader,
241 m_customElementMicrotaskStep.get(), 223 m_customElementMicrotaskStep.get(),
242 isSync() ? "Y" : "N", 224 isSync() ? "Y" : "N",
243 url().string().utf8().data()); 225 url().string().utf8().data());
244 } 226 }
245 #endif 227 #endif
246 228
247 } // namespace WebCore 229 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/imports/HTMLImport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698