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

Unified Diff: third_party/WebKit/Source/core/dom/Script.h

Issue 2780463002: Introduce blink::Script (Closed)
Patch Set: Rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Script.h
diff --git a/third_party/WebKit/Source/core/dom/Script.h b/third_party/WebKit/Source/core/dom/Script.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3e1be5e15f6feef328086588def70afb4138694
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/Script.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef Script_h
+#define Script_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/CoreExport.h"
+#include "platform/heap/Handle.h"
+#include "platform/wtf/text/WTFString.h"
+
+namespace blink {
+
+class Document;
+class LocalFrame;
+class SecurityOrigin;
+
+enum class ScriptType { kClassic, kModule };
+
+// https://html.spec.whatwg.org/#concept-script
+class CORE_EXPORT Script : public GarbageCollectedFinalized<Script>,
+ public TraceWrapperBase {
+ public:
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
+ DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() {}
+
+ virtual ~Script() {}
+
+ virtual ScriptType GetScriptType() const = 0;
+
+ // Used to skip execution of the script if it is empty.
+ virtual bool IsEmpty() const = 0;
+
+ // Returns false if the script should not be run due to MIME type check.
+ virtual bool CheckMIMETypeBeforeRunScript(Document* context_document,
+ const SecurityOrigin*) const = 0;
+
+ // https://html.spec.whatwg.org/#run-a-classic-script or
+ // https://html.spec.whatwg.org/#run-a-module-script,
+ // depending on the script type.
+ virtual void RunScript(LocalFrame*, const SecurityOrigin*) const = 0;
+
+ // For CSP check for inline scripts.
+ virtual String InlineSourceTextForCSP() const = 0;
+};
+
+} // namespace blink
+
+#endif
« no previous file with comments | « third_party/WebKit/Source/core/dom/PendingScript.cpp ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698