Bug 800200: Remove references to JSD from outside js/jsd. r=mccr8,bholley,ted,smaug

This commit is contained in:
Jim Blandy 2014-06-27 11:05:08 -07:00
parent c197a8c3f5
commit e07aaa8185
21 changed files with 6 additions and 268 deletions

View File

@ -84,10 +84,6 @@ ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
DEFINES += -DMOZ_SHARED_MOZGLUE=1
endif
ifdef MOZ_JSDEBUGGER
DEFINES += -DMOZ_JSDEBUGGER
endif
ifdef NECKO_WIFI
DEFINES += -DNECKO_WIFI
endif

View File

@ -247,9 +247,6 @@
@BINPATH@/components/inspector.xpt
@BINPATH@/components/intl.xpt
@BINPATH@/components/jar.xpt
#ifdef MOZ_JSDEBUGGER
@BINPATH@/components/jsdservice.xpt
#endif
@BINPATH@/components/jsdebugger.xpt
@BINPATH@/components/jsdownloads.xpt
@BINPATH@/components/jsinspector.xpt

View File

@ -31,11 +31,6 @@ leak:GI___strdup
### Many leaks only affect some test suites. The suite annotations are not checked.
###
# Bug 800200 - JSD1 is leaking, but it is about to be removed, so ignore it. m4
leak:jsd_CreateLock
leak:jsdScript::GetExecutableLines
leak:jsdService::ActivateDebugger
# Bug 979928 - WebRTC is leaky. m2, m3
leak:/media/mtransport/
leak:/media/webrtc/signaling/

View File

@ -3849,7 +3849,6 @@ MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING=
MOZ_FEEDS=1
MOZ_WEBAPP_RUNTIME=
MOZ_JSDEBUGGER=1
MOZ_AUTH_EXTENSION=1
MOZ_RAW=
MOZ_VORBIS=
@ -4944,15 +4943,6 @@ if test -n "$MOZ_ANDROID_BEAM"; then
AC_DEFINE(MOZ_ANDROID_BEAM)
fi
dnl ========================================================
dnl = JS Debugger XPCOM component (js/jsd)
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(jsd,
[ --disable-jsd Disable JavaScript debug library],
MOZ_JSDEBUGGER=,
MOZ_JSDEBUGGER=1)
dnl ========================================================
dnl = Enable IPDL's "expensive" unit tests
dnl ========================================================
@ -8424,7 +8414,6 @@ AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
AC_SUBST(MOZ_DEBUG_LDFLAGS)
AC_SUBST(WARNINGS_AS_ERRORS)
AC_SUBST(MOZ_EXTENSIONS)
AC_SUBST(MOZ_JSDEBUGGER)
AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
AC_SUBST(MOZ_JPROF)
AC_SUBST(MOZ_SHARK)

View File

@ -182,7 +182,7 @@ LOCAL_INCLUDES += [
'/js/xpconnect/wrappers',
]
for var in ('MOZ_JSDEBUGGER', 'MOZ_B2G_RIL', 'MOZ_B2G_FM'):
for var in ('MOZ_B2G_RIL', 'MOZ_B2G_FM'):
if CONFIG[var]:
DEFINES[var] = True

View File

@ -230,10 +230,6 @@
#include "mozilla/dom/SpeechSynthesis.h"
#endif
#ifdef MOZ_JSDEBUGGER
#include "jsdIDebuggerService.h"
#endif
#ifdef MOZ_B2G
#include "nsPISocketTransportService.h"
#endif
@ -10881,7 +10877,6 @@ nsGlobalWindow::ShowSlowScriptDialog()
// Prioritize the SlowScriptDebug interface over JSD1.
nsCOMPtr<nsISlowScriptDebugCallback> debugCallback;
bool oldDebugPossible = false;
if (hasFrame) {
const char *debugCID = "@mozilla.org/dom/slow-script-debug;1";
@ -10889,33 +10884,9 @@ nsGlobalWindow::ShowSlowScriptDialog()
if (NS_SUCCEEDED(rv)) {
debugService->GetActivationHandler(getter_AddRefs(debugCallback));
}
if (!debugCallback) {
oldDebugPossible = js::CanCallContextDebugHandler(cx);
#ifdef MOZ_JSDEBUGGER
// Get the debugger service if necessary.
if (oldDebugPossible) {
bool jsds_IsOn = false;
const char jsdServiceCtrID[] = "@mozilla.org/js/jsd/debugger-service;1";
nsCOMPtr<jsdIExecutionHook> jsdHook;
nsCOMPtr<jsdIDebuggerService> jsds = do_GetService(jsdServiceCtrID, &rv);
// Check if there's a user for the debugger service that's 'on' for us
if (NS_SUCCEEDED(rv)) {
jsds->GetDebuggerHook(getter_AddRefs(jsdHook));
jsds->GetIsOn(&jsds_IsOn);
}
// If there is a debug handler registered for this runtime AND
// ((jsd is on AND has a hook) OR (jsd isn't on (something else debugs)))
// then something useful will be done with our request to debug.
oldDebugPossible = ((jsds_IsOn && (jsdHook != nullptr)) || !jsds_IsOn);
}
#endif
}
}
bool showDebugButton = debugCallback || oldDebugPossible;
bool showDebugButton = !!debugCallback;
// Get localizable strings
nsXPIDLString title, msg, stopButton, waitButton, debugButton, neverShowDlg;
@ -11024,10 +10995,6 @@ nsGlobalWindow::ShowSlowScriptDialog()
rv = debugCallback->HandleSlowScriptDebug(this);
return NS_SUCCEEDED(rv) ? ContinueSlowScript : KillSlowScript;
}
if (oldDebugPossible) {
return js_CallContextDebugHandler(cx) ? ContinueSlowScript : KillSlowScript;
}
}
JS_ClearPendingException(cx);
return KillSlowScript;

View File

@ -70,9 +70,6 @@
#endif
#include "AccessCheck.h"
#ifdef MOZ_JSDEBUGGER
#include "jsdIDebuggerService.h"
#endif
#ifdef MOZ_LOGGING
// Force PR_LOGGING so we can get JS strict warnings even in release builds
#define FORCE_PR_LOG 1

View File

@ -4,9 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "EventListenerService.h"
#ifdef MOZ_JSDEBUGGER
#include "jsdIDebuggerService.h"
#endif
#include "mozilla/BasicEvents.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
@ -131,35 +128,6 @@ EventListenerInfo::ToSource(nsAString& aResult)
return NS_OK;
}
NS_IMETHODIMP
EventListenerInfo::GetDebugObject(nsISupports** aRetVal)
{
*aRetVal = nullptr;
#ifdef MOZ_JSDEBUGGER
nsresult rv = NS_OK;
nsCOMPtr<jsdIDebuggerService> jsd =
do_GetService("@mozilla.org/js/jsd/debugger-service;1", &rv);
NS_ENSURE_SUCCESS(rv, NS_OK);
bool isOn = false;
jsd->GetIsOn(&isOn);
NS_ENSURE_TRUE(isOn, NS_OK);
AutoSafeJSContext cx;
Maybe<JSAutoCompartment> ac;
JS::Rooted<JS::Value> v(cx);
if (GetJSVal(cx, ac, &v)) {
nsCOMPtr<jsdIValue> jsdValue;
rv = jsd->WrapValue(v, getter_AddRefs(jsdValue));
NS_ENSURE_SUCCESS(rv, rv);
jsdValue.forget(aRetVal);
}
#endif
return NS_OK;
}
NS_IMETHODIMP
EventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
uint32_t* aCount,

View File

@ -144,6 +144,3 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
LOCAL_INCLUDES += [
'/dom/wifi',
]
if CONFIG['MOZ_JSDEBUGGER']:
DEFINES['MOZ_JSDEBUGGER'] = True

View File

@ -12,7 +12,7 @@ interface nsIDOMEventTarget;
* An instance of this interface describes how an event listener
* was added to an event target.
*/
[scriptable, uuid(c4776eb7-05bc-49ce-a0ca-6213a346d53a)]
[scriptable, uuid(11ba5fd7-8db2-4b1a-9f67-342cfa11afad)]
interface nsIEventListenerInfo : nsISupports
{
/**
@ -37,12 +37,6 @@ interface nsIEventListenerInfo : nsISupports
* (for example with C++ listeners).
*/
AString toSource();
/**
* If jsdIDebuggerService is active and the listener is implemented in JS,
* this returns the listener as a jsdIValue. Otherwise null.
*/
nsISupports getDebugObject();
};
[scriptable, uuid(f6964bfb-dabe-4cab-9733-be0ee2bf8171)]

View File

@ -22,12 +22,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448602
var els, root, l2, l3;
function runTests() {
/*
Disabled due to lack of present support for JSD in JM
var jsdIDebuggerService = SpecialPowers.Ci.jsdIDebuggerService;
var jsd = SpecialPowers.Components.classes['@mozilla.org/js/jsd/debugger-service;1']
.getService(jsdIDebuggerService);
*/
els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"]
.getService(SpecialPowers.Ci.nsIEventListenerService);
@ -48,18 +42,6 @@ function runTests() {
is(SpecialPowers.unwrap(infos[0].listenerObject), root.onclick,
"Should have the right listener object (1)");
/*
var jsdOn = jsd.isOn;
if (!jsdOn) {
is(infos[0].getDebugObject(), null,
"If JSD isn't running, getDebugObject() should return null.")
jsd.on();
ok(jsd.isOn, "JSD should be running.");
}
var jsdvalue = infos[0].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
is(jsdvalue.jsType, 3, "Event listener should be a function! (1)");
*/
root.removeAttribute("onclick");
root.setAttribute("onclick", "...invalid script...");
SimpleTest.expectUncaughtException(true);
@ -84,12 +66,6 @@ function runTests() {
is(infos[0].allowsUntrusted, true, "Should allow untrusted events (2)");
is(SpecialPowers.unwrap(infos[0].listenerObject), l,
"Should have the right listener object (2)");
/*
jsdvalue = infos[0].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
is(jsdvalue.jsType, 3, "Event listener should be a function!(2)");
is(jsdvalue.getWrappedValue(), l, "Wrong JS value! (1)");
*/
is(infos[1].toSource(), "(function (e) { alert(e); })",
"Unexpected serialization (3)");
is(infos[1].type, "foo", "Wrong type (3)");
@ -98,11 +74,6 @@ function runTests() {
is(SpecialPowers.unwrap(infos[1].listenerObject), l,
"Should have the right listener object (3)");
/*
jsdvalue2 = infos[1].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
is(jsdvalue2.jsType, 3, "Event listener should be a function! (3)");
is(jsdvalue2.getWrappedValue(), l, "Wrong JS value! (2)");
*/
root.removeEventListener("foo", l, true);
root.removeEventListener("foo", l, false);
infos = els.getListenerInfoFor(root, {});
@ -142,12 +113,6 @@ function runTests() {
ok(hasDocumentInChain, "Should have document in event target chain!");
ok(hasWindowInChain, "Should have window in event target chain!");
/*
if (!jsdOn) {
jsd.off();
ok(!jsd.isOn, "JSD shouldn't be running anymore.");
}
*/
try {
els.getListenerInfoFor(null, {});

View File

@ -164,21 +164,6 @@ function gc()
}
}
function jsdgc()
{
try
{
var jsdIDebuggerService = SpecialPowers.Ci.jsdIDebuggerService;
var service = SpecialPowers.Cc['@mozilla.org/js/jsd/debugger-service;1'].
getService(jsdIDebuggerService);
service.GC();
}
catch(ex)
{
print('jsdgc: ' + ex);
}
}
function quit()
{
}

View File

@ -274,7 +274,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports
{ 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
%}
[noscript, uuid(47fbe8ff-0507-4647-9ea7-e0e1fc76c995)]
[noscript, uuid(523da588-95a4-469f-ba1b-c637c3ad4142)]
interface nsIXPConnect : nsISupports
{
%{ C++
@ -573,16 +573,6 @@ interface nsIXPConnect : nsISupports
nsIXPConnectJSObjectHolder holdObject(in JSContextPtr aJSContext,
in JSObjectPtr aObject);
/**
* When we place the browser in JS debug mode, there can't be any
* JS on the stack. This is because we currently activate debugMode
* on all scripts in the JSRuntime when the debugger is activated.
* This method will turn debug mode on or off when the context
* stack reaches zero length.
*/
[noscript] void setDebugModeWhenPossible(in boolean mode,
in boolean allowSyncDisable);
[noscript] void writeScript(in nsIObjectOutputStream aStream,
in JSContextPtr aJSContext,
in JSScriptPtr aJSScript);

View File

@ -2945,7 +2945,7 @@ nsXPCComponents_Utils::NondeterministicGetWeakMapKeys(HandleValue aMap,
return NS_OK;
}
/* void getDebugObject(); */
/* [implicit_jscontext] jsval getJSTestingFunctions(); */
NS_IMETHODIMP
nsXPCComponents_Utils::GetJSTestingFunctions(JSContext *cx,
MutableHandleValue retval)

View File

@ -1123,7 +1123,7 @@ ProcessArgs(JSContext *cx, JS::Handle<JSObject*> obj, char **argv, int argc, XPC
case 'x':
break;
case 'd':
xpc_ActivateDebugMode();
/* This used to try to turn on the debugger. */
break;
case 'f':
if (++i == argc) {

View File

@ -76,9 +76,6 @@ GENERATED_FILES = [
DEFINES['JS_THREADSAFE'] = True
if CONFIG['MOZ_JSDEBUGGER']:
DEFINES['MOZ_JSDEBUGGER'] = True
LOCAL_INCLUDES += [
'../loader',
'../wrappers',

View File

@ -21,10 +21,6 @@
#include "WrapperFactory.h"
#include "AccessCheck.h"
#ifdef MOZ_JSDEBUGGER
#include "jsdIDebuggerService.h"
#endif
#include "XPCQuickStubs.h"
#include "mozilla/dom/BindingUtils.h"
@ -57,9 +53,6 @@ nsXPConnect* nsXPConnect::gSelf = nullptr;
bool nsXPConnect::gOnceAliveNowDead = false;
uint32_t nsXPConnect::gReportAllJSExceptions = 0;
bool xpc::gDebugMode = false;
bool xpc::gDesiredDebugMode = false;
// Global cache of the default script security manager (QI'd to
// nsIScriptSecurityManager)
nsIScriptSecurityManager *nsXPConnect::gScriptSecurityManager = nullptr;
@ -1047,12 +1040,6 @@ nsXPConnect::AfterProcessNextEvent(nsIThreadInternal *aThread,
PopJSContextNoScriptContext();
// If the cx stack is empty, that means we're at the an un-nested event
// loop. This is a good time to make changes to debug mode.
if (XPCJSRuntime::Get()->GetJSContextStack()->Count() == 0) {
MOZ_ASSERT(mEventDepth == 0);
CheckForDebugMode(XPCJSRuntime::Get()->Runtime());
}
return NS_OK;
}
@ -1114,69 +1101,6 @@ nsXPConnect::UnregisterContextCallback(xpcContextCallback func)
mRuntime->RemoveContextCallback(func);
}
#ifdef MOZ_JSDEBUGGER
void
nsXPConnect::CheckForDebugMode(JSRuntime *rt)
{
if (gDebugMode == gDesiredDebugMode) {
return;
}
// This can happen if a Worker is running, but we don't have the ability to
// debug workers right now, so just return.
if (!NS_IsMainThread())
MOZ_CRASH();
AutoSafeJSContext cx;
JS_SetRuntimeDebugMode(rt, gDesiredDebugMode);
nsresult rv;
const char jsdServiceCtrID[] = "@mozilla.org/js/jsd/debugger-service;1";
nsCOMPtr<jsdIDebuggerService> jsds = do_GetService(jsdServiceCtrID, &rv);
if (NS_FAILED(rv)) {
goto fail;
}
if (!JS_SetDebugModeForAllCompartments(cx, gDesiredDebugMode))
goto fail;
if (gDesiredDebugMode) {
rv = jsds->ActivateDebugger(rt);
}
gDebugMode = gDesiredDebugMode;
return;
fail:
if (jsds)
jsds->DeactivateDebugger();
/*
* If an attempt to turn debug mode on fails, cancel the request. It's
* always safe to turn debug mode off, since DeactivateDebugger prevents
* debugger callbacks from having any effect.
*/
if (gDesiredDebugMode)
JS_SetRuntimeDebugMode(rt, false);
gDesiredDebugMode = gDebugMode = false;
}
#else //MOZ_JSDEBUGGER not defined
void
nsXPConnect::CheckForDebugMode(JSRuntime *rt)
{
gDesiredDebugMode = gDebugMode = false;
}
#endif //#ifdef MOZ_JSDEBUGGER
void
xpc_ActivateDebugMode()
{
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
nsXPConnect::XPConnect()->SetDebugModeWhenPossible(true, true);
nsXPConnect::CheckForDebugMode(rt->Runtime());
}
/* virtual */
JSContext*
nsXPConnect::GetCurrentJSContext()
@ -1319,15 +1243,6 @@ SetLocationForGlobal(JSObject *global, nsIURI *locationURI)
} // namespace xpc
NS_IMETHODIMP
nsXPConnect::SetDebugModeWhenPossible(bool mode, bool allowSyncDisable)
{
gDesiredDebugMode = mode;
if (!mode && allowSyncDisable)
CheckForDebugMode(mRuntime->Runtime());
return NS_OK;
}
NS_IMETHODIMP
nsXPConnect::NotifyDidPaint()
{

View File

@ -313,8 +313,6 @@ public:
return gReportAllJSExceptions > 0;
}
static void CheckForDebugMode(JSRuntime *rt);
protected:
virtual ~nsXPConnect();
@ -3650,9 +3648,6 @@ GetObjectScope(JSObject *obj)
// This returns null if a scope doesn't already exist.
XPCWrappedNativeScope* MaybeGetObjectScope(JSObject *obj);
extern bool gDebugMode;
extern bool gDesiredDebugMode;
extern const JSClass SafeJSContextGlobalClass;
JSObject* NewOutObject(JSContext* cx, JSObject* scope);

View File

@ -207,11 +207,6 @@ xpc_TryUnmarkWrappedGrayObject(nsISupports* aWrappedJS);
extern void
xpc_UnmarkSkippableJSHolders();
// No JS can be on the stack when this is called. Probably only useful from
// xpcshell.
void
xpc_ActivateDebugMode();
// readable string conversions, static methods and members only
class XPCStringConvert
{

View File

@ -38,7 +38,6 @@
[include:storage/test/unit/xpcshell.ini]
[include:docshell/test/unit/xpcshell.ini]
[include:js/xpconnect/tests/unit/xpcshell.ini]
[include:js/jsd/test/xpcshell.ini]
[include:security/manager/ssl/tests/unit/xpcshell.ini]
[include:toolkit/devtools/qrcode/tests/unit/xpcshell.ini]
[include:toolkit/devtools/discovery/tests/unit/xpcshell.ini]

View File

@ -58,9 +58,6 @@ if CONFIG['MOZ_PERMISSIONS']:
add_tier_dir('platform', 'rdf')
if CONFIG['MOZ_JSDEBUGGER']:
add_tier_dir('platform', 'js/jsd')
if CONFIG['MOZ_WEBRTC']:
add_tier_dir('platform', [
'media/webrtc',