| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Element* element() const { return m_element; } | 43 Element* element() const { return m_element; } |
| 44 | 44 |
| 45 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; | 45 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; |
| 46 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); | 46 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); |
| 47 | 47 |
| 48 String scriptCharset() const { return m_characterEncoding; } | 48 String scriptCharset() const { return m_characterEncoding; } |
| 49 String scriptContent() const; | 49 String scriptContent() const; |
| 50 void executeScript(const ScriptSourceCode&); | 50 void executeScript(const ScriptSourceCode&); |
| 51 void execute(ScriptResource*); | 51 void execute(ScriptResource*); |
| 52 | 52 |
| 53 // Check if potentially cross-origin enabled script is accessible | |
| 54 // prior to execution. Returns 'false' if not accessible, signalling | |
| 55 // that callers must not dispatch load events as the cross-origin | |
| 56 // fetch failed. | |
| 57 bool executePotentiallyCrossOriginScript(const ScriptSourceCode&); | |
| 58 | |
| 59 // XML parser calls these | 53 // XML parser calls these |
| 60 void dispatchLoadEvent(); | 54 void dispatchLoadEvent(); |
| 61 void dispatchErrorEvent(); | 55 void dispatchErrorEvent(); |
| 62 bool isScriptTypeSupported(LegacyTypeSupport) const; | 56 bool isScriptTypeSupported(LegacyTypeSupport) const; |
| 63 | 57 |
| 64 bool haveFiredLoadEvent() const { return m_haveFiredLoad; } | 58 bool haveFiredLoadEvent() const { return m_haveFiredLoad; } |
| 65 bool willBeParserExecuted() const { return m_willBeParserExecuted; } | 59 bool willBeParserExecuted() const { return m_willBeParserExecuted; } |
| 66 bool readyToBeParserExecuted() const { return m_readyToBeParserExecuted; } | 60 bool readyToBeParserExecuted() const { return m_readyToBeParserExecuted; } |
| 67 bool willExecuteWhenDocumentFinishedParsing() const { return m_willExecuteWh
enDocumentFinishedParsing; } | 61 bool willExecuteWhenDocumentFinishedParsing() const { return m_willExecuteWh
enDocumentFinishedParsing; } |
| 68 ResourcePtr<ScriptResource> resource() { return m_resource; } | 62 ResourcePtr<ScriptResource> resource() { return m_resource; } |
| 69 | 63 |
| 70 void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFired
Load; } | 64 void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFired
Load; } |
| 71 bool isParserInserted() const { return m_parserInserted; } | 65 bool isParserInserted() const { return m_parserInserted; } |
| 72 bool alreadyStarted() const { return m_alreadyStarted; } | 66 bool alreadyStarted() const { return m_alreadyStarted; } |
| 73 bool forceAsync() const { return m_forceAsync; } | 67 bool forceAsync() const { return m_forceAsync; } |
| 74 bool isPotentiallyCORSEnabled() const { return m_isPotentiallyCORSEnabled; } | |
| 75 | 68 |
| 76 // Helper functions used by our parent classes. | 69 // Helper functions used by our parent classes. |
| 77 void didNotifySubtreeInsertionsToDocument(); | 70 void didNotifySubtreeInsertionsToDocument(); |
| 78 void childrenChanged(); | 71 void childrenChanged(); |
| 79 void handleSourceAttribute(const String& sourceUrl); | 72 void handleSourceAttribute(const String& sourceUrl); |
| 80 void handleAsyncAttribute(); | 73 void handleAsyncAttribute(); |
| 81 | 74 |
| 82 private: | 75 private: |
| 83 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); | 76 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); |
| 84 | 77 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 WTF::OrdinalNumber m_startLineNumber; | 91 WTF::OrdinalNumber m_startLineNumber; |
| 99 bool m_parserInserted : 1; | 92 bool m_parserInserted : 1; |
| 100 bool m_isExternalScript : 1; | 93 bool m_isExternalScript : 1; |
| 101 bool m_alreadyStarted : 1; | 94 bool m_alreadyStarted : 1; |
| 102 bool m_haveFiredLoad : 1; | 95 bool m_haveFiredLoad : 1; |
| 103 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." | 96 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." |
| 104 bool m_readyToBeParserExecuted : 1; | 97 bool m_readyToBeParserExecuted : 1; |
| 105 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 98 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
| 106 bool m_forceAsync : 1; | 99 bool m_forceAsync : 1; |
| 107 bool m_willExecuteInOrder : 1; | 100 bool m_willExecuteInOrder : 1; |
| 108 bool m_isPotentiallyCORSEnabled : 1; | |
| 109 String m_characterEncoding; | 101 String m_characterEncoding; |
| 110 String m_fallbackCharacterEncoding; | 102 String m_fallbackCharacterEncoding; |
| 111 }; | 103 }; |
| 112 | 104 |
| 113 ScriptLoader* toScriptLoaderIfPossible(Element*); | 105 ScriptLoader* toScriptLoaderIfPossible(Element*); |
| 114 | 106 |
| 115 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea
tedByParser, bool isEvaluated) | 107 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea
tedByParser, bool isEvaluated) |
| 116 { | 108 { |
| 117 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); | 109 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); |
| 118 } | 110 } |
| 119 | 111 |
| 120 } | 112 } |
| 121 | 113 |
| 122 | 114 |
| 123 #endif | 115 #endif |
| OLD | NEW |