OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef Script_h |
| 6 #define Script_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/wtf/text/WTFString.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class Document; |
| 15 class LocalFrame; |
| 16 class SecurityOrigin; |
| 17 |
| 18 enum class ScriptType { Classic, Module }; |
| 19 |
| 20 // https://html.spec.whatwg.org/#concept-script |
| 21 class CORE_EXPORT Script : public GarbageCollectedFinalized<Script> { |
| 22 public: |
| 23 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 24 virtual ~Script() {} |
| 25 |
| 26 virtual ScriptType scriptType() const = 0; |
| 27 |
| 28 // Used to skip execution of the script if it is empty. |
| 29 virtual bool isEmpty() const = 0; |
| 30 |
| 31 // Returns false if the script should not be run due to MIME type check. |
| 32 virtual bool checkMIMETypeBeforeRunScript(Document* contextDocument, |
| 33 const SecurityOrigin*) const = 0; |
| 34 |
| 35 // https://html.spec.whatwg.org/#run-a-classic-script or |
| 36 // https://html.spec.whatwg.org/#run-a-module-script, |
| 37 // depending on the script type. |
| 38 virtual void runScript(LocalFrame*, const SecurityOrigin*) const = 0; |
| 39 |
| 40 // For CSP check for inline scripts. |
| 41 virtual String inlineSourceTextForCSP() const = 0; |
| 42 }; |
| 43 |
| 44 } // namespace blink |
| 45 |
| 46 #endif |
OLD | NEW |