зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1550930 part 1. Stop using [array] for nsIDroppedLinkHandler.queryLinks. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D30768 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d9bc4e00c7
Коммит
c976c9b462
|
@ -314,13 +314,9 @@ ContentAreaDropListener.prototype =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
queryLinks: function(aDataTransfer, aCount)
|
queryLinks: function(aDataTransfer)
|
||||||
{
|
{
|
||||||
let links = this._getDropLinks(aDataTransfer);
|
return this._getDropLinks(aDataTransfer);
|
||||||
if (aCount) {
|
|
||||||
aCount.value = links.length;
|
|
||||||
}
|
|
||||||
return links;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_eventTargetIsDisabled: function(aEvent)
|
_eventTargetIsDisabled: function(aEvent)
|
||||||
|
|
|
@ -97,9 +97,7 @@ interface nsIDroppedLinkHandler : nsISupports
|
||||||
* it allows the parent to verify that the child did not modify links
|
* it allows the parent to verify that the child did not modify links
|
||||||
* being dropped.
|
* being dropped.
|
||||||
*/
|
*/
|
||||||
void queryLinks(in DataTransfer aDataTransfer,
|
Array<nsIDroppedLinkItem> queryLinks(in DataTransfer aDataTransfer);
|
||||||
[optional] out unsigned long aCount,
|
|
||||||
[retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a drop event aEvent, determines the triggering principal for the
|
* Given a drop event aEvent, determines the triggering principal for the
|
||||||
|
|
|
@ -1391,42 +1391,36 @@ bool BrowserParent::QueryDropLinksForVerification() {
|
||||||
// verification array and store all links that are being dragged.
|
// verification array and store all links that are being dragged.
|
||||||
mVerifyDropLinks.Clear();
|
mVerifyDropLinks.Clear();
|
||||||
|
|
||||||
uint32_t linksCount = 0;
|
nsTArray<RefPtr<nsIDroppedLinkItem>> droppedLinkItems;
|
||||||
nsIDroppedLinkItem** droppedLinkedItems = nullptr;
|
dropHandler->QueryLinks(initialDataTransfer, droppedLinkItems);
|
||||||
dropHandler->QueryLinks(initialDataTransfer, &linksCount,
|
|
||||||
&droppedLinkedItems);
|
|
||||||
|
|
||||||
// Since the entire event is cancelled if one of the links is invalid,
|
// Since the entire event is cancelled if one of the links is invalid,
|
||||||
// we can store all links on the parent side without any prior
|
// we can store all links on the parent side without any prior
|
||||||
// validation checks.
|
// validation checks.
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
for (uint32_t i = 0; i < linksCount; i++) {
|
for (nsIDroppedLinkItem* item : droppedLinkItems) {
|
||||||
nsString tmp;
|
nsString tmp;
|
||||||
rv = droppedLinkedItems[i]->GetUrl(tmp);
|
rv = item->GetUrl(tmp);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("Failed to query url for verification");
|
NS_WARNING("Failed to query url for verification");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mVerifyDropLinks.AppendElement(tmp);
|
mVerifyDropLinks.AppendElement(tmp);
|
||||||
|
|
||||||
rv = droppedLinkedItems[i]->GetName(tmp);
|
rv = item->GetName(tmp);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("Failed to query name for verification");
|
NS_WARNING("Failed to query name for verification");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mVerifyDropLinks.AppendElement(tmp);
|
mVerifyDropLinks.AppendElement(tmp);
|
||||||
|
|
||||||
rv = droppedLinkedItems[i]->GetType(tmp);
|
rv = item->GetType(tmp);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("Failed to query type for verification");
|
NS_WARNING("Failed to query type for verification");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mVerifyDropLinks.AppendElement(tmp);
|
mVerifyDropLinks.AppendElement(tmp);
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < linksCount; i++) {
|
|
||||||
NS_IF_RELEASE(droppedLinkedItems[i]);
|
|
||||||
}
|
|
||||||
free(droppedLinkedItems);
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mVerifyDropLinks.Clear();
|
mVerifyDropLinks.Clear();
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче