[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 11:11:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5b01ffc03cf3ca15f9919d1006d862ffe2617f42
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 14 22:12:50 2010 +0000

    Call NPN_URLNotify for frame loads initiated by plug-ins
    https://bugs.webkit.org/show_bug.cgi?id=42291
    
    Reviewed by Sam Weinig.
    
    * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
    (WebKit::NetscapePlugin::loadURL):
    If needed, keep track of the request ID and URL so we can call NPP_URLNotify at a later point.
    
    (WebKit::NetscapePlugin::frameDidFinishLoading):
    Get the notification data and the URL from the map and call NPP_URLNotify.
    
    (WebKit::NetscapePlugin::frameDidFail):
    Get the notification data and the URL from the map and call NPP_URLNotify.
    
    * WebProcess/Plugins/Netscape/NetscapePlugin.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63360 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 874a998..80011a8 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,25 @@
 
         Reviewed by Sam Weinig.
 
+        Call NPN_URLNotify for frame loads initiated by plug-ins
+        https://bugs.webkit.org/show_bug.cgi?id=42291
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::loadURL):
+        If needed, keep track of the request ID and URL so we can call NPP_URLNotify at a later point.
+
+        (WebKit::NetscapePlugin::frameDidFinishLoading):
+        Get the notification data and the URL from the map and call NPP_URLNotify.
+
+        (WebKit::NetscapePlugin::frameDidFail):
+        Get the notification data and the URL from the map and call NPP_URLNotify.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+
+2010-07-14  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add NetscapePlugin::NPP_ member functions for calling into the plug-in
         https://bugs.webkit.org/show_bug.cgi?id=42287
 
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index cb6c642..a88cad3 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -29,9 +29,11 @@
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/KURL.h>
+#include <utility>
 #include <wtf/text/CString.h>
 
 using namespace WebCore;
+using namespace std;
 
 namespace WebKit {
 
@@ -102,10 +104,17 @@ void NetscapePlugin::loadURL(const String& urlString, const String& target, bool
 {
     uint64_t requestID = ++m_nextRequestID;
 
+    if (!target.isNull() && sendNotification) {
+        // Eventually we are going to get a frameDidFinishLoading or frameDidFail call for this request.
+        // Keep track of the notification data so we can call NPP_URLNotify.
+        ASSERT(!m_pendingURLNotifications.contains(requestID));
+        m_pendingURLNotifications.set(requestID, make_pair(urlString, notificationData));
+    }
+
     // FIXME: Handle popups.
     bool allowPopups = false;
-
     m_pluginController->loadURL(requestID, urlString, target, allowPopups);
+    
 }
 
 NPError NetscapePlugin::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* savedData)
@@ -226,12 +235,30 @@ void NetscapePlugin::geometryDidChange(const IntRect& frameRect, const IntRect&
 
 void NetscapePlugin::frameDidFinishLoading(uint64_t requestID)
 {
-    // FIXME: Implement.
+    PendingURLNotifyMap::iterator it = m_pendingURLNotifications.find(requestID);
+    if (it == m_pendingURLNotifications.end())
+        return;
+
+    String url = it->second.first;
+    void* notificationData = it->second.second;
+
+    m_pendingURLNotifications.remove(it);
+    
+    NPP_URLNotify(url.utf8().data(), NPRES_DONE, notificationData);
 }
 
 void NetscapePlugin::frameDidFail(uint64_t requestID, bool wasCancelled)
 {
-    // FIXME: Implement.
+    PendingURLNotifyMap::iterator it = m_pendingURLNotifications.find(requestID);
+    if (it == m_pendingURLNotifications.end())
+        return;
+
+    String url = it->second.first;
+    void* notificationData = it->second.second;
+
+    m_pendingURLNotifications.remove(it);
+    
+    NPP_URLNotify(url.utf8().data(), wasCancelled ? NPRES_USER_BREAK : NPRES_NETWORK_ERR, notificationData);
 }
 
 void NetscapePlugin::didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result)
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 16ef13d..7475d5d 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -29,6 +29,7 @@
 #include "NetscapePluginModule.h"
 #include "Plugin.h"
 #include <WebCore/IntRect.h>
+#include <WebCore/StringHash.h>
 
 namespace WebKit {
 
@@ -79,6 +80,9 @@ private:
     PluginController* m_pluginController;
     uint64_t m_nextRequestID;
 
+    typedef HashMap<uint64_t, std::pair<WebCore::String, void*> > PendingURLNotifyMap;
+    PendingURLNotifyMap m_pendingURLNotifications;
+
     RefPtr<NetscapePluginModule> m_pluginModule;
     NPP_t m_npp;
     NPWindow m_npWindow;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list