Bug 1210591, part 1 - Use nsVariantCC in various places. r=smaug

Most of these will end up in DataTransfer:mItems, so this is needed
for it to do anything useful.
This commit is contained in:
Andrew McCreight 2015-10-09 10:24:23 -07:00
parent bf8e782bb7
commit dc667287f6
8 changed files with 12 additions and 11 deletions

View File

@ -727,7 +727,7 @@ DragDataProducer::AddString(DataTransfer* aDataTransfer,
const nsAString& aData,
nsIPrincipal* aPrincipal)
{
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
variant->SetAsAString(aData);
aDataTransfer->SetDataWithPrincipal(aFlavor, variant, 0, aPrincipal);
}
@ -783,7 +783,7 @@ DragDataProducer::AddStringsToDataTransfer(nsIContent* aDragNode,
// a new flavor so as not to confuse anyone who is really registered
// for image/gif or image/jpg.
if (mImage) {
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
variant->SetAsISupports(mImage);
aDataTransfer->SetDataWithPrincipal(NS_LITERAL_STRING(kNativeImageMime),
variant, 0, principal);
@ -795,7 +795,7 @@ DragDataProducer::AddStringsToDataTransfer(nsIContent* aDragNode,
nsCOMPtr<nsIFlavorDataProvider> dataProvider =
new nsContentAreaDragDropDataProvider();
if (dataProvider) {
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
variant->SetAsISupports(dataProvider);
aDataTransfer->SetDataWithPrincipal(NS_LITERAL_STRING(kFilePromiseMime),
variant, 0, principal);

View File

@ -563,7 +563,7 @@ nsTimeout::HasRefCntOne()
static already_AddRefed<nsIVariant>
CreateVoidVariant()
{
nsRefPtr<nsVariant> writable = new nsVariant();
nsRefPtr<nsVariantCC> writable = new nsVariantCC();
writable->SetAsVoid();
return writable.forget();
}

View File

@ -435,7 +435,7 @@ void
DataTransfer::SetData(const nsAString& aFormat, const nsAString& aData,
ErrorResult& aRv)
{
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
variant->SetAsAString(aData);
aRv = MozSetDataAt(aFormat, variant, 0);
@ -1345,7 +1345,7 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
if (!data)
return;
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
nsCOMPtr<nsISupportsString> supportsstr = do_QueryInterface(data);
if (supportsstr) {

View File

@ -808,7 +808,7 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
aDir->GetPath(unicodePath);
if (unicodePath.IsEmpty()) // nothing to do
return NS_OK;
nsRefPtr<nsVariant> prefValue = new nsVariant();
nsRefPtr<nsVariantCC> prefValue = new nsVariantCC();
prefValue->SetAsAString(unicodePath);
// Use the document's current load context to ensure that the content pref

View File

@ -215,7 +215,7 @@ TextTrackManager::UpdateCueDisplay()
mTextTracks->UpdateAndGetShowingCues(activeCues);
if (activeCues.Length() > 0) {
nsRefPtr<nsVariant> jsCues = new nsVariant();
nsRefPtr<nsVariantCC> jsCues = new nsVariantCC();
jsCues->SetAsArray(nsIDataType::VTYPE_INTERFACE,
&NS_GET_IID(nsIDOMEventTarget),

View File

@ -2877,7 +2877,7 @@ ContentChild::RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
auto& items = aTransfers[i].items();
for (uint32_t j = 0; j < items.Length(); ++j) {
const IPCDataTransferItem& item = items[j];
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
if (item.data().type() == IPCDataTransferData::TnsString) {
const nsString& data = item.data().get_nsString();
variant->SetAsAString(data);

View File

@ -3588,7 +3588,7 @@ TabParent::AddInitialDnDDataTo(DataTransfer* aDataTransfer)
nsTArray<DataTransferItem>& itemArray = mInitialDataTransferItems[i];
for (uint32_t j = 0; j < itemArray.Length(); ++j) {
DataTransferItem& item = itemArray[j];
nsRefPtr<nsVariant> variant = new nsVariant();
nsRefPtr<nsVariantCC> variant = new nsVariantCC();
// Special case kFilePromiseMime so that we get the right
// nsIFlavorDataProvider for it.
if (item.mFlavor.EqualsLiteral(kFilePromiseMime)) {

View File

@ -2204,7 +2204,8 @@ MediaManager::AnonymizeId(nsAString& aId, const nsACString& aOriginKey)
already_AddRefed<nsIWritableVariant>
MediaManager::ToJSArray(SourceSet& aDevices)
{
nsRefPtr<nsVariant> var = new nsVariant();
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<nsVariantCC> var = new nsVariantCC();
size_t len = aDevices.Length();
if (len) {
nsTArray<nsIMediaDevice*> tmp(len);