Remove nsICookieStorage, part of the XPCOM plugin API. b=432354 r/sr=jst,sicking

This commit is contained in:
Josh Aas 2009-06-13 13:16:40 -07:00
Родитель 78f23e1e47
Коммит aaec45417e
9 изменённых файлов: 29 добавлений и 241 удалений

Просмотреть файл

@ -426,9 +426,7 @@ nsCookiePermission::GetOriginatingURI(nsIChannel *aChannel,
* the window owning the load, and from there, we find the top same-type
* window and its URI. there are several possible cases:
*
* 1) no channel. this will occur for plugins using the nsICookieStorage
* interface, since they have none to provide. other consumers should
* have a channel.
* 1) no channel.
*
* 2) a channel, but no window. this can occur when the consumer kicking
* off the load doesn't provide one to the channel, and should be limited

Просмотреть файл

@ -74,7 +74,6 @@ XPIDLSRCS = \
nsIPlugin.idl \
nsIHTTPHeaderListener.idl \
nsIEventHandler.idl \
nsICookieStorage.idl \
nsIWindowlessPlugInstPeer.idl \
nsIScriptablePlugin.idl \
nsIPluginTag.idl \

Просмотреть файл

@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nspluginroot.idl"
/**
* nsICookieStorage
*/
%{C++
// {c8c05101-cfdb-11d2-bab8-b088e084e5bc}
#define NS_COOKIESTORAGE_CID \
{ 0xc8c05101, 0xcfdb, 0x11d2, { 0xba, 0xb8, 0xb0, 0x88, 0xe0, 0x84, 0xe5, 0xbc } }
%}
[uuid(c8c05100-cfdb-11d2-bab8-b088e084e5bc)]
interface nsICookieStorage : nsISupports
{
/**
* Retrieves a cookie from the browser's persistent cookie store.
* @param aCookieURL - URL string to look up cookie with.
* @param aCookieBuffer - buffer large enough to accomodate cookie data.
* @param aCookieSize - on input, size of the cookie buffer, on output cookie's size.
*/
void getCookie(in string aCookieURL, in voidPtr aCookieBuffer, in PRUint32Ref aCookieSize);
/**
* Stores a cookie in the browser's persistent cookie store.
* @param aCookieURL - URL string store cookie with.
* @param aCookieBuffer - buffer containing cookie data.
* @param aCookieSize - specifies size of cookie data.
*/
void setCookie(in string aCookieURL, in constVoidPtr aCookieBuffer, in unsigned long aCookieSize);
};

Просмотреть файл

@ -2488,11 +2488,33 @@ _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
switch (variable) {
case NPNURLVCookie:
{
nsCOMPtr<nsICookieStorage> cs = do_GetService(kPluginManagerCID);
if (!url || !value || (0 >= len))
return NPERR_INVALID_PARAM;
if (cs && NS_SUCCEEDED(cs->SetCookie(url, value, len))) {
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return NPERR_GENERIC_ERROR;
nsCOMPtr<nsICookieService> cookieService = do_GetService(NS_COOKIESERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return NPERR_GENERIC_ERROR;
nsCOMPtr<nsIURI> uriIn;
rv = ioService->NewURI(nsDependentCString(url), nsnull, nsnull, getter_AddRefs(uriIn));
if (NS_FAILED(rv))
return NPERR_GENERIC_ERROR;
nsCOMPtr<nsIPrompt> prompt;
nsPluginHostImpl::GetPrompt(nsnull, getter_AddRefs(prompt));
char *cookie = (char*)value;
char c = cookie[len];
cookie[len] = '\0';
rv = cookieService->SetCookieString(uriIn, prompt, cookie, nsnull);
cookie[len] = c;
if (NS_SUCCEEDED(rv))
return NPERR_NO_ERROR;
}
}
break;

Просмотреть файл

@ -2517,11 +2517,10 @@ nsPluginHostImpl::~nsPluginHostImpl()
sInst = nsnull;
}
NS_IMPL_ISUPPORTS7(nsPluginHostImpl,
NS_IMPL_ISUPPORTS6(nsPluginHostImpl,
nsIPluginManager,
nsIPluginManager2,
nsIPluginHost,
nsICookieStorage,
nsIObserver,
nsPIPluginHost,
nsISupportsWeakReference)
@ -5669,87 +5668,6 @@ nsresult nsPluginHostImpl::NewFullPagePluginStream(nsIStreamListener *&aStreamLi
return rv;
}
// nsICookieStorage interface
NS_IMETHODIMP nsPluginHostImpl::GetCookie(const char* inCookieURL, void* inOutCookieBuffer, PRUint32& inOutCookieSize)
{
nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
nsXPIDLCString cookieString;
PRUint32 cookieStringLen = 0;
nsCOMPtr<nsIURI> uriIn;
if (!inCookieURL || (0 >= inOutCookieSize)) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv) || !ioService)
return rv;
nsCOMPtr<nsICookieService> cookieService =
do_GetService(NS_COOKIESERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv) || !cookieService)
return NS_ERROR_INVALID_ARG;
// make an nsURI from the argument url
rv = ioService->NewURI(nsDependentCString(inCookieURL), nsnull, nsnull, getter_AddRefs(uriIn));
if (NS_FAILED(rv))
return rv;
rv = cookieService->GetCookieString(uriIn, nsnull, getter_Copies(cookieString));
if (NS_FAILED(rv) || !cookieString ||
(inOutCookieSize <= (cookieStringLen = PL_strlen(cookieString.get())))) {
return NS_ERROR_FAILURE;
}
PL_strcpy((char *) inOutCookieBuffer, cookieString.get());
inOutCookieSize = cookieStringLen;
rv = NS_OK;
return rv;
}
NS_IMETHODIMP nsPluginHostImpl::SetCookie(const char* inCookieURL, const void* inCookieBuffer, PRUint32 inCookieSize)
{
nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIURI> uriIn;
if (!inCookieURL || !inCookieBuffer ||
(0 >= inCookieSize)) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv) || !ioService)
return rv;
nsCOMPtr<nsICookieService> cookieService =
do_GetService(NS_COOKIESERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv) || !cookieService)
return NS_ERROR_FAILURE;
// make an nsURI from the argument url
rv = ioService->NewURI(nsDependentCString(inCookieURL), nsnull, nsnull, getter_AddRefs(uriIn));
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPrompt> prompt;
GetPrompt(nsnull, getter_AddRefs(prompt));
char * cookie = (char *)inCookieBuffer;
char c = cookie[inCookieSize];
cookie[inCookieSize] = '\0';
rv = cookieService->SetCookieString(uriIn, prompt, cookie, nsnull);
cookie[inCookieSize] = c;
return rv;
}
NS_IMETHODIMP nsPluginHostImpl::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *someData)

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsIPluginTagInfo2.h"
#include "nsIPluginInstancePeer2.h"
#include "nsICookieStorage.h"
#include "nsPluginsDir.h"
#include "nsPluginDirServiceProvider.h"
#include "nsAutoPtr.h"
@ -217,7 +216,6 @@ public:
class nsPluginHostImpl : public nsIPluginManager2,
public nsIPluginHost,
public nsICookieStorage,
public nsIObserver,
public nsPIPluginHost,
public nsSupportsWeakReference
@ -294,7 +292,6 @@ public:
NS_DECL_NSIPLUGINHOST
NS_DECL_NSIPLUGINMANAGER2
NS_DECL_NSIFACTORY
NS_DECL_NSICOOKIESTORAGE
NS_DECL_NSIOBSERVER
NS_DECL_NSPIPLUGINHOST
@ -331,6 +328,8 @@ public:
// that does Java)
static PRBool IsJavaMIMEType(const char *aType);
static nsresult GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt **aPrompt);
private:
NS_IMETHOD
TrySetUpPluginInstance(const char *aMimeType, nsIURI *aURL, nsIPluginInstanceOwner *aOwner);
@ -405,8 +404,6 @@ private:
nsresult EnsurePrivateDirServiceProvider();
nsresult GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt **aPrompt);
// calls PostPluginUnloadEvent for each library in mUnusedLibraries
void UnloadUnusedLibraries();

Просмотреть файл

@ -150,7 +150,6 @@ nsICookieManager
nsICookieManager2
nsICookiePromptService
nsICookieService
nsICookieStorage
nsICopyMessageListener
nsICopyMsgStreamListener
nsICRLInfo

Просмотреть файл

@ -737,19 +737,6 @@ typedef struct vtable_nsIPluginManager2
} VFTnsIPluginManager2;
/**
* nsICookieStorage
*/
typedef struct vtable_nsICookieStorage
{
VFTnsISupports base;
nsresult (*VFTCALL GetCookie)(void *pvThis, const char *aCookieURL, void * aCookieBuffer, PRUint32 & aCookieSize);
VFTDELTA_DECL(GetCookie)
nsresult (*VFTCALL SetCookie)(void *pvThis, const char *aCookieURL, const void * aCookieBuffer, PRUint32 aCookieSize);
VFTDELTA_DECL(SetCookie)
} VFTnsICookieStorage;
/**
* nsIEventHandler
*/

Просмотреть файл

@ -99,7 +99,6 @@
#include "nsIPluginInstancePeer2.h"
#include "nsIPluginTagInfo.h"
#include "nsIPluginTagInfo2.h"
#include "nsICookieStorage.h"
#include "nsIHTTPHeaderListener.h"
#include "nsIJRIPlugin.h"
@ -7231,68 +7230,6 @@ MAKE_SAFE_VFT(VFTnsIPluginTagInfo2, downVFTnsIPluginTagInfo2)
SAFE_VFT_ZEROS();
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
// DOWN: nsICookieStorage
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
/**
* Retrieves a cookie from the browser's persistent cookie store.
* @param aCookieURL - URL string to look up cookie with.
* @param aCookieBuffer - buffer large enough to accomodate cookie data.
* @param aCookieSize - on input, size of the cookie buffer, on output cookie's size.
*/
/* void getCookie (in string aCookieURL, in voidPtr aCookieBuffer, in PRUint32Ref aCookieSize); */
nsresult VFTCALL downICSGetCookie(void *pvThis, const char *aCookieURL, void * aCookieBuffer, PRUint32 & aCookieSize)
{
DOWN_ENTER_RC(pvThis, nsICookieStorage);
dprintf(("%s: aCookieURL=%x aCookieBuffer=%x aCookieSize=%x",
pszFunction, aCookieURL, aCookieBuffer, VALID_REF(aCookieSize) ? aCookieSize : 0xdeadbeef));
DPRINTF_STR(aCookieURL);
rc = pMozI->GetCookie(aCookieURL, aCookieBuffer, aCookieSize);
if (NS_SUCCEEDED(rc) && VALID_REF(aCookieSize))
dprintf(("%s: aCookieSize=%d", pszFunction, aCookieSize));
DOWN_LEAVE_INT(pvThis, rc);
return rc;
}
/**
* Stores a cookie in the browser's persistent cookie store.
* @param aCookieURL - URL string store cookie with.
* @param aCookieBuffer - buffer containing cookie data.
* @param aCookieSize - specifies size of cookie data.
*/
/* void setCookie (in string aCookieURL, in constVoidPtr aCookieBuffer, in unsigned long aCookieSize); */
nsresult VFTCALL downICSSetCookie(void *pvThis, const char *aCookieURL, const void * aCookieBuffer, PRUint32 aCookieSize)
{
DOWN_ENTER_RC(pvThis, nsICookieStorage);
dprintf(("%s: aCookieURL=%x aCookieBuffer=%x aCookieSize=%x",
pszFunction, aCookieURL, aCookieBuffer, aCookieSize));
DPRINTF_STR(aCookieURL);
rc = pMozI->SetCookie(aCookieURL, aCookieBuffer, aCookieSize);
DOWN_LEAVE_INT(pvThis, rc);
return rc;
}
MAKE_SAFE_VFT(VFTnsICookieStorage, downVFTnsICookieStorage)
{
{
VFTFIRST_VAL()
downQueryInterface, VFTDELTA_VAL()
downAddRef, VFTDELTA_VAL()
downRelease, VFTDELTA_VAL()
},
downICSGetCookie, VFTDELTA_VAL()
downICSSetCookie, VFTDELTA_VAL()
}
SAFE_VFT_ZEROS();
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
// DOWN: nsIJVMThreadManager
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
@ -10781,7 +10718,6 @@ static struct SupportedInterface_Down
{ &kPluginInstancePeer2IID, &downVFTnsIPluginInstancePeer2 },
{ &kPluginTagInfoIID, &downVFTnsIPluginTagInfo },
{ &kPluginTagInfo2IID, &downVFTnsIPluginTagInfo2 },
{ &kCookieStorageIID, &downVFTnsICookieStorage },
{ &kJVMThreadManagerIID, &downVFTnsIJVMThreadManager },
{ &kJVMManagerIID, &downVFTnsIJVMManager },
{ &kLiveconnectIID, &downVFTnsILiveconnect },