Title: [292641] trunk/Source
Revision
292641
Author
[email protected]
Date
2022-04-08 16:00:43 -0700 (Fri, 08 Apr 2022)

Log Message

Drop unused pluginReplacementScriptObject
https://bugs.webkit.org/show_bug.cgi?id=239008

Reviewed by Geoff Garen.

Drop unused pluginReplacementScriptObject as it is always null.

Source/WebCore:

* Modules/plugins/PluginReplacement.h:
(): Deleted.
* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::installReplacement):
* Modules/plugins/YouTubePluginReplacement.h:
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginScriptObject):
(WebCore::pluginElementCustomGetCallData):
(WebCore::pluginScriptObjectFromPluginViewBase): Deleted.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestPluginInterface.cpp:
(WebCore::JSTestPluginInterface::visitChildrenImpl):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
(WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Deleted.
* html/HTMLPlugInElement.h:
(WebCore::HTMLPlugInElement::pluginReplacementScriptObject): Deleted.
* plugins/PluginViewBase.h:
(WebCore::PluginViewBase::scriptObject): Deleted.

Source/WebKit:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::scriptObject): Deleted.
* WebProcess/Plugins/PluginView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292640 => 292641)


--- trunk/Source/WebCore/ChangeLog	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/ChangeLog	2022-04-08 23:00:43 UTC (rev 292641)
@@ -1,3 +1,33 @@
+2022-04-08  Chris Dumez  <[email protected]>
+
+        Drop unused pluginReplacementScriptObject
+        https://bugs.webkit.org/show_bug.cgi?id=239008
+
+        Reviewed by Geoff Garen.
+
+        Drop unused pluginReplacementScriptObject as it is always null.
+
+        * Modules/plugins/PluginReplacement.h:
+        (): Deleted.
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::YouTubePluginReplacement::installReplacement):
+        * Modules/plugins/YouTubePluginReplacement.h:
+        * bindings/js/JSPluginElementFunctions.cpp:
+        (WebCore::pluginScriptObject):
+        (WebCore::pluginElementCustomGetCallData):
+        (WebCore::pluginScriptObjectFromPluginViewBase): Deleted.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
+        (WebCore::JSTestPluginInterface::visitChildrenImpl):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
+        (WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Deleted.
+        * html/HTMLPlugInElement.h:
+        (WebCore::HTMLPlugInElement::pluginReplacementScriptObject): Deleted.
+        * plugins/PluginViewBase.h:
+        (WebCore::PluginViewBase::scriptObject): Deleted.
+
 2022-04-08  Elliott Williams  <[email protected]>
 
         [Xcode] Avoid targeting 32-bit iOS and Mac architectures

Modified: trunk/Source/WebCore/Modules/plugins/PluginReplacement.h (292640 => 292641)


--- trunk/Source/WebCore/Modules/plugins/PluginReplacement.h	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/Modules/plugins/PluginReplacement.h	2022-04-08 23:00:43 UTC (rev 292641)
@@ -47,15 +47,8 @@
 public:
     virtual ~PluginReplacement() = default;
 
-    struct InstallResult {
-        bool success;
-#if PLATFORM(COCOA)
-        JSC::JSValue scriptObject { };
-#endif
-    };
+    virtual void installReplacement(ShadowRoot&) = 0;
 
-    virtual InstallResult installReplacement(ShadowRoot&) = 0;
-
     virtual bool willCreateRenderer() { return false; }
     virtual RenderPtr<RenderElement> createElementRenderer(HTMLPlugInElement&, RenderStyle&&, const RenderTreePosition&) = 0;
 };

Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (292640 => 292641)


--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp	2022-04-08 23:00:43 UTC (rev 292641)
@@ -77,7 +77,7 @@
     return m_embedShadowElement->createElementRenderer(WTFMove(style), insertionPosition);
 }
 
-auto YouTubePluginReplacement::installReplacement(ShadowRoot& root) -> InstallResult
+void YouTubePluginReplacement::installReplacement(ShadowRoot& root)
 {
     m_embedShadowElement = YouTubeEmbedShadowElement::create(m_parentElement->document());
 
@@ -99,8 +99,6 @@
     // Disable frame flattening for this iframe.
     iframeElement->setAttributeWithoutSynchronization(HTMLNames::scrollingAttr, AtomString("no", AtomString::ConstructFromLiteral));
     m_embedShadowElement->appendChild(iframeElement);
-
-    return { true };
 }
     
 static URL createYouTubeURL(StringView videoID, StringView timeID)

Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h (292640 => 292641)


--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h	2022-04-08 23:00:43 UTC (rev 292641)
@@ -49,7 +49,7 @@
     static bool supportsURL(const URL&);
     static bool isEnabledBySettings(const Settings&);
 
-    InstallResult installReplacement(ShadowRoot&) final;
+    void installReplacement(ShadowRoot&) final;
 
     String youTubeURL(const String& rawURL);
 

Modified: trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp (292640 => 292641)


--- trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp	2022-04-08 23:00:43 UTC (rev 292641)
@@ -49,25 +49,6 @@
     return instance;
 }
 
-static JSObject* pluginScriptObjectFromPluginViewBase(HTMLPlugInElement& pluginElement, JSGlobalObject* globalObject)
-{
-    Widget* pluginWidget = pluginElement.pluginWidget();
-    if (!is<PluginViewBase>(pluginWidget))
-        return nullptr;
-
-    return downcast<PluginViewBase>(*pluginWidget).scriptObject(globalObject);
-}
-
-static JSObject* pluginScriptObjectFromPluginViewBase(JSHTMLElement* jsHTMLElement)
-{
-    HTMLElement& element = jsHTMLElement->wrapped();
-    if (!is<HTMLPlugInElement>(element))
-        return nullptr;
-
-    HTMLPlugInElement& pluginElement = downcast<HTMLPlugInElement>(element);
-    return pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject());
-}
-
 JSObject* pluginScriptObject(JSGlobalObject* lexicalGlobalObject, JSHTMLElement* jsHTMLElement)
 {
     HTMLElement& element = jsHTMLElement->wrapped();
@@ -79,16 +60,6 @@
     // Choke point for script/plugin interaction; notify DOMTimer of the event.
     DOMTimer::scriptDidInteractWithPlugin(pluginElement);
 
-    // First, see if the element has a plug-in replacement with a script.
-    if (auto* scriptObject = pluginElement.scriptObjectForPluginReplacement())
-        return scriptObject;
-    
-    // Next, see if we can ask the plug-in view for its script object.
-    if (auto* scriptObject = pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject()))
-        return scriptObject;
-
-    // Otherwise, fall back to getting the object from the instance.
-
     // The plugin element holds an owning reference, so we don't have to.
     auto* instance = pluginElement.bindingsInstance();
     if (!instance || !instance->rootObject())
@@ -179,20 +150,10 @@
 {
     CallData callData;
 
-    // First, ask the plug-in view base for its runtime object.
-    if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) {
-        VM& vm = scriptObject->vm();
-        auto scriptObjectCallData = getCallData(vm, scriptObject);
-        if (scriptObjectCallData.type != CallData::Type::None) {
-            callData.type = CallData::Type::Native;
-            callData.native.function = callPlugin;
-        }
-    } else {
-        Instance* instance = pluginInstance(element->wrapped());
-        if (instance && instance->supportsInvokeDefaultMethod()) {
-            callData.type = CallData::Type::Native;
-            callData.native.function = callPlugin;
-        }
+    Instance* instance = pluginInstance(element->wrapped());
+    if (instance && instance->supportsInvokeDefaultMethod()) {
+        callData.type = CallData::Type::Native;
+        callData.native.function = callPlugin;
     }
 
     return callData;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (292640 => 292641)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2022-04-08 23:00:43 UTC (rev 292641)
@@ -4917,11 +4917,6 @@
         push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
         push(@implContent, "    Base::visitChildren(thisObject, visitor);\n");
         push(@implContent, "    thisObject->visitAdditionalChildren(visitor);\n") if $interface->extendedAttributes->{JSCustomMarkFunction};
-        if ($interface->extendedAttributes->{Plugin}) {
-            push(@implContent, "#if PLATFORM(COCOA)\n");
-            push(@implContent, "    thisObject->wrapped().pluginReplacementScriptObject().visit(visitor);\n");
-            push(@implContent, "#endif\n");
-        }
         if ($interface->extendedAttributes->{GenerateAddOpaqueRoot}) {
             AddToImplIncludes("<wtf/GetPtr.h>");
             my $functionName = $interface->extendedAttributes->{GenerateAddOpaqueRoot};

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.cpp (292640 => 292641)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.cpp	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.cpp	2022-04-08 23:00:43 UTC (rev 292641)
@@ -253,9 +253,6 @@
     auto* thisObject = jsCast<JSTestPluginInterface*>(cell);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
-#if PLATFORM(COCOA)
-    thisObject->wrapped().pluginReplacementScriptObject().visit(visitor);
-#endif
 }
 
 DEFINE_VISIT_CHILDREN(JSTestPluginInterface);

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (292640 => 292641)


--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2022-04-08 23:00:43 UTC (rev 292641)
@@ -268,17 +268,11 @@
         return;
     
     root.setResetStyleInheritance(true);
-    auto result = m_pluginReplacement->installReplacement(root);
 
-#if PLATFORM(COCOA)
-    RELEASE_ASSERT(result.success || !result.scriptObject);
-    m_pluginReplacementScriptObject.setWeakly(result.scriptObject);
-#endif
+    m_pluginReplacement->installReplacement(root);
 
-    if (result.success) {
-        setDisplayState(DisplayingPluginReplacement);
-        invalidateStyleAndRenderersForSubtree();
-    }
+    setDisplayState(DisplayingPluginReplacement);
+    invalidateStyleAndRenderersForSubtree();
 }
 
 #if PLATFORM(COCOA)
@@ -368,18 +362,6 @@
     return true;
 }
 
-JSC::JSObject* HTMLPlugInElement::scriptObjectForPluginReplacement()
-{
-#if PLATFORM(COCOA)
-    JSC::JSValue value = m_pluginReplacementScriptObject.getValue();
-    if (!value)
-        return nullptr;
-    return value.getObject();
-#else
-    return nullptr;
-#endif
-}
-
 bool HTMLPlugInElement::isBelowSizeThreshold() const
 {
     auto* renderObject = renderer();

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (292640 => 292641)


--- trunk/Source/WebCore/html/HTMLPlugInElement.h	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h	2022-04-08 23:00:43 UTC (rev 292641)
@@ -59,11 +59,6 @@
     DisplayState displayState() const { return m_displayState; }
     void setDisplayState(DisplayState);
 
-    JSC::JSObject* scriptObjectForPluginReplacement();
-#if PLATFORM(COCOA)
-    JSValueInWrappedObject& pluginReplacementScriptObject() { return m_pluginReplacementScriptObject; }
-#endif
-
     bool isCapturingMouseEvents() const { return m_isCapturingMouseEvents; }
     void setIsCapturingMouseEvents(bool capturing) { m_isCapturingMouseEvents = capturing; }
 
@@ -115,9 +110,6 @@
     RefPtr<JSC::Bindings::Instance> m_instance;
     Timer m_swapRendererTimer;
     RefPtr<PluginReplacement> m_pluginReplacement;
-#if PLATFORM(COCOA)
-    JSValueInWrappedObject m_pluginReplacementScriptObject;
-#endif
     bool m_isCapturingMouseEvents { false };
     DisplayState m_displayState { Playing };
 };

Modified: trunk/Source/WebCore/plugins/PluginViewBase.h (292640 => 292641)


--- trunk/Source/WebCore/plugins/PluginViewBase.h	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebCore/plugins/PluginViewBase.h	2022-04-08 23:00:43 UTC (rev 292641)
@@ -56,7 +56,6 @@
     virtual void detachPluginLayer() { }
 #endif
 
-    virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; }
     virtual void storageBlockingStateChanged() { }
     virtual bool scroll(ScrollDirection, ScrollGranularity) { return false; }
 

Modified: trunk/Source/WebKit/ChangeLog (292640 => 292641)


--- trunk/Source/WebKit/ChangeLog	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebKit/ChangeLog	2022-04-08 23:00:43 UTC (rev 292641)
@@ -1,3 +1,16 @@
+2022-04-08  Chris Dumez  <[email protected]>
+
+        Drop unused pluginReplacementScriptObject
+        https://bugs.webkit.org/show_bug.cgi?id=239008
+
+        Reviewed by Geoff Garen.
+
+        Drop unused pluginReplacementScriptObject as it is always null.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::scriptObject): Deleted.
+        * WebProcess/Plugins/PluginView.h:
+
 2022-04-08  Elliott Williams  <[email protected]>
 
         [Xcode] Avoid targeting 32-bit iOS and Mac architectures

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (292640 => 292641)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2022-04-08 23:00:43 UTC (rev 292641)
@@ -591,22 +591,6 @@
 }
 #endif
 
-JSObject* PluginView::scriptObject(JSGlobalObject* globalObject)
-{
-    // If we're already waiting for synchronous initialization of the plugin,
-    // calls to scriptObject() are from the plug-in itself and need to return 0;
-    if (m_isWaitingForSynchronousInitialization)
-        return 0;
-
-    // We might not have started initialization of the plug-in yet, the plug-in might be in the middle
-    // of being initializing asynchronously, or initialization might have previously failed.
-    if (!m_isInitialized || !m_plugin)
-        return 0;
-
-    UNUSED_PARAM(globalObject);
-    return 0;
-}
-
 void PluginView::storageBlockingStateChanged()
 {
     // The plug-in can be null here if it failed to initialize.

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.h (292640 => 292641)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.h	2022-04-08 22:56:27 UTC (rev 292640)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.h	2022-04-08 23:00:43 UTC (rev 292641)
@@ -151,7 +151,6 @@
 #if PLATFORM(COCOA)
     PlatformLayer* platformLayer() const override;
 #endif
-    JSC::JSObject* scriptObject(JSC::JSGlobalObject*) override;
     void storageBlockingStateChanged() override;
     bool scroll(WebCore::ScrollDirection, WebCore::ScrollGranularity) override;
     WebCore::Scrollbar* horizontalScrollbar() override;
@@ -201,7 +200,6 @@
     Plugin::Parameters m_parameters;
 
     bool m_isInitialized { false };
-    bool m_isWaitingForSynchronousInitialization { false };
     bool m_isWaitingUntilMediaCanStart { false };
 
     // Pending URLRequests that the plug-in has made.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to