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 Microtask::performCheckpoint(); | 289 // FIXME: This may be too agressive as we always deliver mutations at |
| 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(); |
290 | 295 |
291 InsertionPointRecord insertionPointRecord(m_host->inputStream()); | 296 InsertionPointRecord insertionPointRecord(m_host->inputStream()); |
292 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); | 297 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); |
293 | 298 |
294 scriptLoader->prepareScript(scriptStartPosition); | 299 scriptLoader->prepareScript(scriptStartPosition); |
295 | 300 |
296 if (!scriptLoader->willBeParserExecuted()) | 301 if (!scriptLoader->willBeParserExecuted()) |
297 return; | 302 return; |
298 | 303 |
299 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { | 304 if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { |
300 requestDeferredScript(script); | 305 requestDeferredScript(script); |
301 } else if (scriptLoader->readyToBeParserExecuted()) { | 306 } else if (scriptLoader->readyToBeParserExecuted()) { |
302 if (m_scriptNestingLevel == 1) { | 307 if (m_scriptNestingLevel == 1) { |
303 m_parserBlockingScript.setElement(script); | 308 m_parserBlockingScript.setElement(script); |
304 m_parserBlockingScript.setStartingPosition(scriptStartPosition); | 309 m_parserBlockingScript.setStartingPosition(scriptStartPosition); |
305 } else { | 310 } else { |
306 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); | 311 ScriptSourceCode sourceCode(script->textContent(), documentURLFo
rScriptExecution(m_document), scriptStartPosition); |
307 scriptLoader->executeScript(sourceCode); | 312 scriptLoader->executeScript(sourceCode); |
308 } | 313 } |
309 } else { | 314 } else { |
310 requestParsingBlockingScript(script); | 315 requestParsingBlockingScript(script); |
311 } | 316 } |
312 } | 317 } |
313 } | 318 } |
314 | 319 |
315 } | 320 } |
OLD | NEW |