Changeset 63756 in webkit


Ignore:
Timestamp:
Jul 20, 2010 10:50:02 AM (14 years ago)
Author:
andersca@apple.com
Message:

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.

Location:
trunk/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r63708 r63756  
     12010-07-20  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Implement NPN_GetURL and NPN_PostURL
     6        https://bugs.webkit.org/show_bug.cgi?id=42650
     7
     8        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
     9        (WebKit::parsePostBuffer):
     10        Add a FIXME about deleting the file.
     11
     12        (WebKit::makeURLString):
     13        Move this static method before NPN_GetURL.
     14
     15        (WebKit::NPN_GetURL):
     16        Call NetscapePLugin::LoadURL.
     17       
     18        (WebKit::NPN_PostURL):
     19        Ditto.
     20
     21        (WebKit::NPN_PostURLNotify):
     22        * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
     23        Remove unreached code.
     24
     25        (WebKit::NetscapePluginStream::deliverDataToPlugin):
     26        Stop the stream if the plug-in returns -1 from NPP_Write.
     27
    1282010-07-19  Anders Carlsson  <andersca@apple.com>
    229
  • trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp

    r63701 r63756  
    210210        postBuffer = fileContents->data();
    211211        postBufferSize = fileContents->size();
     212
     213        // FIXME: The NPAPI spec states that the file should be deleted here.
    212214    } else {
    213215        postBuffer = buffer;
     
    248250}
    249251
    250 static NPError NPN_GetURL(NPP instance, const char* url, const char* target)
    251 {
    252     notImplemented();
     252static String makeURLString(const char* url)
     253{
     254    String urlString(url);
     255   
     256    // Strip return characters.
     257    urlString.replace('\r', "");
     258    urlString.replace('\n', "");
     259
     260    return urlString;
     261}
     262
     263static NPError NPN_GetURL(NPP npp, const char* url, const char* target)
     264{
     265    if (!url)
     266        return NPERR_GENERIC_ERROR;
     267   
     268    RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
     269    plugin->loadURL("GET", makeURLString(url), target, HTTPHeaderMap(), Vector<char>(), false, 0);
     270   
    253271    return NPERR_GENERIC_ERROR;
    254272}
    255273
    256 static NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file)
    257 {
    258     notImplemented();
    259     return NPERR_GENERIC_ERROR;
     274static NPError NPN_PostURL(NPP npp, const char* url, const char* target, uint32_t len, const char* buf, NPBool file)
     275{
     276    HTTPHeaderMap headerFields;
     277    Vector<char> postData;
     278   
     279    // NPN_PostURL only allows headers if the post buffer points to a file.
     280    bool parseHeaders = file;
     281
     282    NPError error = parsePostBuffer(file, buf, len, parseHeaders, headerFields, postData);
     283    if (error != NPERR_NO_ERROR)
     284        return error;
     285
     286    RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
     287    plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, false, 0);
     288    return NPERR_NO_ERROR;
    260289}
    261290
     
    333362    notImplemented();
    334363    return 0;
    335 }
    336 
    337 static String makeURLString(const char* url)
    338 {
    339     String urlString(url);
    340    
    341     // Strip return characters.
    342     urlString.replace('\r', "");
    343     urlString.replace('\n', "");
    344 
    345     return urlString;
    346364}
    347365
     
    368386    plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, true, notifyData);
    369387    return NPERR_NO_ERROR;
    370    
    371     notImplemented();
    372     return NPERR_GENERIC_ERROR;
    373388}
    374389
  • trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp

    r63704 r63756  
    221221        int32_t numBytesWritten = m_plugin->NPP_Write(&m_npStream, m_offset, dataLength, data);
    222222        if (numBytesWritten < 0) {
    223             // FIXME: Destroy the stream!
    224             ASSERT_NOT_REACHED();
     223            stop(NPRES_NETWORK_ERR);
     224            return;
    225225        }
    226226
Note: See TracChangeset for help on using the changeset viewer.