Bug 1090929 - Enable the remaining debugger tests for e10s;r=mratcliffe
authorEddy Bruël <ejpbruel@gmail.com>
Mon, 24 Nov 2014 06:43:58 +0100
changeset 217042 26112e1b5c61b382bfc61dc68065e1946a99313d
parent 217041 c3ecdd9ea544eb0407fbeda412acfb6793e7c9a2
child 217043 5fdc1acbc53fd5b5cea00229184b9ec981419f34
push id27871
push usercbook@mozilla.com
push dateMon, 24 Nov 2014 12:32:57 +0000
treeherdermozilla-central@b8e1741b7d5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmratcliffe
bugs1090929
milestone36.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 1090929 - Enable the remaining debugger tests for e10s;r=mratcliffe
browser/devtools/debugger/test/browser.ini
browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js
browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js
browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js
browser/devtools/debugger/test/browser_dbg_break-on-dom-01.js
browser/devtools/debugger/test/browser_dbg_clean-exit.js
browser/devtools/debugger/test/browser_dbg_closure-inspection.js
browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js
browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js
browser/devtools/debugger/test/browser_dbg_debugger-statement.js
browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js
browser/devtools/debugger/test/browser_dbg_editor-mode.js
browser/devtools/debugger/test/browser_dbg_event-listeners-01.js
browser/devtools/debugger/test/browser_dbg_event-listeners-02.js
browser/devtools/debugger/test/browser_dbg_event-listeners-03.js
browser/devtools/debugger/test/browser_dbg_file-reload.js
browser/devtools/debugger/test/browser_dbg_function-display-name.js
browser/devtools/debugger/test/browser_dbg_global-method-override.js
browser/devtools/debugger/test/browser_dbg_hit-counts-01.js
browser/devtools/debugger/test/browser_dbg_hit-counts-02.js
browser/devtools/debugger/test/browser_dbg_host-layout.js
browser/devtools/debugger/test/browser_dbg_instruments-pane-collapse.js
browser/devtools/debugger/test/browser_dbg_interrupts.js
browser/devtools/debugger/test/browser_dbg_location-changes-01-simple.js
browser/devtools/debugger/test/browser_dbg_location-changes-02-blank.js
browser/devtools/debugger/test/browser_dbg_on-pause-highlight.js
browser/devtools/debugger/test/browser_dbg_on-pause-raise.js
browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js
browser/devtools/debugger/test/browser_dbg_panel-size.js
browser/devtools/debugger/test/browser_dbg_pause-exceptions-01.js
browser/devtools/debugger/test/browser_dbg_pause-exceptions-02.js
browser/devtools/debugger/test/browser_dbg_pause-resume.js
browser/devtools/debugger/test/browser_dbg_pause-warning.js
browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js
browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js
browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js
browser/devtools/debugger/test/browser_dbg_reload-same-script.js
browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js
browser/devtools/debugger/test/browser_dbg_scripts-switching-03.js
browser/devtools/debugger/test/browser_dbg_sources-labels.js
browser/devtools/debugger/test/browser_dbg_sources-sorting.js
browser/devtools/debugger/test/browser_dbg_step-out.js
browser/devtools/debugger/test/browser_dbg_terminate-on-tab-close.js
--- a/browser/devtools/debugger/test/browser.ini
+++ b/browser/devtools/debugger/test/browser.ini
@@ -93,51 +93,51 @@ support-files =
   doc_watch-expressions.html
   doc_watch-expression-button.html
   doc_with-frame.html
   head.js
   sjs_random-javascript.sjs
   testactors.js
 
 [browser_dbg_aaa_run_first_leaktest.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_addonactor.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_addon-sources.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_addon-modules.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_addon-modules-unpacked.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_addon-panels.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_addon-console.js]
-skip-if = e10s || os == 'win' # bug 1005274
+skip-if = e10s && debug || os == 'win' # bug 1005274
 [browser_dbg_auto-pretty-print-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_auto-pretty-print-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_bfcache.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_blackboxing-01.js]
 skip-if = e10s && debug
 [browser_dbg_blackboxing-02.js]
 skip-if = e10s && debug
 [browser_dbg_blackboxing-03.js]
 skip-if = e10s && debug
 [browser_dbg_blackboxing-04.js]
 skip-if = e10s && debug
 [browser_dbg_blackboxing-05.js]
 skip-if = e10s && debug
 [browser_dbg_blackboxing-06.js]
 skip-if = e10s && debug
 [browser_dbg_breadcrumbs-access.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_break-on-dom-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_break-on-dom-02.js]
 skip-if = e10s && debug
 [browser_dbg_break-on-dom-03.js]
 skip-if = e10s && debug
 [browser_dbg_break-on-dom-04.js]
 skip-if = e10s && debug
 [browser_dbg_break-on-dom-05.js]
 skip-if = e10s && debug
@@ -145,17 +145,17 @@ skip-if = e10s && debug
 skip-if = e10s && debug
 [browser_dbg_break-on-dom-07.js]
 skip-if = e10s && debug
 [browser_dbg_break-on-dom-08.js]
 skip-if = e10s && debug
 [browser_dbg_break-on-dom-event-01.js]
 skip-if = e10s || os == "mac" || e10s # Bug 895426
 [browser_dbg_break-on-dom-event-02.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_breakpoints-actual-location.js]
 skip-if = e10s && debug
 [browser_dbg_breakpoints-actual-location2.js]
 skip-if = e10s && debug
 [browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js]
 skip-if = e10s # Bug 1093535
 [browser_dbg_breakpoints-button-01.js]
 skip-if = e10s && debug
@@ -175,31 +175,31 @@ skip-if = e10s && debug
 skip-if = e10s && debug
 [browser_dbg_breakpoints-other-tabs.js]
 skip-if = e10s && debug
 [browser_dbg_breakpoints-pane.js]
 skip-if = e10s && debug
 [browser_dbg_breakpoints-reload.js]
 skip-if = e10s && debug
 [browser_dbg_chrome-create.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_chrome-debugging.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_clean-exit-window.js]
 skip-if = true # Bug 933950 (leaky test)
 [browser_dbg_clean-exit.js]
 skip-if = true # Bug 1044985 (racy test)
 [browser_dbg_closure-inspection.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_cmd-blackbox.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_cmd-break.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_cmd-dbg.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_conditional-breakpoints-01.js]
 skip-if = e10s && debug
 [browser_dbg_conditional-breakpoints-02.js]
 skip-if = e10s && debug
 [browser_dbg_conditional-breakpoints-03.js]
 skip-if = e10s && debug
 [browser_dbg_conditional-breakpoints-04.js]
 skip-if = e10s && debug
@@ -207,83 +207,83 @@ skip-if = e10s && debug
 skip-if = e10s && debug
 [browser_dbg_server-conditional-bp-02.js]
 skip-if = e10s && debug
 [browser_dbg_server-conditional-bp-03.js]
 skip-if = e10s && debug
 [browser_dbg_server-conditional-bp-04.js]
 skip-if = e10s && debug
 [browser_dbg_controller-evaluate-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_controller-evaluate-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_debugger-statement.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_editor-contextmenu.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_editor-mode.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_event-listeners-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_event-listeners-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_event-listeners-03.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_file-reload.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_function-display-name.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_global-method-override.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_globalactor.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_hide-toolbar-buttons.js]
 skip-if = e10s
 [browser_dbg_hit-counts-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_hit-counts-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_host-layout.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_iframes.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_instruments-pane-collapse.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_interrupts.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_listaddons.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_listtabs-01.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_listtabs-02.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_listtabs-03.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_location-changes-01-simple.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_location-changes-02-blank.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_location-changes-03-new.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_location-changes-04-breakpoint.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_multiple-windows.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_navigation.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_no-page-sources.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_on-pause-highlight.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_on-pause-raise.js]
-skip-if = e10s || os == "linux" || e10s # Bug 888811 & bug 891176
+skip-if = e10s && debug || os == "linux" # Bug 888811 & bug 891176
 [browser_dbg_optimized-out-vars.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_panel-size.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_parser-01.js]
 skip-if = e10s && debug
 [browser_dbg_parser-02.js]
 skip-if = e10s && debug
 [browser_dbg_parser-03.js]
 skip-if = e10s && debug
 [browser_dbg_parser-04.js]
 skip-if = e10s && debug
@@ -295,23 +295,23 @@ skip-if = e10s && debug
 skip-if = e10s && debug
 [browser_dbg_parser-08.js]
 skip-if = e10s && debug
 [browser_dbg_parser-09.js]
 skip-if = e10s && debug
 [browser_dbg_parser-10.js]
 skip-if = e10s && debug
 [browser_dbg_pause-exceptions-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_pause-exceptions-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_pause-resume.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_pause-warning.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_paused-keybindings.js]
 skip-if = e10s
 [browser_dbg_pretty-print-01.js]
 skip-if = e10s && debug
 [browser_dbg_pretty-print-02.js]
 skip-if = e10s && debug
 [browser_dbg_pretty-print-03.js]
 skip-if = e10s && debug
@@ -333,31 +333,31 @@ skip-if = e10s && debug
 skip-if = e10s && debug
 [browser_dbg_pretty-print-12.js]
 skip-if = e10s && debug
 [browser_dbg_pretty-print-13.js]
 skip-if = e10s && debug
 [browser_dbg_pretty-print-on-paused.js]
 skip-if = e10s && debug
 [browser_dbg_progress-listener-bug.js]
-skip-if = e10s
+skip-if = e10a && debug
 [browser_dbg_reload-preferred-script-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_reload-preferred-script-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_reload-preferred-script-03.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_reload-same-script.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_scripts-switching-01.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_scripts-switching-02.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_scripts-switching-03.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_search-autofill-identifier.js]
 skip-if = e10s && debug
 [browser_dbg_search-basic-01.js]
 skip-if = e10s && debug
 [browser_dbg_search-basic-02.js]
 skip-if = e10s && debug
 [browser_dbg_search-basic-03.js]
 skip-if = e10s && debug
@@ -395,45 +395,45 @@ skip-if = e10s && debug
 skip-if = e10s && debug
 [browser_dbg_source-maps-02.js]
 skip-if = e10s && debug
 [browser_dbg_source-maps-03.js]
 skip-if = e10s && debug
 [browser_dbg_source-maps-04.js]
 skip-if = e10s # Bug 1093535
 [browser_dbg_sources-cache.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_sources-labels.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_sources-sorting.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_split-console-paused-reload.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_stack-01.js]
 skip-if = e10s && debug
 [browser_dbg_stack-02.js]
 skip-if = e10s && debug
 [browser_dbg_stack-03.js]
 skip-if = e10s # TODO
 [browser_dbg_stack-04.js]
 skip-if = e10s && debug
 [browser_dbg_stack-05.js]
 skip-if = e10s && debug
 [browser_dbg_stack-06.js]
 skip-if = e10s && debug
 [browser_dbg_stack-07.js]
 skip-if = e10s && debug
 [browser_dbg_step-out.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_tabactor-01.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_tabactor-02.js]
-skip-if = e10s
+skip-if = e10s # TODO
 [browser_dbg_terminate-on-tab-close.js]
-skip-if = e10s
+skip-if = e10s && debug
 [browser_dbg_tracing-01.js]
 skip-if = e10s && debug
 [browser_dbg_tracing-02.js]
 skip-if = e10s && debug
 [browser_dbg_tracing-03.js]
 skip-if = e10s && debug
 [browser_dbg_tracing-04.js]
 skip-if = e10s && debug
--- a/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js
+++ b/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js
@@ -9,20 +9,19 @@
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
 function test() {
   // Wait longer for this very simple test that comes first, to make sure that
   // GC from previous tests does not interfere with the debugger suite.
   requestLongerTimeout(2);
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     ok(aTab, "Should have a tab available.");
-    ok(aDebuggee, "Should have a debuggee available.");
     ok(aPanel, "Should have a debugger pane available.");
 
     waitForSourceAndCaretAndScopes(aPanel, "-02.js", 1).then(() => {
       resumeDebuggerThenCloseAndFinish(aPanel);
     });
 
-    aDebuggee.firstCall();
+    callInTab(aTab, "firstCall");
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js
@@ -1,28 +1,27 @@
 /* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test auto pretty printing.
 
 const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor, gSources, gPrefs, gOptions, gView;
 
 let gFirstSourceLabel = "code_ugly-5.js";
 let gSecondSourceLabel = "code_ugly-6.js";
 
 let gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print");
 Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", true);
 
 function test(){
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
     gPrefs = gDebugger.Prefs;
     gOptions = gDebugger.DebuggerView.Options;
     gView = gDebugger.DebuggerView;
 
@@ -94,17 +93,16 @@ function testAutoPrettyPrintOff(){
 
 function testSourceIsPretty() {
   ok(gEditor.getText().contains("\n  "),
     "The source should be pretty printed.")
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
   gSources = null;
   gOptions = null;
   gPrefs = null;
   gView = null;
   Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", gOriginalPref);
--- a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js
+++ b/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js
@@ -3,37 +3,36 @@
 
 /**
  * Tests if the stackframe breadcrumbs are keyboard accessible.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
 function test() {
-  let gTab, gDebuggee, gPanel, gDebugger;
+  let gTab, gPanel, gDebugger;
   let gSources, gFrames;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
     gFrames = gDebugger.DebuggerView.StackFrames;
 
     waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1)
       .then(checkNavigationWhileNotFocused)
       .then(focusCurrentStackFrame)
       .then(checkNavigationWhileFocused)
       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
 
-    gDebuggee.firstCall();
+    callInTab(gTab, "firstCall");
   });
 
   function checkNavigationWhileNotFocused() {
     checkState({ frame: 3, source: 1, line: 1 });
 
     EventUtils.sendKey("DOWN", gDebugger);
     checkState({ frame: 3, source: 1, line: 2 });
 
--- a/browser/devtools/debugger/test/browser_dbg_break-on-dom-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_break-on-dom-01.js
@@ -3,17 +3,17 @@
 
 /**
  * Tests that event listeners aren't fetched when the events tab isn't selected.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html";
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     let gDebugger = aPanel.panelWin;
     let gView = gDebugger.DebuggerView;
     let gEvents = gView.EventListeners;
 
     gDebugger.on(gDebugger.EVENTS.EVENT_LISTENERS_FETCHED, () => {
       ok(false, "Shouldn't have fetched any event listeners.");
     });
     gDebugger.on(gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED, () => {
--- a/browser/devtools/debugger/test/browser_dbg_clean-exit.js
+++ b/browser/devtools/debugger/test/browser_dbg_clean-exit.js
@@ -1,39 +1,37 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Test that closing a tab with the debugger in a paused state exits cleanly.
  */
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 
 const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
 
     testCleanExit();
   });
 }
 
 function testCleanExit() {
   waitForSourceAndCaretAndScopes(gPanel, ".html", 16).then(() => {
     is(gDebugger.gThreadClient.paused, true,
       "Should be paused after the debugger statement.");
 
     return waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED);
   }).then(() => closeDebuggerAndFinish(gPanel, { whilePaused: true }));
 
-  gDebuggee.runDebuggerStatement();
+  callInTab(gTab, "runDebuggerStatement");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_closure-inspection.js
+++ b/browser/devtools/debugger/test/browser_dbg_closure-inspection.js
@@ -1,41 +1,33 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const TAB_URL = EXAMPLE_URL + "doc_closures.html";
 
 // Test that inspecting a closure works as expected.
 
 function test() {
-  let gPanel, gTab, gDebuggee, gDebugger;
+  let gPanel, gTab, gDebugger;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
-    gDebuggee.gRecurseLimit = 2;
 
     waitForSourceShown(gPanel, ".html")
       .then(testClosure)
       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
   });
 
   function testClosure() {
-    // Spin the event loop before causing the debuggee to pause, to allow
-    // this function to return first.
-    executeSoon(() => {
-      EventUtils.sendMouseEvent({ type: "click" },
-        gDebuggee.document.querySelector("button"),
-        gDebuggee);
-    });
+    sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
     return waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => {
       let gVars = gDebugger.DebuggerView.Variables;
       let localScope = gVars.getScopeAtIndex(0);
       let localNodes = localScope.target.querySelector(".variables-view-element-details").childNodes;
 
       is(localNodes[4].querySelector(".name").getAttribute("value"), "person",
         "Should have the right property name for |person|.");
--- a/browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js
@@ -4,17 +4,17 @@
 /**
  * Tests the public evaluation API from the debugger controller.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
 function test() {
   Task.spawn(function() {
-    let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
+    let [tab,, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
     let frames = win.DebuggerController.StackFrames;
     let framesView = win.DebuggerView.StackFrames;
     let sources = win.DebuggerController.SourceScripts;
     let sourcesView = win.DebuggerView.Sources;
     let editorView = win.DebuggerView.editor;
     let events = win.EVENTS;
 
@@ -40,18 +40,17 @@ function test() {
     // Eval while not paused.
     try {
       yield frames.evaluate("foo");
     } catch (error) {
       is(error.message, "No stack frame available.",
         "Evaluating shouldn't work while the debuggee isn't paused.");
     }
 
-    // Allow this generator function to yield first.
-    executeSoon(() => debuggee.firstCall());
+    callInTab(tab, "firstCall");
     yield waitForSourceAndCaretAndScopes(panel, "-02.js", 1);
     checkView(0, 1, 1, [/secondCall/, 118]);
 
     // Eval in the topmost frame, while paused.
     let updatedView = waitForDebuggerEvents(panel, events.FETCHED_SCOPES);
     let result = yield frames.evaluate("foo");
     ok(!result.throw, "The evaluation hasn't thrown.");
     is(result.return.type, "object", "The evaluation return type is correct.");
--- a/browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js
@@ -4,17 +4,17 @@
 /**
  * Tests the public evaluation API from the debugger controller.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
 function test() {
   Task.spawn(function() {
-    let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
+    let [tab,, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
     let frames = win.DebuggerController.StackFrames;
     let framesView = win.DebuggerView.StackFrames;
     let sources = win.DebuggerController.SourceScripts;
     let sourcesView = win.DebuggerView.Sources;
     let editorView = win.DebuggerView.editor;
     let events = win.EVENTS;
 
@@ -33,17 +33,17 @@ function test() {
         "The correct source is not displayed.");
     }
 
     // Cache the sources text to avoid having to wait for their retrieval.
     yield promise.all(sourcesView.attachments.map(e => sources.getText(e.source)));
     is(sources._cache.size, 2, "There should be two cached sources in the cache.");
 
     // Allow this generator function to yield first.
-    executeSoon(() => debuggee.firstCall());
+    callInTab(tab, "firstCall");
     yield waitForSourceAndCaretAndScopes(panel, "-02.js", 1);
     checkView(0, 1, 1, [/secondCall/, 118]);
 
     // Change the selected frame and eval inside it.
     let updatedFrame = waitForDebuggerEvents(panel, events.FETCHED_SCOPES);
     framesView.selectedDepth = 3; // oldest frame
     yield updatedFrame;
     checkView(3, 0, 5, [/firstCall/, 118]);
--- a/browser/devtools/debugger/test/browser_dbg_debugger-statement.js
+++ b/browser/devtools/debugger/test/browser_dbg_debugger-statement.js
@@ -3,31 +3,35 @@
 
 /**
  * Tests the behavior of the debugger statement.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
 
 let gClient;
+let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
     DebuggerServer.init(() => true);
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
 
     addTab(TAB_URL)
-      .then(() => attachTabActorForUrl(gClient, TAB_URL))
+      .then((aTab) => {
+        gTab = aTab;
+        return attachTabActorForUrl(gClient, TAB_URL)
+      })
       .then(testEarlyDebuggerStatement)
       .then(testDebuggerStatement)
       .then(closeConnection)
       .then(finish)
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
   });
@@ -40,18 +44,17 @@ function testEarlyDebuggerStatement([aGr
     ok(false, "Pause shouldn't be called before we've attached!");
     deferred.reject();
   };
 
   gClient.addListener("paused", onPaused);
 
   // This should continue without nesting an event loop and calling
   // the onPaused hook, because we haven't attached yet.
-  let debuggee = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
-  debuggee.runDebuggerStatement();
+  callInTab(gTab, "runDebuggerStatement");
 
   gClient.removeListener("paused", onPaused);
 
   // Now attach and resume...
   gClient.request({ to: aResponse.threadActor, type: "attach" }, () => {
     gClient.request({ to: aResponse.threadActor, type: "resume" }, () => {
       ok(true, "Pause wasn't called before we've attached.");
       deferred.resolve([aGrip, aResponse]);
@@ -67,18 +70,17 @@ function testDebuggerStatement([aGrip, a
   gClient.addListener("paused", (aEvent, aPacket) => {
     gClient.request({ to: aResponse.threadActor, type: "resume" }, () => {
       ok(true, "The pause handler was triggered on a debugger statement.");
       deferred.resolve();
     });
   });
 
   // Reach around the debugging protocol and execute the debugger statement.
-  let debuggee = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
-  debuggee.runDebuggerStatement();
+  callInTab(gTab, "runDebuggerStatement");
 }
 
 function closeConnection() {
   let deferred = promise.defer();
   gClient.close(deferred.resolve);
   return deferred.promise;
 }
 
--- a/browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js
+++ b/browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js
@@ -3,30 +3,29 @@
 
 /**
  * Bug 731394: Test the debugger source editor default context menu.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
 function test() {
-  let gTab, gDebuggee, gPanel, gDebugger;
+  let gTab, gPanel, gDebugger;
   let gEditor, gSources, gContextMenu;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
     gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu");
 
     waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1).then(performTest).then(null, info);
-    gDebuggee.firstCall();
+    callInTab(gTab, "firstCall");
   });
 
   function performTest() {
     is(gDebugger.gThreadClient.state, "paused",
       "Should only be getting stack frames while paused.");
     is(gSources.itemCount, 2,
       "Found the expected number of sources.");
     is(gEditor.getText().indexOf("debugger"), 172,
--- a/browser/devtools/debugger/test/browser_dbg_editor-mode.js
+++ b/browser/devtools/debugger/test/browser_dbg_editor-mode.js
@@ -3,38 +3,37 @@
 
 /**
  * Make sure that updating the editor mode sets the right highlighting engine,
  * and source URIs with extra query parameters also get the right engine.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor, gSources;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
 
     waitForSourceAndCaretAndScopes(gPanel, "code_test-editor-mode", 1)
       .then(testInitialSource)
       .then(testSwitch1)
       .then(testSwitch2)
       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
 
-    gDebuggee.firstCall();
+    callInTab(gTab, "firstCall");
   });
 }
 
 function testInitialSource() {
   is(gSources.itemCount, 3,
     "Found the expected number of sources.");
 
   is(gEditor.getMode().name, "text",
@@ -80,14 +79,13 @@ function testSwitch2() {
   is(gEditor.getText().search(/debugger/), -1,
     "The second source is not displayed.");
   is(gEditor.getText().search(/banana/), 443,
     "The third source is displayed.");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
   gSources = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js
@@ -3,31 +3,35 @@
 
 /**
  * Tests that the eventListeners request works.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-01.html";
 
 let gClient;
+let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
     DebuggerServer.init(() => true);
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
 
     addTab(TAB_URL)
-      .then(() => attachThreadActorForUrl(gClient, TAB_URL))
+      .then((aTab) => {
+        gTab = aTab;
+        return attachThreadActorForUrl(gClient, TAB_URL)
+      })
       .then(pauseDebuggee)
       .then(testEventListeners)
       .then(closeConnection)
       .then(finish)
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
   });
@@ -40,23 +44,17 @@ function pauseDebuggee(aThreadClient) {
     is(aPacket.type, "paused",
       "We should now be paused.");
     is(aPacket.why.type, "debuggerStatement",
       "The debugger statement was hit.");
 
     deferred.resolve(aThreadClient);
   });
 
-  // Spin the event loop before causing the debuggee to pause, to allow
-  // this function to return first.
-  executeSoon(() => {
-    EventUtils.sendMouseEvent({ type: "click" },
-      content.document.querySelector("button"),
-      content);
-  });
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
   return deferred.promise;
 }
 
 function testEventListeners(aThreadClient) {
   let deferred = promise.defer();
 
   aThreadClient.eventListeners(aPacket => {
--- a/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js
@@ -4,31 +4,35 @@
 /**
  * Tests that the eventListeners request works when bound functions are used as
  * event listeners.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-03.html";
 
 let gClient;
+let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
     DebuggerServer.init(() => true);
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
 
     addTab(TAB_URL)
-      .then(() => attachThreadActorForUrl(gClient, TAB_URL))
+      .then((aTab) => {
+        gTab = aTab;
+        return attachThreadActorForUrl(gClient, TAB_URL);
+      })
       .then(pauseDebuggee)
       .then(testEventListeners)
       .then(closeConnection)
       .then(finish)
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
   });
@@ -41,23 +45,17 @@ function pauseDebuggee(aThreadClient) {
     is(aPacket.type, "paused",
       "We should now be paused.");
     is(aPacket.why.type, "debuggerStatement",
       "The debugger statement was hit.");
 
     deferred.resolve(aThreadClient);
   });
 
-  // Spin the event loop before causing the debuggee to pause, to allow
-  // this function to return first.
-  executeSoon(() => {
-    EventUtils.sendMouseEvent({ type: "click" },
-      content.document.querySelector("button"),
-      content);
-  });
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
   return deferred.promise;
 }
 
 function testEventListeners(aThreadClient) {
   let deferred = promise.defer();
 
   aThreadClient.eventListeners(aPacket => {
--- a/browser/devtools/debugger/test/browser_dbg_event-listeners-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-03.js
@@ -4,31 +4,35 @@
 /**
  * Tests that the eventListeners request works when there are event handlers
  * that the debugger cannot unwrap.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_native-event-handler.html";
 
 let gClient;
+let gTab;
 
 function test() {
   if (!DebuggerServer.initialized) {
     DebuggerServer.init(() => true);
     DebuggerServer.addBrowserActors();
   }
 
   let transport = DebuggerServer.connectPipe();
   gClient = new DebuggerClient(transport);
   gClient.connect((aType, aTraits) => {
     is(aType, "browser",
       "Root actor should identify itself as a browser.");
 
     addTab(TAB_URL)
-      .then(() => attachThreadActorForUrl(gClient, TAB_URL))
+      .then((aTab) => {
+        gTab = aTab;
+        return attachThreadActorForUrl(gClient, TAB_URL)
+      })
       .then(pauseDebuggee)
       .then(testEventListeners)
       .then(closeConnection)
       .then(finish)
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
   });
@@ -41,23 +45,17 @@ function pauseDebuggee(aThreadClient) {
     is(aPacket.type, "paused",
       "We should now be paused.");
     is(aPacket.why.type, "debuggerStatement",
       "The debugger statement was hit.");
 
     deferred.resolve(aThreadClient);
   });
 
-  // Spin the event loop before causing the debuggee to pause, to allow
-  // this function to return first.
-  executeSoon(() => {
-    EventUtils.sendMouseEvent({ type: "click" },
-      content.document.querySelector("button"),
-      content);
-  });
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
   return deferred.promise;
 }
 
 function testEventListeners(aThreadClient) {
   let deferred = promise.defer();
 
   aThreadClient.eventListeners(aPacket => {
--- a/browser/devtools/debugger/test/browser_dbg_file-reload.js
+++ b/browser/devtools/debugger/test/browser_dbg_file-reload.js
@@ -4,17 +4,17 @@
 /**
  * Tests that source contents are invalidated when the target navigates.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_random-javascript.html";
 const JS_URL = EXAMPLE_URL + "sjs_random-javascript.sjs";
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     let gDebugger = aPanel.panelWin;
     let gEditor = gDebugger.DebuggerView.editor;
     let gSources = gDebugger.DebuggerView.Sources;
     let gControllerSources = gDebugger.DebuggerController.SourceScripts;
 
     Task.spawn(function() {
       yield waitForSourceShown(aPanel, JS_URL);
 
--- a/browser/devtools/debugger/test/browser_dbg_function-display-name.js
+++ b/browser/devtools/debugger/test/browser_dbg_function-display-name.js
@@ -3,22 +3,21 @@
 
 /**
  * Tests that anonymous functions appear in the stack frame list with either
  * their displayName property or a SpiderMonkey-inferred name.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_function-display-name.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
 
     testAnonCall();
   });
 }
 
 function testAnonCall() {
@@ -30,17 +29,17 @@ function testAnonCall() {
     is(gDebugger.document.querySelectorAll(".dbg-stackframe").length, 3,
       "Should have three frames.");
     is(gDebugger.document.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
       "anonFunc", "Frame name should be 'anonFunc'.");
 
     testInferredName();
   });
 
-  gDebuggee.evalCall();
+  callInTab(gTab, "evalCall");
 }
 
 function testInferredName() {
   waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => {
     ok(isCaretPos(gPanel, 15),
       "The source editor caret position was incorrect.");
     is(gDebugger.gThreadClient.state, "paused",
       "Should only be getting stack frames while paused.");
@@ -52,12 +51,11 @@ function testInferredName() {
     resumeDebuggerThenCloseAndFinish(gPanel);
   });
 
   gDebugger.gThreadClient.resume();
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_global-method-override.js
+++ b/browser/devtools/debugger/test/browser_dbg_global-method-override.js
@@ -5,16 +5,16 @@
  * Tests that scripts that override properties of the global object, like
  * toString don't break the debugger. The test page used to cause the debugger
  * to throw when trying to attach to the thread actor.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_global-method-override.html";
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     let gDebugger = aPanel.panelWin;
     ok(gDebugger, "Should have a debugger available.");
     is(gDebugger.gThreadClient.state, "attached", "Debugger should be attached.");
 
     closeDebuggerAndFinish(aPanel);
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_hit-counts-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_hit-counts-01.js
@@ -4,26 +4,25 @@
 /**
  * Evaluating two functions on the same line and checking for correct hit count
  * for both of them in CodeMirror's gutter.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_same-line-functions.html";
 const CODE_URL = "code_same-line-functions.js";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor;
 
 function test() {
   Task.async(function* () {
     yield pushPrefs(["devtools.debugger.tracer", true]);
 
-    initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+    initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
       gTab = aTab;
-      gDebuggee = aDebuggee;
       gPanel = aPanel;
       gDebugger = gPanel.panelWin;
       gEditor = gDebugger.DebuggerView.editor;
 
       Task.async(function* () {
         yield waitForSourceShown(gPanel, CODE_URL);
         yield startTracing(gPanel);
 
@@ -39,27 +38,24 @@ function test() {
       })();
     });
   })().catch(e => {
     ok(false, "Got an error: " + e.message + "\n" + e.stack);
   });
 }
 
 function clickButton() {
-  EventUtils.sendMouseEvent({ type: "click" },
-                            gDebuggee.document.querySelector("button"),
-                            gDebuggee);
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 }
 
 function testHitCounts() {
   let marker = gEditor.getMarker(0, 'hit-counts');
 
   is(marker.innerHTML, "1\u00D7|1\u00D7",
     "Both functions should be hit only once.");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
-});
\ No newline at end of file
+});
--- a/browser/devtools/debugger/test/browser_dbg_hit-counts-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_hit-counts-02.js
@@ -3,26 +3,25 @@
 
 /**
  * When tracing is stopped all hit counters should be cleared.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_same-line-functions.html";
 const CODE_URL = "code_same-line-functions.js";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor;
 
 function test() {
   Task.async(function* () {
     yield pushPrefs(["devtools.debugger.tracer", true]);
 
-    initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+    initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
       gTab = aTab;
-      gDebuggee = aDebuggee;
       gPanel = aPanel;
       gDebugger = gPanel.panelWin;
       gEditor = gDebugger.DebuggerView.editor;
 
       Task.async(function* () {
         yield waitForSourceShown(gPanel, CODE_URL);
         yield startTracing(gPanel);
 
@@ -41,30 +40,27 @@ function test() {
       })();
     });
   })().catch(e => {
     ok(false, "Got an error: " + e.message + "\n" + e.stack);
   });
 }
 
 function clickButton() {
-  EventUtils.sendMouseEvent({ type: "click" },
-                            gDebuggee.document.querySelector("button"),
-                            gDebuggee);
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 }
 
 function testHitCountsBeforeStopping() {
   let marker = gEditor.getMarker(0, 'hit-counts');
   ok(marker, "A counter should exists.");
 }
 
 function testHitCountsAfterStopping() {
   let marker = gEditor.getMarker(0, 'hit-counts');
   is(marker, undefined, "A counter should be cleared.");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
-});
\ No newline at end of file
+});
--- a/browser/devtools/debugger/test/browser_dbg_host-layout.js
+++ b/browser/devtools/debugger/test/browser_dbg_host-layout.js
@@ -22,48 +22,48 @@ function test() {
 function testHosts(aHostTypes, aLayoutTypes) {
   let [firstHost, secondHost, thirdHost] = aHostTypes;
   let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes;
 
   Services.prefs.setCharPref("devtools.toolbox.host", firstHost);
 
   return Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger("about:blank");
-    yield testHost(tab, debuggee, panel, firstHost, firstLayout);
-    yield switchAndTestHost(tab, debuggee, panel, secondHost, secondLayout);
-    yield switchAndTestHost(tab, debuggee, panel, thirdHost, thirdLayout);
+    yield testHost(tab, panel, firstHost, firstLayout);
+    yield switchAndTestHost(tab, panel, secondHost, secondLayout);
+    yield switchAndTestHost(tab, panel, thirdHost, thirdLayout);
     yield teardown(panel);
   });
 }
 
-function switchAndTestHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType) {
+function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
   let gToolbox = aPanel._toolbox;
   let gDebugger = aPanel.panelWin;
 
   return Task.spawn(function() {
     let layoutChanged = once(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
     let hostChanged = gToolbox.switchHost(aHostType);
 
     yield hostChanged;
     ok(true, "The toolbox's host has changed.");
 
     yield layoutChanged;
     ok(true, "The debugger's layout has changed.");
 
-    yield testHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType);
+    yield testHost(aTab, aPanel, aHostType, aLayoutType);
   });
 
   function once(aTarget, aEvent) {
     let deferred = promise.defer();
     aTarget.once(aEvent, deferred.resolve);
     return deferred.promise;
   }
 }
 
-function testHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType) {
+function testHost(aTab, aPanel, aHostType, aLayoutType) {
   let gDebugger = aPanel.panelWin;
   let gView = gDebugger.DebuggerView;
 
   is(gView._hostType, aHostType,
     "The default host type should've been set on the panel window (1).");
   is(gDebugger.gHostType, aHostType,
     "The default host type should've been set on the panel window (2).");
 
--- a/browser/devtools/debugger/test/browser_dbg_instruments-pane-collapse.js
+++ b/browser/devtools/debugger/test/browser_dbg_instruments-pane-collapse.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that the debugger panes collapse properly.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gPrefs, gOptions;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gPrefs = gDebugger.Prefs;
     gOptions = gDebugger.DebuggerView.Options;
 
     testPanesState();
 
     gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
@@ -141,14 +140,13 @@ function testPanesStartupPref() {
   is(gPrefs.panesVisibleOnStartup, false,
     "The debugger view panes should now be preffed as hidden.");
   isnot(gOptions._showPanesOnStartupItem.getAttribute("checked"), "true",
     "The options menu item should now be unchecked.");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gPrefs = null;
   gOptions = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_interrupts.js
+++ b/browser/devtools/debugger/test/browser_dbg_interrupts.js
@@ -3,22 +3,21 @@
 
 /**
  * Test if the breakpoints toggle button works as advertised.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
 function test() {
-  let gTab, gDebuggee, gPanel, gDebugger;
+  let gTab, gPanel, gDebugger;
   let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
     gBreakpoints = gDebugger.DebuggerController.Breakpoints;
     gTarget = gDebugger.gTarget;
     gThreadClient = gDebugger.gThreadClient;
     gResumeButton = gDebugger.document.getElementById("resume");
     gResumeKey = gDebugger.document.getElementById("resumeKey");
--- a/browser/devtools/debugger/test/browser_dbg_location-changes-01-simple.js
+++ b/browser/devtools/debugger/test/browser_dbg_location-changes-01-simple.js
@@ -2,31 +2,30 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that changing the tab location URL works.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor, gSources, gFrames;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
     gFrames = gDebugger.DebuggerView.StackFrames;
 
     waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest);
-    gDebuggee.simpleCall();
+    callInTab(gTab, "simpleCall");
   });
 }
 
 function performTest() {
   is(gDebugger.gThreadClient.state, "paused",
     "Should only be getting stack frames while paused.");
 
   is(gFrames.itemCount, 1,
@@ -57,15 +56,14 @@ function performTest() {
 function testLocationChange() {
   navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => {
     closeDebuggerAndFinish(gPanel);
   });
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
   gSources = null;
   gFrames = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_location-changes-02-blank.js
+++ b/browser/devtools/debugger/test/browser_dbg_location-changes-02-blank.js
@@ -2,31 +2,30 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that changing the tab location URL to a page with no sources works.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor, gSources, gFrames;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
     gFrames = gDebugger.DebuggerView.StackFrames;
 
     waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange);
-    gDebuggee.simpleCall();
+    callInTab(gTab, "simpleCall");
   });
 }
 
 function testLocationChange() {
   navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => {
     isnot(gDebugger.gThreadClient.state, "paused",
       "Should not be paused after a tab navigation.");
 
@@ -48,15 +47,14 @@ function testLocationChange() {
       "The sources widget should now display a notice (2).");
 
     closeDebuggerAndFinish(gPanel);
   });
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
   gSources = null;
   gFrames = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_on-pause-highlight.js
+++ b/browser/devtools/debugger/test/browser_dbg_on-pause-highlight.js
@@ -3,23 +3,22 @@
 
 /**
  * Tests that debugger's tab is highlighted when it is paused and not the
  * currently selected tool.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gToolbox, gToolboxTab;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gToolbox = gPanel._toolbox;
     gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger");
 
     waitForSourceShown(gPanel, ".html").then(testPause);
   });
 }
@@ -64,14 +63,13 @@ function testResume() {
 
   EventUtils.sendMouseEvent({ type: "mousedown" },
     gDebugger.document.getElementById("resume"),
     gDebugger);
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gToolbox = null;
   gToolboxTab = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_on-pause-raise.js
+++ b/browser/devtools/debugger/test/browser_dbg_on-pause-raise.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that the toolbox is raised when the debugger gets paused.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gNewTab, gFocusedWindow, gToolbox, gToolboxTab;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gToolbox = gPanel._toolbox;
     gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger");
 
     waitForSourceShown(gPanel, ".html").then(performTest);
   });
 }
@@ -127,17 +126,16 @@ function maybeEndTest() {
 }
 
 registerCleanupFunction(function() {
   // Revert to the default toolbox host, so that the following tests proceed
   // normally and not inside a non-default host.
   Services.prefs.setCharPref("devtools.toolbox.host", devtools.Toolbox.HostType.BOTTOM);
 
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
 
   removeTab(gNewTab);
   gNewTab = null;
   gFocusedWindow = null;
   gToolbox = null;
   gToolboxTab = null;
--- a/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js
+++ b/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js
@@ -3,31 +3,27 @@
 
 // Test that optimized out variables aren't present in the variables view.
 
 function test() {
   Task.spawn(function* () {
     const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html";
     let gDebugger, sources;
 
-    let [, debuggee, panel] = yield initDebugger(TAB_URL);
+    let [tab,, panel] = yield initDebugger(TAB_URL);
     gDebugger = panel.panelWin;
     sources = gDebugger.DebuggerView.Sources;
 
     yield waitForSourceShown(panel, ".html");
     yield panel.addBreakpoint({ url: sources.values[0], line: 18 });
     yield ensureThreadClientState(panel, "resumed");
 
     // Spin the event loop before causing the debuggee to pause, to allow
     // this function to return first.
-    executeSoon(() => {
-      EventUtils.sendMouseEvent({ type: "click" },
-        debuggee.document.querySelector("button"),
-        debuggee);
-    });
+    sendMouseClickToTab(tab, content.document.querySelector("button"));
 
     yield waitForDebuggerEvents(panel, gDebugger.EVENTS.FETCHED_SCOPES);
     let gVars = gDebugger.DebuggerView.Variables;
     let outerScope = gVars.getScopeAtIndex(1);
     outerScope.expand();
 
     let upvarVar = outerScope.get("upvar");
     ok(!upvarVar, "upvar was optimized out.");
--- a/browser/devtools/debugger/test/browser_dbg_panel-size.js
+++ b/browser/devtools/debugger/test/browser_dbg_panel-size.js
@@ -4,22 +4,21 @@
 /**
  * Test that the sources and instruments panels widths are properly
  * remembered when the debugger closes.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
 function test() {
-  let gTab, gDebuggee, gPanel, gDebugger;
+  let gTab, gPanel, gDebugger;
   let gPrefs, gSources, gInstruments;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gPrefs = gDebugger.Prefs;
     gSources = gDebugger.document.getElementById("sources-pane");
     gInstruments = gDebugger.document.getElementById("instruments-pane");
 
     waitForSourceShown(gPanel, ".html").then(performTest);
   });
--- a/browser/devtools/debugger/test/browser_dbg_pause-exceptions-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_pause-exceptions-01.js
@@ -2,24 +2,23 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that pausing on exceptions works.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gFrames, gVariables, gPrefs, gOptions;
 
 function test() {
   requestLongerTimeout(2);
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gFrames = gDebugger.DebuggerView.StackFrames;
     gVariables = gDebugger.DebuggerView.Variables;
     gPrefs = gDebugger.Prefs;
     gOptions = gDebugger.DebuggerView.Options;
 
     is(gPrefs.pauseOnExceptions, false,
@@ -73,19 +72,17 @@ function testPauseOnExceptionsDisabled()
 
     EventUtils.sendMouseEvent({ type: "mousedown" },
       gDebugger.document.getElementById("resume"),
       gDebugger);
 
     return finished;
   });
 
-  EventUtils.sendMouseEvent({ type: "click" },
-    gDebuggee.document.querySelector("button"),
-    gDebuggee);
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
   return finished;
 }
 
 function testPauseOnExceptionsEnabled() {
   let finished = waitForCaretAndScopes(gPanel, 19).then(() => {
     info("Testing enabled pause-on-exceptions.");
 
@@ -146,19 +143,17 @@ function testPauseOnExceptionsEnabled() 
 
     EventUtils.sendMouseEvent({ type: "mousedown" },
       gDebugger.document.getElementById("resume"),
       gDebugger);
 
     return finished;
   });
 
-  EventUtils.sendMouseEvent({ type: "click" },
-    gDebuggee.document.querySelector("button"),
-    gDebuggee);
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
   return finished;
 }
 
 function enablePauseOnExceptions() {
   let deferred = promise.defer();
 
   gDebugger.gThreadClient.addOneTimeListener("resumed", () => {
@@ -231,16 +226,15 @@ function disableIgnoreCaughtExceptions()
   gOptions._ignoreCaughtExceptionsItem.setAttribute("checked", "false");
   gOptions._toggleIgnoreCaughtExceptions();
 
   return deferred.promise;
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gFrames = null;
   gVariables = null;
   gPrefs = null;
   gOptions = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_pause-exceptions-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_pause-exceptions-02.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that pausing on exceptions works after reload.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gFrames, gVariables, gPrefs, gOptions;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gFrames = gDebugger.DebuggerView.StackFrames;
     gVariables = gDebugger.DebuggerView.Variables;
     gPrefs = gDebugger.Prefs;
     gOptions = gDebugger.DebuggerView.Options;
 
     is(gPrefs.pauseOnExceptions, false,
@@ -100,23 +99,17 @@ function testPauseOnExceptionsAfterReloa
 
     EventUtils.sendMouseEvent({ type: "mousedown" },
       gDebugger.document.getElementById("resume"),
       gDebugger);
 
     return finished;
   });
 
-  // Spin the event loop before causing the debuggee to pause, to allow
-  // this function to return first.
-  executeSoon(() => {
-    EventUtils.sendMouseEvent({ type: "click" },
-      gDebuggee.document.querySelector("button"),
-      gDebuggee.window);
-  });
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
 
   return finished;
 }
 
 function enablePauseOnExceptions() {
   let deferred = promise.defer();
 
   gDebugger.gThreadClient.addOneTimeListener("resumed", () => {
@@ -189,16 +182,15 @@ function disableIgnoreCaughtExceptions()
   gOptions._ignoreCaughtExceptionsItem.setAttribute("checked", "false");
   gOptions._toggleIgnoreCaughtExceptions();
 
   return deferred.promise;
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gFrames = null;
   gVariables = null;
   gPrefs = null;
   gOptions = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_pause-resume.js
+++ b/browser/devtools/debugger/test/browser_dbg_pause-resume.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests if pausing and resuming in the main loop works properly.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gResumeButton, gResumeKey, gFrames;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gResumeButton = gDebugger.document.getElementById("resume");
     gResumeKey = gDebugger.document.getElementById("resumeKey");
     gFrames = gDebugger.DebuggerView.StackFrames;
 
     testPause();
   });
@@ -64,15 +63,14 @@ function testResume() {
     closeDebuggerAndFinish(gPanel);
   });
 
   EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gResumeButton = null;
   gResumeKey = null;
   gFrames = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_pause-warning.js
+++ b/browser/devtools/debugger/test/browser_dbg_pause-warning.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests if a warning is shown in the inspector when debugger is paused.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gTarget, gToolbox;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gTarget = gPanel.target;
     gToolbox = gPanel._toolbox;
 
     testPause();
   });
 }
@@ -85,14 +84,13 @@ function testResume() {
 
   EventUtils.sendMouseEvent({ type: "mousedown" },
     gDebugger.document.getElementById("resume"),
     gDebugger);
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gTarget = null;
   gToolbox = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js
+++ b/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js
@@ -1,27 +1,26 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that the debugger does show up even if a progress listener reads the
  * WebProgress argument's DOMWindow property in onStateChange() (bug 771655).
  */
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gOldListener;
 
 const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
 
 function test() {
   installListener();
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
 
     is(!!gDebugger.DebuggerController._startup, true,
       "Controller should be initialized after starting the test.");
     is(!!gDebugger.DebuggerView._startup, true,
       "View should be initialized after starting the test.");
 
@@ -32,17 +31,17 @@ function test() {
 function testPause() {
   waitForSourceAndCaretAndScopes(gPanel, ".html", 16).then(() => {
     is(gDebugger.gThreadClient.state, "paused",
       "The debugger statement was reached.");
 
     resumeDebuggerThenCloseAndFinish(gPanel);
   });
 
-  gDebuggee.runDebuggerStatement();
+  callInTab(gTab, "runDebuggerStatement");
 }
 
 // This is taken almost verbatim from bug 771655.
 function installListener() {
   if ("_testPL" in window) {
     gOldListener = _testPL;
 
     Cc['@mozilla.org/docloaderservice;1']
@@ -75,13 +74,12 @@ function installListener() {
 registerCleanupFunction(function() {
   if (gOldListener) {
     window._testPL = gOldListener;
   } else {
     delete window._testPL;
   }
 
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gOldListener = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js
@@ -4,23 +4,22 @@
 /**
  * Tests if the preferred source is shown when a page is loaded and
  * the preferred source is specified after another source might have been shown.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 const PREFERRED_URL = EXAMPLE_URL + "code_script-switching-02.js";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gSources;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
 
     waitForSourceShown(gPanel, PREFERRED_URL).then(finishTest);
     gSources.preferredSource = PREFERRED_URL;
   });
 }
@@ -34,13 +33,12 @@ function finishTest() {
   is(gSources.selectedValue, PREFERRED_URL,
     "The selected source isn't the correct one.");
 
   closeDebuggerAndFinish(gPanel);
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gSources = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js
@@ -5,23 +5,22 @@
  * Tests if the preferred source is shown when a page is loaded and
  * the preferred source is specified after another source was definitely shown.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 const FIRST_URL = EXAMPLE_URL + "code_script-switching-01.js";
 const SECOND_URL = EXAMPLE_URL + "code_script-switching-02.js";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gSources;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
 
     waitForSourceShown(gPanel, FIRST_URL)
       .then(() => testSource("", FIRST_URL))
       .then(() => switchToSource(SECOND_URL))
       .then(() => testSource(SECOND_URL))
@@ -47,13 +46,12 @@ function testSource(aPreferredUrl, aSele
 function switchToSource(aUrl) {
   let finished = waitForSourceShown(gPanel, aUrl);
   gSources.preferredSource = aUrl;
   return finished;
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gSources = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js
+++ b/browser/devtools/debugger/test/browser_dbg_reload-same-script.js
@@ -8,22 +8,21 @@
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 const FIRST_URL = EXAMPLE_URL + "code_script-switching-01.js";
 const SECOND_URL = EXAMPLE_URL + "code_script-switching-02.js";
 
 function test() {
   // Debug test slaves are a bit slow at this test.
   requestLongerTimeout(2);
 
-  let gTab, gDebuggee, gPanel, gDebugger;
+  let gTab, gPanel, gDebugger;
   let gSources, gStep;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = aPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
     gStep = 0;
 
     waitForSourceShown(gPanel, FIRST_URL).then(performTest);
   });
 
--- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that switching the displayed source in the UI works as advertised.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor, gSources;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
 
     ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel1),
       "Title with first source is correct.");
 
@@ -27,17 +26,17 @@ function test() {
       .then(testSwitchPaused1)
       .then(testSwitchPaused2)
       .then(testSwitchRunning)
       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
 
-    gDebuggee.firstCall();
+    callInTab(gTab, "firstCall");
   });
 }
 
 let gLabel1 = "code_script-switching-01.js";
 let gLabel2 = "code_script-switching-02.js";
 
 function testSourcesDisplay() {
   let deferred = promise.defer();
@@ -182,16 +181,15 @@ function testSwitchRunning() {
     deferred.resolve();
   });
 
   return deferred.promise;
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
   gSources = null;
   gLabel1 = null;
   gLabel2 = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js
@@ -2,39 +2,38 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that switching the displayed source in the UI works as advertised.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-02.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gEditor, gSources;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gEditor = gDebugger.DebuggerView.editor;
     gSources = gDebugger.DebuggerView.Sources;
 
     waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1)
       .then(testSourcesDisplay)
       .then(testSwitchPaused1)
       .then(testSwitchPaused2)
       .then(testSwitchRunning)
       .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
       .then(null, aError => {
         ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
       });
 
-    gDebuggee.firstCall();
+    callInTab(gTab, "firstCall");
   });
 }
 
 let gLabel1 = "code_script-switching-01.js";
 let gLabel2 = "code_script-switching-02.js";
 let gParams = "?foo=bar,baz|lol";
 
 function testSourcesDisplay() {
@@ -171,17 +170,16 @@ function testSwitchRunning() {
     deferred.resolve();
   });
 
   return deferred.promise;
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gEditor = null;
   gSources = null;
   gLabel1 = null;
   gLabel2 = null;
   gParams = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-03.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that the DebuggerView error loading source text is correct.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gView, gEditor, gL10N;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gView = gDebugger.DebuggerView;
     gEditor = gDebugger.DebuggerView.editor;
     gL10N = gDebugger.L10N;
 
     waitForSourceShown(gPanel, "-01.js")
       .then(showBogusSource)
@@ -38,15 +37,14 @@ function showBogusSource() {
 
 function testDebuggerLoadingError() {
   ok(gEditor.getText().contains(gL10N.getStr("errorLoadingText")),
     "The valid error loading message is displayed.");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gView = null;
   gEditor = null;
   gL10N = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_sources-labels.js
+++ b/browser/devtools/debugger/test/browser_dbg_sources-labels.js
@@ -3,22 +3,21 @@
 
 /**
  * Tests that urls are correctly shortened to unique labels.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
 function test() {
-  let gTab, gDebuggee, gPanel, gDebugger;
+  let gTab, gPanel, gDebugger;
   let gSources, gUtils;
 
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
     gUtils = gDebugger.SourceUtils;
 
     let ellipsis = gPanel.panelWin.L10N.ellipsis;
     let nananana = new Array(20).join(NaN);
 
--- a/browser/devtools/debugger/test/browser_dbg_sources-sorting.js
+++ b/browser/devtools/debugger/test/browser_dbg_sources-sorting.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that urls are correctly sorted when added to the sources widget.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gSources, gUtils;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gSources = gDebugger.DebuggerView.Sources;
     gUtils = gDebugger.SourceUtils;
 
     waitForSourceShown(gPanel, ".html").then(() => {
       addSourceAndCheckOrder(1, () => {
         addSourceAndCheckOrder(2, () => {
@@ -124,14 +123,13 @@ function checkSourcesOrder(aMethod) {
     ok(first < second,
       "Using method " + aMethod + ", " +
       "the sources weren't in the correct order: " + first + " vs. " + second);
   }
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gSources = null;
   gUtils = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_step-out.js
+++ b/browser/devtools/debugger/test/browser_dbg_step-out.js
@@ -2,23 +2,22 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Make sure that stepping out of a function displays the right return value.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_step-out.html";
 
-let gTab, gDebuggee, gPanel, gDebugger;
+let gTab, gPanel, gDebugger;
 let gVars;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
     gVars = gDebugger.DebuggerView.Variables;
 
     testNormalReturn();
   });
 }
 
@@ -36,19 +35,17 @@ function testNormalReturn() {
       resumeDebuggee().then(() => testReturnWithException());
     });
 
     EventUtils.sendMouseEvent({ type: "mousedown" },
       gDebugger.document.getElementById("step-out"),
       gDebugger);
   });
 
-  EventUtils.sendMouseEvent({ type: "click" },
-    gDebuggee.document.getElementById("return"),
-    gDebuggee);
+  sendMouseClickToTab(gTab, content.document.getElementById("return"));
 }
 
 function testReturnWithException() {
   waitForCaretAndScopes(gPanel, 24).then(() => {
     waitForCaretAndScopes(gPanel, 27).then(() => {
       let innerScope = gVars.getScopeAtIndex(0);
       let exceptionVar = innerScope.get("<exception>");
 
@@ -60,26 +57,23 @@ function testReturnWithException() {
       resumeDebuggee().then(() => closeDebuggerAndFinish(gPanel));
     });
 
     EventUtils.sendMouseEvent({ type: "mousedown" },
       gDebugger.document.getElementById("step-out"),
       gDebugger);
   });
 
-  EventUtils.sendMouseEvent({ type: "click" },
-    gDebuggee.document.getElementById("throw"),
-    gDebuggee);
+  sendMouseClickToTab(gTab, content.document.getElementById("throw"));
 }
 
 function resumeDebuggee() {
   let deferred = promise.defer();
   gDebugger.gThreadClient.resume(deferred.resolve);
   return deferred.promise;
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
   gVars = null;
 });
--- a/browser/devtools/debugger/test/browser_dbg_terminate-on-tab-close.js
+++ b/browser/devtools/debugger/test/browser_dbg_terminate-on-tab-close.js
@@ -2,37 +2,35 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that debuggee scripts are terminated on tab closure.
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_terminate-on-tab-close.html";
 
-let gTab, gDebuggee, gDebugger, gPanel;
+let gTab, gDebugger, gPanel;
 
 function test() {
-  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
     gTab = aTab;
-    gDebuggee = aDebuggee;
     gPanel = aPanel;
     gDebugger = gPanel.panelWin;
 
     testTerminate();
   });
 }
 
 function testTerminate() {
   gDebugger.gThreadClient.addOneTimeListener("paused", () => {
     resumeDebuggerThenCloseAndFinish(gPanel).then(function () {
       ok(true, "should not throw after this point");
     });
   });
 
-  gDebuggee.debuggerThenThrow();
+  callInTab(gTab, "debuggerThenThrow");
 }
 
 registerCleanupFunction(function() {
   gTab = null;
-  gDebuggee = null;
   gPanel = null;
   gDebugger = null;
 });