Bug 933219 - Fix compartment mismatch in MobileMessageManager::Send. r=gwagner

This commit is contained in:
Blake Kaplan 2013-12-05 13:28:13 -08:00
parent 38437c12c8
commit 6ee70a7c81

View File

@ -181,10 +181,13 @@ MobileMessageManager::Send(const JS::Value& aNumber_,
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(sc);
JS::Rooted<JSObject*> global(aCx, sc->GetWindowProxy());
NS_ASSERTION(global, "Failed to get global object!");
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
JSAutoCompartment ac(aCx, global);
mozilla::Maybe<JSAutoCompartment> ac;
if (!global) {
global = sc->GetWindowProxy();
ac.construct(aCx, global);
}
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);