From 61b7469f457a39687bbff6cd7e95c12525fef2af Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Wed, 23 Mar 2011 10:27:51 -0700 Subject: [PATCH] Bug 640201 - If nsGeolocation::Init fails, mGeolocation is not clear and will be returned on subsequent calls. r=jst --- dom/base/nsGlobalWindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index de392ea79ef8..e8f5dc1f3130 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -10990,9 +10990,11 @@ NS_IMETHODIMP nsNavigator::GetGeolocation(nsIDOMGeoGeolocation **_retval) if (!mGeolocation) return NS_ERROR_FAILURE; - if (NS_FAILED(mGeolocation->Init(contentDOMWindow))) + if (NS_FAILED(mGeolocation->Init(contentDOMWindow))) { + mGeolocation = nsnull; return NS_ERROR_FAILURE; - + } + NS_ADDREF(*_retval = mGeolocation); return NS_OK; }