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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 2099583002: When pumping tokens yield for scripts waiting for resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improved test. Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // We will not have a scriptRunner when parsing a DocumentFragment. 258 // We will not have a scriptRunner when parsing a DocumentFragment.
259 if (m_scriptRunner) 259 if (m_scriptRunner)
260 m_scriptRunner->execute(scriptElement, scriptStartPosition); 260 m_scriptRunner->execute(scriptElement, scriptStartPosition);
261 } 261 }
262 262
263 bool HTMLDocumentParser::canTakeNextToken() 263 bool HTMLDocumentParser::canTakeNextToken()
264 { 264 {
265 if (isStopped()) 265 if (isStopped())
266 return false; 266 return false;
267 267
268 if (isWaitingForScripts()) { 268 // If we're paused waiting for a script, we try to execute scripts before co ntinuing.
269 // If we're paused waiting for a script, we try to execute scripts befor e continuing. 269 if (m_treeBuilder->hasParserBlockingScript())
270 runScriptsForPausedTreeBuilder(); 270 runScriptsForPausedTreeBuilder();
271 if (isStopped()) 271 if (isStopped() || isWaitingForScripts())
272 return false; 272 return false;
273 if (isWaitingForScripts())
274 return false;
275 }
276 273
277 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the 274 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the
278 // LocalFrame, but this approach is how the old parser handled 275 // LocalFrame, but this approach is how the old parser handled
279 // stopping when the page assigns window.location. What really 276 // stopping when the page assigns window.location. What really
280 // should happen is that assigning window.location causes the 277 // should happen is that assigning window.location causes the
281 // parser to stop parsing cleanly. The problem is we're not 278 // parser to stop parsing cleanly. The problem is we're not
282 // perpared to do that at every point where we run JavaScript. 279 // perpared to do that at every point where we run JavaScript.
283 if (!isParsingFragment() 280 if (!isParsingFragment()
284 && document()->frame() && document()->frame()->navigationScheduler().loc ationChangePending()) 281 && document()->frame() && document()->frame()->navigationScheduler().loc ationChangePending())
285 return false; 282 return false;
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); 1108 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50));
1112 successHistogram.count(duration); 1109 successHistogram.count(duration);
1113 } else { 1110 } else {
1114 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); 1111 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50));
1115 failureHistogram.count(duration); 1112 failureHistogram.count(duration);
1116 } 1113 }
1117 1114
1118 } 1115 }
1119 1116
1120 } // namespace blink 1117 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698