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

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

Issue 2695713015: WIP: Reland CompiledScript, prototype compiling in a separate task.
Patch Set: allow compile to fail, disallow restreaming (hack) 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) 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const String& languageAttributeValue, 64 const String& languageAttributeValue,
65 LegacyTypeSupport supportLegacyTypes); 65 LegacyTypeSupport supportLegacyTypes);
66 66
67 // https://html.spec.whatwg.org/#prepare-a-script 67 // https://html.spec.whatwg.org/#prepare-a-script
68 bool prepareScript( 68 bool prepareScript(
69 const TextPosition& scriptStartPosition = TextPosition::minimumPosition(), 69 const TextPosition& scriptStartPosition = TextPosition::minimumPosition(),
70 LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); 70 LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute);
71 71
72 String scriptContent() const; 72 String scriptContent() const;
73 // Returns false if and only if execution was blocked. 73 // Returns false if and only if execution was blocked.
74 bool executeScript(const ScriptSourceCode&); 74 bool executeScript(const ScriptSourceCode&, CompiledScript* = nullptr);
75 virtual void execute(); 75 virtual void execute();
76 76
77 // XML parser calls these 77 // XML parser calls these
78 void dispatchLoadEvent(); 78 void dispatchLoadEvent();
79 void dispatchErrorEvent(); 79 void dispatchErrorEvent();
80 bool isScriptTypeSupported(LegacyTypeSupport) const; 80 bool isScriptTypeSupported(LegacyTypeSupport) const;
81 81
82 bool haveFiredLoadEvent() const { return m_haveFiredLoad; } 82 bool haveFiredLoadEvent() const { return m_haveFiredLoad; }
83 bool willBeParserExecuted() const { return m_willBeParserExecuted; } 83 bool willBeParserExecuted() const { return m_willBeParserExecuted; }
84 bool readyToBeParserExecuted() const { return m_readyToBeParserExecuted; } 84 bool readyToBeParserExecuted() const { return m_readyToBeParserExecuted; }
(...skipping 23 matching lines...) Expand all
108 } 108 }
109 109
110 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite; } 110 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite; }
111 111
112 bool disallowedFetchForDocWrittenScript() { 112 bool disallowedFetchForDocWrittenScript() {
113 return m_documentWriteIntervention == 113 return m_documentWriteIntervention ==
114 DocumentWriteIntervention::DoNotFetchDocWrittenScript; 114 DocumentWriteIntervention::DoNotFetchDocWrittenScript;
115 } 115 }
116 void setFetchDocWrittenScriptDeferIdle(); 116 void setFetchDocWrittenScriptDeferIdle();
117 117
118 static AccessControlStatus accessControlStatusForScript(
119 bool isExternalScript,
120 const ScriptResource*,
121 const SecurityOrigin* scriptElementOrigin);
122
118 protected: 123 protected:
119 ScriptLoader(Element*, 124 ScriptLoader(Element*,
120 bool createdByParser, 125 bool createdByParser,
121 bool isEvaluated, 126 bool isEvaluated,
122 bool createdDuringDocumentWrite); 127 bool createdDuringDocumentWrite);
123 128
124 private: 129 private:
125 bool ignoresLoadRequest() const; 130 bool ignoresLoadRequest() const;
126 bool isScriptForEventSupported() const; 131 bool isScriptForEventSupported() const;
127 void logScriptMIMEType(LocalFrame*, ScriptResource*, const String&); 132 void logScriptMIMEType(LocalFrame*, ScriptResource*, const String&);
128 133
129 bool fetchScript(const String& sourceUrl, 134 bool fetchScript(const String& sourceUrl,
130 const String& encoding, 135 const String& encoding,
131 FetchRequest::DeferOption); 136 FetchRequest::DeferOption);
132 bool doExecuteScript(const ScriptSourceCode&); 137 bool doExecuteScript(const ScriptSourceCode&, CompiledScript* = nullptr);
133 138
134 ScriptLoaderClient* client() const; 139 ScriptLoaderClient* client() const;
135 140
136 // Clears the connection to the PendingScript. 141 // Clears the connection to the PendingScript.
137 void detachPendingScript(); 142 void detachPendingScript();
138 143
139 // PendingScriptClient 144 // PendingScriptClient
140 void pendingScriptFinished(PendingScript*) override; 145 void pendingScriptFinished(PendingScript*) override;
141 146
142 Member<Element> m_element; 147 Member<Element> m_element;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 DocumentWriteIntervention m_documentWriteIntervention; 200 DocumentWriteIntervention m_documentWriteIntervention;
196 201
197 Member<PendingScript> m_pendingScript; 202 Member<PendingScript> m_pendingScript;
198 }; 203 };
199 204
200 ScriptLoader* toScriptLoaderIfPossible(Element*); 205 ScriptLoader* toScriptLoaderIfPossible(Element*);
201 206
202 } // namespace blink 207 } // namespace blink
203 208
204 #endif // ScriptLoader_h 209 #endif // ScriptLoader_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/PendingScript.cpp ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698