mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=497498 prevent GetTargetDragData (and IsTargetContextList) from being called without a target GtkWidget r=roc
--HG-- extra : rebase_source : 4c6d856abbe49913b74da4d9640d47a9870c2210
This commit is contained in:
parent
a986c13433
commit
6317aac66c
@ -547,6 +547,15 @@ NS_IMETHODIMP
|
|||||||
nsDragService::GetNumDropItems(PRUint32 * aNumItems)
|
nsDragService::GetNumDropItems(PRUint32 * aNumItems)
|
||||||
{
|
{
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems"));
|
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems"));
|
||||||
|
|
||||||
|
if (!mTargetWidget) {
|
||||||
|
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||||
|
("*** warning: GetNumDropItems \
|
||||||
|
called without a valid target widget!\n"));
|
||||||
|
*aNumItems = 0;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
bool isList = IsTargetContextList();
|
bool isList = IsTargetContextList();
|
||||||
if (isList)
|
if (isList)
|
||||||
mSourceDataItems->Count(aNumItems);
|
mSourceDataItems->Count(aNumItems);
|
||||||
@ -574,12 +583,18 @@ nsDragService::GetData(nsITransferable * aTransferable,
|
|||||||
if (!aTransferable)
|
if (!aTransferable)
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
|
||||||
|
if (!mTargetWidget) {
|
||||||
|
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||||
|
("*** warning: GetData \
|
||||||
|
called without a valid target widget!\n"));
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// get flavor list that includes all acceptable flavors (including
|
// get flavor list that includes all acceptable flavors (including
|
||||||
// ones obtained through conversion). Flavors are nsISupportsStrings
|
// ones obtained through conversion). Flavors are nsISupportsStrings
|
||||||
// so that they can be seen from JS.
|
// so that they can be seen from JS.
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
|
||||||
nsCOMPtr<nsISupportsArray> flavorList;
|
nsCOMPtr<nsISupportsArray> flavorList;
|
||||||
rv = aTransferable->FlavorsTransferableCanImport(
|
nsresult rv = aTransferable->FlavorsTransferableCanImport(
|
||||||
getter_AddRefs(flavorList));
|
getter_AddRefs(flavorList));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
@ -878,10 +893,10 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor,
|
|||||||
*_retval = false;
|
*_retval = false;
|
||||||
|
|
||||||
// check to make sure that we have a drag object set, here
|
// check to make sure that we have a drag object set, here
|
||||||
if (!mTargetDragContext) {
|
if (!mTargetWidget) {
|
||||||
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
PR_LOG(sDragLm, PR_LOG_DEBUG,
|
||||||
("*** warning: IsDataFlavorSupported \
|
("*** warning: IsDataFlavorSupported \
|
||||||
called without a valid drag context!\n"));
|
called without a valid target widget!\n"));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,9 +1089,6 @@ nsDragService::IsTargetContextList(void)
|
|||||||
{
|
{
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
|
|
||||||
if (!mTargetDragContext)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
// gMimeListType drags only work for drags within a single process.
|
// gMimeListType drags only work for drags within a single process.
|
||||||
// The gtk_drag_get_source_widget() function will return NULL if the
|
// The gtk_drag_get_source_widget() function will return NULL if the
|
||||||
// source of the drag is another app, so we use it to check if a
|
// source of the drag is another app, so we use it to check if a
|
||||||
|
Loading…
Reference in New Issue
Block a user