| Index: Source/core/html/parser/HTMLScriptRunner.cpp
|
| diff --git a/Source/core/html/parser/HTMLScriptRunner.cpp b/Source/core/html/parser/HTMLScriptRunner.cpp
|
| index ec2442f8a305c2f3ac57b8de2ce1792a554a64c1..c65af170be7d3dccf1612b73165e6d468e485148 100644
|
| --- a/Source/core/html/parser/HTMLScriptRunner.cpp
|
| +++ b/Source/core/html/parser/HTMLScriptRunner.cpp
|
| @@ -165,8 +165,34 @@ void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi
|
| ASSERT(!isExecutingScript());
|
| }
|
|
|
| +void HTMLScriptRunner::stopWatchingResourceForLoad(Resource* resource)
|
| +{
|
| + if (m_parserBlockingScript.resource() == resource) {
|
| + m_parserBlockingScript.stopWatchingForLoad(this);
|
| + m_parserBlockingScript.releaseElementAndClear();
|
| + return;
|
| + }
|
| + for (PendingScript& script : m_scriptsToExecuteAfterParsing) {
|
| + if (script.resource() == resource) {
|
| + script.stopWatchingForLoad(this);
|
| + script.releaseElementAndClear();
|
| + return;
|
| + }
|
| + }
|
| +}
|
| +
|
| void HTMLScriptRunner::notifyFinished(Resource* cachedResource)
|
| {
|
| + // Handle cancellations of parser-blocking script loads without
|
| + // notifying the host (i.e., parser) if these were initiated by nested
|
| + // document.write()s. The cancellation may have been triggered by
|
| + // script execution to signal an abrupt stop (e.g., window.close().)
|
| + //
|
| + // The parser is unprepared to be told, and doesn't need to be.
|
| + if (isExecutingScript() && cachedResource->wasCanceled()) {
|
| + stopWatchingResourceForLoad(cachedResource);
|
| + return;
|
| + }
|
| m_host->notifyScriptLoaded(cachedResource);
|
| }
|
|
|
|
|