Title: [279443] trunk
Revision
279443
Author
[email protected]
Date
2021-06-30 16:53:16 -0700 (Wed, 30 Jun 2021)

Log Message

RemotePlayback must keep its media element alive when there is a pending activity
https://bugs.webkit.org/show_bug.cgi?id=227471
<rdar://79694015>

Reviewed by Geoffrey Garen.

Source/WebCore:

Fixed the bug that the media element's JS wrapper can be collected while there is still
a pending activity for RemotePlayback. In fact, the newly added test demonstrates that
the media element can be deleted without this patch.

This patch also introduces new extended IDL interface attribute GenerateAddOpaqueRoot
to make adding an opaque root as a part of visitChildren easy in the DOM code.

Test: media/remoteplayback-watch-availability-gc.html

* Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::ownerNode const):
* Modules/remoteplayback/RemotePlayback.h:
* Modules/remoteplayback/RemotePlayback.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceNeedsVisitChildren):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp: Added.
(WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::prototypeForStructure):
(WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::initializeProperties):
(WebCore::JSTestGenerateAddOpaqueRootPrototype::finishCreation):
(WebCore::JSTestGenerateAddOpaqueRoot::JSTestGenerateAddOpaqueRoot):
(WebCore::JSTestGenerateAddOpaqueRoot::finishCreation):
(WebCore::JSTestGenerateAddOpaqueRoot::createPrototype):
(WebCore::JSTestGenerateAddOpaqueRoot::prototype):
(WebCore::JSTestGenerateAddOpaqueRoot::getConstructor):
(WebCore::JSTestGenerateAddOpaqueRoot::destroy):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::jsTestGenerateAddOpaqueRoot_someAttributeGetter):
(WebCore::JSTestGenerateAddOpaqueRoot::subspaceForImpl):
(WebCore::JSTestGenerateAddOpaqueRoot::visitChildrenImpl):
(WebCore::JSTestGenerateAddOpaqueRoot::analyzeHeap):
(WebCore::JSTestGenerateAddOpaqueRootOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestGenerateAddOpaqueRootOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestGenerateAddOpaqueRoot::toWrapped):
* bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h: Added.
(WebCore::JSTestGenerateAddOpaqueRoot::create):
(WebCore::JSTestGenerateAddOpaqueRoot::createStructure):
(WebCore::JSTestGenerateAddOpaqueRoot::subspaceFor):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObject_TestGenerateAddOpaqueRootConstructorGetter):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestGenerateAddOpaqueRoot.idl: Added.
* testing/Internals.cpp:
(WebCore::Internals::isElementAlive const):
(WebCore::Internals::mediaElementCount):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Added a GC test.

* media/remoteplayback-watch-availability-gc-expected.txt: Added.
* media/remoteplayback-watch-availability-gc.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (279442 => 279443)


--- trunk/LayoutTests/ChangeLog	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/LayoutTests/ChangeLog	2021-06-30 23:53:16 UTC (rev 279443)
@@ -1,3 +1,16 @@
+2021-06-30  Ryosuke Niwa  <[email protected]>
+
+        RemotePlayback must keep its media element alive when there is a pending activity
+        https://bugs.webkit.org/show_bug.cgi?id=227471
+        <rdar://79694015>
+
+        Reviewed by Geoffrey Garen.
+
+        Added a GC test.
+
+        * media/remoteplayback-watch-availability-gc-expected.txt: Added.
+        * media/remoteplayback-watch-availability-gc.html: Added.
+
 2021-06-30  Ayumi Kojima  <[email protected]>
 
         [ MacOS wk1 ] crypto/workers/subtle/hrsa-postMessage-worker.html is flaky failing.

Added: trunk/LayoutTests/media/remoteplayback-watch-availability-gc-expected.txt (0 => 279443)


--- trunk/LayoutTests/media/remoteplayback-watch-availability-gc-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/remoteplayback-watch-availability-gc-expected.txt	2021-06-30 23:53:16 UTC (rev 279443)
@@ -0,0 +1,3 @@
+This tests that calling watchAvailability will keep the media element alive until the callback is called. You should see PASS below:
+
+PASS

Added: trunk/LayoutTests/media/remoteplayback-watch-availability-gc.html (0 => 279443)


--- trunk/LayoutTests/media/remoteplayback-watch-availability-gc.html	                        (rev 0)
+++ trunk/LayoutTests/media/remoteplayback-watch-availability-gc.html	2021-06-30 23:53:16 UTC (rev 279443)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+let elementIdentifier = null;
+let parentIdentifier = null;
+let iterationCount = 20;
+let watchdogTimer = null;
+function runTest() {
+    if (!iterationCount)
+        return endTest('PASS');
+
+    internals.queueTask('DOMManipulation', () => {
+        GCController.collect();
+    });
+
+    (() => {
+        const element = document.createElement('video');
+        elementIdentifier = internals.elementIdentifier(element);
+
+        const parentNode = document.createElement('div');
+        parentIdentifier = internals.elementIdentifier(parentNode);
+        parentNode.appendChild(element);
+
+        element.remote.watchAvailability(checkElement);
+        watchdogTimer = setTimeout(() => endTest('FAIL - the callback was never called'), 3000);
+    })();
+
+    GCController.collect();
+}
+
+function checkElement()
+{
+    clearTimeout(watchdogTimer);
+
+    if (!internals.isElementAlive(elementIdentifier))
+        return endTest('FAIL - element is no longer alive');
+
+    if (!internals.isElementAlive(parentIdentifier))
+        return endTest('FAIL - parent is no longer alive');
+
+    --iterationCount;
+    setTimeout(() => runTest(), 0);
+}
+
+function endTest(status)
+{
+    result.textContent = status;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+</script>
+</head>
+<body _onload_='runTest()'>
+<p>This tests that calling watchAvailability will keep the media element alive until the callback is called. You should see PASS below:</p>
+<p id="result">Running</p>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (279442 => 279443)


--- trunk/Source/WebCore/ChangeLog	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/ChangeLog	2021-06-30 23:53:16 UTC (rev 279443)
@@ -1,3 +1,68 @@
+2021-06-30  Ryosuke Niwa  <[email protected]>
+
+        RemotePlayback must keep its media element alive when there is a pending activity
+        https://bugs.webkit.org/show_bug.cgi?id=227471
+        <rdar://79694015>
+
+        Reviewed by Geoffrey Garen.
+
+        Fixed the bug that the media element's JS wrapper can be collected while there is still
+        a pending activity for RemotePlayback. In fact, the newly added test demonstrates that
+        the media element can be deleted without this patch.
+
+        This patch also introduces new extended IDL interface attribute GenerateAddOpaqueRoot
+        to make adding an opaque root as a part of visitChildren easy in the DOM code.
+
+        Test: media/remoteplayback-watch-availability-gc.html
+
+        * Modules/remoteplayback/RemotePlayback.cpp:
+        (WebCore::RemotePlayback::ownerNode const):
+        * Modules/remoteplayback/RemotePlayback.h:
+        * Modules/remoteplayback/RemotePlayback.idl:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (InstanceNeedsVisitChildren):
+        (GenerateImplementation):
+        * bindings/scripts/IDLAttributes.json:
+        * bindings/scripts/test/BindingTestGlobalConstructors.idl:
+        * bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp: Added.
+        (WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::prototypeForStructure):
+        (WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::initializeProperties):
+        (WebCore::JSTestGenerateAddOpaqueRootPrototype::finishCreation):
+        (WebCore::JSTestGenerateAddOpaqueRoot::JSTestGenerateAddOpaqueRoot):
+        (WebCore::JSTestGenerateAddOpaqueRoot::finishCreation):
+        (WebCore::JSTestGenerateAddOpaqueRoot::createPrototype):
+        (WebCore::JSTestGenerateAddOpaqueRoot::prototype):
+        (WebCore::JSTestGenerateAddOpaqueRoot::getConstructor):
+        (WebCore::JSTestGenerateAddOpaqueRoot::destroy):
+        (WebCore::JSC_DEFINE_CUSTOM_GETTER):
+        (WebCore::jsTestGenerateAddOpaqueRoot_someAttributeGetter):
+        (WebCore::JSTestGenerateAddOpaqueRoot::subspaceForImpl):
+        (WebCore::JSTestGenerateAddOpaqueRoot::visitChildrenImpl):
+        (WebCore::JSTestGenerateAddOpaqueRoot::analyzeHeap):
+        (WebCore::JSTestGenerateAddOpaqueRootOwner::isReachableFromOpaqueRoots):
+        (WebCore::JSTestGenerateAddOpaqueRootOwner::finalize):
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        (WebCore::JSTestGenerateAddOpaqueRoot::toWrapped):
+        * bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h: Added.
+        (WebCore::JSTestGenerateAddOpaqueRoot::create):
+        (WebCore::JSTestGenerateAddOpaqueRoot::createStructure):
+        (WebCore::JSTestGenerateAddOpaqueRoot::subspaceFor):
+        (WebCore::wrapperOwner):
+        (WebCore::wrapperKey):
+        (WebCore::toJS):
+        (WebCore::toJSNewlyCreated):
+        * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+        (WebCore::jsTestGlobalObject_TestGenerateAddOpaqueRootConstructorGetter):
+        (WebCore::JSC_DEFINE_CUSTOM_GETTER):
+        * bindings/scripts/test/SupplementalDependencies.dep:
+        * bindings/scripts/test/TestGenerateAddOpaqueRoot.idl: Added.
+        * testing/Internals.cpp:
+        (WebCore::Internals::isElementAlive const):
+        (WebCore::Internals::mediaElementCount):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2021-06-30  Alex Christensen  <[email protected]>
 
         REGRESSION(r278391) Sometimes load durations show up as large negative numbers in WebInspector

Modified: trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp (279442 => 279443)


--- trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp	2021-06-30 23:53:16 UTC (rev 279443)
@@ -58,6 +58,18 @@
 {
 }
 
+void* RemotePlayback::opaqueRootConcurrently() const
+{
+    if (auto* element = m_mediaElement.get())
+        return element->opaqueRoot();
+    return nullptr;
+}
+
+Node* RemotePlayback::ownerNode() const
+{
+    return m_mediaElement.get();
+}
+
 void RemotePlayback::watchAvailability(Ref<RemotePlaybackAvailabilityCallback>&& callback, Ref<DeferredPromise>&& promise)
 {
     // 6.2.1.3 Getting the remote playback devices availability information

Modified: trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h (279442 => 279443)


--- trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.h	2021-06-30 23:53:16 UTC (rev 279443)
@@ -68,6 +68,9 @@
     using RefCounted::ref;
     using RefCounted::deref;
 
+    void* opaqueRootConcurrently() const;
+    Node* ownerNode() const;
+
 private:
     explicit RemotePlayback(HTMLMediaElement&);
 

Modified: trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.idl (279442 => 279443)


--- trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.idl	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.idl	2021-06-30 23:53:16 UTC (rev 279443)
@@ -34,7 +34,9 @@
     ActiveDOMObject,
     Conditional=WIRELESS_PLAYBACK_TARGET,
     EnabledBySetting=RemotePlayback,
-    Exposed=Window
+    Exposed=Window,
+    GenerateIsReachable=ImplOwnerNodeRoot,
+    GenerateAddOpaqueRoot=opaqueRootConcurrently
 ] interface RemotePlayback : EventTarget {
     Promise<long> watchAvailability(RemotePlaybackAvailabilityCallback callback);
     Promise<undefined> cancelWatchAvailability(optional long id);

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (279442 => 279443)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-06-30 23:53:16 UTC (rev 279443)
@@ -2195,6 +2195,7 @@
     }
 
     return 1 if $interface->extendedAttributes->{JSCustomMarkFunction};
+    return 1 if $interface->extendedAttributes->{GenerateAddOpaqueRoot};
     return 1 if $interface->extendedAttributes->{Plugin};
     return 1 if $interface->extendedAttributes->{ReportExtraMemoryCost};
     return 0;
@@ -4887,6 +4888,10 @@
             push(@implContent, "    thisObject->wrapped().pluginReplacementScriptObject().visit(visitor);\n");
             push(@implContent, "#endif\n");
         }
+        if ($interface->extendedAttributes->{GenerateAddOpaqueRoot}) {
+            my $functionName = $interface->extendedAttributes->{GenerateAddOpaqueRoot};
+            push(@implContent, "    visitor.addOpaqueRoot(thisObject->wrapped().${functionName}());\n");
+        }
         if ($interface->extendedAttributes->{ReportExtraMemoryCost}) {
             push(@implContent, "    visitor.reportExtraMemoryVisited(thisObject->wrapped().memoryCost());\n");
             if ($interface->extendedAttributes->{ReportExternalMemoryCost}) {;

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (279442 => 279443)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-06-30 23:53:16 UTC (rev 279443)
@@ -223,6 +223,10 @@
             "contextsAllowed": ["interface"],
             "values": ["", "Impl", "ImplWebGLRenderingContext", "ImplCanvasBase", "ImplDocument", "ImplElementRoot", "ImplOwnerNodeRoot", "ImplScriptExecutionContext", "ReachableFromDOMWindow", "ReachableFromNavigator"]
         },
+        "GenerateAddOpaqueRoot": {
+            "contextsAllowed": ["interface"],
+            "values": ["*"]
+        },
         "Global": {
             "contextsAllowed": ["interface"],
             "values": ["*"],

Modified: trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl (279442 => 279443)


--- trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl	2021-06-30 23:53:16 UTC (rev 279443)
@@ -13,6 +13,7 @@
     attribute TestEventConstructorConstructor TestEventConstructor;
     attribute TestEventTargetConstructor TestEventTarget;
     attribute TestExceptionConstructor TestException;
+    attribute TestGenerateAddOpaqueRootConstructor TestGenerateAddOpaqueRoot;
     attribute TestGenerateIsReachableConstructor TestGenerateIsReachable;
     attribute TestGlobalObjectConstructor TestGlobalObject;
     attribute TestIndexedSetterNoIdentifierConstructor TestIndexedSetterNoIdentifier;

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp (0 => 279443)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp	2021-06-30 23:53:16 UTC (rev 279443)
@@ -0,0 +1,283 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestGenerateAddOpaqueRoot.h"
+
+#include "ActiveDOMObject.h"
+#include "DOMIsoSubspaces.h"
+#include "JSDOMAttribute.h"
+#include "JSDOMBinding.h"
+#include "JSDOMConstructorNotConstructable.h"
+#include "JSDOMConvertStrings.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMGlobalObjectInlines.h"
+#include "JSDOMWrapperCache.h"
+#include "ScriptExecutionContext.h"
+#include "WebCoreJSClientData.h"
+#include <_javascript_Core/FunctionPrototype.h>
+#include <_javascript_Core/HeapAnalyzer.h>
+#include <_javascript_Core/JSCInlines.h>
+#include <_javascript_Core/JSDestructibleObjectHeapCellType.h>
+#include <_javascript_Core/SlotVisitorMacros.h>
+#include <_javascript_Core/SubspaceInlines.h>
+#include <wtf/GetPtr.h>
+#include <wtf/PointerPreparations.h>
+#include <wtf/URL.h>
+
+
+namespace WebCore {
+using namespace JSC;
+
+// Attributes
+
+static JSC_DECLARE_CUSTOM_GETTER(jsTestGenerateAddOpaqueRootConstructor);
+static JSC_DECLARE_CUSTOM_GETTER(jsTestGenerateAddOpaqueRoot_someAttribute);
+
+class JSTestGenerateAddOpaqueRootPrototype final : public JSC::JSNonFinalObject {
+public:
+    using Base = JSC::JSNonFinalObject;
+    static JSTestGenerateAddOpaqueRootPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSTestGenerateAddOpaqueRootPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestGenerateAddOpaqueRootPrototype>(vm.heap)) JSTestGenerateAddOpaqueRootPrototype(vm, globalObject, structure);
+        ptr->finishCreation(vm);
+        return ptr;
+    }
+
+    DECLARE_INFO;
+    template<typename CellType, JSC::SubspaceAccess>
+    static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
+    {
+        STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestGenerateAddOpaqueRootPrototype, Base);
+        return &vm.plainObjectSpace;
+    }
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+private:
+    JSTestGenerateAddOpaqueRootPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestGenerateAddOpaqueRootPrototype, JSTestGenerateAddOpaqueRootPrototype::Base);
+
+using JSTestGenerateAddOpaqueRootDOMConstructor = JSDOMConstructorNotConstructable<JSTestGenerateAddOpaqueRoot>;
+
+template<> const ClassInfo JSTestGenerateAddOpaqueRootDOMConstructor::s_info = { "TestGenerateAddOpaqueRoot", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestGenerateAddOpaqueRootDOMConstructor) };
+
+template<> JSValue JSTestGenerateAddOpaqueRootDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSTestGenerateAddOpaqueRootDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSTestGenerateAddOpaqueRoot::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, "TestGenerateAddOpaqueRoot"_s), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
+}
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestGenerateAddOpaqueRootPrototypeTableValues[] =
+{
+    { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGenerateAddOpaqueRootConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+    { "someAttribute", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGenerateAddOpaqueRoot_someAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+};
+
+const ClassInfo JSTestGenerateAddOpaqueRootPrototype::s_info = { "TestGenerateAddOpaqueRoot", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestGenerateAddOpaqueRootPrototype) };
+
+void JSTestGenerateAddOpaqueRootPrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSTestGenerateAddOpaqueRoot::info(), JSTestGenerateAddOpaqueRootPrototypeTableValues, *this);
+    JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
+}
+
+const ClassInfo JSTestGenerateAddOpaqueRoot::s_info = { "TestGenerateAddOpaqueRoot", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestGenerateAddOpaqueRoot) };
+
+JSTestGenerateAddOpaqueRoot::JSTestGenerateAddOpaqueRoot(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestGenerateAddOpaqueRoot>&& impl)
+    : JSDOMWrapper<TestGenerateAddOpaqueRoot>(structure, globalObject, WTFMove(impl))
+{
+}
+
+void JSTestGenerateAddOpaqueRoot::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(vm, info()));
+
+    static_assert(!std::is_base_of<ActiveDOMObject, TestGenerateAddOpaqueRoot>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
+
+}
+
+JSObject* JSTestGenerateAddOpaqueRoot::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return JSTestGenerateAddOpaqueRootPrototype::create(vm, &globalObject, JSTestGenerateAddOpaqueRootPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
+}
+
+JSObject* JSTestGenerateAddOpaqueRoot::prototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return getDOMPrototype<JSTestGenerateAddOpaqueRoot>(vm, globalObject);
+}
+
+JSValue JSTestGenerateAddOpaqueRoot::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestGenerateAddOpaqueRootDOMConstructor, DOMConstructorID::TestGenerateAddOpaqueRoot>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+void JSTestGenerateAddOpaqueRoot::destroy(JSC::JSCell* cell)
+{
+    JSTestGenerateAddOpaqueRoot* thisObject = static_cast<JSTestGenerateAddOpaqueRoot*>(cell);
+    thisObject->JSTestGenerateAddOpaqueRoot::~JSTestGenerateAddOpaqueRoot();
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestGenerateAddOpaqueRootConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    VM& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* prototype = jsDynamicCast<JSTestGenerateAddOpaqueRootPrototype*>(vm, JSValue::decode(thisValue));
+    if (UNLIKELY(!prototype))
+        return throwVMTypeError(lexicalGlobalObject, throwScope);
+    return JSValue::encode(JSTestGenerateAddOpaqueRoot::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject()));
+}
+
+static inline JSValue jsTestGenerateAddOpaqueRoot_someAttributeGetter(JSGlobalObject& lexicalGlobalObject, JSTestGenerateAddOpaqueRoot& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.someAttribute())));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestGenerateAddOpaqueRoot_someAttribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
+{
+    return IDLAttribute<JSTestGenerateAddOpaqueRoot>::get<jsTestGenerateAddOpaqueRoot_someAttributeGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName);
+}
+
+JSC::IsoSubspace* JSTestGenerateAddOpaqueRoot::subspaceForImpl(JSC::VM& vm)
+{
+    auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
+    auto& spaces = clientData.subspaces();
+    if (auto* space = spaces.m_subspaceForTestGenerateAddOpaqueRoot.get())
+        return space;
+    static_assert(std::is_base_of_v<JSC::JSDestructibleObject, JSTestGenerateAddOpaqueRoot> || !JSTestGenerateAddOpaqueRoot::needsDestruction);
+    if constexpr (std::is_base_of_v<JSC::JSDestructibleObject, JSTestGenerateAddOpaqueRoot>)
+        spaces.m_subspaceForTestGenerateAddOpaqueRoot = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), JSTestGenerateAddOpaqueRoot);
+    else
+        spaces.m_subspaceForTestGenerateAddOpaqueRoot = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), JSTestGenerateAddOpaqueRoot);
+    auto* space = spaces.m_subspaceForTestGenerateAddOpaqueRoot.get();
+IGNORE_WARNINGS_BEGIN("unreachable-code")
+IGNORE_WARNINGS_BEGIN("tautological-compare")
+    void (*myVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSTestGenerateAddOpaqueRoot::visitOutputConstraints;
+    void (*jsCellVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSC::JSCell::visitOutputConstraints;
+    if (myVisitOutputConstraint != jsCellVisitOutputConstraint)
+        clientData.outputConstraintSpaces().append(space);
+IGNORE_WARNINGS_END
+IGNORE_WARNINGS_END
+    return space;
+}
+
+template<typename Visitor>
+void JSTestGenerateAddOpaqueRoot::visitChildrenImpl(JSCell* cell, Visitor& visitor)
+{
+    auto* thisObject = jsCast<JSTestGenerateAddOpaqueRoot*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    Base::visitChildren(thisObject, visitor);
+    visitor.addOpaqueRoot(thisObject->wrapped().ownerObjectConcurrently());
+}
+
+DEFINE_VISIT_CHILDREN(JSTestGenerateAddOpaqueRoot);
+
+void JSTestGenerateAddOpaqueRoot::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
+{
+    auto* thisObject = jsCast<JSTestGenerateAddOpaqueRoot*>(cell);
+    analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
+    if (thisObject->scriptExecutionContext())
+        analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
+    Base::analyzeHeap(cell, analyzer);
+}
+
+bool JSTestGenerateAddOpaqueRootOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    UNUSED_PARAM(reason);
+    return false;
+}
+
+void JSTestGenerateAddOpaqueRootOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsTestGenerateAddOpaqueRoot = static_cast<JSTestGenerateAddOpaqueRoot*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsTestGenerateAddOpaqueRoot->wrapped(), jsTestGenerateAddOpaqueRoot);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestGenerateAddOpaqueRoot@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore25TestGenerateAddOpaqueRootE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<TestGenerateAddOpaqueRoot>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+    const void* actualVTablePointer = getVTablePointer(impl.ptr());
+#if PLATFORM(WIN)
+    void* expectedVTablePointer = __identifier("??_7TestGenerateAddOpaqueRoot@WebCore@@6B@");
+#else
+    void* expectedVTablePointer = &_ZTVN7WebCore25TestGenerateAddOpaqueRootE[2];
+#endif
+
+    // If this fails TestGenerateAddOpaqueRoot does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
+    static_assert(std::is_polymorphic<TestGenerateAddOpaqueRoot>::value, "TestGenerateAddOpaqueRoot is not polymorphic");
+
+    // If you hit this assertion you either have a use after free bug, or
+    // TestGenerateAddOpaqueRoot has subclasses. If TestGenerateAddOpaqueRoot has subclasses that get passed
+    // to toJS() we currently require TestGenerateAddOpaqueRoot you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
+    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+    return createWrapper<TestGenerateAddOpaqueRoot>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestGenerateAddOpaqueRoot& impl)
+{
+    return wrap(lexicalGlobalObject, globalObject, impl);
+}
+
+TestGenerateAddOpaqueRoot* JSTestGenerateAddOpaqueRoot::toWrapped(JSC::VM& vm, JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicCast<JSTestGenerateAddOpaqueRoot*>(vm, value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h (0 => 279443)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h	2021-06-30 23:53:16 UTC (rev 279443)
@@ -0,0 +1,95 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "JSDOMWrapper.h"
+#include "TestGenerateAddOpaqueRoot.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestGenerateAddOpaqueRoot : public JSDOMWrapper<TestGenerateAddOpaqueRoot> {
+public:
+    using Base = JSDOMWrapper<TestGenerateAddOpaqueRoot>;
+    static JSTestGenerateAddOpaqueRoot* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestGenerateAddOpaqueRoot>&& impl)
+    {
+        JSTestGenerateAddOpaqueRoot* ptr = new (NotNull, JSC::allocateCell<JSTestGenerateAddOpaqueRoot>(globalObject->vm().heap)) JSTestGenerateAddOpaqueRoot(structure, *globalObject, WTFMove(impl));
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
+    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
+    static TestGenerateAddOpaqueRoot* toWrapped(JSC::VM&, JSC::JSValue);
+    static void destroy(JSC::JSCell*);
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info(), JSC::NonArray);
+    }
+
+    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    template<typename, JSC::SubspaceAccess mode> static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
+    {
+        if constexpr (mode == JSC::SubspaceAccess::Concurrently)
+            return nullptr;
+        return subspaceForImpl(vm);
+    }
+    static JSC::IsoSubspace* subspaceForImpl(JSC::VM& vm);
+    DECLARE_VISIT_CHILDREN;
+
+    static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
+protected:
+    JSTestGenerateAddOpaqueRoot(JSC::Structure*, JSDOMGlobalObject&, Ref<TestGenerateAddOpaqueRoot>&&);
+
+    void finishCreation(JSC::VM&);
+};
+
+class JSTestGenerateAddOpaqueRootOwner final : public JSC::WeakHandleOwner {
+public:
+    bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final;
+    void finalize(JSC::Handle<JSC::Unknown>, void* context) final;
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestGenerateAddOpaqueRoot*)
+{
+    static NeverDestroyed<JSTestGenerateAddOpaqueRootOwner> owner;
+    return &owner.get();
+}
+
+inline void* wrapperKey(TestGenerateAddOpaqueRoot* wrappableObject)
+{
+    return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, TestGenerateAddOpaqueRoot&);
+inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestGenerateAddOpaqueRoot* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<TestGenerateAddOpaqueRoot>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<TestGenerateAddOpaqueRoot>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+template<> struct JSDOMWrapperConverterTraits<TestGenerateAddOpaqueRoot> {
+    using WrapperClass = JSTestGenerateAddOpaqueRoot;
+    using ToWrappedReturnType = TestGenerateAddOpaqueRoot*;
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (279442 => 279443)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2021-06-30 23:53:16 UTC (rev 279443)
@@ -53,6 +53,7 @@
 #include "JSTestEventConstructor.h"
 #include "JSTestEventTarget.h"
 #include "JSTestException.h"
+#include "JSTestGenerateAddOpaqueRoot.h"
 #include "JSTestGenerateIsReachable.h"
 #include "JSTestGlobalObject.h"
 #include "JSTestIndexedSetterNoIdentifier.h"
@@ -183,6 +184,7 @@
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestEventConstructorConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestEventTargetConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestExceptionConstructor);
+static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestGenerateAddOpaqueRootConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestGenerateIsReachableConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestGlobalObjectConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestIndexedSetterNoIdentifierConstructor);
@@ -241,13 +243,13 @@
 
 /* Hash table */
 
-static const struct CompactHashIndex JSTestGlobalObjectTableIndex[267] = {
+static const struct CompactHashIndex JSTestGlobalObjectTableIndex[268] = {
     { -1, -1 },
-    { 40, -1 },
+    { 41, -1 },
     { -1, -1 },
     { 0, -1 },
     { 4, -1 },
-    { 44, -1 },
+    { 45, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -255,15 +257,15 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 54, -1 },
+    { 55, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 48, -1 },
+    { 49, -1 },
     { -1, -1 },
-    { 63, -1 },
+    { 64, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -277,14 +279,14 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 34, -1 },
+    { 35, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 66, -1 },
-    { 13, 260 },
+    { 67, -1 },
+    { 13, 261 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -292,11 +294,11 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 38, -1 },
-    { 19, 257 },
+    { 39, -1 },
+    { 20, 258 },
     { 6, -1 },
     { -1, -1 },
-    { 45, -1 },
+    { 46, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -305,7 +307,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 36, -1 },
+    { 37, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -312,7 +314,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 21, 265 },
+    { 22, 266 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -326,8 +328,8 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 29, -1 },
-    { 56, -1 },
+    { 30, -1 },
+    { 57, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -334,19 +336,19 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 9, 256 },
+    { 9, 257 },
     { -1, -1 },
-    { 58, -1 },
-    { 18, -1 },
+    { 59, -1 },
+    { 19, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 17, -1 },
+    { 18, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 35, -1 },
+    { 36, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -354,14 +356,14 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 23, -1 },
+    { 24, -1 },
     { -1, -1 },
     { 2, -1 },
-    { 37, -1 },
+    { 38, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 20, -1 },
+    { 21, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -374,15 +376,15 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 27, -1 },
+    { 28, -1 },
     { -1, -1 },
-    { 42, -1 },
+    { 43, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 53, -1 },
+    { 54, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -390,7 +392,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 47, -1 },
+    { 48, -1 },
     { -1, -1 },
     { -1, -1 },
     { 10, -1 },
@@ -400,12 +402,12 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 64, -1 },
+    { 65, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 26, -1 },
-    { 31, -1 },
+    { 27, -1 },
+    { 32, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -415,9 +417,9 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 15, 259 },
+    { 15, 260 },
     { -1, -1 },
-    { 59, -1 },
+    { 60, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -426,11 +428,11 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 33, 266 },
+    { 34, 267 },
     { -1, -1 },
-    { 16, -1 },
+    { 16, 256 },
     { -1, -1 },
-    { 62, -1 },
+    { 63, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -449,7 +451,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 46, -1 },
+    { 47, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -462,7 +464,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 57, -1 },
+    { 58, -1 },
     { -1, -1 },
     { 1, -1 },
     { -1, -1 },
@@ -471,10 +473,10 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 49, 263 },
-    { 7, 262 },
+    { 50, 264 },
+    { 7, 263 },
     { -1, -1 },
-    { 60, -1 },
+    { 61, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -483,32 +485,33 @@
     { -1, -1 },
     { 14, -1 },
     { -1, -1 },
-    { 24, -1 },
+    { 25, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 30, -1 },
+    { 31, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { 3, -1 },
-    { 51, -1 },
-    { -1, -1 },
     { 52, -1 },
     { -1, -1 },
+    { 53, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 22, 258 },
-    { 25, 264 },
-    { 28, 261 },
-    { 32, -1 },
-    { 39, -1 },
-    { 41, -1 },
-    { 43, -1 },
-    { 50, -1 },
-    { 55, -1 },
-    { 61, -1 },
-    { 65, -1 },
+    { -1, -1 },
+    { 17, -1 },
+    { 23, 259 },
+    { 26, 265 },
+    { 29, 262 },
+    { 33, -1 },
+    { 40, -1 },
+    { 42, -1 },
+    { 44, -1 },
+    { 51, -1 },
+    { 56, -1 },
+    { 62, -1 },
+    { 66, -1 },
 };
 
 
@@ -539,6 +542,7 @@
     { "TestEventConstructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestEventConstructorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestEventTarget", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestEventTargetConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestException", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestExceptionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+    { "TestGenerateAddOpaqueRoot", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestGenerateAddOpaqueRootConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestGenerateIsReachable", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestGenerateIsReachableConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestGlobalObject", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestGlobalObjectConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestIndexedSetterNoIdentifier", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestIndexedSetterNoIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
@@ -599,7 +603,7 @@
     { "regularOperation", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestGlobalObjectInstanceFunction_regularOperation), (intptr_t) (1) } },
 };
 
-static const HashTable JSTestGlobalObjectTable = { 67, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
+static const HashTable JSTestGlobalObjectTable = { 68, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
 /* Hash table for constructor */
 
 static const HashTableValue JSTestGlobalObjectConstructorTableValues[] =
@@ -1017,6 +1021,17 @@
     return IDLAttribute<JSTestGlobalObject>::get<jsTestGlobalObject_TestExceptionConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
 }
 
+static inline JSValue jsTestGlobalObject_TestGenerateAddOpaqueRootConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject)
+{
+    UNUSED_PARAM(lexicalGlobalObject);
+    return JSTestGenerateAddOpaqueRoot::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestGlobalObject_TestGenerateAddOpaqueRootConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
+{
+    return IDLAttribute<JSTestGlobalObject>::get<jsTestGlobalObject_TestGenerateAddOpaqueRootConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
+}
+
 static inline JSValue jsTestGlobalObject_TestGenerateIsReachableConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject)
 {
     UNUSED_PARAM(lexicalGlobalObject);

Modified: trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep (279442 => 279443)


--- trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep	2021-06-30 23:53:16 UTC (rev 279443)
@@ -110,6 +110,9 @@
 JSTestException.h: 
 DOMTestException.h: 
 WebDOMTestException.h: 
+JSTestGenerateAddOpaqueRoot.h: 
+DOMTestGenerateAddOpaqueRoot.h: 
+WebDOMTestGenerateAddOpaqueRoot.h: 
 JSTestGenerateIsReachable.h: 
 DOMTestGenerateIsReachable.h: 
 WebDOMTestGenerateIsReachable.h: 

Added: trunk/Source/WebCore/bindings/scripts/test/TestGenerateAddOpaqueRoot.idl (0 => 279443)


--- trunk/Source/WebCore/bindings/scripts/test/TestGenerateAddOpaqueRoot.idl	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestGenerateAddOpaqueRoot.idl	2021-06-30 23:53:16 UTC (rev 279443)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+[
+    Exposed=TestGlobalObject,
+    GenerateAddOpaqueRoot=ownerObjectConcurrently
+] interface TestGenerateAddOpaqueRoot {
+    readonly attribute DOMString someAttribute;
+};
+

Modified: trunk/Source/WebCore/testing/Internals.cpp (279442 => 279443)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-06-30 23:53:16 UTC (rev 279443)
@@ -2706,6 +2706,11 @@
     return element.document().identifierForElement(element).toUInt64();
 }
 
+bool Internals::isElementAlive(Document& document, uint64_t elementIdentifier) const
+{
+    return document.searchForElementByIdentifier(makeObjectIdentifier<ElementIdentifierType>(elementIdentifier));
+}
+
 uint64_t Internals::frameIdentifier(const Document& document) const
 {
     if (auto* page = document.page())
@@ -3865,6 +3870,11 @@
 
 #if ENABLE(VIDEO)
 
+unsigned Internals::mediaElementCount()
+{
+    return HTMLMediaElement::allMediaElements().size();
+}
+
 Vector<String> Internals::mediaResponseSources(HTMLMediaElement& media)
 {
     auto* resourceLoader = media.lastMediaResourceLoaderForTesting();

Modified: trunk/Source/WebCore/testing/Internals.h (279442 => 279443)


--- trunk/Source/WebCore/testing/Internals.h	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/testing/Internals.h	2021-06-30 23:53:16 UTC (rev 279443)
@@ -484,6 +484,8 @@
     uint64_t storageAreaMapCount() const;
 
     uint64_t elementIdentifier(Element&) const;
+    bool isElementAlive(Document&, uint64_t documentIdentifier) const;
+
     uint64_t frameIdentifier(const Document&) const;
     uint64_t pageIdentifier(const Document&) const;
 
@@ -644,6 +646,7 @@
     String getImageSourceURL(Element&);
 
 #if ENABLE(VIDEO)
+    unsigned mediaElementCount();
     Vector<String> mediaResponseSources(HTMLMediaElement&);
     Vector<String> mediaResponseContentRanges(HTMLMediaElement&);
     void simulateAudioInterruption(HTMLMediaElement&);

Modified: trunk/Source/WebCore/testing/Internals.idl (279442 => 279443)


--- trunk/Source/WebCore/testing/Internals.idl	2021-06-30 23:51:58 UTC (rev 279442)
+++ trunk/Source/WebCore/testing/Internals.idl	2021-06-30 23:53:16 UTC (rev 279443)
@@ -875,6 +875,7 @@
     readonly attribute unsigned long long storageAreaMapCount;
 
     unsigned long long elementIdentifier(Element element);
+    [CallWith=Document] boolean isElementAlive(unsigned long long documentIdentifier);
     unsigned long long frameIdentifier(Document document);
     unsigned long long pageIdentifier(Document document);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to