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

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

Issue 2715533007: Use ScriptLoader::errorOccurred() instead of Resource in ScriptLoader (Closed)
Patch Set: Move DCHECK_EQ 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
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 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 dispatchLoadEvent(); 825 dispatchLoadEvent();
826 else 826 else
827 dispatchErrorEvent(); 827 dispatchErrorEvent();
828 } 828 }
829 m_resource = nullptr; 829 m_resource = nullptr;
830 } 830 }
831 831
832 void ScriptLoader::pendingScriptFinished(PendingScript* pendingScript) { 832 void ScriptLoader::pendingScriptFinished(PendingScript* pendingScript) {
833 DCHECK(!m_willBeParserExecuted); 833 DCHECK(!m_willBeParserExecuted);
834 DCHECK_EQ(m_pendingScript, pendingScript); 834 DCHECK_EQ(m_pendingScript, pendingScript);
835 DCHECK_EQ(pendingScript->resource(), m_resource);
835 836
836 // We do not need this script in the memory cache. The primary goals of 837 // We do not need this script in the memory cache. The primary goals of
837 // sending this fetch request are to let the third party server know 838 // sending this fetch request are to let the third party server know
838 // about the document.write scripts intervention and populate the http 839 // about the document.write scripts intervention and populate the http
839 // cache for subsequent uses. 840 // cache for subsequent uses.
840 if (m_documentWriteIntervention == 841 if (m_documentWriteIntervention ==
841 DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) { 842 DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) {
842 memoryCache()->remove(m_pendingScript->resource()); 843 memoryCache()->remove(m_pendingScript->resource());
843 m_pendingScript->stopWatchingForLoad(); 844 m_pendingScript->stopWatchingForLoad();
844 return; 845 return;
845 } 846 }
846 847
847 DCHECK(m_asyncExecType != ScriptRunner::None); 848 DCHECK(m_asyncExecType != ScriptRunner::None);
848 849
849 Document* contextDocument = m_element->document().contextDocument(); 850 Document* contextDocument = m_element->document().contextDocument();
850 if (!contextDocument) { 851 if (!contextDocument) {
851 detachPendingScript(); 852 detachPendingScript();
852 return; 853 return;
853 } 854 }
854 855
855 DCHECK_EQ(pendingScript->resource(), m_resource); 856 if (errorOccurred()) {
856
857 if (m_resource->errorOccurred()) {
858 contextDocument->scriptRunner()->notifyScriptLoadError(this, 857 contextDocument->scriptRunner()->notifyScriptLoadError(this,
859 m_asyncExecType); 858 m_asyncExecType);
860 detachPendingScript(); 859 detachPendingScript();
861 dispatchErrorEvent(); 860 dispatchErrorEvent();
862 return; 861 return;
863 } 862 }
864 contextDocument->scriptRunner()->notifyScriptReady(this, m_asyncExecType); 863 contextDocument->scriptRunner()->notifyScriptReady(this, m_asyncExecType);
865 m_pendingScript->stopWatchingForLoad(); 864 m_pendingScript->stopWatchingForLoad();
866 } 865 }
867 866
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 if (isHTMLScriptLoader(element)) 916 if (isHTMLScriptLoader(element))
918 return toHTMLScriptElement(element)->loader(); 917 return toHTMLScriptElement(element)->loader();
919 918
920 if (isSVGScriptLoader(element)) 919 if (isSVGScriptLoader(element))
921 return toSVGScriptElement(element)->loader(); 920 return toSVGScriptElement(element)->loader();
922 921
923 return 0; 922 return 0;
924 } 923 }
925 924
926 } // namespace blink 925 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors-bad-integrity.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698