Bug 800200: Remove references to JSD from outside js/jsd. r=mccr8,bholley,ted,smaug
authorJim Blandy <jimb@mozilla.com>
Fri, 27 Jun 2014 11:05:08 -0700
changeset 213182 c357bd774c476fc94b6a3136b502d9c6e31ccbb8
parent 213181 d75a551eb075543d92045f8189a2fd28674c6428
child 213183 f508e26a0c805bce84106122768d079951978c68
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, bholley, ted, smaug
bugs800200
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 800200: Remove references to JSD from outside js/jsd. r=mccr8,bholley,ted,smaug
browser/installer/Makefile.in
browser/installer/package-manifest.in
build/sanitizers/lsan_suppressions.txt
configure.in
dom/base/moz.build
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/events/EventListenerService.cpp
dom/events/moz.build
dom/events/nsIEventListenerService.idl
dom/events/test/test_bug448602.html
js/src/tests/browser.js
js/xpconnect/idl/nsIXPConnect.idl
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCShellImpl.cpp
js/xpconnect/src/moz.build
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/src/xpcpublic.h
testing/xpcshell/xpcshell_android.ini
toolkit/toolkit.mozbuild
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -79,20 +79,16 @@ ifdef MOZ_NO_DEBUG_RTL
 DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
 endif
 endif
 
 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
 
 ifdef GKMEDIAS_SHARED_LIBRARY
 DEFINES += -DGKMEDIAS_SHARED_LIBRARY
 endif
 
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -242,19 +242,16 @@
 @BINPATH@/components/html5.xpt
 @BINPATH@/components/htmlparser.xpt
 @BINPATH@/components/identity.xpt
 @BINPATH@/components/imglib2.xpt
 @BINPATH@/components/imgicon.xpt
 @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
 @BINPATH@/components/layout_base.xpt
 #ifdef NS_PRINTING
 @BINPATH@/components/layout_printing.xpt
 #endif
 @BINPATH@/components/layout_xul_tree.xpt
--- a/build/sanitizers/lsan_suppressions.txt
+++ b/build/sanitizers/lsan_suppressions.txt
@@ -26,21 +26,16 @@ leak:libfontconfig.so
 leak:GI___strdup
 # The symbol is really __GI___strdup, but if you have the leading _, it doesn't suppress it.
 
 
 ###
 ### 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/
 
 # Bug 981195 - Small leak in the parser. m4
 leak:TypeCompartment::fixObjectType
 
 # Bug 982111 - WebM is leaking. m1
--- a/configure.in
+++ b/configure.in
@@ -3844,17 +3844,16 @@ dnl ====================================
 MOZ_ARG_HEADER(Application)
 
 ENABLE_TESTS=1
 ENABLE_SYSTEM_EXTENSION_DIRS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_FEEDS=1
 MOZ_WEBAPP_RUNTIME=
-MOZ_JSDEBUGGER=1
 MOZ_AUTH_EXTENSION=1
 MOZ_RAW=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
 MOZ_OPUS=1
@@ -4940,25 +4939,16 @@ fi
 dnl ========================================================
 dnl = Enable NFC permission on Android
 dnl ========================================================
 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 ========================================================
 MOZ_IPDL_TESTS=
 
 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
 [  --enable-ipdl-tests     Enable expensive IPDL tests],
     MOZ_IPDL_TESTS=1,
     MOZ_IPDL_TESTS=)
@@ -8419,17 +8409,16 @@ AC_SUBST(MOZ_PREF_EXTENSIONS)
 AC_SUBST(MOZ_JS_LIBS)
 AC_SUBST(MOZ_DEBUG)
 AC_SUBST(MOZ_DEBUG_SYMBOLS)
 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
 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)
 AC_SUBST(MOZ_INSTRUMENTS)
 AC_SUBST(MOZ_CALLGRIND)
 AC_SUBST(MOZ_VTUNE)
 AC_SUBST(MOZ_PROFILING)
 AC_SUBST(LIBICONV)
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -177,14 +177,14 @@ include('/ipc/chromium/chromium-config.m
 
 FINAL_LIBRARY = 'gklayout'
 
 LOCAL_INCLUDES += [
     '/js/xpconnect/src',
     '/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
 
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
     DEFINES['HAVE_SIDEBAR'] = True
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -225,20 +225,16 @@
 #ifdef HAVE_SIDEBAR
 #include "mozilla/dom/ExternalBinding.h"
 #endif
 
 #ifdef MOZ_WEBSPEECH
 #include "mozilla/dom/SpeechSynthesis.h"
 #endif
 
-#ifdef MOZ_JSDEBUGGER
-#include "jsdIDebuggerService.h"
-#endif
-
 #ifdef MOZ_B2G
 #include "nsPISocketTransportService.h"
 #endif
 
 // Apple system headers seem to have a check() macro.  <sigh>
 #ifdef check
 class nsIScriptTimeoutHandler;
 #undef check
@@ -10876,51 +10872,26 @@ nsGlobalWindow::ShowSlowScriptDialog()
 
   // Check if we should offer the option to debug
   JS::AutoFilename filename;
   unsigned lineno;
   bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
 
   // Prioritize the SlowScriptDebug interface over JSD1.
   nsCOMPtr<nsISlowScriptDebugCallback> debugCallback;
-  bool oldDebugPossible = false;
 
   if (hasFrame) {
     const char *debugCID = "@mozilla.org/dom/slow-script-debug;1";
     nsCOMPtr<nsISlowScriptDebug> debugService = do_GetService(debugCID, &rv);
     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;
 
   rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                           "KillScriptTitle",
                                           title);
 
@@ -11019,20 +10990,16 @@ nsGlobalWindow::ShowSlowScriptDialog()
   if (NS_SUCCEEDED(rv) && (buttonPressed == 0)) {
     return neverShowDlgChk ? AlwaysContinueSlowScript : ContinueSlowScript;
   }
   if (buttonPressed == 2) {
     if (debugCallback) {
       rv = debugCallback->HandleSlowScriptDebug(this);
       return NS_SUCCEEDED(rv) ? ContinueSlowScript : KillSlowScript;
     }
-
-    if (oldDebugPossible) {
-      return js_CallContextDebugHandler(cx) ? ContinueSlowScript : KillSlowScript;
-    }
   }
   JS_ClearPendingException(cx);
   return KillSlowScript;
 }
 
 uint32_t
 nsGlobalWindow::FindInsertionIndex(IdleObserverHolder* aIdleObserver)
 {
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -65,19 +65,16 @@
 #include "nsJSPrincipals.h"
 
 #ifdef XP_MACOSX
 // AssertMacros.h defines 'check' and conflicts with AccessCheck.h
 #undef check
 #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
 #endif
 #include "prlog.h"
 #include "prthread.h"
 
 #include "mozilla/Preferences.h"
--- a/dom/events/EventListenerService.cpp
+++ b/dom/events/EventListenerService.cpp
@@ -1,17 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * 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"
 #include "mozilla/JSEventHandler.h"
 #include "mozilla/Maybe.h"
 #include "nsCOMArray.h"
 #include "nsCxPusher.h"
 #include "nsDOMClassInfoID.h"
@@ -127,45 +124,16 @@ EventListenerInfo::ToSource(nsAString& a
         aResult.Assign(depStr);
       }
     }
   }
   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,
                                          nsIEventListenerInfo*** aOutArray)
 {
   NS_ENSURE_ARG_POINTER(aEventTarget);
   *aCount = 0;
   *aOutArray = nullptr;
   nsCOMArray<nsIEventListenerInfo> listenerInfos;
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -139,11 +139,8 @@ LOCAL_INCLUDES += [
     '/layout/xul',
     '/layout/xul/tree/',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     LOCAL_INCLUDES += [
         '/dom/wifi',
     ]
-
-if CONFIG['MOZ_JSDEBUGGER']:
-    DEFINES['MOZ_JSDEBUGGER'] = True
--- a/dom/events/nsIEventListenerService.idl
+++ b/dom/events/nsIEventListenerService.idl
@@ -7,17 +7,17 @@
 
 interface nsIDOMEventListener;
 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
 {
   /**
    * The type of the event for which the listener was added.
    * Null if the listener is for all the events.
    */
   readonly attribute AString type;
   readonly attribute boolean capturing;
@@ -32,22 +32,16 @@ interface nsIEventListenerInfo : nsISupp
   readonly attribute jsval listenerObject;
 
   /**
    * Tries to serialize event listener to a string.
    * Returns null if serialization isn't possible
    * (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)]
 interface nsIEventListenerService : nsISupports
 {
   /**
    * Returns an array of nsIEventListenerInfo objects.
    * If aEventTarget doesn't have any listeners, this returns null.
--- a/dom/events/test/test_bug448602.html
+++ b/dom/events/test/test_bug448602.html
@@ -17,22 +17,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">          
 <script type="application/javascript">
 
 /** Test for Bug 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);
 
   // Event listener info tests
   root = document.getElementById("testroot");
   var infos = els.getListenerInfoFor(root, {});
   is(infos.length, 0, "Element shouldn't have listeners (1)");
 
@@ -43,28 +37,16 @@ function runTests() {
   is(infos[0].toSource(), 'function onclick(event) {\n' + listenerSource + '\n}',
      "Unexpected serialization (1)");
   is(infos[0].type, "click", "Wrong type (1)");
   is(infos[0].capturing, false, "Wrong phase (1)");
   is(infos[0].allowsUntrusted, true, "Should allow untrusted events (1)");
   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);
   infos = els.getListenerInfoFor(root, {});
   SimpleTest.expectUncaughtException(false);
   is(infos.length, 1);
   is(infos[0].listenerObject, null);
 
@@ -79,35 +61,24 @@ function runTests() {
   is(infos.length, 2, "Element should have listeners (2)");
   is(infos[0].toSource(), "(function (e) { alert(e); })",
      "Unexpected serialization (2)");
   is(infos[0].type, "foo", "Wrong type (2)");
   is(infos[0].capturing, true, "Wrong phase (2)");
   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)");
   is(infos[1].capturing, false, "Wrong phase (3)");
   is(infos[1].allowsUntrusted, false, "Shouldn't allow untrusted events (1)");
   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, {});
   is(infos.length, 0, "Element shouldn't have listeners (3)");
 
   root.onclick = l;
   infos = els.getListenerInfoFor(root, {});
   is(infos.length, 1, "Element should have listeners (3)");
@@ -137,22 +108,16 @@ function runTests() {
       hasDocumentInChain = true;
     } else if (SpecialPowers.compare(chain[i], window)) {
       hasWindowInChain = true;
     }
   }
 
   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, {});
     ok(false, "Should have thrown an exception.");
   } catch (ex) {
     ok(true, "We should be still running.");
   }
   setTimeout(testAllListener, 0);
--- a/js/src/tests/browser.js
+++ b/js/src/tests/browser.js
@@ -159,31 +159,16 @@ function gc()
     SpecialPowers.forceGC();
   }
   catch(ex)
   {
     print('gc: ' + ex);
   }
 }
 
-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()
 {
 }
 
 function options(aOptionName)
 {
   // return value of options() is a comma delimited list
   // of the previously set values
--- a/js/xpconnect/idl/nsIXPConnect.idl
+++ b/js/xpconnect/idl/nsIXPConnect.idl
@@ -269,17 +269,17 @@ interface nsIXPCFunctionThisTranslator :
 %{ C++
 // For use with the service manager
 // {CB6593E0-F9B2-11d2-BDD6-000064657374}
 #define NS_XPCONNECT_CID \
 { 0xcb6593e0, 0xf9b2, 0x11d2, \
     { 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++
   NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCONNECT_CID)
 %}
 
     /**
      * Initializes classes on a global object that has already been created.
@@ -568,26 +568,16 @@ interface nsIXPConnect : nsISupports
 
     /**
      * Creates a JS object holder around aObject that will hold the object
      * alive for as long as the holder stays alive.
      */
     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);
 
     [noscript] JSScriptPtr readScript(in nsIObjectInputStream aStream,
                                       in JSContextPtr aJSContext);
 
     [noscript] void writeFunction(in nsIObjectOutputStream aStream,
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2940,17 +2940,17 @@ nsXPCComponents_Utils::NondeterministicG
     RootedObject objRet(aCx);
     RootedObject mapObj(aCx, &aMap.toObject());
     if (!JS_NondeterministicGetWeakMapKeys(aCx, mapObj, &objRet))
         return NS_ERROR_OUT_OF_MEMORY;
      aKeys.set(objRet ? ObjectValue(*objRet) : UndefinedValue());
     return NS_OK;
 }
 
-/* void getDebugObject(); */
+/* [implicit_jscontext] jsval getJSTestingFunctions(); */
 NS_IMETHODIMP
 nsXPCComponents_Utils::GetJSTestingFunctions(JSContext *cx,
                                              MutableHandleValue retval)
 {
     JSObject *obj = js::GetTestingFunctions(cx);
     if (!obj)
         return NS_ERROR_XPC_JAVASCRIPT_ERROR;
     retval.setObject(*obj);
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -1118,17 +1118,17 @@ ProcessArgs(JSContext *cx, JS::Handle<JS
             reportWarnings = false;
             break;
         case 'w':
             reportWarnings = true;
             break;
         case 'x':
             break;
         case 'd':
-            xpc_ActivateDebugMode();
+            /* This used to try to turn on the debugger. */
             break;
         case 'f':
             if (++i == argc) {
                 return usage();
             }
             Process(cx, obj, argv[i], false);
             /*
              * XXX: js -f foo.js should interpret foo.js and then
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -71,19 +71,16 @@ FINAL_LIBRARY = 'gklayout'
 GENERATED_FILES = [
     'dom_quickstubs.h',
     'GeneratedEventClasses.h',
     'GeneratedEvents.h',
 ]
 
 DEFINES['JS_THREADSAFE'] = True
 
-if CONFIG['MOZ_JSDEBUGGER']:
-    DEFINES['MOZ_JSDEBUGGER'] = True
-
 LOCAL_INCLUDES += [
     '../loader',
     '../wrappers',
     '/caps/include',
     '/content/base/public',
     '/content/base/src',
     '/content/html/content/src',
     '/content/html/document/src',
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -16,20 +16,16 @@
 #include "js/OldDebugAPI.h"
 #include "nsJSEnvironment.h"
 #include "nsThreadUtils.h"
 #include "nsDOMJSUtils.h"
 
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 
-#ifdef MOZ_JSDEBUGGER
-#include "jsdIDebuggerService.h"
-#endif
-
 #include "XPCQuickStubs.h"
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/PromiseBinding.h"
 #include "mozilla/dom/TextDecoderBinding.h"
 #include "mozilla/dom/TextEncoderBinding.h"
 #include "mozilla/dom/DOMErrorBinding.h"
@@ -52,19 +48,16 @@ NS_IMPL_ISUPPORTS(nsXPConnect,
                   nsISupportsWeakReference,
                   nsIThreadObserver,
                   nsIJSRuntimeService)
 
 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;
 
 const char XPC_CONTEXT_STACK_CONTRACTID[] = "@mozilla.org/js/xpc/ContextStack;1";
 const char XPC_RUNTIME_CONTRACTID[]       = "@mozilla.org/js/xpc/RuntimeService;1";
 const char XPC_EXCEPTION_CONTRACTID[]     = "@mozilla.org/js/xpc/Exception;1";
 const char XPC_CONSOLE_CONTRACTID[]       = "@mozilla.org/consoleservice;1";
@@ -1042,22 +1035,16 @@ nsXPConnect::AfterProcessNextEvent(nsITh
 
     // Call cycle collector occasionally.
     MOZ_ASSERT(NS_IsMainThread());
     nsJSContext::MaybePokeCC();
     nsDOMMutationObserver::HandleMutations();
 
     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;
 }
 
 NS_IMETHODIMP
 nsXPConnect::OnDispatchedEvent(nsIThreadInternal* aThread)
 {
     NS_NOTREACHED("Why tell us?");
     return NS_ERROR_UNEXPECTED;
@@ -1109,79 +1096,16 @@ nsXPConnect::RegisterContextCallback(xpc
 
 /* [noscript, notxpcom] void unregisterContextCallback(in xpcContextCallback func); */
 NS_IMETHODIMP_(void)
 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()
 {
     return GetRuntime()->GetJSContextStack()->Peek();
 }
 
 /* virtual */
@@ -1315,25 +1239,16 @@ SetLocationForGlobal(JSObject *global, n
 {
     MOZ_ASSERT(global);
     EnsureCompartmentPrivate(global)->SetLocationURI(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()
 {
     JS::NotifyDidPaint(GetRuntime()->Runtime());
     return NS_OK;
 }
 
 // Note - We used to have HAS_PRINCIPALS_FLAG = 1 here, so reusing that flag
 // will require bumping the XDR version number.
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -308,18 +308,16 @@ public:
                                     bool showThisProps);
 
 
     static bool ReportAllJSExceptions()
     {
       return gReportAllJSExceptions > 0;
     }
 
-    static void CheckForDebugMode(JSRuntime *rt);
-
 protected:
     virtual ~nsXPConnect();
 
     nsXPConnect();
 
 private:
     // Singleton instance
     static nsXPConnect*             gSelf;
@@ -3645,19 +3643,16 @@ inline XPCWrappedNativeScope*
 GetObjectScope(JSObject *obj)
 {
     return EnsureCompartmentPrivate(obj)->scope;
 }
 
 // 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);
 bool IsOutObject(JSContext* cx, JSObject* obj);
 
 nsresult HasInstance(JSContext *cx, JS::HandleObject objArg, const nsID *iid, bool *bp);
 
 /**
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -202,21 +202,16 @@ xpc_MarkInCCGeneration(nsISupports* aVar
 
 // If aWrappedJS is a JS wrapper, unmark its JSObject.
 extern void
 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
 {
     // One-slot cache, because it turns out it's common for web pages to
     // get the same string a few times in a row.  We get about a 40% cache
     // hit rate on this cache last it was measured.  We'd get about 70%
     // hit rate with a hashtable with removal on finalization, but that
     // would take a lot more machinery.
--- a/testing/xpcshell/xpcshell_android.ini
+++ b/testing/xpcshell/xpcshell_android.ini
@@ -33,12 +33,11 @@
 [include:netwerk/test/unit/xpcshell.ini]
 [include:intl/strres/tests/unit/xpcshell.ini]
 [include:intl/unicharutil/tests/unit/xpcshell.ini]
 [include:intl/uconv/tests/unit/xpcshell.ini]
 [include:uriloader/exthandler/tests/unit/xpcshell.ini]
 [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]
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -53,19 +53,16 @@ add_tier_dir('platform', 'media/libyuv')
 
 add_tier_dir('platform', ['modules/libjar', 'storage'])
 
 if CONFIG['MOZ_PERMISSIONS']:
     add_tier_dir('platform', ['extensions/cookie', 'extensions/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',
         'media/mtransport/third_party',
         'media/mtransport/build',
         'media/mtransport/standalone',
     ])