Bug 1497476 - Remove nsITransferable.kFlavorHasDataProvider. r=NeilDeakin

Depends on D8074

Differential Revision: https://phabricator.services.mozilla.com/D8075

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Schuster 2018-10-16 20:35:10 +00:00
Родитель a60ebfae5e
Коммит 1506df6b61
3 изменённых файлов: 22 добавлений и 23 удалений

Просмотреть файл

@ -1157,10 +1157,9 @@ DataTransfer::ConvertFromVariant(nsIVariant* aVariant,
nsCOMPtr<nsIFlavorDataProvider> fdp = do_QueryInterface(data);
if (fdp) {
// for flavour data providers, use kFlavorHasDataProvider (which has the
// value 0) as the length.
// For flavour data providers, use 0 as the length.
fdp.forget(aSupports);
*aLength = nsITransferable::kFlavorHasDataProvider;
*aLength = 0;
} else {
data.forget(aSupports);
*aLength = sizeof(nsISupports *);

Просмотреть файл

@ -95,8 +95,6 @@ interface nsIFlavorDataProvider : nsISupports
[scriptable, uuid(97e0c418-1c1e-4106-bad1-9fcb11dff2fe)]
interface nsITransferable : nsISupports
{
const long kFlavorHasDataProvider = 0;
/**
* Initializes a transferable object. This should be called on all
* transferable objects. Failure to do so will result in fatal assertions in

Просмотреть файл

@ -262,17 +262,18 @@ nsTransferable::GetTransferData(const char* aFlavor,
nsCOMPtr<nsISupports> dataBytes;
uint32_t len;
data.GetData(getter_AddRefs(dataBytes), &len);
if (len == kFlavorHasDataProvider && dataBytes) {
// do we have a data provider?
nsCOMPtr<nsIFlavorDataProvider> dataProvider =
do_QueryInterface(dataBytes);
if (dataProvider) {
rv = dataProvider->GetFlavorData(
this, aFlavor, getter_AddRefs(dataBytes), &len);
if (NS_FAILED(rv))
break; // the provider failed. fall into the converter code below.
// Do we have a (lazy) data provider?
if (nsCOMPtr<nsIFlavorDataProvider> dataProvider =
do_QueryInterface(dataBytes)) {
rv = dataProvider->GetFlavorData(this, aFlavor,
getter_AddRefs(dataBytes), &len);
if (NS_FAILED(rv)) {
// The provider failed, fall into the converter code below.
break;
}
}
if (dataBytes && len > 0) { // XXXmats why is zero length not ok?
*aDataLen = len;
dataBytes.forget(aData);
@ -295,17 +296,18 @@ nsTransferable::GetTransferData(const char* aFlavor,
nsCOMPtr<nsISupports> dataBytes;
uint32_t len;
data.GetData(getter_AddRefs(dataBytes), &len);
if (len == kFlavorHasDataProvider && dataBytes) {
// do we have a data provider?
nsCOMPtr<nsIFlavorDataProvider> dataProvider =
do_QueryInterface(dataBytes);
if (dataProvider) {
rv = dataProvider->GetFlavorData(
this, aFlavor, getter_AddRefs(dataBytes), &len);
if (NS_FAILED(rv))
break; // give up
// Do we have a (lazy) data provider?
if (nsCOMPtr<nsIFlavorDataProvider> dataProvider =
do_QueryInterface(dataBytes)) {
rv = dataProvider->GetFlavorData(this, aFlavor,
getter_AddRefs(dataBytes), &len);
if (NS_FAILED(rv)) {
// Give up.
break;
}
}
mFormatConv->Convert(
data.GetFlavor().get(), dataBytes, len, aFlavor, aData, aDataLen);
found = true;