mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 932886 - Stop doing slow getService bits in dom::GetCurrentJSStack, r=bz
This commit is contained in:
parent
eef7e42e54
commit
05466579d2
@ -16,6 +16,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "XPCWrapper.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -166,11 +167,14 @@ GetCurrentJSStack()
|
||||
JSContext* cx = nullptr;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
// We can't call nsContentUtils::ThreadsafeGetCurrentJSContext, since in
|
||||
// xpcshell nsContentUtils is never initialized, but we still need to
|
||||
// report exceptions.
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
cx = xpc->GetCurrentJSContext();
|
||||
// Note, in xpcshell nsContentUtils is never initialized, but we still need
|
||||
// to report exceptions.
|
||||
if (nsContentUtils::XPConnect()) {
|
||||
cx = nsContentUtils::XPConnect()->GetCurrentJSContext();
|
||||
} else {
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
cx = xpc->GetCurrentJSContext();
|
||||
}
|
||||
} else {
|
||||
cx = workers::GetCurrentThreadJSContext();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user