| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class Element; | 34 class Element; |
| 35 class ScriptLoaderClient; | 35 class ScriptLoaderClient; |
| 36 class ScriptSourceCode; | 36 class ScriptSourceCode; |
| 37 class LocalFrame; | 37 class LocalFrame; |
| 38 | 38 |
| 39 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>,
public ScriptResourceClient { | 39 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>,
public ScriptResourceClient { |
| 40 public: | 40 public: |
| 41 static RawPtr<ScriptLoader> create(Element* element, bool createdByParser, b
ool isEvaluated) | 41 static RawPtr<ScriptLoader> create(Element* element, bool createdByParser, b
ool isEvaluated, bool createdDuringDocumentWrite = false) |
| 42 { | 42 { |
| 43 return new ScriptLoader(element, createdByParser, isEvaluated); | 43 return new ScriptLoader(element, createdByParser, isEvaluated, createdDu
ringDocumentWrite); |
| 44 } | 44 } |
| 45 | 45 |
| 46 ~ScriptLoader() override; | 46 ~ScriptLoader() override; |
| 47 DECLARE_VIRTUAL_TRACE(); | 47 DECLARE_VIRTUAL_TRACE(); |
| 48 | 48 |
| 49 Element* element() const { return m_element; } | 49 Element* element() const { return m_element; } |
| 50 | 50 |
| 51 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; | 51 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; |
| 52 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); | 52 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); |
| 53 | 53 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 78 void childrenChanged(); | 78 void childrenChanged(); |
| 79 void handleSourceAttribute(const String& sourceUrl); | 79 void handleSourceAttribute(const String& sourceUrl); |
| 80 void handleAsyncAttribute(); | 80 void handleAsyncAttribute(); |
| 81 | 81 |
| 82 virtual bool isReady() const { return m_pendingScript && m_pendingScript->is
Ready(); } | 82 virtual bool isReady() const { return m_pendingScript && m_pendingScript->is
Ready(); } |
| 83 bool errorOccurred() const { return m_pendingScript && m_pendingScript->erro
rOccurred(); } | 83 bool errorOccurred() const { return m_pendingScript && m_pendingScript->erro
rOccurred(); } |
| 84 | 84 |
| 85 // Clears the connection to the PendingScript (and Element and Resource). | 85 // Clears the connection to the PendingScript (and Element and Resource). |
| 86 void detach(); | 86 void detach(); |
| 87 | 87 |
| 88 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite;
} |
| 89 |
| 88 protected: | 90 protected: |
| 89 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); | 91 ScriptLoader(Element*, bool createdByParser, bool isEvaluated, bool createdD
uringDocumentWrite); |
| 90 | 92 |
| 91 private: | 93 private: |
| 92 bool ignoresLoadRequest() const; | 94 bool ignoresLoadRequest() const; |
| 93 bool isScriptForEventSupported() const; | 95 bool isScriptForEventSupported() const; |
| 94 void logScriptMimetype(ScriptResource*, LocalFrame*, String); | 96 void logScriptMimetype(ScriptResource*, LocalFrame*, String); |
| 95 | 97 |
| 96 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); | 98 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); |
| 97 | 99 |
| 98 ScriptLoaderClient* client() const; | 100 ScriptLoaderClient* client() const; |
| 99 | 101 |
| 100 // ResourceClient | 102 // ResourceClient |
| 101 void notifyFinished(Resource*) override; | 103 void notifyFinished(Resource*) override; |
| 102 String debugName() const override { return "ScriptLoader"; } | 104 String debugName() const override { return "ScriptLoader"; } |
| 103 | 105 |
| 104 Member<Element> m_element; | 106 Member<Element> m_element; |
| 105 Member<ScriptResource> m_resource; | 107 Member<ScriptResource> m_resource; |
| 106 WTF::OrdinalNumber m_startLineNumber; | 108 WTF::OrdinalNumber m_startLineNumber; |
| 107 String m_characterEncoding; | 109 String m_characterEncoding; |
| 108 String m_fallbackCharacterEncoding; | 110 String m_fallbackCharacterEncoding; |
| 109 | 111 |
| 110 bool m_parserInserted : 1; | 112 bool m_parserInserted : 1; |
| 111 bool m_isExternalScript : 1; | 113 bool m_isExternalScript : 1; |
| 112 bool m_alreadyStarted : 1; | 114 bool m_alreadyStarted : 1; |
| 113 bool m_haveFiredLoad : 1; | 115 bool m_haveFiredLoad : 1; |
| 114 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." | 116 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." |
| 115 bool m_readyToBeParserExecuted : 1; | 117 bool m_readyToBeParserExecuted : 1; |
| 116 bool m_willExecuteInOrder : 1; | 118 bool m_willExecuteInOrder : 1; |
| 117 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 119 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
| 118 bool m_forceAsync : 1; | 120 bool m_forceAsync : 1; |
| 121 const bool m_createdDuringDocumentWrite : 1; |
| 119 | 122 |
| 120 Member<PendingScript> m_pendingScript; | 123 Member<PendingScript> m_pendingScript; |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 ScriptLoader* toScriptLoaderIfPossible(Element*); | 126 ScriptLoader* toScriptLoaderIfPossible(Element*); |
| 124 | 127 |
| 125 } // namespace blink | 128 } // namespace blink |
| 126 | 129 |
| 127 #endif // ScriptLoader_h | 130 #endif // ScriptLoader_h |
| OLD | NEW |