зеркало из https://github.com/mozilla/gecko-dev.git
Bug 627474 - Part 2: Use nsIXPConnect::WrapNative directly in order to avoid having to link in libgklayout in non-libxul builds; r=bzbarsky a=bustage
--HG-- extra : rebase_source : 58c2f6e6bc3a8fd1070732a9b27d780739afc7f7
This commit is contained in:
Родитель
aa6e9c5442
Коммит
57bd111b18
|
@ -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);
|
||||
|
||||
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);
|
||||
static NS_DEFINE_CID(kXPConnectCID, NS_XPCONNECT_CID);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXPConnect> xpc(do_GetService(kXPConnectCID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (VisitsArray::size_type idx = 0; idx < mVisits.Length(); idx++) {
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> 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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче