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

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

Issue 2781713003: Enable module scripts in ScriptLoader (Closed)
Patch Set: Update TestExpectations Created 3 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
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 21 matching lines...) Expand all
32 #include "public/platform/WebURLRequest.h" 32 #include "public/platform/WebURLRequest.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 class ScriptElementBase; 36 class ScriptElementBase;
37 class Script; 37 class Script;
38 38
39 class ResourceFetcher; 39 class ResourceFetcher;
40 class ScriptResource; 40 class ScriptResource;
41 41
42 class Modulator;
43 class ModulePendingScriptTreeClient;
44
42 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>, 45 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>,
43 public PendingScriptClient { 46 public PendingScriptClient {
44 USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader); 47 USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader);
45 48
46 public: 49 public:
47 static ScriptLoader* Create(ScriptElementBase* element, 50 static ScriptLoader* Create(ScriptElementBase* element,
48 bool created_by_parser, 51 bool created_by_parser,
49 bool is_evaluated, 52 bool is_evaluated,
50 bool created_during_document_write = false) { 53 bool created_during_document_write = false) {
51 return new ScriptLoader(element, created_by_parser, is_evaluated, 54 return new ScriptLoader(element, created_by_parser, is_evaluated,
(...skipping 16 matching lines...) Expand all
68 static bool BlockForNoModule(ScriptType, bool nomodule); 71 static bool BlockForNoModule(ScriptType, bool nomodule);
69 72
70 // https://html.spec.whatwg.org/#prepare-a-script 73 // https://html.spec.whatwg.org/#prepare-a-script
71 bool PrepareScript(const TextPosition& script_start_position = 74 bool PrepareScript(const TextPosition& script_start_position =
72 TextPosition::MinimumPosition(), 75 TextPosition::MinimumPosition(),
73 LegacyTypeSupport = kDisallowLegacyTypeInTypeAttribute); 76 LegacyTypeSupport = kDisallowLegacyTypeInTypeAttribute);
74 77
75 String ScriptContent() const; 78 String ScriptContent() const;
76 79
77 // Creates a PendingScript for external script whose fetch is started in 80 // Creates a PendingScript for external script whose fetch is started in
78 // FetchClassicScript(). 81 // FetchClassicScript()/FetchModuleScriptTree().
79 PendingScript* CreatePendingScript(); 82 PendingScript* CreatePendingScript();
80 83
81 // Returns false if and only if execution was blocked. 84 // Returns false if and only if execution was blocked.
82 bool ExecuteScript(const Script*); 85 bool ExecuteScript(const Script*);
83 virtual void Execute(); 86 virtual void Execute();
84 87
85 // XML parser calls these 88 // XML parser calls these
86 void DispatchLoadEvent(); 89 void DispatchLoadEvent();
87 void DispatchErrorEvent(); 90 void DispatchErrorEvent();
88 bool IsScriptTypeSupported(LegacyTypeSupport, 91 bool IsScriptTypeSupported(LegacyTypeSupport,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // 146 //
144 // https://html.spec.whatwg.org/#fetch-a-classic-script 147 // https://html.spec.whatwg.org/#fetch-a-classic-script
145 bool FetchClassicScript(const KURL&, 148 bool FetchClassicScript(const KURL&,
146 ResourceFetcher*, 149 ResourceFetcher*,
147 const String& nonce, 150 const String& nonce,
148 const IntegrityMetadataSet&, 151 const IntegrityMetadataSet&,
149 ParserDisposition, 152 ParserDisposition,
150 CrossOriginAttributeValue, 153 CrossOriginAttributeValue,
151 SecurityOrigin*, 154 SecurityOrigin*,
152 const String& encoding); 155 const String& encoding);
156 // https://html.spec.whatwg.org/#fetch-a-module-script-tree
157 void FetchModuleScriptTree(const KURL&,
158 Modulator*,
159 const String& nonce,
160 ParserDisposition,
161 WebURLRequest::FetchCredentialsMode);
153 162
154 bool DoExecuteScript(const Script*); 163 bool DoExecuteScript(const Script*);
155 164
156 // Clears the connection to the PendingScript. 165 // Clears the connection to the PendingScript.
157 void DetachPendingScript(); 166 void DetachPendingScript();
158 167
159 // PendingScriptClient 168 // PendingScriptClient
160 void PendingScriptFinished(PendingScript*) override; 169 void PendingScriptFinished(PendingScript*) override;
161 170
162 Member<ScriptElementBase> element_; 171 Member<ScriptElementBase> element_;
(...skipping 14 matching lines...) Expand all
177 // https://html.spec.whatwg.org/#non-blocking 186 // https://html.spec.whatwg.org/#non-blocking
178 // "Initially, script elements must have this flag set." 187 // "Initially, script elements must have this flag set."
179 bool non_blocking_ = true; 188 bool non_blocking_ = true;
180 189
181 // https://html.spec.whatwg.org/#ready-to-be-parser-executed 190 // https://html.spec.whatwg.org/#ready-to-be-parser-executed
182 // "Initially, script elements must have this flag unset" 191 // "Initially, script elements must have this flag unset"
183 bool ready_to_be_parser_executed_ = false; 192 bool ready_to_be_parser_executed_ = false;
184 193
185 // https://html.spec.whatwg.org/#concept-script-type 194 // https://html.spec.whatwg.org/#concept-script-type
186 // "It is determined when the script is prepared" 195 // "It is determined when the script is prepared"
187 // TODO(hiroshige): Currently |script_type_| is set but ignored, and
188 // thus is handled as if it is a classic script even if type is "module"
189 // and module scripts is enabled.
190 ScriptType script_type_ = ScriptType::kClassic; 196 ScriptType script_type_ = ScriptType::kClassic;
191 197
192 // https://html.spec.whatwg.org/#concept-script-external 198 // https://html.spec.whatwg.org/#concept-script-external
193 // "It is determined when the script is prepared" 199 // "It is determined when the script is prepared"
194 bool is_external_script_ = false; 200 bool is_external_script_ = false;
195 201
196 bool have_fired_load_; 202 bool have_fired_load_;
197 203
198 // Same as "The parser will handle executing the script." 204 // Same as "The parser will handle executing the script."
199 bool will_be_parser_executed_; 205 bool will_be_parser_executed_;
(...skipping 12 matching lines...) Expand all
212 // present in the http cache, send a GET for it with an interventions 218 // present in the http cache, send a GET for it with an interventions
213 // header to allow the server to know of the intervention. This fetch 219 // header to allow the server to know of the intervention. This fetch
214 // will be using DeferOption::IdleLoad to keep it out of the critical 220 // will be using DeferOption::IdleLoad to keep it out of the critical
215 // path. 221 // path.
216 kFetchDocWrittenScriptDeferIdle, 222 kFetchDocWrittenScriptDeferIdle,
217 }; 223 };
218 224
219 DocumentWriteIntervention document_write_intervention_; 225 DocumentWriteIntervention document_write_intervention_;
220 226
221 Member<PendingScript> pending_script_; 227 Member<PendingScript> pending_script_;
228 Member<ModulePendingScriptTreeClient> module_tree_client_;
222 }; 229 };
223 230
224 } // namespace blink 231 } // namespace blink
225 232
226 #endif // ScriptLoader_h 233 #endif // ScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698