mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
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:
parent
eba0daa4d6
commit
dd84912fd6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user