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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: ModuleScriptLoaderTest Created 3 years, 11 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/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index c69e212363ca0f5e1fe74a96c436c013208b4706..4237ea7772ed94881c260de74fd65dc0bb770b4f 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -35,6 +35,7 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "bindings/core/v8/HTMLScriptElementOrSVGScriptElement.h"
#include "bindings/core/v8/Microtask.h"
+#include "bindings/core/v8/ModuleController.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/SourceLocation.h"
#include "bindings/core/v8/StringOrDictionary.h"
@@ -89,6 +90,7 @@
#include "core/dom/IntersectionObserverController.h"
#include "core/dom/LayoutTreeBuilderTraversal.h"
#include "core/dom/LiveNodeList.h"
+#include "core/dom/ModulatorImpl.h"
#include "core/dom/MutationObserver.h"
#include "core/dom/NodeChildRemovalTracker.h"
#include "core/dom/NodeComputedStyle.h"
@@ -6445,6 +6447,19 @@ PropertyRegistry* Document::propertyRegistry() {
return m_propertyRegistry;
}
+Modulator* Document::ensureModulator() {
+ if (!RuntimeEnabledFeatures::moduleScriptsEnabled())
+ return nullptr;
+
+ if (!m_modulator && frame()) {
+ m_modulator = ModulatorImpl::create(
+ this, ModuleController::create(ScriptState::forMainWorld(frame())),
+ fetcher());
+ }
+
+ return m_modulator;
+}
+
const PropertyRegistry* Document::propertyRegistry() const {
return const_cast<Document*>(this)->propertyRegistry();
}
@@ -6529,6 +6544,7 @@ DEFINE_TRACE(Document) {
visitor->trace(m_resizeObserverController);
visitor->trace(m_propertyRegistry);
visitor->trace(m_styleReattachDataMap);
+ visitor->trace(m_modulator);
Supplementable<Document>::trace(visitor);
TreeScope::trace(visitor);
ContainerNode::trace(visitor);

Powered by Google App Engine
This is Rietveld 408576698