mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 865729 - Use XPConnect directly in C++ unit tests. r=gabor
This commit is contained in:
parent
4afac12af4
commit
e22d7d9f6e
@ -21,7 +21,7 @@
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "jsapi.h"
|
||||
#include "prio.h"
|
||||
|
||||
@ -505,10 +505,9 @@ int main(int argc, char** argv)
|
||||
// using the cx here without triggering a cx stack assert, so just do that
|
||||
// for now. Eventually, the whole notion of pushing and popping will just go
|
||||
// away.
|
||||
nsCOMPtr<nsIThreadJSContextStack> stack =
|
||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||
if (stack)
|
||||
cx = stack->GetSafeJSContext();
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
if (xpc)
|
||||
cx = xpc->GetSafeJSContext();
|
||||
|
||||
bool use_js = !!cx;
|
||||
JSAutoRequest req(cx);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "nsISettingsService.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
@ -153,13 +153,8 @@ TestSettingsObserver::Observe(nsISupports *aSubject,
|
||||
}
|
||||
|
||||
// Get the safe JS context.
|
||||
nsCOMPtr<nsIThreadJSContextStack> stack =
|
||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||
if (!stack) {
|
||||
CHECK_MSG(false, "Failed to get JSContextStack");
|
||||
return NS_OK;
|
||||
}
|
||||
JSContext *cx = stack->GetSafeJSContext();
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
JSContext *cx = xpc->GetSafeJSContext();
|
||||
if (!cx) {
|
||||
CHECK_MSG(false, "Failed to GetSafeJSContext");
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user