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

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

Issue 2720683003: Clear pointers to PendingScript when dispose()d in pendingScriptFinished() (Closed)
Patch Set: Merge the fix for (2). Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 void HTMLParserScriptRunner::pendingScriptFinished( 356 void HTMLParserScriptRunner::pendingScriptFinished(
357 PendingScript* pendingScript) { 357 PendingScript* pendingScript) {
358 // Handle cancellations of parser-blocking script loads without 358 // Handle cancellations of parser-blocking script loads without
359 // notifying the host (i.e., parser) if these were initiated by nested 359 // notifying the host (i.e., parser) if these were initiated by nested
360 // document.write()s. The cancellation may have been triggered by 360 // document.write()s. The cancellation may have been triggered by
361 // script execution to signal an abrupt stop (e.g., window.close().) 361 // script execution to signal an abrupt stop (e.g., window.close().)
362 // 362 //
363 // The parser is unprepared to be told, and doesn't need to be. 363 // The parser is unprepared to be told, and doesn't need to be.
364 if (isExecutingScript() && pendingScript->resource()->wasCanceled()) { 364 if (isExecutingScript() && pendingScript->resource()->wasCanceled()) {
365 pendingScript->dispose(); 365 pendingScript->dispose();
366
367 if (pendingScript == parserBlockingScript()) {
368 m_parserBlockingScript = nullptr;
369 } else {
370 CHECK_EQ(pendingScript, m_scriptsToExecuteAfterParsing.first());
371
372 // TODO(hiroshige): Remove this CHECK() before going to beta.
373 // This is only to make clusterfuzz to find a test case that executes
374 // this code path.
375 CHECK(false);
376
377 m_scriptsToExecuteAfterParsing.removeFirst();
378 // TODO(hiroshige): executeScriptsWaitingForParsing() should be
379 // called later at the appropriate time. https://crbug.com/696775
380 }
381
366 return; 382 return;
367 } 383 }
368 384
369 // If the script was blocked as part of document.write intervention, 385 // If the script was blocked as part of document.write intervention,
370 // then send an asynchronous GET request with an interventions header. 386 // then send an asynchronous GET request with an interventions header.
371 possiblyFetchBlockedDocWriteScript(pendingScript); 387 possiblyFetchBlockedDocWriteScript(pendingScript);
372 388
373 m_host->notifyScriptLoaded(pendingScript); 389 m_host->notifyScriptLoaded(pendingScript);
374 } 390 }
375 391
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 692
677 DEFINE_TRACE(HTMLParserScriptRunner) { 693 DEFINE_TRACE(HTMLParserScriptRunner) {
678 visitor->trace(m_document); 694 visitor->trace(m_document);
679 visitor->trace(m_host); 695 visitor->trace(m_host);
680 visitor->trace(m_parserBlockingScript); 696 visitor->trace(m_parserBlockingScript);
681 visitor->trace(m_scriptsToExecuteAfterParsing); 697 visitor->trace(m_scriptsToExecuteAfterParsing);
682 PendingScriptClient::trace(visitor); 698 PendingScriptClient::trace(visitor);
683 } 699 }
684 700
685 } // namespace blink 701 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698