Chromium Code Reviews| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(script); | 279 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(script); |
| 280 | 280 |
| 281 // This contains both and ASSERTION and a null check since we should not | 281 // This contains both and ASSERTION and a null check since we should not |
| 282 // be getting into the case of a null script element, but seem to be fro m | 282 // be getting into the case of a null script element, but seem to be fro m |
| 283 // time to time. The assertion is left in to help find those cases and | 283 // time to time. The assertion is left in to help find those cases and |
| 284 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>. | 284 // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>. |
| 285 ASSERT(scriptLoader); | 285 ASSERT(scriptLoader); |
| 286 if (!scriptLoader) | 286 if (!scriptLoader) |
| 287 return; | 287 return; |
| 288 | 288 |
| 289 // FIXME: This may be too agressive as we always deliver mutations at | 289 Microtask::performCheckpoint(); |
|
esprehn
2014/02/11 00:44:49
This is not correct, now appendChild(script) does
| |
| 290 // every script element, even if it's not ready to execute yet. There's | |
| 291 // unfortuantely no obvious way to tell if prepareScript is going to | |
| 292 // execute the script from out here. | |
| 293 if (!isExecutingScript()) | |
| 294 Microtask::performCheckpoint(); | |
| 295 | 290 |
| 296 InsertionPointRecord insertionPointRecord(m_host->inputStream()); | 291 InsertionPointRecord insertionPointRecord(m_host->inputStream()); |
| 297 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); | 292 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); |
| 298 | 293 |
| 299 scriptLoader->prepareScript(scriptStartPosition); | 294 scriptLoader->prepareScript(scriptStartPosition); |
| 300 | 295 |
| 301 if (!scriptLoader->willBeParserExecuted()) | 296 if (!scriptLoader->willBeParserExecuted()) |
| 302 return; | 297 return; |
| 303 | 298 |
| 304 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { | 299 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { |
| 305 requestDeferredScript(script); | 300 requestDeferredScript(script); |
| 306 } else if (scriptLoader->readyToBeParserExecuted()) { | 301 } else if (scriptLoader->readyToBeParserExecuted()) { |
| 307 if (m_scriptNestingLevel == 1) { | 302 if (m_scriptNestingLevel == 1) { |
| 308 m_parserBlockingScript.setElement(script); | 303 m_parserBlockingScript.setElement(script); |
| 309 m_parserBlockingScript.setStartingPosition(scriptStartPosition); | 304 m_parserBlockingScript.setStartingPosition(scriptStartPosition); |
| 310 } else { | 305 } else { |
| 311 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition); | 306 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition); |
| 312 scriptLoader->executeScript(sourceCode); | 307 scriptLoader->executeScript(sourceCode); |
| 313 } | 308 } |
| 314 } else { | 309 } else { |
| 315 requestParsingBlockingScript(script); | 310 requestParsingBlockingScript(script); |
| 316 } | 311 } |
| 317 } | 312 } |
| 318 } | 313 } |
| 319 | 314 |
| 320 } | 315 } |
| OLD | NEW |