| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 25 #include "core/dom/PendingScript.h" | 25 #include "core/dom/PendingScript.h" |
| 26 #include "core/dom/ScriptRunner.h" | 26 #include "core/dom/ScriptRunner.h" |
| 27 #include "core/loader/resource/ScriptResource.h" | 27 #include "core/loader/resource/ScriptResource.h" |
| 28 #include "platform/loader/fetch/FetchParameters.h" | 28 #include "platform/loader/fetch/FetchParameters.h" |
| 29 #include "platform/loader/fetch/ResourceClient.h" | 29 #include "platform/loader/fetch/ResourceClient.h" |
| 30 #include "platform/wtf/text/TextPosition.h" | 30 #include "platform/wtf/text/TextPosition.h" |
| 31 #include "platform/wtf/text/WTFString.h" | 31 #include "platform/wtf/text/WTFString.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class LocalFrame; | |
| 36 class ScriptElementBase; | 35 class ScriptElementBase; |
| 37 class ScriptSourceCode; | 36 class Script; |
| 38 | 37 |
| 39 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>, | 38 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>, |
| 40 public PendingScriptClient { | 39 public PendingScriptClient { |
| 41 USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader); | 40 USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader); |
| 42 | 41 |
| 43 public: | 42 public: |
| 44 static ScriptLoader* Create(ScriptElementBase* element, | 43 static ScriptLoader* Create(ScriptElementBase* element, |
| 45 bool created_by_parser, | 44 bool created_by_parser, |
| 46 bool is_evaluated, | 45 bool is_evaluated, |
| 47 bool created_during_document_write = false) { | 46 bool created_during_document_write = false) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 TextPosition::MinimumPosition(), | 65 TextPosition::MinimumPosition(), |
| 67 LegacyTypeSupport = kDisallowLegacyTypeInTypeAttribute); | 66 LegacyTypeSupport = kDisallowLegacyTypeInTypeAttribute); |
| 68 | 67 |
| 69 String ScriptContent() const; | 68 String ScriptContent() const; |
| 70 | 69 |
| 71 // Creates a PendingScript for external script whose fetch is started in | 70 // Creates a PendingScript for external script whose fetch is started in |
| 72 // fetchScript(). | 71 // fetchScript(). |
| 73 PendingScript* CreatePendingScript(); | 72 PendingScript* CreatePendingScript(); |
| 74 | 73 |
| 75 // Returns false if and only if execution was blocked. | 74 // Returns false if and only if execution was blocked. |
| 76 bool ExecuteScript(const ScriptSourceCode&); | 75 bool ExecuteScript(const Script*); |
| 77 virtual void Execute(); | 76 virtual void Execute(); |
| 78 | 77 |
| 79 // XML parser calls these | 78 // XML parser calls these |
| 80 void DispatchLoadEvent(); | 79 void DispatchLoadEvent(); |
| 81 void DispatchErrorEvent(); | 80 void DispatchErrorEvent(); |
| 82 bool IsScriptTypeSupported(LegacyTypeSupport) const; | 81 bool IsScriptTypeSupported(LegacyTypeSupport) const; |
| 83 | 82 |
| 84 bool HaveFiredLoadEvent() const { return have_fired_load_; } | 83 bool HaveFiredLoadEvent() const { return have_fired_load_; } |
| 85 bool WillBeParserExecuted() const { return will_be_parser_executed_; } | 84 bool WillBeParserExecuted() const { return will_be_parser_executed_; } |
| 86 bool ReadyToBeParserExecuted() const { return ready_to_be_parser_executed_; } | 85 bool ReadyToBeParserExecuted() const { return ready_to_be_parser_executed_; } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 120 |
| 122 protected: | 121 protected: |
| 123 ScriptLoader(ScriptElementBase*, | 122 ScriptLoader(ScriptElementBase*, |
| 124 bool created_by_parser, | 123 bool created_by_parser, |
| 125 bool is_evaluated, | 124 bool is_evaluated, |
| 126 bool created_during_document_write); | 125 bool created_during_document_write); |
| 127 | 126 |
| 128 private: | 127 private: |
| 129 bool IgnoresLoadRequest() const; | 128 bool IgnoresLoadRequest() const; |
| 130 bool IsScriptForEventSupported() const; | 129 bool IsScriptForEventSupported() const; |
| 131 void LogScriptMIMEType(LocalFrame*, ScriptResource*, const String&); | |
| 132 | 130 |
| 133 bool FetchScript(const String& source_url, | 131 bool FetchScript(const String& source_url, |
| 134 const String& encoding, | 132 const String& encoding, |
| 135 FetchParameters::DeferOption); | 133 FetchParameters::DeferOption); |
| 136 bool DoExecuteScript(const ScriptSourceCode&); | 134 bool DoExecuteScript(const Script*); |
| 137 | 135 |
| 138 // Clears the connection to the PendingScript. | 136 // Clears the connection to the PendingScript. |
| 139 void DetachPendingScript(); | 137 void DetachPendingScript(); |
| 140 | 138 |
| 141 // PendingScriptClient | 139 // PendingScriptClient |
| 142 void PendingScriptFinished(PendingScript*) override; | 140 void PendingScriptFinished(PendingScript*) override; |
| 143 | 141 |
| 144 Member<ScriptElementBase> element_; | 142 Member<ScriptElementBase> element_; |
| 145 Member<ScriptResource> resource_; | 143 Member<ScriptResource> resource_; |
| 146 WTF::OrdinalNumber start_line_number_; | 144 WTF::OrdinalNumber start_line_number_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 }; | 193 }; |
| 196 | 194 |
| 197 DocumentWriteIntervention document_write_intervention_; | 195 DocumentWriteIntervention document_write_intervention_; |
| 198 | 196 |
| 199 Member<PendingScript> pending_script_; | 197 Member<PendingScript> pending_script_; |
| 200 }; | 198 }; |
| 201 | 199 |
| 202 } // namespace blink | 200 } // namespace blink |
| 203 | 201 |
| 204 #endif // ScriptLoader_h | 202 #endif // ScriptLoader_h |
| OLD | NEW |