diff --git a/toolkit/components/places/src/PlaceInfo.cpp b/toolkit/components/places/src/PlaceInfo.cpp index df6762570e31..5f4a9b1dd9f0 100644 --- a/toolkit/components/places/src/PlaceInfo.cpp +++ b/toolkit/components/places/src/PlaceInfo.cpp @@ -38,7 +38,8 @@ #include "PlaceInfo.h" #include "VisitInfo.h" #include "nsIURI.h" -#include "nsContentUtils.h" +#include "nsServiceManagerUtils.h" +#include "nsIXPConnect.h" namespace mozilla { namespace places { @@ -112,13 +113,23 @@ PlaceInfo::GetVisits(JSContext* aContext, JSObject* global = JS_GetGlobalForScopeChain(aContext); NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED); + static NS_DEFINE_CID(kXPConnectCID, NS_XPCONNECT_CID); + nsresult rv; + nsCOMPtr xpc(do_GetService(kXPConnectCID, &rv)); + NS_ENSURE_SUCCESS(rv, rv); + for (VisitsArray::size_type idx = 0; idx < mVisits.Length(); idx++) { - jsval wrappedVisit; - nsresult rv = nsContentUtils::WrapNative(aContext, global, mVisits[idx], - &NS_GET_IID(mozIVisitInfo), - &wrappedVisit); + nsCOMPtr wrapper; + rv = xpc->WrapNative(aContext, global, mVisits[idx], + NS_GET_IID(mozIVisitInfo), + getter_AddRefs(wrapper)); NS_ENSURE_SUCCESS(rv, rv); + JSObject* jsobj; + rv = wrapper->GetJSObject(&jsobj); + NS_ENSURE_SUCCESS(rv, rv); + jsval wrappedVisit = OBJECT_TO_JSVAL(jsobj); + JSBool rc = JS_SetElement(aContext, visits, idx, &wrappedVisit); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); }