CS Painting API should support multiple worklets.
authorjustin_michaud@apple.com <justin_michaud@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2018 03:55:49 +0000 (03:55 +0000)
committerjustin_michaud@apple.com <justin_michaud@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2018 03:55:49 +0000 (03:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192335

Reviewed by Dean Jackson.

Source/WebCore:

Adds a new map to support separate paint worklet global scopes (one for each worklet). Also
adds some tests and a fix for a repaint bug that this oncovered, where changing a custom property required
for paint would not trigger a repaint if there had not been a valid value set before.

Test: fast/css-custom-paint/multiple-worklets.html

* css/CSSPaintImageValue.cpp:
(WebCore::CSSPaintImageValue::image):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* dom/Document.cpp:
(WebCore::Document::prepareForDestruction):
(WebCore::Document::paintWorkletGlobalScope):
(WebCore::Document::setPaintWorkletGlobalScope):
* dom/Document.h:
(WebCore::Document::paintWorkletGlobalScope): Deleted.
* rendering/style/RenderStyle.cpp:
(WebCore::changedCustomPaintWatchedProperty):
* worklets/Worklet.cpp:
(WebCore::Worklet::addModule):
* worklets/WorkletGlobalScope.cpp:
(WebCore::WorkletGlobalScope::prepareForDestruction):

LayoutTests:

* fast/css-custom-paint/animate-repaint-expected.txt:
* fast/css-custom-paint/animate-repaint.html:
* fast/css-custom-paint/delay-expected.html: Added.
* fast/css-custom-paint/delay-repaint-expected.txt: Copied from LayoutTests/fast/css-custom-paint/animate-repaint-expected.txt.
* fast/css-custom-paint/delay-repaint.html: Copied from LayoutTests/fast/css-custom-paint/animate-repaint.html.
* fast/css-custom-paint/delay.html: Copied from LayoutTests/fast/css-custom-paint/animate-repaint.html.
* fast/css-custom-paint/multiple-worklets-expected.html: Added.
* fast/css-custom-paint/multiple-worklets.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-custom-paint/animate-repaint-expected.txt
LayoutTests/fast/css-custom-paint/animate-repaint.html
LayoutTests/fast/css-custom-paint/delay-expected.html [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/delay-repaint-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/delay-repaint.html [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/delay.html [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/multiple-worklets-expected.html [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/multiple-worklets-isolation-expected.html [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/multiple-worklets-isolation.html [new file with mode: 0644]
LayoutTests/fast/css-custom-paint/multiple-worklets.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPaintImageValue.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/worklets/Worklet.cpp
Source/WebCore/worklets/WorkletGlobalScope.cpp

index fecbcaf..3b69483 100644 (file)
@@ -1,3 +1,19 @@
+2018-12-10  Justin Michaud  <justin_michaud@apple.com>
+
+        CS Painting API should support multiple worklets.
+        https://bugs.webkit.org/show_bug.cgi?id=192335
+
+        Reviewed by Dean Jackson.
+
+        * fast/css-custom-paint/animate-repaint-expected.txt:
+        * fast/css-custom-paint/animate-repaint.html:
+        * fast/css-custom-paint/delay-expected.html: Added.
+        * fast/css-custom-paint/delay-repaint-expected.txt: Copied from LayoutTests/fast/css-custom-paint/animate-repaint-expected.txt.
+        * fast/css-custom-paint/delay-repaint.html: Copied from LayoutTests/fast/css-custom-paint/animate-repaint.html.
+        * fast/css-custom-paint/delay.html: Copied from LayoutTests/fast/css-custom-paint/animate-repaint.html.
+        * fast/css-custom-paint/multiple-worklets-expected.html: Added.
+        * fast/css-custom-paint/multiple-worklets.html: Added.
+
 2018-12-10  Youenn Fablet  <youenn@apple.com>
 
         DataChannels created asynchronously never open and are unusable
index c410ce3..7616b64 100644 (file)
@@ -1,9 +1,5 @@
 (repaint rects
   (rect 0 0 800 600)
-  (rect 0 0 150 150)
-  (rect 8 8 784 150)
-  (rect 0 0 800 166)
-  (rect 0 0 800 600)
   (rect 8 8 150 150)
   (rect 8 8 150 150)
   (rect 8 8 150 150)
index 3a326a5..d95e88e 100644 (file)
 </script>
 
 <script type="text/javascript">
-  if (window.testRunner && window.internals) {
-    window.testRunner.dumpAsText(false);
-    window.internals.startTrackingRepaints();
-  }
-  importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
-
-  // FIXME: Once importWorklet returns a promise, these setTimeouts should go away.
-  setTimeout(function() {
-    document.getElementById('paint').style.setProperty('--my-prop', 'goodbye');
-  }, 500);
-
-  setTimeout(function() {
-    var repaintRects = "No test runner";
+  function onload() {
     if (window.testRunner && window.internals) {
+      window.testRunner.dumpAsText(false);
       window.internals.startTrackingRepaints();
+    }
+    importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
 
-      // force a style recalc.
-      var dummy = document.body.offsetTop;
-
-      repaintRects = window.internals.repaintRectsAsText();
+    // FIXME: Once importWorklet returns a promise, these setTimeouts should go away.
+    setTimeout(function() {
+      document.getElementById('paint').style.setProperty('--my-prop', 'goodbye');
+    }, 500);
 
-      window.internals.stopTrackingRepaints();
-    }
+    setTimeout(function() {
+      var repaintRects = "No test runner";
+      if (window.testRunner && window.internals) {
+        // force a style recalc.
+        var dummy = document.body.offsetTop;
+        repaintRects = window.internals.repaintRectsAsText();
+        window.internals.stopTrackingRepaints();
+      }
 
-    var pre = document.createElement('pre');
-    document.body.appendChild(pre);
-    pre.innerHTML = repaintRects;
-  }, 1000);
+      var pre = document.createElement('pre');
+      document.body.appendChild(pre);
+      pre.innerHTML = repaintRects;
+    }, 1000);
+  }
 </script>
 
 <style>
@@ -61,6 +59,6 @@
   }
 </style>
 
-<body>
+<body onload="onload()">
   <div id="paint"></div>
 </body>
diff --git a/LayoutTests/fast/css-custom-paint/delay-expected.html b/LayoutTests/fast/css-custom-paint/delay-expected.html
new file mode 100644 (file)
index 0000000..4048cd6
--- /dev/null
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div id="paint" style="width: 150px; height: 150px; background-color: green;" ></div>
diff --git a/LayoutTests/fast/css-custom-paint/delay-repaint-expected.txt b/LayoutTests/fast/css-custom-paint/delay-repaint-expected.txt
new file mode 100644 (file)
index 0000000..7616b64
--- /dev/null
@@ -0,0 +1,7 @@
+(repaint rects
+  (rect 0 0 800 600)
+  (rect 8 8 150 150)
+  (rect 8 8 150 150)
+  (rect 8 8 150 150)
+)
+
diff --git a/LayoutTests/fast/css-custom-paint/delay-repaint.html b/LayoutTests/fast/css-custom-paint/delay-repaint.html
new file mode 100644 (file)
index 0000000..089999f
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
+<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
+<meta name="assert" content="Test that paint worklets repaint when modules are added, and correctly watch properties">
+<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
+<script src="resources/testharness.js"></script>
+
+<script id="code" type="text/worklet">
+  class MyPaint {
+    static get inputProperties() { return ['--my-prop']; }
+
+    paint(ctx, geom, properties) {
+      if (properties.get('--my-prop') == 5) {
+        ctx.fillStyle = "green";
+      } else {
+        ctx.fillStyle = "red";
+      }
+      ctx.fillRect(0, 0, geom.width, geom.height);
+    }
+  }
+  registerPaint('my-paint', MyPaint);
+</script>
+
+<script type="text/javascript">
+function onload() {
+  if (window.testRunner && window.internals) {
+    window.testRunner.dumpAsText(false);
+    window.internals.startTrackingRepaints();
+  }
+
+  // FIXME: Once importWorklet returns a promise, these setTimeouts should go away.
+  setTimeout(function() {
+    importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
+  }, 500);
+
+  setTimeout(function() {
+    paint.style.setProperty('--my-prop', 5);
+  }, 2000);
+
+  setTimeout(function() {
+    var repaintRects = "No test runner";
+    if (window.testRunner && window.internals) {
+      // force a style recalc.
+      var dummy = document.body.offsetTop;
+      repaintRects = window.internals.repaintRectsAsText();
+      window.internals.stopTrackingRepaints();
+    }
+
+    var pre = document.createElement('pre');
+    document.body.appendChild(pre);
+    pre.innerHTML = repaintRects;
+  }, 2500);
+}
+</script>
+
+<style>
+  #paint {
+    background-image: paint(my-paint);
+    width: 150px;
+    height: 150px;
+  }
+</style>
+
+<body onload="onload()">
+  <div id="paint"></div>
+</body>
diff --git a/LayoutTests/fast/css-custom-paint/delay.html b/LayoutTests/fast/css-custom-paint/delay.html
new file mode 100644 (file)
index 0000000..0a0c879
--- /dev/null
@@ -0,0 +1,43 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
+<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
+<meta name="assert" content="Test that paint worklets repaint when modules are added, and correctly watch properties">
+<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
+<script src="resources/testharness.js"></script>
+
+<script id="code" type="text/worklet">
+  class MyPaint {
+    static get inputProperties() { return ['--my-prop']; }
+
+    paint(ctx, geom, properties) {
+      if (properties.get('--my-prop') == 5) {
+        ctx.fillStyle = "green";
+      } else {
+        ctx.fillStyle = "red";
+      }
+      ctx.fillRect(0, 0, geom.width, geom.height);
+    }
+  }
+  registerPaint('my-paint', MyPaint);
+</script>
+
+<script type="text/javascript">
+  setTimeout(function() {
+    importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
+  }, 500);
+  // FIXME: This should use a promise once addModule supports it.
+  setTimeout(function() {
+    paint.style.setProperty('--my-prop', 5);
+  }, 2000);
+</script>
+
+<style>
+  #paint {
+    background-image: paint(my-paint);
+    width: 150px;
+    height: 150px;
+  }
+</style>
+
+<body>
+  <div id="paint"></div>
+</body>
diff --git a/LayoutTests/fast/css-custom-paint/multiple-worklets-expected.html b/LayoutTests/fast/css-custom-paint/multiple-worklets-expected.html
new file mode 100644 (file)
index 0000000..e90e880
--- /dev/null
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<div id="paint" style="width: 150px; height: 150px; background-color: purple;" ></div>
+<div id="paint2" style="width: 150px; height: 150px; background-color: green;" ></div>
diff --git a/LayoutTests/fast/css-custom-paint/multiple-worklets-isolation-expected.html b/LayoutTests/fast/css-custom-paint/multiple-worklets-isolation-expected.html
new file mode 100644 (file)
index 0000000..15ee96c
--- /dev/null
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<div id="paint" style="width: 150px; height: 150px; background-color: green;" ></div>
+<div id="paint2" style="width: 150px; height: 150px; background-color: green;" ></div>
diff --git a/LayoutTests/fast/css-custom-paint/multiple-worklets-isolation.html b/LayoutTests/fast/css-custom-paint/multiple-worklets-isolation.html
new file mode 100644 (file)
index 0000000..9525d88
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
+<script src="resources/testharness.js"></script>
+<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
+<meta name="assert" content="test multiple modules being added to the paintWorklet are isolated">
+<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
+
+<style>
+  #paint {
+    background-image: paint(my-paint);
+    width: 150px;
+    height: 150px;
+  }
+
+  #paint2 {
+    background-image: paint(my-paint2);
+    width: 150px;
+    height: 150px;
+  }
+</style>
+
+<div id="paint"></div>
+<div id="paint2"></div>
+
+<script id="code1" type="text/worklet">
+function shouldOnlyBeInCode1() {}
+
+registerPaint('my-paint', class {
+  paint(ctx, geom, properties) {
+    ctx.fillStyle = typeof(shouldOnlyBeInCode1) == 'function' ? 'green' : 'red';
+    ctx.fillRect(0, 0, geom.width, geom.height);
+  }
+});
+</script>
+
+<script id="code2" type="text/worklet">
+registerPaint('my-paint2', class {
+  paint(ctx, geom, properties) {
+    ctx.fillStyle = typeof(shouldOnlyBeInCode1) == 'undefined' ? 'green' : 'red';
+    ctx.fillRect(0, 0, geom.width, geom.height);
+  }
+});
+</script>
+
+<script>
+importWorklet(CSS.paintWorklet, document.getElementById('code1').textContent);
+importWorklet(CSS.paintWorklet, document.getElementById('code2').textContent);
+</script>
diff --git a/LayoutTests/fast/css-custom-paint/multiple-worklets.html b/LayoutTests/fast/css-custom-paint/multiple-worklets.html
new file mode 100644 (file)
index 0000000..b580de8
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
+<script src="resources/testharness.js"></script>
+<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
+<meta name="assert" content="test multiple modules being added to the paintWorklet">
+<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
+
+<style>
+  #paint {
+    background-image: paint(my-paint2);
+    width: 150px;
+    height: 150px;
+  }
+
+  #paint2 {
+    background-image: paint(my-paint);
+    width: 150px;
+    height: 150px;
+  }
+</style>
+
+<div id="paint"></div>
+<div id="paint2"></div>
+
+<script id="code1" type="text/worklet">
+registerPaint('my-paint', class {
+  paint(ctx, geom, properties) {
+    ctx.fillStyle = 'purple';
+    ctx.fillRect(0, 0, geom.width, geom.height);
+  }
+});
+</script>
+
+<script id="code2" type="text/worklet">
+registerPaint('my-paint2', class {
+  paint(ctx, geom, properties) {
+    ctx.fillStyle = 'green';
+    ctx.fillRect(0, 0, geom.width, geom.height);
+  }
+});
+</script>
+
+<script>
+importWorklet(CSS.paintWorklet, document.getElementById('code1').textContent);
+importWorklet(CSS.paintWorklet, document.getElementById('code2').textContent);
+paint.style.backgroundImage = "paint(my-paint)";
+paint2.style.backgroundImage = "paint(my-paint2)";
+</script>
index 81dae6f..ee83b1d 100644 (file)
@@ -1,3 +1,33 @@
+2018-12-10  Justin Michaud  <justin_michaud@apple.com>
+
+        CS Painting API should support multiple worklets.
+        https://bugs.webkit.org/show_bug.cgi?id=192335
+
+        Reviewed by Dean Jackson.
+
+        Adds a new map to support separate paint worklet global scopes (one for each worklet). Also
+        adds some tests and a fix for a repaint bug that this oncovered, where changing a custom property required
+        for paint would not trigger a repaint if there had not been a valid value set before.
+
+        Test: fast/css-custom-paint/multiple-worklets.html
+
+        * css/CSSPaintImageValue.cpp:
+        (WebCore::CSSPaintImageValue::image):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        * dom/Document.cpp:
+        (WebCore::Document::prepareForDestruction):
+        (WebCore::Document::paintWorkletGlobalScope):
+        (WebCore::Document::setPaintWorkletGlobalScope):
+        * dom/Document.h:
+        (WebCore::Document::paintWorkletGlobalScope): Deleted.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::changedCustomPaintWatchedProperty):
+        * worklets/Worklet.cpp:
+        (WebCore::Worklet::addModule):
+        * worklets/WorkletGlobalScope.cpp:
+        (WebCore::WorkletGlobalScope::prepareForDestruction):
+
 2018-12-10  Youenn Fablet  <youenn@apple.com>
 
         Remove derived classes of RealtimeMediaSourceCenter
index 796846e..8ca6e5e 100644 (file)
@@ -51,7 +51,7 @@ RefPtr<Image> CSSPaintImageValue::image(RenderElement& renderElement, const Floa
 {
     if (size.isEmpty())
         return nullptr;
-    auto* selectedGlobalScope = renderElement.document().paintWorkletGlobalScope();
+    auto* selectedGlobalScope = renderElement.document().paintWorkletGlobalScopeForName(m_name);
     if (!selectedGlobalScope)
         return nullptr;
     auto locker = holdLock(selectedGlobalScope->paintDefinitionLock());
index 6a1ce49..ecfa4c5 100644 (file)
@@ -1720,13 +1720,14 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value, ApplyCascad
         state.style()->setHasExplicitlyInheritedProperties();
 
 #if ENABLE(CSS_PAINTING_API)
-    if (is<CSSPaintImageValue>(*valueToApply) && document().paintWorkletGlobalScope()) {
-        // FIXME: This should use the "document paint registration map" from the spec, once it is implemented.
-        auto& paintWorklet = *document().paintWorkletGlobalScope();
-        auto locker = holdLock(paintWorklet.paintDefinitionLock());
-        if (auto* registration = paintWorklet.paintDefinitionMap().get(downcast<CSSPaintImageValue>(*valueToApply).name())) {
-            for (auto& property : registration->inputProperties)
-                state.style()->addCustomPaintWatchProperty(property);
+    if (is<CSSPaintImageValue>(*valueToApply)) {
+        auto& name = downcast<CSSPaintImageValue>(*valueToApply).name();
+        if (auto* paintWorklet = document().paintWorkletGlobalScopeForName(name)) {
+            auto locker = holdLock(paintWorklet->paintDefinitionLock());
+            if (auto* registration = paintWorklet->paintDefinitionMap().get(name)) {
+                for (auto& property : registration->inputProperties)
+                    state.style()->addCustomPaintWatchProperty(property);
+            }
         }
     }
 #endif
index b1a3e68..226bff2 100644 (file)
@@ -2562,10 +2562,9 @@ void Document::prepareForDestruction()
 #endif
 
 #if ENABLE(CSS_PAINTING_API)
-    if (m_paintWorkletGlobalScope) {
-        m_paintWorkletGlobalScope->prepareForDestruction();
-        m_paintWorkletGlobalScope = nullptr;
-    }
+    for (auto& scope : m_paintWorkletGlobalScopes.values())
+        scope->prepareForDestruction();
+    m_paintWorkletGlobalScopes.clear();
 #endif
 
     m_hasPreparedForDestruction = true;
@@ -8517,9 +8516,15 @@ Worklet& Document::ensurePaintWorklet()
     return *m_paintWorklet;
 }
 
-void Document::setPaintWorkletGlobalScope(Ref<PaintWorkletGlobalScope>&& scope)
+PaintWorkletGlobalScope* Document::paintWorkletGlobalScopeForName(const String& name)
+{
+    return m_paintWorkletGlobalScopes.get(name);
+}
+
+void Document::setPaintWorkletGlobalScopeForName(const String& name, Ref<PaintWorkletGlobalScope>&& scope)
 {
-    m_paintWorkletGlobalScope = WTFMove(scope);
+    auto addResult = m_paintWorkletGlobalScopes.add(name, WTFMove(scope));
+    ASSERT_UNUSED(addResult, addResult);
 }
 #endif
 
index b29f362..4cca3a1 100644 (file)
@@ -1522,8 +1522,8 @@ public:
 
 #if ENABLE(CSS_PAINTING_API)
     Worklet& ensurePaintWorklet();
-    PaintWorkletGlobalScope* paintWorkletGlobalScope() { return m_paintWorkletGlobalScope.get(); }
-    void setPaintWorkletGlobalScope(Ref<PaintWorkletGlobalScope>&&);
+    PaintWorkletGlobalScope* paintWorkletGlobalScopeForName(const String& name);
+    void setPaintWorkletGlobalScopeForName(const String& name, Ref<PaintWorkletGlobalScope>&&);
 #endif
 
     void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
@@ -2072,7 +2072,7 @@ private:
 
 #if ENABLE(CSS_PAINTING_API)
     RefPtr<Worklet> m_paintWorklet;
-    RefPtr<PaintWorkletGlobalScope> m_paintWorkletGlobalScope;
+    HashMap<String, Ref<PaintWorkletGlobalScope>> m_paintWorkletGlobalScopes;
 #endif
 
     bool m_isRunningUserScripts { false };
index df39cb2..552aafc 100644 (file)
@@ -989,9 +989,11 @@ inline static bool changedCustomPaintWatchedProperty(const RenderStyle& a, const
             for (auto& name : *watchPropertiesMap) {
                 RefPtr<CSSValue> valueA;
                 RefPtr<CSSValue> valueB;
-                if (isCustomPropertyName(name) && a.getCustomProperty(name) && b.getCustomProperty(name)) {
-                    valueA = CSSCustomPropertyValue::create(*a.getCustomProperty(name));
-                    valueB = CSSCustomPropertyValue::create(*b.getCustomProperty(name));
+                if (isCustomPropertyName(name)) {
+                    if (a.getCustomProperty(name))
+                        valueA = CSSCustomPropertyValue::create(*a.getCustomProperty(name));
+                    if (b.getCustomProperty(name))
+                        valueB = CSSCustomPropertyValue::create(*b.getCustomProperty(name));
                 } else {
                     CSSPropertyID propertyID = cssPropertyID(name);
                     if (!propertyID)
index 38f2c58..f3b9af6 100644 (file)
@@ -49,9 +49,10 @@ void Worklet::addModule(Document& document, const String& moduleURL)
     // https://bugs.webkit.org/show_bug.cgi?id=191136
     auto context = PaintWorkletGlobalScope::create(document, ScriptSourceCode(moduleURL));
     context->evaluate();
-    // FIXME: We should store multiple global scopes and choose between them
-    // This will not function correctly if multiple modules are added.
-    document.setPaintWorkletGlobalScope(WTFMove(context));
+
+    auto locker = holdLock(context->paintDefinitionLock());
+    for (auto& name : context->paintDefinitionMap().keys())
+        document.setPaintWorkletGlobalScopeForName(name, makeRef(context.get()));
 }
 
 } // namespace WebCore
index 3c56196..7234031 100644 (file)
@@ -74,7 +74,8 @@ WorkletGlobalScope::~WorkletGlobalScope()
 
 void WorkletGlobalScope::prepareForDestruction()
 {
-    ASSERT(m_script);
+    if (!m_script)
+        return;
     stopActiveDOMObjects();
     removeRejectedPromiseTracker();
     removeAllEventListeners();