Changeset 86169 in webkit


Ignore:
Timestamp:
May 10, 2011 11:04:00 AM (13 years ago)
Author:
andersca@apple.com
Message:

2011-05-10 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Extra sign in required to view video on MobileMe Gallery album
https://bugs.webkit.org/show_bug.cgi?id=60560
<rdar://problem/9338693>

Add symbols required by WebKit2.

  • WebCore.exp.in:

2011-05-10 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Extra sign in required to view video on MobileMe Gallery album
https://bugs.webkit.org/show_bug.cgi?id=60560

Implement NPN_GetAuthenticationInfo.

  • PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::getAuthenticationInfo): Send a GetAuthenticationInfo message to the web process.
  • PluginProcess/PluginControllerProxy.h:
  • WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::initializeProtectionSpace): Initialize a WebCore::ProtectionSpace object from NPAPI parameters.

(WebKit::NPN_GetAuthenticationInfo):
Make a ProtectionSpace object and then call NetscapePlugin::getAuthenticationInfo.
Finally, copy the username/password and pass them back to the plug-in.

  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::getAuthenticationInfo): Call the plug-in controller.
  • WebProcess/Plugins/PluginController.h: Add getAuthenticationInfo pure virtual member function.
  • WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::getAuthenticationInfo): Call the real plug-in controller's getAuthenticationInfo member function.
  • WebProcess/Plugins/PluginProxy.messages.in: Add GetAuthenticationInfo message.
  • WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::getAuthenticationInfo): Try to get the authentication info from the credential storage. Failing that, get it from the persistent credential storage.
Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86168 r86169  
     12011-05-10  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Extra sign in required to view video on MobileMe Gallery album
     6        https://bugs.webkit.org/show_bug.cgi?id=60560
     7        <rdar://problem/9338693>
     8
     9        Add symbols required by WebKit2.
     10
     11        * WebCore.exp.in:
     12
    1132011-05-10  Alexander Pavlov  <apavlov@chromium.org>
    214
  • trunk/Source/WebCore/WebCore.exp.in

    r86039 r86169  
    490490__ZN7WebCore16startOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
    491491__ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
     492__ZN7WebCore17CredentialStorage24getFromPersistentStorageERKNS_15ProtectionSpaceE
    492493__ZN7WebCore17DOMImplementation13isXMLMIMETypeERKN3WTF6StringE
    493494__ZN7WebCore17DOMImplementation14isTextMIMETypeERKN3WTF6StringE
     
    10151016__ZNK3WTF6String14createCFStringEv
    10161017__ZNK7WebCore5Frame26getDocumentBackgroundColorEv
     1018__ZNK7WebCore10Credential11hasPasswordEv
    10171019__ZNK7WebCore10Credential11persistenceEv
    10181020__ZNK7WebCore10Credential4userEv
     1021__ZNK7WebCore10Credential7isEmptyEv
    10191022__ZNK7WebCore10Credential8passwordEv
    10201023__ZNK7WebCore10FloatPointcv8_NSPointEv
  • trunk/Source/WebKit2/ChangeLog

    r86161 r86169  
     12011-05-10  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Extra sign in required to view video on MobileMe Gallery album
     6        https://bugs.webkit.org/show_bug.cgi?id=60560
     7
     8        Implement NPN_GetAuthenticationInfo.
     9
     10        * PluginProcess/PluginControllerProxy.cpp:
     11        (WebKit::PluginControllerProxy::getAuthenticationInfo):
     12        Send a GetAuthenticationInfo message to the web process.
     13
     14        * PluginProcess/PluginControllerProxy.h:
     15        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
     16        (WebKit::initializeProtectionSpace):
     17        Initialize a WebCore::ProtectionSpace object from NPAPI parameters.
     18
     19        (WebKit::NPN_GetAuthenticationInfo):
     20        Make a ProtectionSpace object and then call NetscapePlugin::getAuthenticationInfo.
     21        Finally, copy the username/password and pass them back to the plug-in.
     22
     23        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     24        (WebKit::NetscapePlugin::getAuthenticationInfo):
     25        Call the plug-in controller.
     26
     27        * WebProcess/Plugins/PluginController.h:
     28        Add getAuthenticationInfo pure virtual member function.
     29
     30        * WebProcess/Plugins/PluginProxy.cpp:
     31        (WebKit::PluginProxy::getAuthenticationInfo):
     32        Call the real plug-in controller's getAuthenticationInfo member function.
     33
     34        * WebProcess/Plugins/PluginProxy.messages.in:
     35        Add GetAuthenticationInfo message.
     36
     37        * WebProcess/Plugins/PluginView.cpp:
     38        (WebKit::PluginView::getAuthenticationInfo):
     39        Try to get the authentication info from the credential storage. Failing that,
     40        get it from the persistent credential storage.
     41
    1422011-05-10  Adam Roben  <aroben@apple.com>
    243
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp

    r85961 r86169  
    355355}
    356356
     357bool PluginControllerProxy::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password)
     358{
     359    bool returnValue;
     360    if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetAuthenticationInfo(protectionSpace), Messages::PluginProxy::GetAuthenticationInfo::Reply(returnValue, username, password), m_pluginInstanceID))
     361        return false;
     362
     363    return returnValue;
     364}
     365
    357366void PluginControllerProxy::protectPluginFromDestruction()
    358367{
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h

    r85961 r86169  
    103103    virtual void setCookiesForURL(const String& urlString, const String& cookieString);
    104104    virtual bool isPrivateBrowsingEnabled();
     105    virtual bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password);
    105106    virtual void protectPluginFromDestruction();
    106107    virtual void unprotectPluginFromDestruction();
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp

    r85859 r86169  
    3333#include <WebCore/IdentifierRep.h>
    3434#include <WebCore/NotImplemented.h>
     35#include <WebCore/ProtectionSpace.h>
    3536#include <WebCore/SharedBuffer.h>
    3637#include <utility>
     
    855856}
    856857
    857 static NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme,
    858                                          const char* realm, char** username, uint32_t* ulen, char** password, uint32_t* plen)
    859 {
    860     notImplemented();
    861     return NPERR_GENERIC_ERROR;
     858static bool initializeProtectionSpace(const char* protocol, const char* host, int port, const char* scheme, const char* realm, ProtectionSpace& protectionSpace)
     859{
     860    ProtectionSpaceServerType serverType;
     861    if (!strcasecmp(protocol, "http"))
     862        serverType = ProtectionSpaceServerHTTP;
     863    else if (!strcasecmp(protocol, "https"))
     864        serverType = ProtectionSpaceServerHTTPS;
     865    else {
     866        // We only care about http and https.
     867        return false;
     868    }
     869
     870    ProtectionSpaceAuthenticationScheme authenticationScheme = ProtectionSpaceAuthenticationSchemeDefault;
     871    if (serverType == ProtectionSpaceServerHTTP) {
     872        if (!strcasecmp(scheme, "basic"))
     873            authenticationScheme = ProtectionSpaceAuthenticationSchemeHTTPBasic;
     874        else if (!strcmp(scheme, "digest"))
     875            authenticationScheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
     876    }
     877
     878    protectionSpace = ProtectionSpace(host, port, serverType, realm, authenticationScheme);
     879    return true;
     880}
     881
     882static NPError NPN_GetAuthenticationInfo(NPP npp, const char* protocol, const char* host, int32_t port, const char* scheme,
     883                                         const char* realm, char** username, uint32_t* usernameLength, char** password, uint32_t* passwordLength)
     884{
     885    if (!protocol || !host || !scheme || !realm || !username || !usernameLength || !password || !passwordLength)
     886        return NPERR_GENERIC_ERROR;
     887
     888    ProtectionSpace protectionSpace;
     889    if (!initializeProtectionSpace(protocol, host, port, scheme, realm, protectionSpace))
     890        return NPERR_GENERIC_ERROR;
     891
     892    RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
     893    String usernameString;
     894    String passwordString;
     895    if (!plugin->getAuthenticationInfo(protectionSpace, usernameString, passwordString))
     896        return NPERR_GENERIC_ERROR;
     897
     898    NPError result = copyCString(usernameString.utf8(), username, usernameLength);
     899    if (result != NPERR_NO_ERROR)
     900        return result;
     901
     902    result = copyCString(passwordString.utf8(), password, passwordLength);
     903    if (result != NPERR_NO_ERROR) {
     904        npnMemFree(*username);
     905        return result;
     906    }
     907
     908    return NPERR_NO_ERROR;
    862909}
    863910
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r85961 r86169  
    289289}
    290290
     291bool NetscapePlugin::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password)
     292{
     293    return m_pluginController->getAuthenticationInfo(protectionSpace, username, password);
     294}
     295
    291296NPError NetscapePlugin::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* savedData)
    292297{
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r85961 r86169  
    3838namespace WebCore {
    3939    class HTTPHeaderMap;
     40    class ProtectionSpace;
    4041}
    4142
     
    100101    String cookiesForURL(const String& urlString);
    101102    void setCookiesForURL(const String& urlString, const String& cookieString);
     103    bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password);
    102104
    103105    // Member functions for calling into the plug-in.
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h

    r85961 r86169  
    3636    class IntRect;
    3737    class KURL;
     38    class ProtectionSpace;
    3839}
    3940
     
    120121    virtual void setCookiesForURL(const String& urlString, const String& cookieString) = 0;
    121122
     123    // Get authentication credentials for the given protection space.
     124    virtual bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password) = 0;
     125
    122126    // Returns whether private browsing is enabled.
    123127    virtual bool isPrivateBrowsingEnabled() = 0;
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r85961 r86169  
    396396}
    397397
     398void PluginProxy::getAuthenticationInfo(const ProtectionSpace& protectionSpace, bool& returnValue, String& username, String& password)
     399{
     400    returnValue = m_pluginController->getAuthenticationInfo(protectionSpace, username, password);
     401}
     402
    398403void PluginProxy::getWindowScriptNPObject(uint64_t& windowScriptNPObjectID)
    399404{
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h

    r85961 r86169  
    3939namespace WebCore {
    4040    class HTTPHeaderMap;
     41    class ProtectionSpace;
    4142}
    4243
     
    111112    void cookiesForURL(const String& urlString, String& cookieString);
    112113    void setCookiesForURL(const String& urlString, const String& cookieString);
     114    void getAuthenticationInfo(const WebCore::ProtectionSpace&, bool& returnValue, String& username, String& password);
    113115    void getWindowScriptNPObject(uint64_t& windowScriptNPObjectID);
    114116    void getPluginElementNPObject(uint64_t& pluginElementNPObjectID);
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in

    r74224 r86169  
    3939    SetCookiesForURL(WTF::String urlString, WTF::String cookieString)
    4040
     41    # Gets the authentication info for the given protection space.
     42    GetAuthenticationInfo(WebCore::ProtectionSpace protectionSpace) -> (bool returnValue, WTF::String username, WTF::String password)
     43
    4144    # Gets a reference to the window NPObject.
    4245    GetWindowScriptNPObject() -> (uint64_t windowScriptNPObjectID)
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r86045 r86169  
    3636#include <WebCore/Chrome.h>
    3737#include <WebCore/CookieJar.h>
     38#include <WebCore/CredentialStorage.h>
    3839#include <WebCore/DocumentLoader.h>
    3940#include <WebCore/Event.h>
     
    4748#include <WebCore/NetscapePlugInStreamLoader.h>
    4849#include <WebCore/NetworkingContext.h>
     50#include <WebCore/ProtectionSpace.h>
    4951#include <WebCore/ProxyServer.h>
    5052#include <WebCore/RenderEmbeddedObject.h>
     
    10781080}
    10791081
     1082bool PluginView::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password)
     1083{
     1084    Credential credential = CredentialStorage::get(protectionSpace);
     1085    if (credential.isEmpty())
     1086        credential = CredentialStorage::getFromPersistentStorage(protectionSpace);
     1087
     1088    if (!credential.hasPassword())
     1089        return false;
     1090
     1091    username = credential.user();
     1092    password = credential.password();
     1093
     1094    return true;
     1095}
     1096
    10801097bool PluginView::isPrivateBrowsingEnabled()
    10811098{
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h

    r85961 r86169  
    146146    virtual String cookiesForURL(const String&);
    147147    virtual void setCookiesForURL(const String& urlString, const String& cookieString);
     148    virtual bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password);
    148149    virtual bool isPrivateBrowsingEnabled();
    149150    virtual void protectPluginFromDestruction();
Note: See TracChangeset for help on using the changeset viewer.