| OLD | NEW |
| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // We will not have a scriptRunner when parsing a DocumentFragment. | 265 // We will not have a scriptRunner when parsing a DocumentFragment. |
| 266 if (m_scriptRunner) | 266 if (m_scriptRunner) |
| 267 m_scriptRunner->execute(scriptElement, scriptStartPosition); | 267 m_scriptRunner->execute(scriptElement, scriptStartPosition); |
| 268 } | 268 } |
| 269 | 269 |
| 270 bool HTMLDocumentParser::canTakeNextToken() | 270 bool HTMLDocumentParser::canTakeNextToken() |
| 271 { | 271 { |
| 272 if (isStopped()) | 272 if (isStopped()) |
| 273 return false; | 273 return false; |
| 274 | 274 |
| 275 if (isWaitingForScripts()) { | 275 // If we're paused waiting for a script, we try to execute scripts before co
ntinuing. |
| 276 // If we're paused waiting for a script, we try to execute scripts befor
e continuing. | 276 if (m_treeBuilder->hasParserBlockingScript()) |
| 277 runScriptsForPausedTreeBuilder(); | 277 runScriptsForPausedTreeBuilder(); |
| 278 if (isStopped()) | 278 if (isStopped() || isWaitingForScripts()) |
| 279 return false; | 279 return false; |
| 280 if (isWaitingForScripts()) | |
| 281 return false; | |
| 282 } | |
| 283 | 280 |
| 284 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the | 281 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the |
| 285 // LocalFrame, but this approach is how the old parser handled | 282 // LocalFrame, but this approach is how the old parser handled |
| 286 // stopping when the page assigns window.location. What really | 283 // stopping when the page assigns window.location. What really |
| 287 // should happen is that assigning window.location causes the | 284 // should happen is that assigning window.location causes the |
| 288 // parser to stop parsing cleanly. The problem is we're not | 285 // parser to stop parsing cleanly. The problem is we're not |
| 289 // perpared to do that at every point where we run JavaScript. | 286 // perpared to do that at every point where we run JavaScript. |
| 290 if (!isParsingFragment() | 287 if (!isParsingFragment() |
| 291 && document()->frame() && document()->frame()->navigationScheduler().loc
ationChangePending()) | 288 && document()->frame() && document()->frame()->navigationScheduler().loc
ationChangePending()) |
| 292 return false; | 289 return false; |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); | 1123 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); |
| 1127 successHistogram.count(duration); | 1124 successHistogram.count(duration); |
| 1128 } else { | 1125 } else { |
| 1129 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); | 1126 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); |
| 1130 failureHistogram.count(duration); | 1127 failureHistogram.count(duration); |
| 1131 } | 1128 } |
| 1132 | 1129 |
| 1133 } | 1130 } |
| 1134 | 1131 |
| 1135 } // namespace blink | 1132 } // namespace blink |
| OLD | NEW |