mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1037669: Setting LoadInfo explicitly for nsIWebSocketChannels (r=tanvi,jduell)
This commit is contained in:
parent
2e10c3c528
commit
7879c92b87
@ -722,6 +722,7 @@ WebSocket::Init(JSContext* aCx,
|
||||
// Check content policy.
|
||||
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
nsCOMPtr<nsIDocument> originDoc = nsContentUtils::GetDocumentFromScriptContext(sc);
|
||||
mOriginDocument = do_GetWeakReference(originDoc);
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_WEBSOCKET,
|
||||
mURI,
|
||||
mPrincipal,
|
||||
@ -801,6 +802,17 @@ WebSocket::EstablishConnection()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// manually adding loadinfo to the channel since it
|
||||
// was not set during channel creation.
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mOriginDocument);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new LoadInfo(mPrincipal,
|
||||
doc,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_WEBSOCKET);
|
||||
rv = wsChannel->SetLoadInfo(loadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mRequestedProtocolList.IsEmpty()) {
|
||||
rv = wsChannel->SetProtocol(mRequestedProtocolList);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -235,6 +235,7 @@ protected: //data
|
||||
uint16_t mReadyState;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsWeakPtr mOriginDocument;
|
||||
|
||||
uint32_t mOutgoingBufferedAmount;
|
||||
|
||||
|
@ -96,6 +96,20 @@ BaseWebSocketChannel::SetLoadGroup(nsILoadGroup *aLoadGroup)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::SetLoadInfo(nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
mLoadInfo = aLoadInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::GetLoadInfo(nsILoadInfo** aLoadInfo)
|
||||
{
|
||||
NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::GetExtensions(nsACString &aExtensions)
|
||||
{
|
||||
|
@ -43,6 +43,8 @@ class BaseWebSocketChannel : public nsIWebSocketChannel,
|
||||
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor *aNotificationCallbacks);
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup **aLoadGroup);
|
||||
NS_IMETHOD SetLoadGroup(nsILoadGroup *aLoadGroup);
|
||||
NS_IMETHOD SetLoadInfo(nsILoadInfo *aLoadInfo);
|
||||
NS_IMETHOD GetLoadInfo(nsILoadInfo **aLoadInfo);
|
||||
NS_IMETHOD GetExtensions(nsACString &aExtensions);
|
||||
NS_IMETHOD GetProtocol(nsACString &aProtocol);
|
||||
NS_IMETHOD SetProtocol(const nsACString &aProtocol);
|
||||
@ -58,6 +60,7 @@ class BaseWebSocketChannel : public nsIWebSocketChannel,
|
||||
nsCOMPtr<nsISupports> mContext;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
||||
nsCOMPtr<nsIThread> mTargetThread;
|
||||
|
||||
nsCString mProtocol;
|
||||
|
@ -2796,6 +2796,9 @@ WebSocketChannel::AsyncOpen(nsIURI *aURI,
|
||||
getter_AddRefs(localChannel));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = localChannel->SetLoadInfo(mLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Pass most GetInterface() requests through to our instantiator, but handle
|
||||
// nsIChannelEventSink in this object in order to deal with redirects
|
||||
localChannel->SetNotificationCallbacks(this);
|
||||
|
@ -9,6 +9,7 @@ interface nsIInterfaceRequestor;
|
||||
interface nsILoadGroup;
|
||||
interface nsIWebSocketListener;
|
||||
interface nsIInputStream;
|
||||
interface nsILoadInfo;
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
@ -19,7 +20,7 @@ interface nsIInputStream;
|
||||
* We are also making it scriptable for now, but this may change once we have
|
||||
* WebSockets for Workers.
|
||||
*/
|
||||
[scriptable, uuid(9ee5874c-ec39-4bc2-b2d7-194a4c98c9d2)]
|
||||
[scriptable, uuid(3fb248c2-c0fc-4516-9c58-505a92ad8c64)]
|
||||
interface nsIWebSocketChannel : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -47,10 +48,15 @@ interface nsIWebSocketChannel : nsISupports
|
||||
readonly attribute nsISupports securityInfo;
|
||||
|
||||
/**
|
||||
* The load group of the websockets code.
|
||||
* The load group of of the websocket
|
||||
*/
|
||||
attribute nsILoadGroup loadGroup;
|
||||
|
||||
/**
|
||||
* The load info of the websocket
|
||||
*/
|
||||
attribute nsILoadInfo loadInfo;
|
||||
|
||||
/**
|
||||
* Sec-Websocket-Protocol value
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user