[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:21:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e9e91bee0997111b209e67bc9264738ba6263903
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 20 17:50:02 2010 +0000

    Implement NPN_GetURL and NPN_PostURL
    https://bugs.webkit.org/show_bug.cgi?id=42650
    
    Reviewed by Dan Bernstein.
    
    * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
    (WebKit::parsePostBuffer):
    Add a FIXME about deleting the file.
    
    (WebKit::makeURLString):
    Move this static method before NPN_GetURL.
    
    (WebKit::NPN_GetURL):
    Call NetscapePLugin::LoadURL.
    
    (WebKit::NPN_PostURL):
    Ditto.
    
    (WebKit::NPN_PostURLNotify):
    * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
    Remove unreached code.
    
    (WebKit::NetscapePluginStream::deliverDataToPlugin):
    Stop the stream if the plug-in returns -1 from NPP_Write.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63756 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 2048d66..98ce1a2 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,30 @@
+2010-07-20  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Implement NPN_GetURL and NPN_PostURL
+        https://bugs.webkit.org/show_bug.cgi?id=42650
+
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::parsePostBuffer):
+        Add a FIXME about deleting the file.
+
+        (WebKit::makeURLString):
+        Move this static method before NPN_GetURL.
+
+        (WebKit::NPN_GetURL):
+        Call NetscapePLugin::LoadURL.
+        
+        (WebKit::NPN_PostURL):
+        Ditto.
+
+        (WebKit::NPN_PostURLNotify):
+        * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
+        Remove unreached code.
+
+        (WebKit::NetscapePluginStream::deliverDataToPlugin):
+        Stop the stream if the plug-in returns -1 from NPP_Write.
+
 2010-07-19  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index 1a6f707..df1bee7 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -209,6 +209,8 @@ static NPError parsePostBuffer(bool isFile, const char *buffer, uint32_t length,
 
         postBuffer = fileContents->data();
         postBufferSize = fileContents->size();
+
+        // FIXME: The NPAPI spec states that the file should be deleted here.
     } else {
         postBuffer = buffer;
         postBufferSize = length;
@@ -247,18 +249,45 @@ static NPError parsePostBuffer(bool isFile, const char *buffer, uint32_t length,
     return NPERR_NO_ERROR;
 }
 
-static NPError NPN_GetURL(NPP instance, const char* url, const char* target)
+static String makeURLString(const char* url)
 {
-    notImplemented();
-    return NPERR_GENERIC_ERROR;
+    String urlString(url);
+    
+    // Strip return characters.
+    urlString.replace('\r', "");
+    urlString.replace('\n', "");
+
+    return urlString;
 }
 
-static NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file)
+static NPError NPN_GetURL(NPP npp, const char* url, const char* target)
 {
-    notImplemented();
+    if (!url)
+        return NPERR_GENERIC_ERROR;
+    
+    RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+    plugin->loadURL("GET", makeURLString(url), target, HTTPHeaderMap(), Vector<char>(), false, 0);
+    
     return NPERR_GENERIC_ERROR;
 }
 
+static NPError NPN_PostURL(NPP npp, const char* url, const char* target, uint32_t len, const char* buf, NPBool file)
+{
+    HTTPHeaderMap headerFields;
+    Vector<char> postData;
+    
+    // NPN_PostURL only allows headers if the post buffer points to a file.
+    bool parseHeaders = file;
+
+    NPError error = parsePostBuffer(file, buf, len, parseHeaders, headerFields, postData);
+    if (error != NPERR_NO_ERROR)
+        return error;
+
+    RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+    plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, false, 0);
+    return NPERR_NO_ERROR;
+}
+
 static NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
     notImplemented();
@@ -334,17 +363,6 @@ static jref NPN_GetJavaPeer(NPP instance)
     return 0;
 }
 
-static String makeURLString(const char* url)
-{
-    String urlString(url);
-    
-    // Strip return characters.
-    urlString.replace('\r', "");
-    urlString.replace('\n', "");
-
-    return urlString;
-}
-
 static NPError NPN_GetURLNotify(NPP npp, const char* url, const char* target, void* notifyData)
 {
     if (!url)
@@ -367,9 +385,6 @@ static NPError NPN_PostURLNotify(NPP npp, const char* url, const char* target, u
     RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
     plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, true, notifyData);
     return NPERR_NO_ERROR;
-    
-    notImplemented();
-    return NPERR_GENERIC_ERROR;
 }
 
 static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
index 0c7a1fb..5e5e041 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
@@ -220,8 +220,8 @@ void NetscapePluginStream::deliverDataToPlugin()
 
         int32_t numBytesWritten = m_plugin->NPP_Write(&m_npStream, m_offset, dataLength, data);
         if (numBytesWritten < 0) {
-            // FIXME: Destroy the stream!
-            ASSERT_NOT_REACHED();
+            stop(NPRES_NETWORK_ERR);
+            return;
         }
 
         // NPP_Write could call NPN_DestroyStream and destroy the stream.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list