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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 1939743002: Completely detach failed script loader before dispatching error event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drop experimental assert Created 4 years, 7 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 else 457 else
458 dispatchErrorEvent(); 458 dispatchErrorEvent();
459 } 459 }
460 m_resource = nullptr; 460 m_resource = nullptr;
461 } 461 }
462 462
463 void ScriptLoader::notifyFinished(Resource* resource) 463 void ScriptLoader::notifyFinished(Resource* resource)
464 { 464 {
465 DCHECK(!m_willBeParserExecuted); 465 DCHECK(!m_willBeParserExecuted);
466 466
467 Document* elementDocument = &(m_element->document()); 467 Document* contextDocument = m_element->document().contextDocument();
468 Document* contextDocument = elementDocument->contextDocument();
469 if (!contextDocument) 468 if (!contextDocument)
470 return; 469 return;
471 470
472 ASSERT_UNUSED(resource, resource == m_resource); 471 ASSERT_UNUSED(resource, resource == m_resource);
473 472
474 ScriptRunner::ExecutionType runOrder = m_willExecuteInOrder ? ScriptRunner:: IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION; 473 ScriptRunner::ExecutionType runOrder = m_willExecuteInOrder ? ScriptRunner:: IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION;
475 if (m_resource->errorOccurred()) { 474 if (m_resource->errorOccurred()) {
476 contextDocument->scriptRunner()->notifyScriptLoadError(this, runOrder); 475 contextDocument->scriptRunner()->notifyScriptLoadError(this, runOrder);
476 detach();
477 dispatchErrorEvent(); 477 dispatchErrorEvent();
478 detach();
479 return; 478 return;
480 } 479 }
481 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); 480 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder);
482 m_pendingScript->stopWatchingForLoad(); 481 m_pendingScript->stopWatchingForLoad();
483 } 482 }
484 483
485 bool ScriptLoader::ignoresLoadRequest() const 484 bool ScriptLoader::ignoresLoadRequest() const
486 { 485 {
487 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inShadowIncludingDocument(); 486 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inShadowIncludingDocument();
488 } 487 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 if (isHTMLScriptLoader(element)) 522 if (isHTMLScriptLoader(element))
524 return toHTMLScriptElement(element)->loader(); 523 return toHTMLScriptElement(element)->loader();
525 524
526 if (isSVGScriptLoader(element)) 525 if (isSVGScriptLoader(element))
527 return toSVGScriptElement(element)->loader(); 526 return toSVGScriptElement(element)->loader();
528 527
529 return 0; 528 return 0;
530 } 529 }
531 530
532 } // namespace blink 531 } // 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