Bug 1225923 - part 4 - fix AppendElement(nsDependentCString(...)) call in nsClipboardProxy.cpp; r=roc

I think the intent of this call is not to copy the flavor data passed
in, but to simply convert it to a friendlier nsCString container for
serializing to an IPC message.  Since we won't be retaining references
to the passed-in strings after this function returns, we can make the
elements of our temporary array actually dependent strings, rather than
creating temporary dependent strings that would need to be copied into
the array.
This commit is contained in:
Nathan Froyd 2015-11-18 10:55:41 -05:00
Родитель eba0daa4d6
Коммит dd84912fd6
1 изменённых файлов: 2 добавлений и 1 удалений

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

@ -127,8 +127,9 @@ nsClipboardProxy::HasDataMatchingFlavors(const char **aFlavorList,
*aHasType = false;
nsTArray<nsCString> types;
nsCString* t = types.AppendElements(aLength);
for (uint32_t j = 0; j < aLength; ++j) {
types.AppendElement(nsDependentCString(aFlavorList[j]));
t[j].Rebind(aFlavorList[j], nsCharTraits<char>::length(aFlavorList[j]));
}
ContentChild::GetSingleton()->SendClipboardHasType(types, aWhichClipboard, aHasType);