r=vidur, av
a=brendan
bug=49525
This simple fix just adds parameters to an existing method in an XPCOM
safe way, by defining a new method at the end of the interface
definition with the additional parameters.
Original method:
NS_IMETHOD
GetURL(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE) = 0;
New method:
NS_IMETHOD
GetURLWithHeaders(nsISupports* pluginInst,
const char* url,
const char* target = NULL,
nsIPluginStreamListener* streamListener = NULL,
const char* altHost = NULL,
const char* referrer = NULL,
PRBool forceJSEnabled = PR_FALSE,
PRUint32 getHeadersLength = 0,
const char* getHeaders = NULL) = 0;
I have modified nsPluginHostImpl.h to include this new method, and
modified nsPluginHostImpl.cpp so that its GetURL calls GetURLWithHeaders
with null values for the last two params.
M modules/plugin/public/nsIPluginManager.h
M modules/plugin/nglsrc/nsPluginHostImpl.cpp
M modules/plugin/nglsrc/nsPluginHostImpl.h
git-svn-id: svn://10.0.0.236/trunk@79207 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -162,10 +162,13 @@ public:
|
||||
* URLs, even if the user currently has JavaScript disabled (usually
|
||||
* specify PR_FALSE)
|
||||
* @param postHeadersLength - the length of postHeaders (if non-NULL)
|
||||
* @param postHeaders - the headers to POST. NULL specifies that there
|
||||
* are no post headers
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
|
||||
* @param postHeaders - the headers to POST. Must be in the form of
|
||||
* "HeaderName: HeaderValue\r\n". Each header, including the last,
|
||||
* must be followed by "\r\n". NULL specifies that there are no
|
||||
* post headers
|
||||
|
||||
* @result - NS_OK if this operation was successful */
|
||||
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* pluginInst,
|
||||
@@ -221,6 +224,35 @@ public:
|
||||
|
||||
NS_IMETHOD
|
||||
UnregisterPlugin(REFNSIID aCID) = 0;
|
||||
|
||||
/**
|
||||
* Fetches a URL, with Headers
|
||||
|
||||
* @see GetURL. Identical except for additional params headers and
|
||||
* headersLen
|
||||
|
||||
* @param getHeadersLength - the length of getHeaders (if non-NULL)
|
||||
|
||||
* @param getHeaders - the headers to GET. Must be in the form of
|
||||
* "HeaderName: HeaderValue\r\n". Each header, including the last,
|
||||
* must be followed by "\r\n". NULL specifies that there are no
|
||||
* get headers
|
||||
|
||||
* @result - NS_OK if this operation was successful
|
||||
|
||||
*/
|
||||
|
||||
NS_IMETHOD
|
||||
GetURLWithHeaders(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target = NULL,
|
||||
nsIPluginStreamListener* streamListener = NULL,
|
||||
const char* altHost = NULL,
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 getHeadersLength = 0,
|
||||
const char* getHeaders = NULL) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1533,6 +1533,20 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
const char* altHost,
|
||||
const char* referrer,
|
||||
PRBool forceJSEnabled)
|
||||
{
|
||||
return GetURLWithHeaders(pluginInst, url, target, streamListener,
|
||||
altHost, referrer, forceJSEnabled, nsnull, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginHostImpl::GetURLWithHeaders(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target,
|
||||
nsIPluginStreamListener* streamListener,
|
||||
const char* altHost,
|
||||
const char* referrer,
|
||||
PRBool forceJSEnabled,
|
||||
PRUint32 getHeadersLength,
|
||||
const char* getHeaders)
|
||||
{
|
||||
nsAutoString string; string.AssignWithConversion(url);
|
||||
nsIPluginInstance *instance;
|
||||
@@ -1567,7 +1581,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
|
||||
rv = owner->GetURL(url, target, nsnull, 0, nsnull, nsnull);
|
||||
rv = owner->GetURL(url, target, nsnull, 0, (void *) getHeaders,
|
||||
getHeadersLength);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
@@ -1575,7 +1590,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
}
|
||||
|
||||
if (nsnull != streamListener)
|
||||
rv = NewPluginURLStream(string, instance, streamListener);
|
||||
rv = NewPluginURLStream(string, instance, streamListener,
|
||||
nsnull, nsnull, getHeaders, getHeadersLength);
|
||||
|
||||
NS_RELEASE(instance);
|
||||
}
|
||||
|
||||
@@ -148,6 +148,17 @@ public:
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE);
|
||||
|
||||
NS_IMETHOD
|
||||
GetURLWithHeaders(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target = NULL,
|
||||
nsIPluginStreamListener* streamListener = NULL,
|
||||
const char* altHost = NULL,
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 getHeadersLength = 0,
|
||||
const char* getHeaders = NULL);
|
||||
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
|
||||
@@ -1533,6 +1533,20 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
const char* altHost,
|
||||
const char* referrer,
|
||||
PRBool forceJSEnabled)
|
||||
{
|
||||
return GetURLWithHeaders(pluginInst, url, target, streamListener,
|
||||
altHost, referrer, forceJSEnabled, nsnull, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginHostImpl::GetURLWithHeaders(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target,
|
||||
nsIPluginStreamListener* streamListener,
|
||||
const char* altHost,
|
||||
const char* referrer,
|
||||
PRBool forceJSEnabled,
|
||||
PRUint32 getHeadersLength,
|
||||
const char* getHeaders)
|
||||
{
|
||||
nsAutoString string; string.AssignWithConversion(url);
|
||||
nsIPluginInstance *instance;
|
||||
@@ -1567,7 +1581,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
|
||||
rv = owner->GetURL(url, target, nsnull, 0, nsnull, nsnull);
|
||||
rv = owner->GetURL(url, target, nsnull, 0, (void *) getHeaders,
|
||||
getHeadersLength);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
@@ -1575,7 +1590,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
}
|
||||
|
||||
if (nsnull != streamListener)
|
||||
rv = NewPluginURLStream(string, instance, streamListener);
|
||||
rv = NewPluginURLStream(string, instance, streamListener,
|
||||
nsnull, nsnull, getHeaders, getHeadersLength);
|
||||
|
||||
NS_RELEASE(instance);
|
||||
}
|
||||
|
||||
@@ -148,6 +148,17 @@ public:
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE);
|
||||
|
||||
NS_IMETHOD
|
||||
GetURLWithHeaders(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target = NULL,
|
||||
nsIPluginStreamListener* streamListener = NULL,
|
||||
const char* altHost = NULL,
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 getHeadersLength = 0,
|
||||
const char* getHeaders = NULL);
|
||||
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
|
||||
@@ -162,10 +162,13 @@ public:
|
||||
* URLs, even if the user currently has JavaScript disabled (usually
|
||||
* specify PR_FALSE)
|
||||
* @param postHeadersLength - the length of postHeaders (if non-NULL)
|
||||
* @param postHeaders - the headers to POST. NULL specifies that there
|
||||
* are no post headers
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
|
||||
* @param postHeaders - the headers to POST. Must be in the form of
|
||||
* "HeaderName: HeaderValue\r\n". Each header, including the last,
|
||||
* must be followed by "\r\n". NULL specifies that there are no
|
||||
* post headers
|
||||
|
||||
* @result - NS_OK if this operation was successful */
|
||||
|
||||
NS_IMETHOD
|
||||
PostURL(nsISupports* pluginInst,
|
||||
@@ -221,6 +224,35 @@ public:
|
||||
|
||||
NS_IMETHOD
|
||||
UnregisterPlugin(REFNSIID aCID) = 0;
|
||||
|
||||
/**
|
||||
* Fetches a URL, with Headers
|
||||
|
||||
* @see GetURL. Identical except for additional params headers and
|
||||
* headersLen
|
||||
|
||||
* @param getHeadersLength - the length of getHeaders (if non-NULL)
|
||||
|
||||
* @param getHeaders - the headers to GET. Must be in the form of
|
||||
* "HeaderName: HeaderValue\r\n". Each header, including the last,
|
||||
* must be followed by "\r\n". NULL specifies that there are no
|
||||
* get headers
|
||||
|
||||
* @result - NS_OK if this operation was successful
|
||||
|
||||
*/
|
||||
|
||||
NS_IMETHOD
|
||||
GetURLWithHeaders(nsISupports* pluginInst,
|
||||
const char* url,
|
||||
const char* target = NULL,
|
||||
nsIPluginStreamListener* streamListener = NULL,
|
||||
const char* altHost = NULL,
|
||||
const char* referrer = NULL,
|
||||
PRBool forceJSEnabled = PR_FALSE,
|
||||
PRUint32 getHeadersLength = 0,
|
||||
const char* getHeaders = NULL) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user