Title: [90764] trunk
Revision
90764
Author
[email protected]
Date
2011-07-11 11:14:01 -0700 (Mon, 11 Jul 2011)

Log Message

Implement getFormValue for WebKit2
https://bugs.webkit.org/show_bug.cgi?id=64294
<rdar://problem/3964087>

Source/WebKit2: 

Reviewed by Kevin Decker.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::getFormValue):
Call Plugin::getFormValue.

* PluginProcess/PluginControllerProxy.messages.in:
Add new GetFormValue message.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::getFormValue):
Get the form value and convert it to a String.

* WebProcess/Plugins/Plugin.h:
Add getFormValue pure virtual member function.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::getFormValue):
Send a GetFormValue message to the plug-in process.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::getFormValue):
Call Plugin::getFormValue.

LayoutTests: 

Remove now passing test.

* platform/wk2/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90763 => 90764)


--- trunk/LayoutTests/ChangeLog	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/LayoutTests/ChangeLog	2011-07-11 18:14:01 UTC (rev 90764)
@@ -1,3 +1,13 @@
+2011-07-11  Anders Carlsson  <[email protected]>
+
+        Implement getFormValue for WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=64294
+        <rdar://problem/3964087>
+
+        Remove now passing test.
+
+        * platform/wk2/Skipped:
+
 2011-07-11  Ojan Vafai  <[email protected]>
 
         Fix syntax error from r90757.

Modified: trunk/LayoutTests/platform/wk2/Skipped (90763 => 90764)


--- trunk/LayoutTests/platform/wk2/Skipped	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/LayoutTests/platform/wk2/Skipped	2011-07-11 18:14:01 UTC (rev 90764)
@@ -1852,9 +1852,6 @@
 # missing window.internals.createShadowContentElement
 fast/dom/shadow/create-content-element.html
 
-# Need to implement getFormValue().
-plugins/form-value.html
-
 ### END OF (2) Classified failures without bug reports (yet)
 ########################################
 

Modified: trunk/Source/WebKit2/ChangeLog (90763 => 90764)


--- trunk/Source/WebKit2/ChangeLog	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-11 18:14:01 UTC (rev 90764)
@@ -1,3 +1,33 @@
+2011-07-11  Anders Carlsson  <[email protected]>
+
+        Implement getFormValue for WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=64294
+        <rdar://problem/3964087>
+
+        Reviewed by Kevin Decker.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::getFormValue):
+        Call Plugin::getFormValue.
+
+        * PluginProcess/PluginControllerProxy.messages.in:
+        Add new GetFormValue message.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::getFormValue):
+        Get the form value and convert it to a String.
+
+        * WebProcess/Plugins/Plugin.h:
+        Add getFormValue pure virtual member function.
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::getFormValue):
+        Send a GetFormValue message to the plug-in process.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::getFormValue):
+        Call Plugin::getFormValue.
+
 2011-07-11  Ada Chan  <[email protected]>
 
         The original request should be accessible from WebNavigationData.

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (90763 => 90764)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-07-11 18:14:01 UTC (rev 90764)
@@ -593,6 +593,11 @@
     m_plugin->privateBrowsingStateChanged(isPrivateBrowsingEnabled);
 }
 
+void PluginControllerProxy::getFormValue(bool& returnValue, String& formValue)
+{
+    returnValue = m_plugin->getFormValue(formValue);
+}
+
 bool PluginControllerProxy::tryToShortCircuitEvaluate(NPObject* npObject, const String& scriptString, NPVariant* result)
 {
     // Only try to short circuit evaluate for plug-ins that have the quirk specified.

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (90763 => 90764)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2011-07-11 18:14:01 UTC (rev 90764)
@@ -140,6 +140,7 @@
 #endif
 
     void privateBrowsingStateChanged(bool);
+    void getFormValue(bool& returnValue, String& formValue);
 
     bool tryToShortCircuitEvaluate(NPObject*, const String& scriptString, NPVariant* result);
 

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in (90763 => 90764)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2011-07-11 18:14:01 UTC (rev 90764)
@@ -105,6 +105,9 @@
     
     # Sent when private browsing is enabled or disabled
     PrivateBrowsingStateChanged(bool isPrivateBrowsingEnabled)
+
+    # Gets the string representating the form value of the plug-in
+    GetFormValue() -> (bool returnValue, WTF::String formValue)
 }
 
 #endif

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-07-11 18:14:01 UTC (rev 90764)
@@ -767,6 +767,21 @@
     NPP_SetValue(NPNVprivateModeBool, &value);
 }
 
+bool NetscapePlugin::getFormValue(String& formValue)
+{
+    ASSERT(m_isStarted);
+
+    char* formValueString = 0;
+    if (NPP_GetValue(NPPVformValue, &formValueString) != NPERR_NO_ERROR)
+        return false;
+
+    formValue = String::fromUTF8(formValueString);
+
+    // The plug-in allocates the form value string with NPN_MemAlloc so it needs to be freed with NPN_MemFree.
+    npnMemFree(formValueString);
+    return true;
+}
+
 bool NetscapePlugin::supportsSnapshotting() const
 {
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-07-11 18:14:01 UTC (rev 90764)
@@ -193,6 +193,7 @@
 #endif
 
     virtual void privateBrowsingStateChanged(bool);
+    virtual bool getFormValue(String& formValue);
 
     bool supportsSnapshotting() const;
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-07-11 18:14:01 UTC (rev 90764)
@@ -192,6 +192,9 @@
     // Called when the private browsing state for this plug-in changes.
     virtual void privateBrowsingStateChanged(bool) = 0;
 
+    // Gets the form value representation for the plug-in, letting plug-ins participate in form submission.
+    virtual bool getFormValue(String& formValue) = 0;
+
 protected:
     Plugin();
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-07-11 18:14:01 UTC (rev 90764)
@@ -373,6 +373,15 @@
     m_connection->connection()->send(Messages::PluginControllerProxy::PrivateBrowsingStateChanged(isPrivateBrowsingEnabled), m_pluginInstanceID);
 }
 
+bool PluginProxy::getFormValue(String& formValue)
+{
+    bool returnValue;
+    if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::GetFormValue(), Messages::PluginControllerProxy::GetFormValue::Reply(returnValue, formValue), m_pluginInstanceID))
+        return false;
+
+    return returnValue;
+}
+
 void PluginProxy::loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups)
 {
     controller()->loadURL(requestID, method, urlString, target, headerFields, httpBody, allowPopups);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-07-11 18:14:01 UTC (rev 90764)
@@ -101,6 +101,7 @@
 #endif
 
     virtual void privateBrowsingStateChanged(bool);
+    virtual bool getFormValue(String& formValue);
 
     bool needsBackingStore() const;
     uint64_t windowNPObjectID();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-07-11 18:14:01 UTC (rev 90764)
@@ -507,6 +507,15 @@
     m_plugin->privateBrowsingStateChanged(privateBrowsingEnabled);
 }
 
+bool PluginView::getFormValue(String& formValue)
+{
+    // The plug-in can be null here if it failed to initialize.
+    if (!m_isInitialized || !m_plugin)
+        return false;
+
+    return m_plugin->getFormValue(formValue);
+}
+
 void PluginView::setFrameRect(const WebCore::IntRect& rect)
 {
     Widget::setFrameRect(rect);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (90763 => 90764)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2011-07-11 17:55:26 UTC (rev 90763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2011-07-11 18:14:01 UTC (rev 90764)
@@ -102,7 +102,8 @@
 #endif
     virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*);
     virtual void privateBrowsingStateChanged(bool);
-    
+    virtual bool getFormValue(String&);
+
     // WebCore::Widget
     virtual void setFrameRect(const WebCore::IntRect&);
     virtual void setBoundsSize(const WebCore::IntSize&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to