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

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

Issue 2693423002: Do not re-initialize PendingScript in HTMLParserScriptRunner (Closed)
Patch Set: Reflect comments Created 3 years, 10 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) 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void handleSourceAttribute(const String& sourceUrl); 100 void handleSourceAttribute(const String& sourceUrl);
101 void handleAsyncAttribute(); 101 void handleAsyncAttribute();
102 102
103 virtual bool isReady() const { 103 virtual bool isReady() const {
104 return m_pendingScript && m_pendingScript->isReady(); 104 return m_pendingScript && m_pendingScript->isReady();
105 } 105 }
106 bool errorOccurred() const { 106 bool errorOccurred() const {
107 return m_pendingScript && m_pendingScript->errorOccurred(); 107 return m_pendingScript && m_pendingScript->errorOccurred();
108 } 108 }
109 109
110 // Clears the connection to the PendingScript (and Element and Resource).
111 void detach();
112
113 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite; } 110 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite; }
114 111
115 bool disallowedFetchForDocWrittenScript() { 112 bool disallowedFetchForDocWrittenScript() {
116 return m_documentWriteIntervention == 113 return m_documentWriteIntervention ==
117 DocumentWriteIntervention::DoNotFetchDocWrittenScript; 114 DocumentWriteIntervention::DoNotFetchDocWrittenScript;
118 } 115 }
119 void setFetchDocWrittenScriptDeferIdle(); 116 void setFetchDocWrittenScriptDeferIdle();
120 117
121 protected: 118 protected:
122 ScriptLoader(Element*, 119 ScriptLoader(Element*,
123 bool createdByParser, 120 bool createdByParser,
124 bool isEvaluated, 121 bool isEvaluated,
125 bool createdDuringDocumentWrite); 122 bool createdDuringDocumentWrite);
126 123
127 private: 124 private:
128 bool ignoresLoadRequest() const; 125 bool ignoresLoadRequest() const;
129 bool isScriptForEventSupported() const; 126 bool isScriptForEventSupported() const;
130 void logScriptMIMEType(LocalFrame*, ScriptResource*, const String&); 127 void logScriptMIMEType(LocalFrame*, ScriptResource*, const String&);
131 128
132 bool fetchScript(const String& sourceUrl, 129 bool fetchScript(const String& sourceUrl,
133 const String& encoding, 130 const String& encoding,
134 FetchRequest::DeferOption); 131 FetchRequest::DeferOption);
135 bool doExecuteScript(const ScriptSourceCode&); 132 bool doExecuteScript(const ScriptSourceCode&);
136 133
137 ScriptLoaderClient* client() const; 134 ScriptLoaderClient* client() const;
138 135
136 // Clears the connection to the PendingScript.
137 void detachPendingScript();
138
139 // PendingScriptClient 139 // PendingScriptClient
140 void pendingScriptFinished(PendingScript*) override; 140 void pendingScriptFinished(PendingScript*) override;
141 141
142 Member<Element> m_element; 142 Member<Element> m_element;
143 Member<ScriptResource> m_resource; 143 Member<ScriptResource> m_resource;
144 WTF::OrdinalNumber m_startLineNumber; 144 WTF::OrdinalNumber m_startLineNumber;
145 145
146 // https://html.spec.whatwg.org/#script-processing-model 146 // https://html.spec.whatwg.org/#script-processing-model
147 // "A script element has several associated pieces of state.": 147 // "A script element has several associated pieces of state.":
148 148
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 DocumentWriteIntervention m_documentWriteIntervention; 195 DocumentWriteIntervention m_documentWriteIntervention;
196 196
197 Member<PendingScript> m_pendingScript; 197 Member<PendingScript> m_pendingScript;
198 }; 198 };
199 199
200 ScriptLoader* toScriptLoaderIfPossible(Element*); 200 ScriptLoader* toScriptLoaderIfPossible(Element*);
201 201
202 } // namespace blink 202 } // namespace blink
203 203
204 #endif // ScriptLoader_h 204 #endif // ScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698