mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1038756: Callsites creating a channel in /widget/windows/ (r=jimm)
* * * [mq]: windows.patch
This commit is contained in:
parent
2a3c0c0266
commit
af79d0093e
@ -8,6 +8,7 @@
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsIFormatConverter.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
|
||||
%{ C++
|
||||
|
||||
@ -81,7 +82,7 @@ interface nsIFlavorDataProvider : nsISupports
|
||||
};
|
||||
|
||||
|
||||
[scriptable, uuid(5a611a60-e5b5-11e1-aff1-0800200c9a66)]
|
||||
[scriptable, uuid(97e0c418-1c1e-4106-bad1-9fcb11dff2fe)]
|
||||
interface nsITransferable : nsISupports
|
||||
{
|
||||
const long kFlavorHasDataProvider = 0;
|
||||
@ -194,5 +195,12 @@ interface nsITransferable : nsISupports
|
||||
*/
|
||||
[noscript] attribute boolean isPrivateData;
|
||||
|
||||
/**
|
||||
* The source dom node this transferable was created from.
|
||||
* Note, currently only in use on Windows for network principal
|
||||
* information in drag operations.
|
||||
*/
|
||||
[noscript] attribute nsIDOMNode requestingNode;
|
||||
|
||||
};
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
@ -59,8 +61,8 @@ using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
#define ENTRY(_msg) { #_msg, _msg }
|
||||
|
||||
#define ENTRY(_msg) { #_msg, _msg }
|
||||
EventMsgInfo gAllEvents[] = {
|
||||
ENTRY(WM_NULL),
|
||||
ENTRY(WM_CREATE),
|
||||
@ -1059,7 +1061,12 @@ nsresult AsyncFaviconDataReady::OnFaviconDataNotAvailable(void)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_NewChannel(getter_AddRefs(channel), mozIconURI);
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
mozIconURI,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_IMAGE);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDownloadObserver> downloadObserver = new myDownloadObserver;
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include "nsITimer.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsINode.h"
|
||||
|
||||
#include "WinUtils.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
@ -58,12 +61,24 @@ nsDataObj::CStream::~CStream()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// helper - initializes the stream
|
||||
nsresult nsDataObj::CStream::Init(nsIURI *pSourceURI)
|
||||
nsresult nsDataObj::CStream::Init(nsIURI *pSourceURI,
|
||||
nsINode* aRequestingNode)
|
||||
{
|
||||
// we can not create a channel without a requestingNode
|
||||
if (!aRequestingNode) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv;
|
||||
rv = NS_NewChannel(getter_AddRefs(mChannel), pSourceURI,
|
||||
nullptr, nullptr, nullptr,
|
||||
rv = NS_NewChannel(getter_AddRefs(mChannel),
|
||||
pSourceURI,
|
||||
aRequestingNode,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
nullptr, // aChannelPolicy
|
||||
nullptr, // loadGroup
|
||||
nullptr, // aCallbacks
|
||||
nsIRequest::LOAD_FROM_CACHE);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = mChannel->AsyncOpen(this, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -324,7 +339,13 @@ HRESULT nsDataObj::CreateStream(IStream **outStream)
|
||||
|
||||
pStream->AddRef();
|
||||
|
||||
rv = pStream->Init(sourceURI);
|
||||
// query the requestingNode from the transferable and add it to the new channel
|
||||
nsCOMPtr<nsIDOMNode> requestingDomNode;
|
||||
mTransferable->GetRequestingNode(getter_AddRefs(requestingDomNode));
|
||||
nsCOMPtr<nsINode> requestingNode = do_QueryInterface(requestingDomNode);
|
||||
MOZ_ASSERT(requestingNode, "can not create channel without a node");
|
||||
|
||||
rv = pStream->Init(sourceURI, requestingNode);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
pStream->Release();
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsITimer.h"
|
||||
|
||||
class nsIThread;
|
||||
class nsINode;
|
||||
|
||||
// The SDK shipping with VC11 has renamed IAsyncOperation to
|
||||
// IDataObjectAsyncCapability. We try to detect this, and rename this in our
|
||||
@ -248,7 +249,7 @@ protected:
|
||||
|
||||
public:
|
||||
CStream();
|
||||
nsresult Init(nsIURI *pSourceURI);
|
||||
nsresult Init(nsIURI *pSourceURI, nsINode* aRequestingNode);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
@ -214,6 +214,8 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
|
||||
anArrayTransferables->GetElementAt(i, getter_AddRefs(supports));
|
||||
nsCOMPtr<nsITransferable> trans(do_QueryInterface(supports));
|
||||
if (trans) {
|
||||
// set the requestingNode on the transferable
|
||||
trans->SetRequestingNode(aDOMNode);
|
||||
nsRefPtr<IDataObject> dataObj;
|
||||
rv = nsClipboard::CreateNativeDataObject(trans,
|
||||
getter_AddRefs(dataObj), uri);
|
||||
@ -231,6 +233,8 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
|
||||
anArrayTransferables->GetElementAt(0, getter_AddRefs(supports));
|
||||
nsCOMPtr<nsITransferable> trans(do_QueryInterface(supports));
|
||||
if (trans) {
|
||||
// set the requestingNode on the transferable
|
||||
trans->SetRequestingNode(aDOMNode);
|
||||
rv = nsClipboard::CreateNativeDataObject(trans,
|
||||
getter_AddRefs(itemToDrag),
|
||||
uri);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsSound.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "prlog.h"
|
||||
@ -209,8 +210,12 @@ NS_IMETHODIMP nsSound::Play(nsIURL *aURL)
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIStreamLoader> loader;
|
||||
rv = NS_NewStreamLoader(getter_AddRefs(loader), aURL, this);
|
||||
|
||||
rv = NS_NewStreamLoader(getter_AddRefs(loader),
|
||||
aURL,
|
||||
this, // aObserver
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -626,3 +626,17 @@ nsTransferable::SetIsPrivateData(bool aIsPrivateData)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransferable::GetRequestingNode(nsIDOMNode** outRequestingNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryReferent(mRequestingNode);
|
||||
node.forget(outRequestingNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTransferable::SetRequestingNode(nsIDOMNode* aRequestingNode)
|
||||
{
|
||||
mRequestingNode = do_GetWeakReference(aRequestingNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
|
||||
class nsString;
|
||||
class nsDataObj;
|
||||
@ -73,6 +74,7 @@ protected:
|
||||
nsTArray<DataStruct> mDataArray;
|
||||
nsCOMPtr<nsIFormatConverter> mFormatConv;
|
||||
bool mPrivateData;
|
||||
nsWeakPtr mRequestingNode;
|
||||
#if DEBUG
|
||||
bool mInitialized;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user