mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 452762 - Make sure Geolocation callbacks run in the right JS context r/sr=jst
This commit is contained in:
parent
dda5d0de06
commit
3291d97489
@ -48,6 +48,7 @@
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -180,7 +181,18 @@ nsGeolocationRequest::Allow()
|
||||
NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
|
||||
getter_AddRefs(callbackProxy));
|
||||
|
||||
|
||||
// Ensure that the proper context is on the stack (bug 452762)
|
||||
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
|
||||
if (!stack || NS_FAILED(stack->Push(nsnull)))
|
||||
return NS_OK; // silently fail
|
||||
|
||||
callbackProxy->HandleEvent(positionError);
|
||||
|
||||
// remove the stack
|
||||
JSContext* cx;
|
||||
stack->Pop(&cx);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -207,6 +219,11 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* position)
|
||||
if (mCleared || !mAllowed)
|
||||
return;
|
||||
|
||||
// Ensure that the proper context is on the stack (bug 452762)
|
||||
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
|
||||
if (!stack || NS_FAILED(stack->Push(nsnull)))
|
||||
return; // silently fail
|
||||
|
||||
//TODO mFuzzLocation. Needs to be defined what we do here.
|
||||
if (mFuzzLocation)
|
||||
{
|
||||
@ -246,10 +263,15 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* position)
|
||||
velocity,
|
||||
time);
|
||||
mCallback->HandleEvent(somewhere);
|
||||
return;
|
||||
}
|
||||
|
||||
mCallback->HandleEvent(position);
|
||||
else
|
||||
{
|
||||
mCallback->HandleEvent(position);
|
||||
}
|
||||
|
||||
// remove the stack
|
||||
JSContext* cx;
|
||||
stack->Pop(&cx);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user