r=av
bug=50811
This bug fix was suggested by Stanley Ho <stanley.ho@eng.sun.com>.
Stanley proposed we overload the meaning of the nsIPluginStreamListener
argument to nsIPluginManager::{GetURL,PostURL}() so that it also may
implement an interface for reading headers. Thus, the browser could QI
the plugin's nsIPluginStreamListener instance to this headers reading
interface and send the plugin the headers from the response.
I have implemented Stanley's above proposal. I have defined a new
interface, nsIHTTPHeaderListener.idl with one method:
/**
* Called for each HTTP Response header.
* NOTE: You must copy the values of the params.
*/
void newResponseHeader(in string headerName, in string headerValue);
To affect this fix, I have added a new private method
nsPluginStreamListenerPeer::
ReadHeadersFromChannelAndPostToListener(nsIHTTPChannel *httpChannel,
nsIHTTPHeaderListener *listener)
Then, modified nsPluginStreamListenerPeer::OnDataAvailable() to call
this method BEFORE reading the content data. However, this fix makes
two important assumptions I would like to check out:
* Assumption
* By the time nsPluginStreamListenerPeer::OnDataAvailable() gets
* called, all the headers have been read.
* Assumption:
* The return value from nsIHTTPHeader->{GetFieldName,GetValue}()
* must be freed.
The following files are included in this fix:
A modules/plugin/public/nsIHTTPHeaderListener.idl
A modules/plugin/public/makefile.win
A modules/plugin/public/Makefile.in
M modules/plugin/nglsrc/nsPluginHostImpl.cpp
r=av
bug=50811
This bug fix was suggested by Stanley Ho <stanley.ho@eng.sun.com>.
Stanley proposed we overload the meaning of the nsIPluginStreamListener
argument to nsIPluginManager::{GetURL,PostURL}() so that it also may
implement an interface for reading headers. Thus, the browser could QI
the plugin's nsIPluginStreamListener instance to this headers reading
interface and send the plugin the headers from the response.
I have implemented Stanley's above proposal. I have defined a new
interface, nsIHTTPHeaderListener.idl with one method:
/**
* Called for each HTTP Response header.
* NOTE: You must copy the values of the params.
*/
void newResponseHeader(in string headerName, in string headerValue);
To affect this fix, I have added a new private method
nsPluginStreamListenerPeer::
ReadHeadersFromChannelAndPostToListener(nsIHTTPChannel *httpChannel,
nsIHTTPHeaderListener *listener)
Then, modified nsPluginStreamListenerPeer::OnDataAvailable() to call
this method BEFORE reading the content data. However, this fix makes
two important assumptions I would like to check out:
* Assumption
* By the time nsPluginStreamListenerPeer::OnDataAvailable() gets
* called, all the headers have been read.
* Assumption:
* The return value from nsIHTTPHeader->{GetFieldName,GetValue}()
* must be freed.
The following files are included in this fix:
A modules/plugin/public/nsIHTTPHeaderListener.idl
A modules/plugin/public/makefile.win
A modules/plugin/public/Makefile.in
M modules/plugin/nglsrc/nsPluginHostImpl.cpp
a=waterson
bug=51919
This fix makes it so nsIPluginManager::PostURL() works correctly in the
case of a null target and non-null streamListener.
The fix was to add parameters to NewPluginURLStream() for headers and
post data:
NS_IMETHOD
- NewPluginURLStream(const nsString& aURL, nsIPluginInstance *aInstance, nsIPluginStreamListener *aListener);
+ NewPluginURLStream(const nsString& aURL, nsIPluginInstance *aInstance,
+ nsIPluginStreamListener *aListener,
+ void *aPostData = nsnull, PRUint32 aPostDataLen = 0,
+ const char *aHeadersData = nsnull,
+ PRUint32 aHeadersDataLen = 0);
And to add a new method to correctly send the headers to the channel:
+ NS_IMETHOD
+ AddHeadersToChannel(const char *aHeadersData, PRUint32 aHeadersDataLen,
+ nsIChannel *aGenericChannel);
Files in this fix:
M modules/plugin/nglsrc/nsPluginHostImpl.cpp
M modules/plugin/nglsrc/nsPluginHostImpl.h
Right now, nsIPluginManager::PostURL() has parameters for
postHeadersLength and postHeaders. However, nothing is being done with
these parameters. This bug fix utilizes these params for their intended
purpose: to allow the plugin the ability to add HTTP headers to a POST
data stream.
Important assumptions made by this fix:
* postHeadersLength is the correct length for postHeaders.
* postHeaders is a buffer of headers in the form
"HeaderName: HeaderValue\r\n"
each header, including the last, MUST be followed by "\r\n".
To affect this fix I had to modify the following files:
M docshell/base/nsDocShell.cpp
M docshell/base/nsDocShell.h
M docshell/base/nsWebShell.cpp
M modules/plugin/nglsrc/nsPluginViewer.cpp
M docshell/base/nsWebShell.h
M layout/html/base/src/nsObjectFrame.cpp
M modules/plugin/nglsrc/nsIPluginInstanceOwner.h
M modules/plugin/nglsrc/nsPluginHostImpl.cpp
M modules/plugin/nglsrc/nsPluginInstancePeer.cpp
M webshell/public/nsILinkHandler.h
Basically, it involved clearing a path so the headers arguments can make
it down to nsIPluginInstanceOwner::GetURL()'s implementation in
nsObjectFrame.cpp, where an nsIInputStream is made of the headers.