diff --git a/dom/base/nsContentAreaDragDrop.cpp b/dom/base/nsContentAreaDragDrop.cpp index 0256e9f4710e..f35346c42561 100644 --- a/dom/base/nsContentAreaDragDrop.cpp +++ b/dom/base/nsContentAreaDragDrop.cpp @@ -57,6 +57,7 @@ #include "TabParent.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/HTMLAreaElement.h" +#include "nsVariant.h" using namespace mozilla::dom; @@ -726,11 +727,9 @@ DragDataProducer::AddString(DataTransfer* aDataTransfer, const nsAString& aData, nsIPrincipal* aPrincipal) { - nsCOMPtr variant = do_CreateInstance(NS_VARIANT_CONTRACTID); - if (variant) { - variant->SetAsAString(aData); - aDataTransfer->SetDataWithPrincipal(aFlavor, variant, 0, aPrincipal); - } + nsRefPtr variant = new nsVariant(); + variant->SetAsAString(aData); + aDataTransfer->SetDataWithPrincipal(aFlavor, variant, 0, aPrincipal); } nsresult @@ -784,12 +783,10 @@ 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) { - nsCOMPtr variant = do_CreateInstance(NS_VARIANT_CONTRACTID); - if (variant) { - variant->SetAsISupports(mImage); - aDataTransfer->SetDataWithPrincipal(NS_LITERAL_STRING(kNativeImageMime), - variant, 0, principal); - } + nsRefPtr variant = new nsVariant(); + variant->SetAsISupports(mImage); + aDataTransfer->SetDataWithPrincipal(NS_LITERAL_STRING(kNativeImageMime), + variant, 0, principal); // assume the image comes from a file, and add a file promise. We // register ourselves as a nsIFlavorDataProvider, and will use the @@ -798,12 +795,10 @@ DragDataProducer::AddStringsToDataTransfer(nsIContent* aDragNode, nsCOMPtr dataProvider = new nsContentAreaDragDropDataProvider(); if (dataProvider) { - nsCOMPtr variant = do_CreateInstance(NS_VARIANT_CONTRACTID); - if (variant) { - variant->SetAsISupports(dataProvider); - aDataTransfer->SetDataWithPrincipal(NS_LITERAL_STRING(kFilePromiseMime), - variant, 0, principal); - } + nsRefPtr variant = new nsVariant(); + variant->SetAsISupports(dataProvider); + aDataTransfer->SetDataWithPrincipal(NS_LITERAL_STRING(kFilePromiseMime), + variant, 0, principal); } AddString(aDataTransfer, NS_LITERAL_STRING(kFilePromiseURLMime), diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index 42d472d5c087..f7ffa726141b 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -10,7 +10,6 @@ #include "DataTransfer.h" #include "nsIDOMDocument.h" -#include "nsIVariant.h" #include "nsISupportsPrimitives.h" #include "nsIScriptSecurityManager.h" #include "mozilla/dom/DOMStringList.h" @@ -24,6 +23,7 @@ #include "nsIScriptContext.h" #include "nsIDocument.h" #include "nsIScriptGlobalObject.h" +#include "nsVariant.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/DataTransferBinding.h" #include "mozilla/dom/Directory.h" @@ -435,12 +435,7 @@ void DataTransfer::SetData(const nsAString& aFormat, const nsAString& aData, ErrorResult& aRv) { - nsCOMPtr variant = do_CreateInstance(NS_VARIANT_CONTRACTID); - if (!variant) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); - return; - } - + nsRefPtr variant = new nsVariant(); variant->SetAsAString(aData); aRv = MozSetDataAt(aFormat, variant, 0); @@ -1350,9 +1345,7 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex) if (!data) return; - nsCOMPtr variant = do_CreateInstance(NS_VARIANT_CONTRACTID); - if (!variant) - return; + nsRefPtr variant = new nsVariant(); nsCOMPtr supportsstr = do_QueryInterface(data); if (supportsstr) { diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index eba90f613032..bb86518ca38c 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -63,6 +63,7 @@ #include "nsReadableUtils.h" #include "nsUnicharUtils.h" #include "nsLayoutUtils.h" +#include "nsVariant.h" #include "nsIDOMMutationEvent.h" #include "mozilla/ContentEvents.h" @@ -807,9 +808,7 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir) aDir->GetPath(unicodePath); if (unicodePath.IsEmpty()) // nothing to do return NS_OK; - nsCOMPtr prefValue = do_CreateInstance(NS_VARIANT_CONTRACTID); - if (!prefValue) - return NS_ERROR_OUT_OF_MEMORY; + nsRefPtr prefValue = new nsVariant(); prefValue->SetAsAString(unicodePath); // Use the document's current load context to ensure that the content pref diff --git a/dom/html/TextTrackManager.cpp b/dom/html/TextTrackManager.cpp index d4e0e8d4161d..e9fed00226ee 100644 --- a/dom/html/TextTrackManager.cpp +++ b/dom/html/TextTrackManager.cpp @@ -13,6 +13,7 @@ #include "mozilla/dom/Event.h" #include "mozilla/ClearOnShutdown.h" #include "nsComponentManagerUtils.h" +#include "nsVariant.h" #include "nsVideoFrame.h" #include "nsIFrame.h" #include "nsTArrayHelpers.h" @@ -214,8 +215,7 @@ TextTrackManager::UpdateCueDisplay() mTextTracks->UpdateAndGetShowingCues(activeCues); if (activeCues.Length() > 0) { - nsCOMPtr jsCues = - do_CreateInstance("@mozilla.org/variant;1"); + nsRefPtr jsCues = new nsVariant(); jsCues->SetAsArray(nsIDataType::VTYPE_INTERFACE, &NS_GET_IID(nsIDOMEventTarget), diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index d3cc35f6d481..7a81a59a56ef 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -85,6 +85,7 @@ #include "nsMemoryInfoDumper.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" +#include "nsVariant.h" #include "nsXULAppAPI.h" #include "nsIScriptError.h" #include "nsIConsoleService.h" @@ -2864,9 +2865,7 @@ ContentChild::RecvInvokeDragSession(nsTArray&& aTransfers, auto& items = aTransfers[i].items(); for (uint32_t j = 0; j < items.Length(); ++j) { const IPCDataTransferItem& item = items[j]; - nsCOMPtr variant = - do_CreateInstance(NS_VARIANT_CONTRACTID); - NS_ENSURE_TRUE(variant, false); + nsRefPtr variant = new nsVariant(); if (item.data().type() == IPCDataTransferData::TnsString) { const nsString& data = item.data().get_nsString(); variant->SetAsAString(data); diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 5687209eb0eb..f034e64a58a8 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -63,6 +63,7 @@ #include "nsIXULWindow.h" #include "nsIRemoteBrowser.h" #include "nsViewManager.h" +#include "nsVariant.h" #include "nsIWidget.h" #include "nsIWindowMediator.h" #include "nsIWindowWatcher.h" @@ -3541,7 +3542,7 @@ TabParent::RecvInvokeDragSession(nsTArray&& aTransfers, } mDragAreaX = aDragAreaX; mDragAreaY = aDragAreaY; - + esm->BeginTrackingRemoteDragGesture(mFrameElement); return true; @@ -3554,11 +3555,7 @@ TabParent::AddInitialDnDDataTo(DataTransfer* aDataTransfer) nsTArray& itemArray = mInitialDataTransferItems[i]; for (uint32_t j = 0; j < itemArray.Length(); ++j) { DataTransferItem& item = itemArray[j]; - nsCOMPtr variant = - do_CreateInstance(NS_VARIANT_CONTRACTID); - if (!variant) { - break; - } + nsRefPtr variant = new nsVariant(); // Special case kFilePromiseMime so that we get the right // nsIFlavorDataProvider for it. if (item.mFlavor.EqualsLiteral(kFilePromiseMime)) { diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 14414e5fde6a..2e1b3643d9f0 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -50,6 +50,7 @@ #include "Latency.h" #include "nsProxyRelease.h" #include "nsNullPrincipal.h" +#include "nsVariant.h" // For PR_snprintf #include "prprf.h" @@ -2203,7 +2204,7 @@ MediaManager::AnonymizeId(nsAString& aId, const nsACString& aOriginKey) already_AddRefed MediaManager::ToJSArray(SourceSet& aDevices) { - nsCOMPtr var = do_CreateInstance("@mozilla.org/variant;1"); + nsRefPtr var = new nsVariant(); size_t len = aDevices.Length(); if (len) { nsTArray tmp(len); diff --git a/dom/mobilemessage/DeletedMessageInfo.cpp b/dom/mobilemessage/DeletedMessageInfo.cpp index d9975f2d87d3..17b708a26b3b 100644 --- a/dom/mobilemessage/DeletedMessageInfo.cpp +++ b/dom/mobilemessage/DeletedMessageInfo.cpp @@ -69,10 +69,9 @@ DeletedMessageInfo::GetDeletedMessageIds(nsIVariant** aDeletedMessageIds) return NS_OK; } - nsresult rv; - mDeletedMessageIds = do_CreateInstance(NS_VARIANT_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); + mDeletedMessageIds = new nsVariant(); + nsresult rv; rv = mDeletedMessageIds->SetAsArray(nsIDataType::VTYPE_INT32, nullptr, length, @@ -103,10 +102,9 @@ DeletedMessageInfo::GetDeletedThreadIds(nsIVariant** aDeletedThreadIds) return NS_OK; } - nsresult rv; - mDeletedThreadIds = do_CreateInstance(NS_VARIANT_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); + mDeletedThreadIds = new nsVariant(); + nsresult rv; rv = mDeletedThreadIds->SetAsArray(nsIDataType::VTYPE_UINT64, nullptr, length, diff --git a/dom/storage/DOMStorageDBThread.cpp b/dom/storage/DOMStorageDBThread.cpp index 27ac7a2ecc14..c04f9f0025db 100644 --- a/dom/storage/DOMStorageDBThread.cpp +++ b/dom/storage/DOMStorageDBThread.cpp @@ -20,7 +20,7 @@ #include "mozIStorageValueArray.h" #include "mozIStorageFunction.h" #include "nsIObserverService.h" -#include "nsIVariant.h" +#include "nsVariant.h" #include "mozilla/IOInterposer.h" #include "mozilla/Services.h" @@ -403,10 +403,7 @@ nsReverseStringSQLFunction::OnFunctionCall( nsAutoCString result; ReverseString(stringToReverse, result); - nsCOMPtr outVar(do_CreateInstance( - NS_VARIANT_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - + nsRefPtr outVar(new nsVariant()); rv = outVar->SetAsAUTF8String(result); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/system/gonk/mozstumbler/UploadStumbleRunnable.cpp b/dom/system/gonk/mozstumbler/UploadStumbleRunnable.cpp index 963109cb5397..1d1b825dd440 100644 --- a/dom/system/gonk/mozstumbler/UploadStumbleRunnable.cpp +++ b/dom/system/gonk/mozstumbler/UploadStumbleRunnable.cpp @@ -10,9 +10,9 @@ #include "nsIInputStream.h" #include "nsIScriptSecurityManager.h" #include "nsIURLFormatter.h" -#include "nsIVariant.h" #include "nsIXMLHttpRequest.h" #include "nsNetUtil.h" +#include "nsVariant.h" UploadStumbleRunnable::UploadStumbleRunnable(nsIInputStream* aUploadData) : mUploadInputStream(aUploadData) @@ -34,8 +34,7 @@ nsresult UploadStumbleRunnable::Upload() { nsresult rv; - nsCOMPtr variant = do_CreateInstance("@mozilla.org/variant;1", &rv); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr variant = new nsVariant(); rv = variant->SetAsISupports(mUploadInputStream); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index fd733ae0f9e2..23336e6973c6 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -9,7 +9,6 @@ #include "nsIDOMEvent.h" #include "nsIDOMEventListener.h" #include "nsIRunnable.h" -#include "nsIVariant.h" #include "nsIXMLHttpRequest.h" #include "nsIXPConnect.h" @@ -24,6 +23,7 @@ #include "nsFormData.h" #include "nsJSUtils.h" #include "nsThreadUtils.h" +#include "nsVariant.h" #include "RuntimeService.h" #include "WorkerPrivate.h" @@ -1527,9 +1527,7 @@ SendRunnable::MainThreadRun() } } else { - nsCOMPtr wvariant = - do_CreateInstance(NS_VARIANT_CONTRACTID); - NS_ENSURE_TRUE(wvariant, NS_ERROR_UNEXPECTED); + nsRefPtr wvariant = new nsVariant(); if (NS_FAILED(wvariant->SetAsAString(mStringBody))) { MOZ_ASSERT(false, "This should never fail!"); diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index f122e501e418..721dc7e83316 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -34,6 +34,7 @@ #include "nsIScriptSecurityManager.h" #include "nsJSUtils.h" #include "nsIXPConnect.h" +#include "nsVariant.h" #include "mozilla/dom/DocumentFragment.h" #include "mozilla/dom/XSLTProcessorBinding.h" @@ -845,9 +846,7 @@ txMozillaXSLTProcessor::SetParameter(const nsAString & aNamespaceURI, rv = xpathResult->Clone(getter_AddRefs(clone)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr variant = - do_CreateInstance("@mozilla.org/variant;1", &rv); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr variant = new nsVariant(); rv = variant->SetAsISupports(clone); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp b/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp index 52b049690bcd..363e7d4ca1ea 100644 --- a/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp +++ b/dom/xul/templates/nsXULTemplateQueryProcessorStorage.cpp @@ -9,7 +9,7 @@ #include "nsUnicharUtils.h" #include "nsArrayUtils.h" -#include "nsIVariant.h" +#include "nsVariant.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIURI.h" @@ -110,7 +110,7 @@ nsXULTemplateResultSetStorage::FillColumnValues(nsCOMArray& aArray) int32_t count = mColumnNames.Count(); for (int32_t c = 0; c < count; c++) { - nsCOMPtr value = do_CreateInstance("@mozilla.org/variant;1"); + nsRefPtr value = new nsVariant(); int32_t type; mStatement->GetTypeOfIndex(c, &type); diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSpellCheck.cpp index f20a66f9e538..c47d7d59f962 100644 --- a/editor/composer/nsEditorSpellCheck.cpp +++ b/editor/composer/nsEditorSpellCheck.cpp @@ -35,7 +35,7 @@ #include "nsITextServicesDocument.h" // for nsITextServicesDocument #include "nsITextServicesFilter.h" // for nsITextServicesFilter #include "nsIURI.h" // for nsIURI -#include "nsIVariant.h" // for nsIWritableVariant, etc +#include "nsVariant.h" // for nsIWritableVariant, etc #include "nsLiteralString.h" // for NS_LITERAL_STRING, etc #include "nsMemory.h" // for nsMemory #include "nsRange.h" @@ -201,8 +201,7 @@ StoreCurrentDictionary(nsIEditor* aEditor, const nsAString& aDictionary) rv = docUri->GetSpec(docUriSpec); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr prefValue = do_CreateInstance(NS_VARIANT_CONTRACTID); - NS_ENSURE_TRUE(prefValue, NS_ERROR_OUT_OF_MEMORY); + nsRefPtr prefValue = new nsVariant(); prefValue->SetAsAString(aDictionary); nsCOMPtr contentPrefService = diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 3b8b1cbc40da..f15bc68916eb 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -44,6 +44,7 @@ #include "nsContainerFrame.h" #include "nsView.h" #include "nsViewManager.h" +#include "nsVariant.h" #include "nsWidgetsCID.h" #include "nsBoxFrame.h" #include "nsIURL.h" @@ -4635,10 +4636,7 @@ nsTreeBodyFrame::FireRowCountChangedEvent(int32_t aIndex, int32_t aCount) // Set 'count' data - the number of changed rows. propBag->SetPropertyAsInt32(NS_LITERAL_STRING("count"), aCount); - nsCOMPtr detailVariant( - do_CreateInstance("@mozilla.org/variant;1")); - if (!detailVariant) - return; + nsRefPtr detailVariant(new nsVariant()); detailVariant->SetAsISupports(propBag); treeEvent->InitCustomEvent(NS_LITERAL_STRING("TreeRowCountChanged"), @@ -4707,10 +4705,7 @@ nsTreeBodyFrame::FireInvalidateEvent(int32_t aStartRowIdx, int32_t aEndRowIdx, endColIdx); } - nsCOMPtr detailVariant( - do_CreateInstance("@mozilla.org/variant;1")); - if (!detailVariant) - return; + nsRefPtr detailVariant(new nsVariant()); detailVariant->SetAsISupports(propBag); treeEvent->InitCustomEvent(NS_LITERAL_STRING("TreeInvalidated"), diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index 67832cc227c8..eab128bedbc8 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -18,6 +18,7 @@ #include "nsPlacesIndexes.h" #include "nsPlacesTriggers.h" #include "nsPlacesMacros.h" +#include "nsVariant.h" #include "SQLFunctions.h" #include "Helpers.h" @@ -420,9 +421,7 @@ NS_IMETHODIMP DatabaseShutdown::GetState(nsIPropertyBag** aState) if (NS_WARN_IF(NS_FAILED(rv))) return rv; // Put `mState` in field `progress` - nsCOMPtr progress = - do_CreateInstance(NS_VARIANT_CONTRACTID, &rv); - if (NS_WARN_IF(NS_FAILED(rv))) return rv; + nsRefPtr progress = new nsVariant(); rv = progress->SetAsUint8(mState); if (NS_WARN_IF(NS_FAILED(rv))) return rv; @@ -440,9 +439,7 @@ NS_IMETHODIMP DatabaseShutdown::GetState(nsIPropertyBag** aState) return NS_OK; } - nsCOMPtr barrier = - do_CreateInstance(NS_VARIANT_CONTRACTID, &rv); - if (NS_WARN_IF(NS_FAILED(rv))) return rv; + nsRefPtr barrier = new nsVariant(); rv = barrier->SetAsInterface(NS_GET_IID(nsIPropertyBag), barrierState); if (NS_WARN_IF(NS_FAILED(rv))) return rv; diff --git a/toolkit/components/places/SQLFunctions.cpp b/toolkit/components/places/SQLFunctions.cpp index ad14ac97ede4..6a38d9b69ea3 100644 --- a/toolkit/components/places/SQLFunctions.cpp +++ b/toolkit/components/places/SQLFunctions.cpp @@ -16,6 +16,7 @@ #include "nsPrintfCString.h" #include "nsNavHistory.h" #include "mozilla/Likely.h" +#include "nsVariant.h" using namespace mozilla::storage; @@ -703,9 +704,7 @@ namespace places { nsAutoString src; aArguments->GetString(0, src); - nsCOMPtr result = - do_CreateInstance("@mozilla.org/variant;1"); - NS_ENSURE_STATE(result); + nsRefPtr result = new nsVariant(); if (src.Length()>1) { src.Truncate(src.Length() - 1); @@ -761,9 +760,7 @@ namespace places { nsAutoString src; aArguments->GetString(0, src); - nsCOMPtr result = - do_CreateInstance("@mozilla.org/variant;1"); - NS_ENSURE_STATE(result); + nsRefPtr result = new nsVariant(); if (StringBeginsWith(src, NS_LITERAL_STRING("http://"))) src.Cut(0, 7); @@ -835,9 +832,7 @@ namespace places { navHistory->DispatchFrecencyChangedNotification(spec, newFrecency, guid, hidden, lastVisitDate); - nsCOMPtr result = - do_CreateInstance("@mozilla.org/variant;1"); - NS_ENSURE_STATE(result); + nsRefPtr result = new nsVariant(); rv = result->SetAsInt32(newFrecency); NS_ENSURE_SUCCESS(rv, rv); result.forget(_result); diff --git a/toolkit/components/places/nsNavHistoryQuery.cpp b/toolkit/components/places/nsNavHistoryQuery.cpp index 936a53590b0c..04b21ca4179e 100644 --- a/toolkit/components/places/nsNavHistoryQuery.cpp +++ b/toolkit/components/places/nsNavHistoryQuery.cpp @@ -18,6 +18,7 @@ #include "nsNetUtil.h" #include "nsTArray.h" #include "prprf.h" +#include "nsVariant.h" using namespace mozilla; @@ -1130,13 +1131,11 @@ NS_IMETHODIMP nsNavHistoryQuery::GetTags(nsIVariant **aTags) { NS_ENSURE_ARG_POINTER(aTags); - nsresult rv; - nsCOMPtr out = do_CreateInstance(NS_VARIANT_CONTRACTID, - &rv); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr out = new nsVariant(); uint32_t arrayLen = mTags.Length(); + nsresult rv; if (arrayLen == 0) rv = out->SetAsEmptyArray(); else { diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 7666623fb298..6ea803e1c85a 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -11,7 +11,7 @@ #include "nsAppRunner.h" #include "nsIWritablePropertyBag.h" #include "nsIFile.h" -#include "nsIVariant.h" +#include "nsVariant.h" #include "nsCOMPtr.h" #include "nsString.h" #include "prproces.h" @@ -691,12 +691,7 @@ SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir) return; } - nsCOMPtr variant = - do_CreateInstance("@mozilla.org/variant;1", &rv); - if (NS_FAILED(rv)) { - return; - } - + nsRefPtr variant = new nsVariant(); rv = variant->SetAsACString(osApplyToDir); if (NS_FAILED(rv)) { return; diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index eaafa1abecfc..184b631c6b69 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -7,7 +7,6 @@ #include "nsArrayEnumerator.h" #include "nsCOMArray.h" #include "nsIFile.h" -#include "nsIVariant.h" #include "nsMIMEInfoWin.h" #include "nsNetUtil.h" #include @@ -22,6 +21,7 @@ #include "nsOSHelperAppService.h" #include "nsUnicharUtils.h" #include "nsITextToSubURI.h" +#include "nsVariant.h" #define RUNDLL32_EXE L"\\rundll32.exe" @@ -172,15 +172,13 @@ nsMIMEInfoWin::GetEnumerator(nsISimpleEnumerator* *_retval) static nsresult GetIconURLVariant(nsIFile* aApplication, nsIVariant* *_retval) { - nsresult rv = CallCreateInstance("@mozilla.org/variant;1", _retval); - if (NS_FAILED(rv)) - return rv; nsAutoCString fileURLSpec; NS_GetURLSpecFromFile(aApplication, fileURLSpec); nsAutoCString iconURLSpec; iconURLSpec.AssignLiteral("moz-icon://"); iconURLSpec += fileURLSpec; - nsCOMPtr writable(do_QueryInterface(*_retval)); + nsRefPtr writable(new nsVariant()); writable->SetAsAUTF8String(iconURLSpec); + writable.forget(_retval); return NS_OK; }