diff options
author | Matt A. Tobin <email@mattatobin.com> | 2014-07-02 00:07:24 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2014-07-02 05:58:53 -0400 |
commit | 77707b62085f862709562185e615634e7431080a (patch) | |
tree | cb1d173d0dbae3332df6d4a1160336e04c2286a7 /browser/devtools/debugger | |
parent | 432326d2eae38aaacaeff9e790a2835d6578ee3b (diff) | |
download | palemoon-gre-77707b62085f862709562185e615634e7431080a.tar.gz |
Remove tests from /browser (except /browser/metro)
Diffstat (limited to 'browser/devtools/debugger')
134 files changed, 1 insertions, 19354 deletions
diff --git a/browser/devtools/debugger/moz.build b/browser/devtools/debugger/moz.build index 86ec46748..8deb0b138 100644 --- a/browser/devtools/debugger/moz.build +++ b/browser/devtools/debugger/moz.build @@ -4,4 +4,4 @@ # 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/. -TEST_DIRS += ['test'] + diff --git a/browser/devtools/debugger/test/Makefile.in b/browser/devtools/debugger/test/Makefile.in deleted file mode 100644 index a912a546c..000000000 --- a/browser/devtools/debugger/test/Makefile.in +++ /dev/null @@ -1,164 +0,0 @@ -# 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/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ -relativesrcdir = @relativesrcdir@ - -include $(DEPTH)/config/autoconf.mk - -MOCHITEST_BROWSER_TESTS = \ - browser_dbg_aaa_run_first_leaktest.js \ - browser_dbg_clean-exit.js \ - browser_dbg_cmd.js \ - browser_dbg_cmd_break.js \ - browser_dbg_debuggerstatement.js \ - browser_dbg_listtabs-01.js \ - browser_dbg_listtabs-02.js \ - browser_dbg_tabactor-01.js \ - browser_dbg_tabactor-02.js \ - browser_dbg_globalactor-01.js \ - browser_dbg_nav-01.js \ - browser_dbg_propertyview-01.js \ - browser_dbg_propertyview-02.js \ - browser_dbg_propertyview-03.js \ - browser_dbg_propertyview-04.js \ - browser_dbg_propertyview-05.js \ - browser_dbg_propertyview-06.js \ - browser_dbg_propertyview-07.js \ - browser_dbg_propertyview-08.js \ - browser_dbg_propertyview-09.js \ - browser_dbg_propertyview-10.js \ - browser_dbg_propertyview-11.js \ - browser_dbg_propertyview-12.js \ - browser_dbg_propertyview-edit-value.js \ - browser_dbg_propertyview-edit-watch.js \ - browser_dbg_propertyview-data-big.js \ - browser_dbg_propertyview-data-getset-01.js \ - browser_dbg_propertyview-data-getset-02.js \ - browser_dbg_propertyview-data.js \ - browser_dbg_propertyview-filter-04.js \ - browser_dbg_propertyview-filter-05.js \ - browser_dbg_propertyview-filter-06.js \ - browser_dbg_propertyview-filter-07.js \ - browser_dbg_propertyview-filter-08.js \ - $(filter disabled-temporarily--bug-782179, browser_dbg_reload-same-script.js) \ - browser_dbg_reload-preferred-script.js \ - browser_dbg_pane-collapse.js \ - browser_dbg_panesize-inner.js \ - browser_dbg_breadcrumbs-access.js \ - browser_dbg_stack-01.js \ - browser_dbg_stack-02.js \ - browser_dbg_stack-03.js \ - browser_dbg_stack-04.js \ - browser_dbg_stack-05.js \ - browser_dbg_location-changes.js \ - browser_dbg_location-changes-new.js \ - browser_dbg_location-changes-blank.js \ - browser_dbg_location-changes-bp.js \ - browser_dbg_sources-cache.js \ - browser_dbg_scripts-switching.js \ - browser_dbg_scripts-switching-02.js \ - browser_dbg_scripts-sorting.js \ - browser_dbg_scripts-searching-01.js \ - browser_dbg_scripts-searching-02.js \ - browser_dbg_scripts-searching-03.js \ - browser_dbg_scripts-searching-04.js \ - browser_dbg_scripts-searching-05.js \ - browser_dbg_scripts-searching-06.js \ - browser_dbg_scripts-searching-07.js \ - browser_dbg_scripts-searching-08.js \ - browser_dbg_scripts-searching-files_ui.js \ - browser_dbg_scripts-searching-popup.js \ - browser_dbg_function-search.js \ - browser_dbg_pause-resume.js \ - browser_dbg_pause-warning.js \ - browser_dbg_update-editor-mode.js \ - browser_dbg_select-line.js \ - browser_dbg_breakpoint-new-script.js \ - browser_dbg_bug723069_editor-breakpoints.js \ - browser_dbg_bug723071_editor-breakpoints-pane.js \ - browser_dbg_bug723071_editor-breakpoints-highlight.js \ - browser_dbg_bug723071_editor-breakpoints-contextmenu.js \ - browser_dbg_bug740825_conditional-breakpoints-01.js \ - browser_dbg_bug740825_conditional-breakpoints-02.js \ - browser_dbg_bug727429_watch-expressions-01.js \ - browser_dbg_bug727429_watch-expressions-02.js \ - browser_dbg_bug731394_editor-contextmenu.js \ - browser_dbg_bug737803_editor_actual_location.js \ - browser_dbg_bug786070_hide_nonenums.js \ - browser_dbg_bug868163_highight_on_pause.js \ - browser_dbg_displayName.js \ - browser_dbg_pause-exceptions.js \ - browser_dbg_multiple-windows.js \ - browser_dbg_iframes.js \ - browser_dbg_bfcache.js \ - browser_dbg_progress-listener-bug.js \ - browser_dbg_chrome-debugging.js \ - browser_dbg_source_maps-01.js \ - browser_dbg_source_maps-02.js \ - browser_dbg_step-out.js \ - head.js \ - $(NULL) - -MOCHITEST_BROWSER_PAGES = \ - browser_dbg_cmd_break.html \ - browser_dbg_cmd.html \ - testactors.js \ - browser_dbg_tab1.html \ - browser_dbg_tab2.html \ - browser_dbg_debuggerstatement.html \ - browser_dbg_stack.html \ - browser_dbg_script-switching.html \ - browser_dbg_script-switching-02.html \ - test-script-switching-01.js \ - test-script-switching-02.js \ - browser_dbg_big-data.html \ - browser_dbg_frame-parameters.html \ - browser_dbg_update-editor-mode.html \ - test-editor-mode \ - browser_dbg_displayName.html \ - browser_dbg_iframes.html \ - browser_dbg_with-frame.html \ - browser_dbg_pause-exceptions.html \ - browser_dbg_breakpoint-new-script.html \ - browser_dbg_conditional-breakpoints.html \ - browser_dbg_watch-expressions.html \ - browser_dbg_function-search-01.html \ - browser_dbg_function-search-02.html \ - test-function-search-01.js \ - test-function-search-02.js \ - test-function-search-03.js \ - binary_search.html \ - binary_search.coffee \ - binary_search.js \ - binary_search.map \ - test-location-changes-bp.js \ - test-location-changes-bp.html \ - test-step-out.html \ - $(NULL) - -# Bug 903750 - Disabled on OSX for intermittent failures -ifneq ($(OS_ARCH), Darwin) -MOCHITEST_BROWSER_TESTS += \ - browser_dbg_propertyview-filter-01.js \ - $(NULL) -endif - -# Bug 847588, bug 860349, bug 871713 -# Disabled on OSX and Linux for intermittent failures -ifeq (,$(filter Darwin Linux,$(OS_ARCH))) -MOCHITEST_BROWSER_TESTS += \ - browser_dbg_createChrome.js \ - browser_dbg_propertyview-filter-02.js \ - browser_dbg_propertyview-filter-03.js \ - browser_dbg_propertyview-reexpand.js \ - $(NULL) -endif - -MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES - -include $(topsrcdir)/config/rules.mk diff --git a/browser/devtools/debugger/test/binary_search.coffee b/browser/devtools/debugger/test/binary_search.coffee deleted file mode 100644 index e3dacdaaa..000000000 --- a/browser/devtools/debugger/test/binary_search.coffee +++ /dev/null @@ -1,18 +0,0 @@ -# Uses a binary search algorithm to locate a value in the specified array. -window.binary_search = (items, value) -> - - start = 0 - stop = items.length - 1 - pivot = Math.floor (start + stop) / 2 - - while items[pivot] isnt value and start < stop - - # Adjust the search area. - stop = pivot - 1 if value < items[pivot] - start = pivot + 1 if value > items[pivot] - - # Recalculate the pivot. - pivot = Math.floor (stop + start) / 2 - - # Make sure we've found the correct value. - if items[pivot] is value then pivot else -1
\ No newline at end of file diff --git a/browser/devtools/debugger/test/binary_search.html b/browser/devtools/debugger/test/binary_search.html deleted file mode 100644 index f9615da7c..000000000 --- a/browser/devtools/debugger/test/binary_search.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Source Map Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript" src="binary_search.js"></script> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/binary_search.js b/browser/devtools/debugger/test/binary_search.js deleted file mode 100644 index ab5a77df1..000000000 --- a/browser/devtools/debugger/test/binary_search.js +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by CoffeeScript 1.6.1 -(function() { - - window.binary_search = function(items, value) { - var pivot, start, stop; - start = 0; - stop = items.length - 1; - pivot = Math.floor((start + stop) / 2); - while (items[pivot] !== value && start < stop) { - if (value < items[pivot]) { - stop = pivot - 1; - } - if (value > items[pivot]) { - start = pivot + 1; - } - pivot = Math.floor((stop + start) / 2); - } - if (items[pivot] === value) { - return pivot; - } else { - return -1; - } - }; - -}).call(this); - -/* -//# sourceMappingURL=binary_search.map -*/ diff --git a/browser/devtools/debugger/test/binary_search.map b/browser/devtools/debugger/test/binary_search.map deleted file mode 100644 index c5aaeab2f..000000000 --- a/browser/devtools/debugger/test/binary_search.map +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 3, - "file": "binary_search.js", - "sourceRoot": "", - "sources": [ - "binary_search.coffee" - ], - "names": [], - "mappings": ";AACA;CAAA;CAAA,CAAA,CAAuB,EAAA,CAAjB,GAAkB,IAAxB;CAEE,OAAA,UAAA;CAAA,EAAQ,CAAR,CAAA;CAAA,EACQ,CAAR,CAAa,CAAL;CADR,EAEQ,CAAR,CAAA;CAEA,EAA0C,CAAR,CAAtB,MAAN;CAGJ,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,CAAR,CAAQ,GAAR;QAAA;CACA,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,EAAR,GAAA;QADA;CAAA,EAIQ,CAAI,CAAZ,CAAA;CAXF,IAIA;CAUA,GAAA,CAAS;CAAT,YAA8B;MAA9B;AAA0C,CAAD,YAAA;MAhBpB;CAAvB,EAAuB;CAAvB" -}
\ No newline at end of file diff --git a/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js b/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js deleted file mode 100644 index a179a2d0a..000000000 --- a/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js +++ /dev/null @@ -1,73 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * This tests if the debugger leaks. - * If leaks happen here, there's something very, very fishy going on. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - // 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); - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function performTest() - { - closeDebuggerAndFinish(); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bfcache.js b/browser/devtools/debugger/test/browser_dbg_bfcache.js deleted file mode 100644 index 0b2b4c1ea..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bfcache.js +++ /dev/null @@ -1,129 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the debugger is updated with the correct scripts when moving - * back and forward in the tab. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gSources = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testInitialLoad(); - }); -} - -function testInitialLoad() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - executeSoon(function() { - validateFirstPage(); - testLocationChange(); - }); - }); - - gDebuggee.firstCall(); -} - -function testLocationChange() -{ - gDebugger.DebuggerController.activeThread.resume(function() { - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired."); - info("Still attached to the tab."); - - gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - validateSecondPage(); - testBack(); - }); - }); - }); - content.location = STACK_URL; - }); -} - -function testBack() -{ - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired after going back."); - info("Still attached to the tab."); - - gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - validateFirstPage(); - testForward(); - }); - }); - }); - - info("Going back."); - content.history.back(); -} - -function testForward() -{ - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired after going forward."); - info("Still attached to the tab."); - - gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - validateSecondPage(); - closeDebuggerAndFinish(); - }); - }); - }); - - info("Going forward."); - content.history.forward(); -} - -function validateFirstPage() { - gSources = gDebugger.DebuggerView.Sources; - - is(gSources.itemCount, 2, - "Found the expected number of scripts."); - - ok(gDebugger.DebuggerView.Sources.containsLabel("test-script-switching-01.js"), - "Found the first script label."); - ok(gDebugger.DebuggerView.Sources.containsLabel("test-script-switching-02.js"), - "Found the second script label."); -} - -function validateSecondPage() { - gSources = gDebugger.DebuggerView.Sources; - - is(gSources.itemCount, 1, - "Found the expected number of scripts."); - - ok(gDebugger.DebuggerView.Sources.containsLabel("browser_dbg_stack.html"), - "Found the single script label."); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSources = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_big-data.html b/browser/devtools/debugger/test/browser_dbg_big-data.html deleted file mode 100644 index bbdacd6a6..000000000 --- a/browser/devtools/debugger/test/browser_dbg_big-data.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Debugger Big Data Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript"> - window.addEventListener("load", function() { - function test(aNumber) { - var buffer = new ArrayBuffer(aNumber); - var z = new Int8Array(buffer); - debugger; - }; - function load() { - test(10000); - } - var button = document.querySelector("button"); - button.addEventListener("click", load, false); - }); - </script> - - </head> - <body> - <button>Click me!</button> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js b/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js deleted file mode 100644 index a16b8264f..000000000 --- a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js +++ /dev/null @@ -1,154 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function performTest() - { - let editor = gDebugger.DebuggerView.editor; - let sources = gDebugger.DebuggerView.Sources; - let stackframes = gDebugger.DebuggerView.StackFrames; - - is(editor.getCaretPosition().line, 5, - "The source editor caret position was incorrect (1)."); - is(sources.selectedLabel, "test-script-switching-02.js", - "The currently selected source is incorrect (1)."); - is(stackframes.selectedIndex, 3, - "The currently selected stackframe is incorrect (1)."); - - EventUtils.sendKey("DOWN", gDebugger); - is(editor.getCaretPosition().line, 6, - "The source editor caret position was incorrect (2)."); - is(sources.selectedLabel, "test-script-switching-02.js", - "The currently selected source is incorrect (2)."); - is(stackframes.selectedIndex, 3, - "The currently selected stackframe is incorrect (2)."); - - EventUtils.sendKey("UP", gDebugger); - is(editor.getCaretPosition().line, 5, - "The source editor caret position was incorrect (3)."); - is(sources.selectedLabel, "test-script-switching-02.js", - "The currently selected source is incorrect (3)."); - is(stackframes.selectedIndex, 3, - "The currently selected stackframe is incorrect (3)."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - stackframes.selectedItem.target, - gDebugger); - - - EventUtils.sendKey("UP", gDebugger); - is(editor.getCaretPosition().line, 5, - "The source editor caret position was incorrect (4)."); - is(sources.selectedLabel, "test-script-switching-02.js", - "The currently selected source is incorrect (4)."); - is(stackframes.selectedIndex, 2, - "The currently selected stackframe is incorrect (4)."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - is(editor.getCaretPosition().line, 4, - "The source editor caret position was incorrect (5)."); - is(sources.selectedLabel, "test-script-switching-01.js", - "The currently selected source is incorrect (5)."); - is(stackframes.selectedIndex, 1, - "The currently selected stackframe is incorrect (5)."); - - EventUtils.sendKey("UP", gDebugger); - - is(editor.getCaretPosition().line, 4, - "The source editor caret position was incorrect (6)."); - is(sources.selectedLabel, "test-script-switching-01.js", - "The currently selected source is incorrect (6)."); - is(stackframes.selectedIndex, 0, - "The currently selected stackframe is incorrect (6)."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - is(editor.getCaretPosition().line, 5, - "The source editor caret position was incorrect (7)."); - is(sources.selectedLabel, "test-script-switching-02.js", - "The currently selected source is incorrect (7)."); - is(stackframes.selectedIndex, 3, - "The currently selected stackframe is incorrect (7)."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - is(editor.getCaretPosition().line, 4, - "The source editor caret position was incorrect (8)."); - is(sources.selectedLabel, "test-script-switching-01.js", - "The currently selected source is incorrect (8)."); - is(stackframes.selectedIndex, 0, - "The currently selected stackframe is incorrect (8)."); - - closeDebuggerAndFinish(); - }); - - EventUtils.sendKey("HOME", gDebugger); - }); - - EventUtils.sendKey("END", gDebugger); - }); - - EventUtils.sendKey("UP", gDebugger); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html b/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html deleted file mode 100644 index 547afd9d8..000000000 --- a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset='utf-8'/> -<script type="text/javascript"> -function runDebuggerStatement() { - debugger; -} -function myFunction() { - var a = 1; - debugger; -} -</script> -</head> -<body> - -<button type="button" onclick="myFunction()">Run</button> - -</body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js b/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js deleted file mode 100644 index 59ebc49ee..000000000 --- a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js +++ /dev/null @@ -1,92 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Bug 771452: make sure that setting a breakpoint in an inline script doesn't -// add it twice. - -const TAB_URL = EXAMPLE_URL + "browser_dbg_breakpoint-new-script.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - testAddBreakpoint(); - }); -} - -function testAddBreakpoint() -{ - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The debugger statement was reached."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have one frame."); - - gPane.addBreakpoint({ url: TAB_URL, line: 9 }, function (aResponse, bpClient) { - testResume(); - }); - }}, 0); - }); - - gDebuggee.runDebuggerStatement(); -} - -function testResume() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The breakpoint wasn't hit yet."); - - let thread = gDebugger.DebuggerController.activeThread; - thread.addOneTimeListener("resumed", function() { - thread.addOneTimeListener("paused", function() { - executeSoon(testBreakpointHit); - }); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button")); - }); - - thread.resume(); -} - -function testBreakpointHit() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The breakpoint was hit."); - - let thread = gDebugger.DebuggerController.activeThread; - thread.addOneTimeListener("paused", function test(aEvent, aPacket) { - thread.addOneTimeListener("resumed", function() { - executeSoon(closeDebuggerAndFinish); - }); - - is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line."); - isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit."); - thread.resume(); - }); - - thread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js b/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js deleted file mode 100644 index 642ffd50c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js +++ /dev/null @@ -1,308 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 723069: test the debugger breakpoint API and connection to the source - * editor. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; -let gBreakpoints = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onSourceShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onSourceShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onSourceShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function performTest() - { - gSources = gDebugger.DebuggerView.Sources; - gEditor = gDebugger.editor; - gBreakpoints = gPane.getAllBreakpoints(); - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 2, - "Found the expected number of scripts."); - - isnot(gEditor.getText().indexOf("debugger"), -1, - "The correct script was loaded initially."); - - isnot(gSources.selectedValue, gSources.values[0], - "The correct script is selected"); - - is(Object.keys(gBreakpoints), 0, "no breakpoints"); - ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey"); - is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor"); - - gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddFirst); - executeSoon(function() { - gPane.addBreakpoint({url: gSources.selectedValue, line: 6}, onBreakpointAddFirst); - }); - } - - let breakpointsAdded = 0; - let breakpointsRemoved = 0; - let editorBreakpointChanges = 0; - - function onEditorBreakpointAddFirst(aEvent) - { - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddFirst); - editorBreakpointChanges++; - - ok(aEvent, "breakpoint1 added to the editor"); - is(aEvent.added.length, 1, "one breakpoint added to the editor"); - is(aEvent.removed.length, 0, "no breakpoint was removed from the editor"); - is(aEvent.added[0].line, 5, "editor breakpoint line is correct"); - - is(gEditor.getBreakpoints().length, 1, - "editor.getBreakpoints().length is correct"); - } - - function onBreakpointAddFirst(aBreakpointClient, aResponseError) - { - breakpointsAdded++; - - ok(aBreakpointClient, "breakpoint1 added, client received"); - ok(!aResponseError, "breakpoint1 added without errors"); - is(aBreakpointClient.location.url, gSources.selectedValue, - "breakpoint1 client url is correct"); - is(aBreakpointClient.location.line, 6, - "breakpoint1 client line is correct"); - - executeSoon(function() { - ok(aBreakpointClient.actor in gBreakpoints, - "breakpoint1 client found in the list of debugger breakpoints"); - is(Object.keys(gBreakpoints).length, 1, - "the list of debugger breakpoints holds only one breakpoint"); - is(gPane.getBreakpoint(gSources.selectedValue, 6), aBreakpointClient, - "getBreakpoint returns the correct breakpoint"); - - info("remove the first breakpoint"); - gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveFirst); - gPane.removeBreakpoint(aBreakpointClient, onBreakpointRemoveFirst); - }); - } - - function onBreakpointRemoveFirst(aLocation) - { - breakpointsRemoved++; - - ok(aLocation, "breakpoint1 removed"); - is(aLocation.url, gSources.selectedValue, "breakpoint1 remove: url is correct"); - is(aLocation.line, 6, "breakpoint1 remove: line is correct"); - - executeSoon(testBreakpointAddBackground); - } - - function onEditorBreakpointRemoveFirst(aEvent) - { - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveFirst); - editorBreakpointChanges++; - - ok(aEvent, "breakpoint1 removed from the editor"); - is(aEvent.added.length, 0, "no breakpoint was added to the editor"); - is(aEvent.removed.length, 1, "one breakpoint was removed from the editor"); - is(aEvent.removed[0].line, 5, "editor breakpoint line is correct"); - - is(gEditor.getBreakpoints().length, 0, - "editor.getBreakpoints().length is correct"); - } - - function testBreakpointAddBackground() - { - info("add a breakpoint to the second script which is not selected"); - - is(Object.keys(gBreakpoints).length, 0, - "no breakpoints in the debugger"); - ok(!gPane.getBreakpoint(gSources.selectedValue, 6), - "getBreakpoint(selectedScript, 6) returns no breakpoint"); - isnot(gSources.values[0], gSources.selectedValue, - "first script location is not the currently selected script"); - - gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddBackgroundTrap); - gPane.addBreakpoint({url: gSources.values[0], line: 5}, onBreakpointAddBackground); - } - - function onEditorBreakpointAddBackgroundTrap(aEvent) - { - // Trap listener: no breakpoint must be added to the editor when a - // breakpoint is added to a script that is not currently selected. - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddBackgroundTrap); - editorBreakpointChanges++; - ok(false, "breakpoint2 must not be added to the editor"); - } - - function onBreakpointAddBackground(aBreakpointClient, aResponseError) - { - breakpointsAdded++; - - ok(aBreakpointClient, "breakpoint2 added, client received"); - ok(!aResponseError, "breakpoint2 added without errors"); - is(aBreakpointClient.location.url, gSources.values[0], - "breakpoint2 client url is correct"); - is(aBreakpointClient.location.line, 5, - "breakpoint2 client line is correct"); - - executeSoon(function() { - ok(aBreakpointClient.actor in gBreakpoints, - "breakpoint2 client found in the list of debugger breakpoints"); - - is(Object.keys(gBreakpoints).length, 1, - "one breakpoint in the debugger"); - is(gPane.getBreakpoint(gSources.values[0], 5), aBreakpointClient, - "getBreakpoint(locations[0], 5) returns the correct breakpoint"); - - // remove the trap listener - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddBackgroundTrap); - - info("switch to the second script"); - gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddSwitch); - gEditor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onEditorTextChanged); - gSources.selectedIndex = 0; - }); - } - - function onEditorBreakpointAddSwitch(aEvent) - { - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddSwitch); - editorBreakpointChanges++; - - ok(aEvent, "breakpoint2 added to the editor"); - is(aEvent.added.length, 1, "one breakpoint added to the editor"); - is(aEvent.removed.length, 0, "no breakpoint was removed from the editor"); - is(aEvent.added[0].line, 4, "editor breakpoint line is correct"); - - is(gEditor.getBreakpoints().length, 1, - "editor.getBreakpoints().length is correct"); - } - - function onEditorTextChanged() - { - // Wait for the actual text to be shown. - if (gDebugger.editor.getText() == gDebugger.L10N.getStr("loadingText")) { - return; - } - // The requested source text has been shown, remove the event listener. - gEditor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onEditorTextChanged); - - is(gEditor.getText().indexOf("debugger"), -1, - "The second script is no longer displayed."); - - isnot(gEditor.getText().indexOf("firstCall"), -1, - "The first script is displayed."); - - let window = gEditor.editorElement.contentWindow; - executeSoon(() => window.mozRequestAnimationFrame(onReadyForClick)); - } - - function onReadyForClick() - { - info("remove the second breakpoint using the mouse"); - gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveSecond); - - let iframe = gEditor.editorElement; - let testWin = iframe.ownerDocument.defaultView; - - // flush the layout for the iframe - info("rect " + iframe.contentDocument.documentElement.getBoundingClientRect()); - - let utils = testWin.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - - let lineOffset = gEditor.getLineStart(4); - let coords = gEditor.getLocationAtOffset(lineOffset); - - let rect = iframe.getBoundingClientRect(); - let left = rect.left + 10; - let top = rect.top + coords.y + 4; - utils.sendMouseEventToWindow("mousedown", left, top, 0, 1, 0, false, 0, 0); - utils.sendMouseEventToWindow("mouseup", left, top, 0, 1, 0, false, 0, 0); - } - - function onEditorBreakpointRemoveSecond(aEvent) - { - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveSecond); - editorBreakpointChanges++; - - ok(aEvent, "breakpoint2 removed from the editor"); - is(aEvent.added.length, 0, "no breakpoint was added to the editor"); - is(aEvent.removed.length, 1, "one breakpoint was removed from the editor"); - is(aEvent.removed[0].line, 4, "editor breakpoint line is correct"); - - is(gEditor.getBreakpoints().length, 0, - "editor.getBreakpoints().length is correct"); - - executeSoon(function() { - gDebugger.gClient.addOneTimeListener("resumed", function() { - finalCheck(); - closeDebuggerAndFinish(); - }); - gDebugger.DebuggerController.activeThread.resume(); - }); - } - - function finalCheck() { - is(Object.keys(gBreakpoints).length, 0, "no breakpoint in the debugger"); - ok(!gPane.getBreakpoint(gSources.values[0], 5), - "getBreakpoint(locations[0], 5) returns no breakpoint"); - } - - registerCleanupFunction(function() { - removeTab(gTab); - is(breakpointsAdded, 2, "correct number of breakpoints have been added"); - is(breakpointsRemoved, 1, "correct number of breakpoints have been removed"); - is(editorBreakpointChanges, 4, "correct number of editor breakpoint changes"); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gBreakpoints = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js deleted file mode 100644 index 20bfb39a1..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js +++ /dev/null @@ -1,466 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test if the context menu associated with each breakpoint does what it should. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSources.preferredSource = EXAMPLE_URL + "test-script-switching-02.js"; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let { url, loaded, text } = aEvent.detail; - info("Shown source: " + url + ", loaded: " + loaded + ", text:\n" + text); - info("Shown label: " + gSources.selectedLabel); - info("All labels:" + gSources.labels); - if (url.indexOf("-02") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - performTestWhileNotPaused(); - } - }); - }); - - function addBreakpoints(callback) { - gPane.addBreakpoint({url: gSources.orderedItems[0].value, line: 5}, function(cl, err) { - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 6}, function(cl, err) { - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 7}, function(cl, err) { - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 8}, function(cl, err) { - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 9}, function(cl, err) { - callback(); - }); - }); - }); - }); - }); - } - - function performTestWhileNotPaused() - { - info("Performing test while not paused..."); - - addBreakpoints(function() { - initialChecks(); - - checkBreakpointToggleSelf(0, function() { - checkBreakpointToggleOthers(0, function() { - checkBreakpointToggleSelf(1, function() { - checkBreakpointToggleOthers(1, function() { - checkBreakpointToggleSelf(2, function() { - checkBreakpointToggleOthers(2, function() { - checkBreakpointToggleSelf(3, function() { - checkBreakpointToggleOthers(3, function() { - checkBreakpointToggleSelf(4, function() { - checkBreakpointToggleOthers(4, function() { - testDeleteAll(function() { - performTestWhilePaused(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - } - - function performTestWhilePaused() - { - info("Performing test while paused..."); - - addBreakpoints(function() { - initialChecks(); - - pauseAndCheck(function() { - checkBreakpointToggleSelf(0, function() { - checkBreakpointToggleOthers(0, function() { - checkBreakpointToggleSelf(1, function() { - checkBreakpointToggleOthers(1, function() { - checkBreakpointToggleSelf(2, function() { - checkBreakpointToggleOthers(2, function() { - checkBreakpointToggleSelf(3, function() { - checkBreakpointToggleOthers(3, function() { - checkBreakpointToggleSelf(4, function() { - checkBreakpointToggleOthers(4, function() { - testDeleteAll(function() { - closeDebuggerAndFinish(); - }); - }, true); - }); - }, true); - }); - }, true); - }); - }, true); - }); - }, true); - }); - }); - }); - } - - function pauseAndCheck(callback) { - gDebugger.gThreadClient.addOneTimeListener("resumed", function() { - pauseAndCallback(function() { - is(gSources.selectedLabel, "test-script-switching-01.js", - "The currently selected source is incorrect (1)."); - is(gSources.selectedIndex, 1, - "The currently selected source is incorrect (2)."); - - waitForCaretPos(4, function() { - ok(true, "The editor location is correct after pausing."); - callback(); - }); - }); - }); - } - - function pauseAndCallback(callback) { - let scriptShown = false; - let framesadded = false; - let testContinued = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-01") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - scriptShown = true; - executeSoon(continueTest); - } - }); - - gDebugger.gThreadClient.addOneTimeListener("framesadded", function() { - framesadded = true; - executeSoon(continueTest); - }); - - function continueTest() { - if (scriptShown && framesadded && !testContinued) { - testContinued = true; - callback(); - } - } - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); - } - - function initialChecks() { - for (let source in gSources) { - for (let breakpoint in source) { - let { sourceLocation: url, lineNumber: line, actor } = breakpoint.attachment; - - ok(gPane.getBreakpoint(url, line), - "All breakpoint items should have corresponding clients (1)."); - ok(breakpoint.attachment.actor, - "All breakpoint items should have corresponding clients (2)."); - is(!!breakpoint.attachment.disabled, false, - "All breakpoints should initially be enabled."); - - let prefix = "bp-cMenu-"; // "breakpoints context menu" - let enableSelfId = prefix + "enableSelf-" + actor + "-menuitem"; - let disableSelfId = prefix + "disableSelf-" + actor + "-menuitem"; - - is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true", - "The 'Enable breakpoint' context menu item should initially be hidden'."); - ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"), - "The 'Disable breakpoint' context menu item should initially not be hidden'."); - is(breakpoint.attachment.view.checkbox.getAttribute("checked"), "true", - "All breakpoints should initially have a checked checkbox."); - } - } - } - - function checkBreakpointToggleSelf(index, callback) { - EventUtils.sendMouseEvent({ type: "click" }, - gDebugger.document.querySelectorAll(".dbg-breakpoint")[index], - gDebugger); - - let selectedBreakpoint = gSources.selectedBreakpointItem; - let { sourceLocation: url, lineNumber: line, actor } = selectedBreakpoint.attachment; - - ok(gPane.getBreakpoint(url, line), - "There should be a breakpoint client available (1)."); - ok(gSources.selectedBreakpointClient, - "There should be a breakpoint client available (2)."); - is(!!selectedBreakpoint.attachment.disabled, false, - "The breakpoint should not be disabled yet."); - - let prefix = "bp-cMenu-"; // "breakpoints context menu" - let enableSelfId = prefix + "enableSelf-" + actor + "-menuitem"; - let disableSelfId = prefix + "disableSelf-" + actor + "-menuitem"; - - is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true", - "The 'Enable breakpoint' context menu item should be hidden'."); - ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"), - "The 'Disable breakpoint' context menu item should not be hidden'."); - - waitForCaretPos(selectedBreakpoint.attachment.lineNumber - 1, function() { - ok(true, "The editor location is correct (" + index + ")."); - - gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - ok(!gPane.getBreakpoint(url, line), - "There should be no breakpoint client available (2)."); - ok(!gSources.selectedBreakpointClient, - "There should be no breakpoint client available (3)."); - - gDebugger.addEventListener("Debugger:BreakpointShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - ok(gPane.getBreakpoint(url, line), - "There should be a breakpoint client available (4)."); - ok(gSources.selectedBreakpointClient, - "There should be a breakpoint client available (5)."); - - callback(); - }); - - // Test re-disabling this breakpoint. - executeSoon(function() { - gSources._onEnableSelf(selectedBreakpoint.attachment.actor); - is(selectedBreakpoint.attachment.disabled, false, - "The current breakpoint should now be enabled.") - - is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true", - "The 'Enable breakpoint' context menu item should be hidden'."); - ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"), - "The 'Disable breakpoint' context menu item should not be hidden'."); - ok(selectedBreakpoint.attachment.view.checkbox.hasAttribute("checked"), - "The breakpoint should now be checked."); - }); - }); - - // Test disabling this breakpoint. - executeSoon(function() { - gSources._onDisableSelf(selectedBreakpoint.attachment.actor); - is(selectedBreakpoint.attachment.disabled, true, - "The current breakpoint should now be disabled.") - - ok(!gDebugger.document.getElementById(enableSelfId).hasAttribute("hidden"), - "The 'Enable breakpoint' context menu item should not be hidden'."); - is(gDebugger.document.getElementById(disableSelfId).getAttribute("hidden"), "true", - "The 'Disable breakpoint' context menu item should be hidden'."); - ok(!selectedBreakpoint.attachment.view.checkbox.hasAttribute("checked"), - "The breakpoint should now be unchecked."); - }); - }); - } - - function checkBreakpointToggleOthers(index, callback, whilePaused) { - let count = 4 - gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) { - info(count + " breakpoints remain to be hidden..."); - if (!(--count)) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - ok(true, "All breakpoints except one were hidden."); - - let selectedBreakpoint = gSources.selectedBreakpointItem; - let { sourceLocation: url, lineNumber: line, actor } = selectedBreakpoint.attachment; - - ok(gPane.getBreakpoint(url, line), - "There should be a breakpoint client available (6)."); - ok(gSources.selectedBreakpointClient, - "There should be a breakpoint client available (7)."); - is(!!selectedBreakpoint.attachment.disabled, false, - "The targetted breakpoint should not have been disabled."); - - for (let source in gSources) { - for (let otherBreakpoint in source) { - if (otherBreakpoint != selectedBreakpoint) { - ok(!gPane.getBreakpoint( - otherBreakpoint.attachment.sourceLocation, - otherBreakpoint.attachment.lineNumber), - "There should be no breakpoint client for a disabled breakpoint (8)."); - is(otherBreakpoint.attachment.disabled, true, - "Non-targetted breakpoints should have been disabled (9)."); - } - } - } - - count = 4; - gDebugger.addEventListener("Debugger:BreakpointShown", function _onEvent(aEvent) { - info(count + " breakpoints remain to be reshown..."); - if (!(--count)) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - ok(true, "All breakpoints are now reshown."); - - for (let source in gSources) { - for (let someBreakpoint in source) { - ok(gPane.getBreakpoint( - someBreakpoint.attachment.sourceLocation, - someBreakpoint.attachment.lineNumber), - "There should be a breakpoint client for all enabled breakpoints (10)."); - is(someBreakpoint.attachment.disabled, false, - "All breakpoints should now have been enabled (11)."); - } - } - - count = 5; - gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) { - info(count + " breakpoints remain to be rehidden..."); - if (!(--count)) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - ok(true, "All breakpoints are now rehidden."); - - for (let source in gSources) { - for (let someBreakpoint in source) { - ok(!gPane.getBreakpoint( - someBreakpoint.attachment.sourceLocation, - someBreakpoint.attachment.lineNumber), - "There should be no breakpoint client for a disabled breakpoint (12)."); - is(someBreakpoint.attachment.disabled, true, - "All breakpoints should now have been disabled (13)."); - } - } - - count = 5; - gDebugger.addEventListener("Debugger:BreakpointShown", function _onEvent(aEvent) { - info(count + " breakpoints remain to be reshown..."); - if (!(--count)) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - ok(true, "All breakpoints are now rehidden."); - - for (let source in gSources) { - for (let someBreakpoint in source) { - ok(gPane.getBreakpoint( - someBreakpoint.attachment.sourceLocation, - someBreakpoint.attachment.lineNumber), - "There should be a breakpoint client for all enabled breakpoints (14)."); - is(someBreakpoint.attachment.disabled, false, - "All breakpoints should now have been enabled (15)."); - } - } - - // Done. - if (!whilePaused) { - gDebugger.gThreadClient.addOneTimeListener("resumed", callback); - } else { - callback(); - } - } - }); - - // Test re-enabling all breakpoints. - enableAll(); - } - }); - - // Test disabling all breakpoints. - if (!whilePaused) { - gDebugger.gThreadClient.addOneTimeListener("resumed", disableAll); - } else { - disableAll(); - } - } - }); - - // Test re-enabling other breakpoints. - enableOthers(); - } - }); - - // Test disabling other breakpoints. - if (!whilePaused) { - gDebugger.gThreadClient.addOneTimeListener("resumed", disableOthers); - } else { - disableOthers(); - } - } - - function testDeleteAll(callback) { - let count = 5 - gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) { - info(count + " breakpoints remain to be hidden..."); - if (!(--count)) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - ok(true, "All breakpoints were hidden."); - - ok(!gSources.selectedBreakpointItem, - "There should be no breakpoint item available (16)."); - ok(!gSources.selectedBreakpointClient, - "There should be no breakpoint client available (17)."); - - for (let source in gSources) { - for (let otherBreakpoint in source) { - ok(false, "It's a trap!"); - } - } - - // Done. - callback(); - } - }); - - // Test deleting all breakpoints. - deleteAll(); - } - - function disableOthers() { - gSources._onDisableOthers(gSources.selectedBreakpointItem.attachment.actor); - } - function enableOthers() { - gSources._onEnableOthers(gSources.selectedBreakpointItem.attachment.actor); - } - function disableAll() { - gSources._onDisableAll(gSources.selectedBreakpointItem.attachment.actor); - } - function enableAll() { - gSources._onEnableAll(gSources.selectedBreakpointItem.attachment.actor); - } - function deleteAll() { - gSources._onDeleteAll(gSources.selectedBreakpointItem.attachment.actor); - } - - function waitForCaretPos(number, callback) - { - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gEditor.getCaretPosition().line != number) { - return; - } - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js b/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js deleted file mode 100644 index 1440cf268..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js +++ /dev/null @@ -1,224 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test if breakpoints are highlighted when they should. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSources.preferredSource = EXAMPLE_URL + "test-script-switching-02.js"; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let { url, loaded, text } = aEvent.detail; - info("Shown source: " + url + ", loaded: " + loaded + ", text:\n" + text); - info("Shown label: " + gSources.selectedLabel); - info("All labels:" + gSources.labels); - if (url.indexOf("-02") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - performTest(); - } - }); - }); - - function performTest() - { - initialChecks(); - gPane.addBreakpoint({url: gSources.orderedItems[0].value, line: 5}, function(cl, err) { - initialChecks(); - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 6}, function(cl, err) { - initialChecks(); - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 7}, function(cl, err) { - initialChecks(); - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 8}, function(cl, err) { - initialChecks(); - gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 9}, function(cl, err) { - initialChecks(); - testHighlight1(); - }); - }); - }); - }); - }); - } - - function initialChecks() { - is(gSources.selectedValue, gSources.orderedItems[1].value, - "The currently selected source is incorrect (0)."); - is(gEditor.getCaretPosition().line, 0, - "The editor caret line was incorrect (0)."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret column was incorrect (0)."); - } - - function testHighlight1() { - gSources.highlightBreakpoint(gSources.orderedItems[0].value, 5); - checkHighlight(gSources.orderedItems[0].value, 5); - - is(gSources.selectedValue, gSources.orderedItems[1].value, - "The currently selected source is incorrect (1)."); - - is(gEditor.getCaretPosition().line, 0, - "The editor caret line was incorrect (1)."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret column was incorrect (1)."); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebugger.document.querySelectorAll(".dbg-breakpoint")[0], - gDebugger); - - waitForCaretPos(4, function() { - ok(true, "The editor location is correct (1)."); - testHighlight2(); - }); - } - - function testHighlight2() { - gSources.highlightBreakpoint(gSources.orderedItems[1].value, 6); - checkHighlight(gSources.orderedItems[1].value, 6); - - is(gSources.selectedValue, gSources.orderedItems[0].value, - "The currently selected source is incorrect (2)."); - - is(gEditor.getCaretPosition().line, 4, - "The editor caret line was incorrect (2)."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret column was incorrect (2)."); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebugger.document.querySelectorAll(".dbg-breakpoint")[1], - gDebugger); - - waitForCaretPos(5, function() { - ok(true, "The editor location is correct (2)."); - testHighlight3(); - }); - } - - function testHighlight3() { - gSources.highlightBreakpoint(gSources.orderedItems[1].value, 7); - checkHighlight(gSources.orderedItems[1].value, 7); - - is(gSources.selectedValue, gSources.orderedItems[1].value, - "The currently selected source is incorrect (3)."); - - is(gEditor.getCaretPosition().line, 5, - "The editor caret line was incorrect (3)."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret column was incorrect (3)."); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebugger.document.querySelectorAll(".dbg-breakpoint")[2], - gDebugger); - - waitForCaretPos(6, function() { - ok(true, "The editor location is correct (3)."); - testHighlight4(); - }); - } - - function testHighlight4() { - gSources.highlightBreakpoint(gSources.orderedItems[1].value, 8); - checkHighlight(gSources.orderedItems[1].value, 8); - - is(gSources.selectedValue, gSources.orderedItems[1].value, - "The currently selected source is incorrect (4)."); - - is(gEditor.getCaretPosition().line, 6, - "The editor caret line was incorrect (4)."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret column was incorrect (4)."); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebugger.document.querySelectorAll(".dbg-breakpoint")[3], - gDebugger); - - waitForCaretPos(7, function() { - ok(true, "The editor location is correct (4)."); - testHighlight5(); - }); - } - - function testHighlight5() { - gSources.highlightBreakpoint(gSources.orderedItems[1].value, 9); - checkHighlight(gSources.orderedItems[1].value, 9); - - is(gSources.selectedValue, gSources.orderedItems[1].value, - "The currently selected source is incorrect (5)."); - - is(gEditor.getCaretPosition().line, 7, - "The editor caret line was incorrect (5)."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret column was incorrect (5)."); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebugger.document.querySelectorAll(".dbg-breakpoint")[4], - gDebugger); - - waitForCaretPos(8, function() { - ok(true, "The editor location is correct (5)."); - closeDebuggerAndFinish(); - }); - } - - function checkHighlight(aUrl, aLine) { - is(gSources.selectedBreakpointItem, gSources.getBreakpoint(aUrl, aLine), - "The currently selected breakpoint item is incorrect."); - is(gSources.selectedBreakpointClient, gPane.getBreakpoint(aUrl, aLine), - "The currently selected breakpoint client is incorrect."); - - is(gSources.selectedBreakpointItem.attachment.sourceLocation, aUrl, - "The selected breakpoint item's source location attachment is incorrect."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, aLine, - "The selected breakpoint item's source line number is incorrect."); - - ok(gSources.selectedBreakpointItem.target.classList.contains("selected"), - "The selected breakpoint item's target should have a selected class."); - } - - function waitForCaretPos(number, callback) - { - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gEditor.getCaretPosition().line != number) { - return; - } - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js b/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js deleted file mode 100644 index edce10c27..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js +++ /dev/null @@ -1,301 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 723071: test adding a pane to display the list of breakpoints across - * all scripts in the debuggee. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; -let gBreakpoints = null; -let gBreakpointsParent = null; -let gBreakpointsList = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - let breakpointsAdded = 0; - let breakpointsDisabled = 0; - let breakpointsRemoved = 0; - - function performTest() - { - gEditor = gDebugger.editor; - gSources = gDebugger.DebuggerView.Sources; - gBreakpoints = gPane.getAllBreakpoints(); - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 2, - "Found the expected number of scripts."); - - isnot(gEditor.getText().indexOf("debugger"), -1, - "The correct script was loaded initially."); - - isnot(gSources.selectedValue, gSources.values[0], - "The correct script is selected"); - - is(Object.keys(gBreakpoints).length, 0, "no breakpoints"); - ok(!gPane.getBreakpoint("chocolate", 3), "getBreakpoint('chocolate', 3) returns falsey"); - is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor"); - - gBreakpointsParent = gSources.widget._parent; - gBreakpointsList = gSources.widget._list; - - is(gBreakpointsParent.childNodes.length, 1, // one sources list - "Found junk in the breakpoints container."); - is(gBreakpointsList.childNodes.length, 1, // one sources group - "Found junk in the breakpoints container."); - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, 0, - "No breakpoints should be visible at this point."); - - addBreakpoints(function() { - is(breakpointsAdded, 3, - "Should have added 3 breakpoints so far."); - is(breakpointsDisabled, 0, - "Shouldn't have disabled anything so far."); - is(breakpointsRemoved, 0, - "Shouldn't have removed anything so far."); - - is(gBreakpointsParent.childNodes.length, 1, // one sources list - "Found junk in the breakpoints container."); - is(gBreakpointsList.childNodes.length, 1, // one sources group - "Found junk in the breakpoints container."); - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, 3, - "3 breakpoints should be visible at this point."); - - disableBreakpoints(function() { - is(breakpointsAdded, 3, - "Should still have 3 breakpoints added so far."); - is(breakpointsDisabled, 3, - "Should have 3 disabled breakpoints."); - is(breakpointsRemoved, 0, - "Shouldn't have removed anything so far."); - - is(gBreakpointsParent.childNodes.length, 1, // one sources list - "Found junk in the breakpoints container."); - is(gBreakpointsList.childNodes.length, 1, // one sources group - "Found junk in the breakpoints container."); - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsAdded, - "Should have the same number of breakpoints in the pane."); - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsDisabled, - "Should have the same number of disabled breakpoints."); - - addBreakpoints(function() { - is(breakpointsAdded, 3, - "Should still have only 3 breakpoints added so far."); - is(breakpointsDisabled, 3, - "Should still have 3 disabled breakpoints."); - is(breakpointsRemoved, 0, - "Shouldn't have removed anything so far."); - - is(gBreakpointsParent.childNodes.length, 1, // one sources list - "Found junk in the breakpoints container."); - is(gBreakpointsList.childNodes.length, 1, // one sources group - "Found junk in the breakpoints container."); - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsAdded, - "Since half of the breakpoints already existed, but disabled, " + - "only half of the added breakpoints are actually in the pane."); - - removeBreakpoints(function() { - is(breakpointsRemoved, 3, - "Should have 3 removed breakpoints."); - - is(gBreakpointsParent.childNodes.length, 1, // one sources list - "Found junk in the breakpoints container."); - is(gBreakpointsList.childNodes.length, 1, // one sources group - "Found junk in the breakpoints container."); - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, 0, - "No breakpoints should be visible at this point."); - - executeSoon(function() { - gDebugger.gClient.addOneTimeListener("resumed", function() { - finalCheck(); - closeDebuggerAndFinish(); - }); - gDebugger.DebuggerController.activeThread.resume(); - }); - }); - }); - }); - }, true); - - function addBreakpoints(callback, increment) - { - let line; - - executeSoon(function() - { - line = 6; - gPane.addBreakpoint({url: gSources.selectedValue, line: line}, - function(cl, err) { - onBreakpointAdd.call({ increment: increment, line: line }, cl, err); - - line = 7; - gPane.addBreakpoint({url: gSources.selectedValue, line: line}, - function(cl, err) { - onBreakpointAdd.call({ increment: increment, line: line }, cl, err); - - line = 9; - gPane.addBreakpoint({url: gSources.selectedValue, line: line}, - function(cl, err) { - onBreakpointAdd.call({ increment: increment, line: line }, cl, err); - - executeSoon(function() { - callback(); - }); - }); - }); - }); - }); - } - - function disableBreakpoints(callback) - { - let nodes = Array.slice(gBreakpointsList.querySelectorAll(".dbg-breakpoint")); - info("Nodes to disable: " + breakpointsAdded); - - is(nodes.length, breakpointsAdded, - "The number of nodes to disable is incorrect."); - - Array.forEach(nodes, function(bkp) { - info("Disabling breakpoint: " + bkp.id); - - let sourceItem = gSources.getItemForElement(bkp); - let breakpointItem = gSources.getItemForElement.call(sourceItem, bkp); - let { sourceLocation: url, lineNumber: line } = breakpointItem.attachment; - info("Found data: " + breakpointItem.attachment.toSource()); - - gSources.disableBreakpoint(url, line, { callback: function() { - if (++breakpointsDisabled !== breakpointsAdded) { - return; - } - executeSoon(function() { - callback(); - }); - }}); - }); - } - - function removeBreakpoints(callback) - { - let nodes = Array.slice(gBreakpointsList.querySelectorAll(".dbg-breakpoint")); - info("Nodes to remove: " + breakpointsAdded); - - is(nodes.length, breakpointsAdded, - "The number of nodes to remove is incorrect."); - - Array.forEach(nodes, function(bkp) { - info("Removing breakpoint: " + bkp.id); - - let sourceItem = gSources.getItemForElement(bkp); - let breakpointItem = gSources.getItemForElement.call(sourceItem, bkp); - let { sourceLocation: url, lineNumber: line } = breakpointItem.attachment; - info("Found data: " + breakpointItem.attachment.toSource()); - - gPane.removeBreakpoint(gPane.getBreakpoint(url, line), function() { - if (++breakpointsRemoved !== breakpointsAdded) { - return; - } - executeSoon(function() { - callback(); - }); - }); - }); - } - - function onBreakpointAdd(aBreakpointClient, aResponseError) - { - if (this.increment) { - breakpointsAdded++; - } - - is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsAdded, - this.increment ? "Should have added a breakpoint in the pane." - : "Should have the same number of breakpoints in the pane."); - - let id = "breakpoint-" + aBreakpointClient.actor; - let bkp = gDebugger.document.getElementById(id); - let line = bkp.getElementsByClassName("dbg-breakpoint-line")[0]; - let text = bkp.getElementsByClassName("dbg-breakpoint-text")[0]; - let check = bkp.querySelector("checkbox"); - - is(bkp.id, id, - "Breakpoint element " + id + " found successfully."); - is(line.getAttribute("value"), this.line, - "The expected information wasn't found in the breakpoint element."); - is(text.getAttribute("value"), gDebugger.DebuggerView.getEditorLineText(this.line - 1).trim(), - "The expected line text wasn't found in the breakpoint element."); - is(check.getAttribute("checked"), "true", - "The breakpoint enable checkbox is checked as expected."); - } - } - - function finalCheck() { - is(Object.keys(gBreakpoints).length, 0, "no breakpoint in the debugger"); - ok(!gPane.getBreakpoint(gSources.values[0], 5), - "getBreakpoint(locations[0], 5) returns no breakpoint"); - } - - registerCleanupFunction(function() { - is(breakpointsAdded, 3, "correct number of breakpoints have been added"); - is(breakpointsDisabled, 3, "correct number of breakpoints have been disabled"); - is(breakpointsRemoved, 3, "correct number of breakpoints have been removed"); - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gBreakpoints = null; - gBreakpointsParent = null; - gBreakpointsList = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js b/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js deleted file mode 100644 index c4d7fd46f..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js +++ /dev/null @@ -1,241 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 727429: test the debugger watch expressions. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_watch-expressions.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gWatch = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gWatch = gDebugger.DebuggerView.WatchExpressions; - - gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - performTest(); - }); - - function performTest() - { - is(gWatch.getAllStrings().length, 0, - "There should initially be no watch expressions"); - - addAndCheckExpressions(1, 0, "a"); - addAndCheckExpressions(2, 0, "b"); - addAndCheckExpressions(3, 0, "c"); - - removeAndCheckExpression(2, 1, "a"); - removeAndCheckExpression(1, 0, "a"); - - - addAndCheckExpressions(2, 0, "", true); - gDebugger.editor.focus(); - is(gWatch.getAllStrings().length, 1, - "Empty watch expressions are automatically removed"); - - - addAndCheckExpressions(2, 0, "a", true); - gDebugger.editor.focus(); - is(gWatch.getAllStrings().length, 1, - "Duplicate watch expressions are automatically removed"); - - addAndCheckExpressions(2, 0, "a\t", true); - addAndCheckExpressions(2, 0, "a\r", true); - addAndCheckExpressions(2, 0, "a\n", true); - gDebugger.editor.focus(); - is(gWatch.getAllStrings().length, 1, - "Duplicate watch expressions are automatically removed"); - - addAndCheckExpressions(2, 0, "\ta", true); - addAndCheckExpressions(2, 0, "\ra", true); - addAndCheckExpressions(2, 0, "\na", true); - gDebugger.editor.focus(); - is(gWatch.getAllStrings().length, 1, - "Duplicate watch expressions are automatically removed"); - - - addAndCheckCustomExpression(2, 0, "bazΩΩka"); - addAndCheckCustomExpression(3, 0, "bambøøcha"); - - - EventUtils.sendMouseEvent({ type: "click" }, - gWatch.getItemAtIndex(0).attachment.closeNode, - gDebugger); - - is(gWatch.getAllStrings().length, 2, - "Watch expressions are removed when the close button is pressed"); - is(gWatch.getAllStrings()[0], "bazΩΩka", - "The expression at index " + 0 + " should be correct (1)"); - is(gWatch.getAllStrings()[1], "a", - "The expression at index " + 1 + " should be correct (2)"); - - - EventUtils.sendMouseEvent({ type: "click" }, - gWatch.getItemAtIndex(0).attachment.closeNode, - gDebugger); - - is(gWatch.getAllStrings().length, 1, - "Watch expressions are removed when the close button is pressed"); - is(gWatch.getAllStrings()[0], "a", - "The expression at index " + 0 + " should be correct (3)"); - - - EventUtils.sendMouseEvent({ type: "click" }, - gWatch.getItemAtIndex(0).attachment.closeNode, - gDebugger); - - is(gWatch.getAllStrings().length, 0, - "Watch expressions are removed when the close button is pressed"); - - - EventUtils.sendMouseEvent({ type: "click" }, - gWatch.widget._parent, - gDebugger); - - is(gWatch.getAllStrings().length, 1, - "Watch expressions are added when the view container is pressed"); - - - closeDebuggerAndFinish(); - } - - function addAndCheckCustomExpression(total, index, string, noBlur) { - addAndCheckExpressions(total, index, "", true); - - for (let i = 0; i < string.length; i++) { - EventUtils.sendChar(string[i], gDebugger); - } - - gDebugger.editor.focus(); - - let element = gWatch.getItemAtIndex(index).target; - - is(gWatch.getItemAtIndex(index).attachment.initialExpression, "", - "The initial expression at index " + index + " should be correct (1)"); - is(gWatch.getItemForElement(element).attachment.initialExpression, "", - "The initial expression at index " + index + " should be correct (2)"); - - is(gWatch.getItemAtIndex(index).attachment.currentExpression, string, - "The expression at index " + index + " should be correct (1)"); - is(gWatch.getItemForElement(element).attachment.currentExpression, string, - "The expression at index " + index + " should be correct (2)"); - - is(gWatch.getString(index), string, - "The expression at index " + index + " should be correct (3)"); - is(gWatch.getAllStrings()[index], string, - "The expression at index " + index + " should be correct (4)"); - } - - function addAndCheckExpressions(total, index, string, noBlur) { - gWatch.addExpression(string); - - is(gWatch.getAllStrings().length, total, - "There should be " + total + " watch expressions available (1)"); - is(gWatch.itemCount, total, - "There should be " + total + " watch expressions available (2)"); - - ok(gWatch.getItemAtIndex(index), - "The expression at index " + index + " should be available"); - is(gWatch.getItemAtIndex(index).attachment.initialExpression, string, - "The expression at index " + index + " should have an initial expression"); - - let element = gWatch.getItemAtIndex(index).target; - - ok(element, - "There should be a new expression item in the view"); - ok(gWatch.getItemForElement(element), - "The watch expression item should be accessible"); - is(gWatch.getItemForElement(element), gWatch.getItemAtIndex(index), - "The correct watch expression item was accessed"); - - ok(gWatch.widget.getItemAtIndex(index) instanceof XULElement, - "The correct watch expression element was accessed (1)"); - is(element, gWatch.widget.getItemAtIndex(index), - "The correct watch expression element was accessed (2)"); - - is(gWatch.getItemForElement(element).attachment.arrowNode.hidden, false, - "The arrow node should be visible"); - is(gWatch.getItemForElement(element).attachment.closeNode.hidden, false, - "The close button should be visible"); - is(gWatch.getItemForElement(element).attachment.inputNode.getAttribute("focused"), "true", - "The textbox input should be focused"); - - is(gDebugger.DebuggerView.Variables.parentNode.scrollTop, 0, - "The variables view should be scrolled to top"); - - is(gWatch.orderedItems[0], gWatch.getItemAtIndex(index), - "The correct watch expression was added to the cache (1)"); - is(gWatch.orderedItems[0], gWatch.getItemForElement(element), - "The correct watch expression was added to the cache (2)"); - - if (!noBlur) { - gDebugger.editor.focus(); - - is(gWatch.getItemAtIndex(index).attachment.initialExpression, string, - "The initial expression at index " + index + " should be correct (1)"); - is(gWatch.getItemForElement(element).attachment.initialExpression, string, - "The initial expression at index " + index + " should be correct (2)"); - - is(gWatch.getItemAtIndex(index).attachment.currentExpression, string, - "The expression at index " + index + " should be correct (1)"); - is(gWatch.getItemForElement(element).attachment.currentExpression, string, - "The expression at index " + index + " should be correct (2)"); - - is(gWatch.getString(index), string, - "The expression at index " + index + " should be correct (3)"); - is(gWatch.getAllStrings()[index], string, - "The expression at index " + index + " should be correct (4)"); - } - } - - function removeAndCheckExpression(total, index, string) { - gWatch.removeAt(index); - - is(gWatch.getAllStrings().length, total, - "There should be " + total + " watch expressions available (1)"); - is(gWatch.itemCount, total, - "There should be " + total + " watch expressions available (2)"); - - ok(gWatch.getItemAtIndex(index), - "The expression at index " + index + " should still be available"); - is(gWatch.getItemAtIndex(index).attachment.initialExpression, string, - "The expression at index " + index + " should still have an initial expression"); - - let element = gWatch.getItemAtIndex(index).target; - - is(gWatch.getItemAtIndex(index).attachment.initialExpression, string, - "The initial expression at index " + index + " should be correct (1)"); - is(gWatch.getItemForElement(element).attachment.initialExpression, string, - "The initial expression at index " + index + " should be correct (2)"); - - is(gWatch.getItemAtIndex(index).attachment.currentExpression, string, - "The expression at index " + index + " should be correct (1)"); - is(gWatch.getItemForElement(element).attachment.currentExpression, string, - "The expression at index " + index + " should be correct (2)"); - - is(gWatch.getString(index), string, - "The expression at index " + index + " should be correct (3)"); - is(gWatch.getAllStrings()[index], string, - "The expression at index " + index + " should be correct (4)"); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gWatch = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js b/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js deleted file mode 100644 index df24c4d91..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js +++ /dev/null @@ -1,394 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 727429: test the debugger watch expressions. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_watch-expressions.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gWatch = null; -let gVars = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gWatch = gDebugger.DebuggerView.WatchExpressions; - gVars = gDebugger.DebuggerView.Variables; - - gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - addExpressions(); - performTest(); - }); - - function addExpressions() - { - gWatch.addExpression("'a'"); - gWatch.addExpression("\"a\""); - gWatch.addExpression("'a\"\"'"); - gWatch.addExpression("\"a''\""); - gWatch.addExpression("?"); - gWatch.addExpression("a"); - gWatch.addExpression("this"); - gWatch.addExpression("this.canada"); - gWatch.addExpression("[1, 2, 3]"); - gWatch.addExpression("x = [1, 2, 3]"); - gWatch.addExpression("y = [1, 2, 3]; y.test = 4"); - gWatch.addExpression("z = [1, 2, 3]; z.test = 4; z"); - gWatch.addExpression("t = [1, 2, 3]; t.test = 4; !t"); - gWatch.addExpression("arguments[0]"); - gWatch.addExpression("encodeURI(\"\\\")"); - gWatch.addExpression("decodeURI(\"\\\")"); - gWatch.addExpression("decodeURIComponent(\"%\")"); - gWatch.addExpression("//"); - gWatch.addExpression("// 42"); - gWatch.addExpression("{}.foo"); - gWatch.addExpression("{}.foo()"); - gWatch.addExpression("({}).foo()"); - gWatch.addExpression("new Array(-1)"); - gWatch.addExpression("4.2.toExponential(-4.2)"); - gWatch.addExpression("throw new Error(\"bazinga\")"); - gWatch.addExpression("({ get error() { throw new Error(\"bazinga\") } }).error"); - gWatch.addExpression("throw { get name() { throw \"bazinga\" } }"); - } - - function performTest() - { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0, - "There should be 0 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27, - "There should be 27 visible nodes in the watch expressions container"); - - test1(function() { - test2(function() { - test3(function() { - test4(function() { - test5(function() { - test6(function() { - test7(function() { - test8(function() { - test9(function() { - finishTest(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - } - - function finishTest() - { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0, - "There should be 0 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27, - "There should be 27 visible nodes in the watch expressions container"); - - closeDebuggerAndFinish(); - } - - function test1(callback) { - waitForWatchExpressions(function() { - info("Performing test1"); - checkWatchExpressions("ReferenceError: a is not defined", - { type: "object", class: "Object" }, - { type: "object", class: "String" }, - { type: "undefined" }, - 26); - callback(); - }); - executeSoon(function() { - gDebuggee.test(); // ermahgerd!! - }); - } - - function test2(callback) { - waitForWatchExpressions(function() { - info("Performing test2"); - checkWatchExpressions({ type: "undefined" }, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 26); - callback(); - }); - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); - } - - function test3(callback) { - waitForWatchExpressions(function() { - info("Performing test3"); - checkWatchExpressions({ type: "object", class: "Object" }, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 26); - callback(); - }); - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); - } - - function test4(callback) { - waitForWatchExpressions(function() { - info("Performing test4"); - checkWatchExpressions(5, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 27); - callback(); - }); - executeSoon(function() { - gWatch.addExpression("a = 5"); - EventUtils.sendKey("RETURN", gDebugger); - }); - } - - function test5(callback) { - waitForWatchExpressions(function() { - info("Performing test5"); - checkWatchExpressions(5, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 27); - callback(); - }); - executeSoon(function() { - gWatch.addExpression("encodeURI(\"\\\")"); - EventUtils.sendKey("RETURN", gDebugger); - }); - } - - function test6(callback) { - waitForWatchExpressions(function() { - info("Performing test6"); - checkWatchExpressions(5, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 27); - callback(); - }) - executeSoon(function() { - gWatch.addExpression("decodeURI(\"\\\")"); - EventUtils.sendKey("RETURN", gDebugger); - }); - } - - function test7(callback) { - waitForWatchExpressions(function() { - info("Performing test7"); - checkWatchExpressions(5, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 27); - callback(); - }); - executeSoon(function() { - gWatch.addExpression("?"); - EventUtils.sendKey("RETURN", gDebugger); - }); - } - - function test8(callback) { - waitForWatchExpressions(function() { - info("Performing test8"); - checkWatchExpressions(5, - { type: "object", class: "Window" }, - { type: "undefined" }, - "sensational", - 27); - callback(); - }); - executeSoon(function() { - gWatch.addExpression("a"); - EventUtils.sendKey("RETURN", gDebugger); - }); - } - - function test9(callback) { - waitForAfterFramesCleared(function() { - info("Performing test9"); - callback(); - }); - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); - } - - function waitForAfterFramesCleared(callback) { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function onClear() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", onClear, false); - executeSoon(callback); - }, false); - } - - function waitForWatchExpressions(callback) { - gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function onFetch() { - gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", onFetch, false); - executeSoon(callback); - }, false); - } - - function checkWatchExpressions(expected_a, - expected_this, - expected_prop, - expected_arguments, - total) - { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, total, - "There should be " + total + " hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, total, "There should be " + total + " evaluations availalble"); - - let w1 = scope.get("'a'"); - let w2 = scope.get("\"a\""); - let w3 = scope.get("'a\"\"'"); - let w4 = scope.get("\"a''\""); - let w5 = scope.get("?"); - let w6 = scope.get("a"); - let w7 = scope.get("this"); - let w8 = scope.get("this.canada"); - let w9 = scope.get("[1, 2, 3]"); - let w10 = scope.get("x = [1, 2, 3]"); - let w11 = scope.get("y = [1, 2, 3]; y.test = 4"); - let w12 = scope.get("z = [1, 2, 3]; z.test = 4; z"); - let w13 = scope.get("t = [1, 2, 3]; t.test = 4; !t"); - let w14 = scope.get("arguments[0]"); - let w15 = scope.get("encodeURI(\"\\\")"); - let w16 = scope.get("decodeURI(\"\\\")"); - let w17 = scope.get("decodeURIComponent(\"%\")"); - let w18 = scope.get("//"); - let w19 = scope.get("// 42"); - let w20 = scope.get("{}.foo"); - let w21 = scope.get("{}.foo()"); - let w22 = scope.get("({}).foo()"); - let w23 = scope.get("new Array(-1)"); - let w24 = scope.get("4.2.toExponential(-4.2)"); - let w25 = scope.get("throw new Error(\"bazinga\")"); - let w26 = scope.get("({ get error() { throw new Error(\"bazinga\") } }).error"); - let w27 = scope.get("throw { get name() { throw \"bazinga\" } }"); - - ok(w1, "The first watch expression should be present in the scope"); - ok(w2, "The second watch expression should be present in the scope"); - ok(w3, "The third watch expression should be present in the scope"); - ok(w4, "The fourth watch expression should be present in the scope"); - ok(w5, "The fifth watch expression should be present in the scope"); - ok(w6, "The sixth watch expression should be present in the scope"); - ok(w7, "The seventh watch expression should be present in the scope"); - ok(w8, "The eight watch expression should be present in the scope"); - ok(w9, "The ninth watch expression should be present in the scope"); - ok(w10, "The tenth watch expression should be present in the scope"); - ok(w11, "The eleventh watch expression should be present in the scope"); - ok(w12, "The twelfth watch expression should be present in the scope"); - ok(w13, "The 13th watch expression should be present in the scope"); - ok(w14, "The 14th watch expression should be present in the scope"); - ok(w15, "The 15th watch expression should be present in the scope"); - ok(w16, "The 16th watch expression should be present in the scope"); - ok(w17, "The 17th watch expression should be present in the scope"); - ok(w18, "The 18th watch expression should be present in the scope"); - ok(w19, "The 19th watch expression should be present in the scope"); - ok(w20, "The 20th watch expression should be present in the scope"); - ok(w21, "The 21st watch expression should be present in the scope"); - ok(w22, "The 22nd watch expression should be present in the scope"); - ok(w23, "The 23nd watch expression should be present in the scope"); - ok(w24, "The 24th watch expression should be present in the scope"); - ok(w25, "The 25th watch expression should be present in the scope"); - ok(w26, "The 26th watch expression should be present in the scope"); - ok(!w27, "The 27th watch expression should not be present in the scope"); - - is(w1.value, "a", "The first value is correct"); - is(w2.value, "a", "The second value is correct"); - is(w3.value, "a\"\"", "The third value is correct"); - is(w4.value, "a''", "The fourth value is correct"); - is(w5.value, "SyntaxError: syntax error", "The fifth value is correct"); - - if (typeof expected_a == "object") { - is(w6.value.type, expected_a.type, "The sixth value type is correct"); - is(w6.value.class, expected_a.class, "The sixth value class is correct"); - } else { - is(w6.value, expected_a, "The sixth value is correct"); - } - - if (typeof expected_this == "object") { - is(w7.value.type, expected_this.type, "The seventh value type is correct"); - is(w7.value.class, expected_this.class, "The seventh value class is correct"); - } else { - is(w7.value, expected_this, "The seventh value is correct"); - } - - if (typeof expected_prop == "object") { - is(w8.value.type, expected_prop.type, "The eighth value type is correct"); - is(w8.value.class, expected_prop.class, "The eighth value class is correct"); - } else { - is(w8.value, expected_prop, "The eighth value is correct"); - } - - is(w9.value.type, "object", "The ninth value type is correct"); - is(w9.value.class, "Array", "The ninth value class is correct"); - is(w10.value.type, "object", "The tenth value type is correct"); - is(w10.value.class, "Array", "The tenth value class is correct"); - is(w11.value, "4", "The eleventh value is correct"); - is(w12.value.type, "object", "The eleventh value type is correct"); - is(w12.value.class, "Array", "The twelfth value class is correct"); - is(w13.value, false, "The 13th value is correct"); - - if (typeof expected_arguments == "object") { - is(w14.value.type, expected_arguments.type, "The 14th value type is correct"); - is(w14.value.class, expected_arguments.class, "The 14th value class is correct"); - } else { - is(w14.value, expected_arguments, "The 14th value is correct"); - } - - is(w15.value, "SyntaxError: unterminated string literal", "The 15th value is correct"); - is(w16.value, "SyntaxError: unterminated string literal", "The 16th value is correct"); - is(w17.value, "URIError: malformed URI sequence", "The 17th value is correct"); - - is(w18.value.type, "undefined", "The 18th value type is correct"); - is(w18.value.class, undefined, "The 18th value class is correct"); - - is(w19.value.type, "undefined", "The 19th value type is correct"); - is(w19.value.class, undefined, "The 19th value class is correct"); - - is(w20.value, "SyntaxError: syntax error", "The 20th value is correct"); - is(w21.value, "SyntaxError: syntax error", "The 21th value is correct"); - is(w22.value, "TypeError: (intermediate value).foo is not a function", "The 22th value is correct"); - is(w23.value, "RangeError: invalid array length", "The 23th value is correct"); - is(w24.value, "RangeError: precision -4 out of range", "The 24st value is correct"); - is(w25.value, "Error: bazinga", "The 25nd value is correct"); - is(w26.value, "Error: bazinga", "The 26rd value is correct"); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gWatch = null; - gVars = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js deleted file mode 100644 index fc3b2efb5..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js +++ /dev/null @@ -1,127 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 731394: test the debugger source editor default context menu. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; - -function test() -{ - let contextMenu = null; - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onSourceShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", - onFramesAdded); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onFramesAdded(aEvent) { - framesAdded = true; - executeSoon(startTest); - } - - function onSourceShown(aEvent) { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - testStarted = true; - gDebugger.removeEventListener("Debugger:SourceShown", onSourceShown); - executeSoon(performTest); - } - } - - function performTest() - { - let scripts = gDebugger.DebuggerView.Sources; - let editor = gDebugger.editor; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(scripts.itemCount, 2, - "Found the expected number of scripts."); - - isnot(editor.getText().indexOf("debugger"), -1, - "The correct script was loaded initially."); - - isnot(editor.getText().indexOf("\u263a"), -1, - "Unicode characters are converted correctly."); - - contextMenu = gDebugger.document.getElementById("sourceEditorContextMenu"); - ok(contextMenu, "source editor context menupopup"); - ok(editor.readOnly, "editor is read only"); - - editor.focus(); - editor.setSelection(0, 10); - - contextMenu.addEventListener("popupshown", function onPopupShown() { - contextMenu.removeEventListener("popupshown", onPopupShown, false); - executeSoon(testContextMenu); - }, false); - contextMenu.openPopup(editor.editorElement, "overlap", 0, 0, true, false); - } - - function testContextMenu() - { - let document = gDebugger.document; - - ok(document.getElementById("editMenuCommands"), - "#editMenuCommands found"); - ok(!document.getElementById("editMenuKeys"), - "#editMenuKeys not found"); - ok(document.getElementById("sourceEditorCommands"), - "#sourceEditorCommands found"); - - // Map command ids to their expected disabled state. - let commands = {"se-cmd-undo": true, "se-cmd-redo": true, - "se-cmd-cut": true, "se-cmd-paste": true, - "se-cmd-delete": true, "cmd_findAgain": true, - "cmd_findPrevious": true, "cmd_find": false, - "cmd_gotoLine": false, "cmd_copy": false, - "se-cmd-selectAll": false}; - - for (let id in commands) { - is(document.getElementById(id).hasAttribute("disabled"), commands[id], - id + " hasAttribute('disabled') check"); - } - - executeSoon(function() { - contextMenu.hidePopup(); - closeDebuggerAndFinish(); - }); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js b/browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js deleted file mode 100644 index 79ed9cb32..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js +++ /dev/null @@ -1,121 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 737803: Setting a breakpoint in a line without code should move - * the icon to the actual location. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gSources = null; -let gEditor = null; -let gBreakpoints = null; - -function test() { - let scriptShown = false; - let framesAdded = false; - let testStarted = false; - let resumed = false; - - debug_tab_pane(TAB_URL, function (aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebuggee = aDebuggee; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onSourceShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function () { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function () { - gDebuggee.firstCall(); - }); - }); - - function onSourceShown(aEvent) { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onSourceShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function performTest() { - gSources = gDebugger.DebuggerView.Sources; - gEditor = gDebugger.editor; - gBreakpoints = gPane.getAllBreakpoints(); - is(Object.keys(gBreakpoints), 0, "There are no breakpoints"); - - gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, - onEditorBreakpointAdd); - - let location = { url: gSources.selectedValue, line: 4 }; - executeSoon(function () { - gPane.addBreakpoint(location, onBreakpointAdd); - }); - } - - let onBpDebuggerAdd = false; - let onBpEditorAdd = false; - - function onBreakpointAdd(aBpClient) { - is(aBpClient.location.url, gSources.selectedValue, "URL is the same"); - is(aBpClient.location.line, 6, "Line number is new"); - is(aBpClient.requestedLocation.line, 4, "Requested location is correct"); - - onBpDebuggerAdd = true; - tryFinish(); - } - - function onEditorBreakpointAdd(aEvent) { - gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, - onEditorBreakpointAdd); - - is(gEditor.getBreakpoints().length, 1, - "There is only one breakpoint in the editor"); - - ok(!gPane.getBreakpoint(gSources.selectedValue, 4), - "There are no breakpoints on an invalid line"); - - let br = gPane.getBreakpoint(gSources.selectedValue, 6); - is(br.location.url, gSources.selectedValue, "URL is correct"); - is(br.location.line, 6, "Line number is correct"); - - onBpEditorAdd = true; - tryFinish(); - } - - function tryFinish() { - info("onBpDebuggerAdd: " + onBpDebuggerAdd); - info("onBpEditorAdd: " + onBpEditorAdd); - - if (onBpDebuggerAdd && onBpEditorAdd) { - closeDebuggerAndFinish(); - } - } - - registerCleanupFunction(function () { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSources = null; - gEditor = null; - gBreakpoints = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js b/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js deleted file mode 100644 index ed5e9c85c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js +++ /dev/null @@ -1,393 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 740825: test the debugger conditional breakpoints. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_conditional-breakpoints.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; -let gBreakpoints = null; - -requestLongerTimeout(2); - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.ermahgerd(); // ermahgerd!! - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("conditional-breakpoints") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: addBreakpoints }, 0); - } - } - - function performTest() - { - gEditor = gDebugger.editor; - gSources = gDebugger.DebuggerView.Sources; - gBreakpoints = gPane.getAllBreakpoints(); - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 1, - "Found the expected number of scripts."); - - isnot(gEditor.getText().indexOf("ermahgerd"), -1, - "The correct script was loaded initially."); - - is(gSources.selectedValue, gSources.values[0], - "The correct script is selected"); - - is(Object.keys(gBreakpoints).length, 13, "thirteen breakpoints"); - ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey"); - is(gEditor.getBreakpoints().length, 13, "thirteen breakpoints in the editor"); - - executeSoon(test1); - } - - function test1(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 14, test2); - } - - function test2(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 15, test3); - } - - function test3(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 16, test4); - } - - function test4(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 17, test5); - } - - function test5(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 18, test6); - } - - function test6(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 19, test7); - } - - function test7(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 21, test8); - } - - function test8(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 22, test9); - } - - function test9(callback) - { - resumeAndTestBreakpoint(gSources.selectedValue, 23, test10); - } - - function test10(callback) - { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - - isnot(gSources.selectedItem, null, - "There should be a selected script in the scripts pane.") - is(gSources.selectedBreakpointItem, null, - "There should be no selected breakpoint in the scripts pane.") - is(gSources.selectedBreakpointClient, null, - "There should be no selected client in the scripts pane."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - - is(gDebugger.DebuggerView.StackFrames.widget._list.querySelectorAll(".dbg-stackframe").length, 0, - "There should be no visible stackframes."); - is(gDebugger.DebuggerView.Sources.widget._list.querySelectorAll(".dbg-breakpoint").length, 13, - "There should be thirteen visible breakpoints."); - - testReload(); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); - } - - function resumeAndTestBreakpoint(url, line, callback) - { - resume(line, function() { - waitForCaretPos(line - 1, function() { - testBreakpoint(gSources.selectedBreakpointItem, gSources.selectedBreakpointClient, url, line, true); - callback(); - }); - }); - } - - function testBreakpoint(aBreakpointItem, aBreakpointClient, url, line, editor) - { - is(aBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The breakpoint on line " + line + " wasn't added on the correct source."); - is(aBreakpointItem.attachment.lineNumber, line, - "The breakpoint on line " + line + " wasn't found."); - is(!!aBreakpointItem.attachment.disabled, false, - "The breakpoint on line " + line + " should be enabled."); - is(!!aBreakpointItem.attachment.openPopupFlag, false, - "The breakpoint on line " + line + " should not open a popup."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - - is(aBreakpointClient.location.url, url, - "The breakpoint's client url is correct"); - is(aBreakpointClient.location.line, line, - "The breakpoint's client line is correct"); - isnot(aBreakpointClient.conditionalExpression, undefined, - "The breakpoint on line " + line + " should have a conditional expression."); - - if (editor) { - is(gEditor.getCaretPosition().line + 1, line, - "The editor caret position is not situated on the proper line."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret position is not situated on the proper column."); - } - } - - function addBreakpoints(callback) - { - let currentUrl = gDebugger.DebuggerView.Sources.selectedValue; - - gPane.addBreakpoint({ url: currentUrl, line: 12 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 13 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 14 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 15 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 16 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 17 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 18 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 19 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 20 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 21 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 22 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 23 }, function() { - gPane.addBreakpoint({ url: currentUrl, line: 24 }, function() { - performTest(); - }, { - conditionalExpression: "b" - }); - }, { - conditionalExpression: "a !== null" - }); - }, { - conditionalExpression: "a !== undefined" - }); - }, { - conditionalExpression: "a" - }); - }, { - conditionalExpression: "(function() { return false; })()" - }); - }, { - conditionalExpression: "(function() {})" - }); - }, { - conditionalExpression: "({})" - }); - }, { - conditionalExpression: "/regexp/" - }); - }, { - conditionalExpression: "'nasu'" - }); - }, { - conditionalExpression: "true" - }); - }, { - conditionalExpression: "42" - }); - }, { - conditionalExpression: "null" - }); - }, { - conditionalExpression: "undefined" - }); - } - - function testReload() - { - info("Testing reload..."); - - function _get(url, line) { - return [ - gDebugger.DebuggerView.Sources.getBreakpoint(url, line), - gDebugger.DebuggerController.Breakpoints.getBreakpoint(url, line), - url, - line, - ]; - } - - gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown() { - gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown); - - waitForBreakpoints(13, function() { - testBreakpoint.apply(this, _get(gSources.selectedValue, 14)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 15)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 16)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 17)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 18)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 19)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 21)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 22)); - testBreakpoint.apply(this, _get(gSources.selectedValue, 23)); - - isnot(gSources.selectedItem, null, - "There should be a selected script in the scripts pane.") - is(gSources.selectedBreakpointItem, null, - "There should be no selected breakpoint in the scripts pane.") - is(gSources.selectedBreakpointClient, null, - "There should be no selected client in the scripts pane."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - - closeDebuggerAndFinish(); - }); - }); - - finalCheck(); - gDebuggee.location.reload(); - } - - function finalCheck() { - isnot(gEditor.getText().indexOf("ermahgerd"), -1, - "The correct script is still loaded."); - is(gSources.selectedValue, gSources.values[0], - "The correct script is still selected"); - } - - function resume(expected, callback) { - gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() { - waitForBreakpoint(expected, callback); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); - } - - let bogusClient = { - location: { - url: null, - line: null - } - }; - - function waitForBreakpoint(expected, callback) { - // Poll every few milliseconds until expected breakpoint is hit. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the breakpoint."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if ((gSources.selectedBreakpointClient !== expected) && - (gSources.selectedBreakpointClient || bogusClient).location.line !== expected) { - return; - } - // We arrived at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - function waitForBreakpoints(total, callback) - { - // Poll every few milliseconds until the breakpoints are retrieved. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the breakpoints."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gSources.widget._list.querySelectorAll(".dbg-breakpoint").length != total) { - return; - } - // We got all the breakpoints, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - function waitForCaretPos(number, callback) - { - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gEditor.getCaretPosition().line != number) { - return; - } - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gBreakpoints = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js b/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js deleted file mode 100644 index 460d8879e..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js +++ /dev/null @@ -1,583 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Bug 740825: test the debugger conditional breakpoints. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_conditional-breakpoints.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; -let gBreakpoints = null; - -requestLongerTimeout(2); - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - resumed = true; - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.ermahgerd(); // ermahgerd!! - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("conditional-breakpoints") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function performTest() - { - gEditor = gDebugger.editor; - gSources = gDebugger.DebuggerView.Sources; - gBreakpoints = gPane.getAllBreakpoints(); - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 1, - "Found the expected number of scripts."); - - isnot(gEditor.getText().indexOf("ermahgerd"), -1, - "The correct script was loaded initially."); - - is(gSources.selectedValue, gSources.values[0], - "The correct script is selected"); - - is(Object.keys(gBreakpoints), 0, "no breakpoints"); - ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey"); - is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor"); - - executeSoon(addBreakpoint1); - } - - function addBreakpoint1() - { - gPane.addBreakpoint({ url: gSources.selectedValue, line: 12 }); - - waitForBreakpoint(12, function() { - waitForCaretPos(10, function() { - waitForPopup(false, function() { - testBreakpoint(gSources.selectedBreakpointItem, - gSources.selectedBreakpointClient, - gSources.selectedValue, 12, false, false, false); - - executeSoon(addBreakpoint2); - }); - }); - }); - } - - function addBreakpoint2() - { - gSources._editorContextMenuLineNumber = 12; - gSources._onCmdAddBreakpoint(); - - waitForBreakpoint(13, function() { - waitForCaretPos(12, function() { - waitForPopup(false, function() { - testBreakpoint(gSources.selectedBreakpointItem, - gSources.selectedBreakpointClient, - gSources.selectedValue, 13, false, false, true); - - executeSoon(modBreakpoint2); - }); - }); - }); - } - - function modBreakpoint2() - { - gSources._editorContextMenuLineNumber = 12; - gSources._onCmdAddConditionalBreakpoint(); - - waitForBreakpoint(13, function() { - waitForCaretPos(12, function() { - waitForPopup(true, function() { - testBreakpoint(gSources.selectedBreakpointItem, - gSources.selectedBreakpointClient, - gSources.selectedValue, 13, true, true, true); - - executeSoon(addBreakpoint3); - }); - }); - }); - } - - function addBreakpoint3() - { - gSources._editorContextMenuLineNumber = 13; - gSources._onCmdAddConditionalBreakpoint(); - - waitForBreakpoint(14, function() { - waitForCaretPos(13, function() { - waitForPopup(true, function() { - testBreakpoint(gSources.selectedBreakpointItem, - gSources.selectedBreakpointClient, - gSources.selectedValue, 14, true, true, true); - - executeSoon(modBreakpoint3); - }); - }); - }); - } - - function modBreakpoint3() - { - write("bamboocha"); - EventUtils.sendKey("RETURN", gDebugger); - - waitForBreakpoint(14, function() { - waitForCaretPos(13, function() { - waitForPopup(false, function() { - is(gSources.selectedBreakpointClient.conditionalExpression, "bamboocha", - "The bamboocha expression wasn't fonud on the conditional breakpoint"); - - executeSoon(setContextMenu); - }); - }); - }); - } - - function setContextMenu() - { - let contextMenu = gDebugger.document.getElementById("sourceEditorContextMenu"); - info("Testing source editor popup..."); - - contextMenu.addEventListener("popupshown", function onPopupShown() { - contextMenu.removeEventListener("popupshown", onPopupShown, false); - info("Source editor popup shown..."); - - contextMenu.addEventListener("popuphidden", function onPopupHidden() { - contextMenu.removeEventListener("popuphidden", onPopupHidden, false); - info("Source editor popup hidden..."); - - is(gSources._editorContextMenuLineNumber, 14, - "The context menu line number is incorrect after the popup was hidden."); - executeSoon(addBreakpoint4); - }, false); - - is(gSources._editorContextMenuLineNumber, 14, - "The context menu line number is incorrect after the popup was shown."); - contextMenu.hidePopup(); - }, false); - - is(gSources._editorContextMenuLineNumber, -1, - "The context menu line number was incorrect before the popup was shown."); - gSources._editorContextMenuLineNumber = 14; - contextMenu.openPopup(gEditor.editorElement, "overlap", 0, 0, true, false); - } - - function addBreakpoint4() - { - gEditor.setCaretPosition(14); - gSources._onCmdAddBreakpoint(); - - waitForBreakpoint(15, function() { - waitForCaretPos(14, function() { - waitForPopup(false, function() { - testBreakpoint(gSources.selectedBreakpointItem, - gSources.selectedBreakpointClient, - gSources.selectedValue, 15, false, false, true); - - executeSoon(delBreakpoint4); - }); - }); - }); - } - - function delBreakpoint4() - { - gEditor.setCaretPosition(14); - gSources._onCmdAddBreakpoint(); - - waitForBreakpoint(null, function() { - waitForCaretPos(14, function() { - waitForPopup(false, function() { - is(gSources.selectedBreakpointItem, null, - "There should be no selected breakpoint in the breakpoints pane.") - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - - executeSoon(moveHighlight1); - }); - }); - }); - } - - function moveHighlight1() - { - gEditor.setCaretPosition(13); - - waitForBreakpoint(14, function() { - waitForCaretPos(13, function() { - waitForPopup(false, function() { - testBreakpoint(gSources.selectedBreakpointItem, - gSources.selectedBreakpointClient, - gSources.selectedValue, 14, false, true, true); - - executeSoon(testHighlights1); - }); - }); - }); - } - - function testHighlights1() - { - isnot(gSources.selectedBreakpointItem, null, - "There should be a selected breakpoint in the breakpoints pane."); - is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The selected breakpoint should have the correct location."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, 14, - "The selected breakpoint should have the correct line number."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - is(gEditor.getCaretPosition().line, 13, - "The source editor caret position should be at line 13"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - gEditor.setCaretPosition(12); - - waitForCaretPos(12, function() { - waitForPopup(false, function() { - isnot(gSources.selectedBreakpointItem, null, - "There should be a selected breakpoint in the breakpoints pane."); - is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The selected breakpoint should have the correct location."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, 13, - "The selected breakpoint should have the correct line number."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - is(gEditor.getCaretPosition().line, 12, - "The source editor caret position should be at line 12"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - gEditor.setCaretPosition(11); - - waitForCaretPos(11, function() { - waitForPopup(false, function() { - isnot(gSources.selectedBreakpointItem, null, - "There should be a selected breakpoint in the breakpoints pane."); - is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The selected breakpoint should have the correct location."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, 12, - "The selected breakpoint should have the correct line number."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - is(gEditor.getCaretPosition().line, 11, - "The source editor caret position should be at line 11"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - gEditor.setCaretPosition(10); - - waitForCaretPos(10, function() { - waitForPopup(false, function() { - is(gSources.selectedBreakpointItem, null, - "There should not be a selected breakpoint in the breakpoints pane."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - is(gEditor.getCaretPosition().line, 10, - "The source editor caret position should be at line 10"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - gEditor.setCaretPosition(14); - - waitForCaretPos(14, function() { - waitForPopup(false, function() { - is(gSources.selectedBreakpointItem, null, - "There should not be a selected breakpoint in the breakpoints pane."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - is(gEditor.getCaretPosition().line, 14, - "The source editor caret position should be at line 14"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - executeSoon(testHighlights2); - }); - }); - }); - }); - }); - }); - }); - }); - } - - function testHighlights2() - { - EventUtils.sendMouseEvent({ type: "click" }, - gSources.widget._list.querySelectorAll(".dbg-breakpoint")[2], - gDebugger); - - waitForCaretPos(13, function() { - waitForPopup(true, function() { - isnot(gSources.selectedBreakpointItem, null, - "There should be a selected breakpoint in the breakpoints pane."); - is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The selected breakpoint should have the correct location."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, 14, - "The selected breakpoint should have the correct line number."); - is(gSources._conditionalPopupVisible, true, - "The breakpoint conditional expression popup should be shown."); - is(gEditor.getCaretPosition().line, 13, - "The source editor caret position should be at line 13"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - EventUtils.sendMouseEvent({ type: "click" }, - gSources.widget._list.querySelectorAll(".dbg-breakpoint")[1], - gDebugger); - - waitForCaretPos(12, function() { - waitForPopup(true, function() { - isnot(gSources.selectedBreakpointItem, null, - "There should be a selected breakpoint in the breakpoints pane."); - is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The selected breakpoint should have the correct location."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, 13, - "The selected breakpoint should have the correct line number."); - is(gSources._conditionalPopupVisible, true, - "The breakpoint conditional expression popup should be shown."); - is(gEditor.getCaretPosition().line, 12, - "The source editor caret position should be at line 12"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - EventUtils.sendMouseEvent({ type: "click" }, - gSources.widget._list.querySelectorAll(".dbg-breakpoint")[0], - gDebugger); - - waitForCaretPos(11, function() { - waitForPopup(false, function() { - isnot(gSources.selectedBreakpointItem, null, - "There should be a selected breakpoint in the breakpoints pane."); - is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The selected breakpoint should have the correct location."); - is(gSources.selectedBreakpointItem.attachment.lineNumber, 12, - "The selected breakpoint should have the correct line number."); - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should be shown."); - is(gEditor.getCaretPosition().line, 11, - "The source editor caret position should be at line 11"); - is(gEditor.getCaretPosition().col, 0, - "The source editor caret position should be at column 0"); - - executeSoon(delBreakpoint2); - }); - }); - }); - }); - }); - }); - } - - function delBreakpoint2() - { - gSources._editorContextMenuLineNumber = 12; - gSources._onCmdAddBreakpoint(); - - waitForBreakpoint(null, function() { - waitForPopup(false, function() { - is(gSources.selectedBreakpointItem, null, - "There should be no selected breakpoint in the breakpoints pane.") - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - - executeSoon(delBreakpoint3); - }); - }); - } - - function delBreakpoint3() - { - gSources._editorContextMenuLineNumber = 13; - gSources._onCmdAddBreakpoint(); - - waitForBreakpoint(null, function() { - waitForPopup(false, function() { - is(gSources.selectedBreakpointItem, null, - "There should be no selected breakpoint in the breakpoints pane.") - is(gSources._conditionalPopupVisible, false, - "The breakpoint conditional expression popup should not be shown."); - - executeSoon(testBreakpoints); - }); - }); - } - - function testBreakpoints() - { - is(Object.keys(gBreakpoints).length, 1, "one breakpoint"); - ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey"); - is(gEditor.getBreakpoints().length, 1, "one breakpoint in the editor"); - - closeDebuggerAndFinish(); - } - - function testBreakpoint(aBreakpointItem, aBreakpointClient, url, line, popup, conditional, editor) - { - is(aBreakpointItem.attachment.sourceLocation, gSources.selectedValue, - "The breakpoint on line " + line + " wasn't added on the correct source."); - is(aBreakpointItem.attachment.lineNumber, line, - "The breakpoint on line " + line + " wasn't found."); - is(!aBreakpointItem.attachment.disabled, true, - "The breakpoint on line " + line + " should be enabled."); - is(gSources._conditionalPopupVisible, popup, - "The breakpoint conditional expression popup should " + (popup ? "" : "not ") + "be shown."); - - is(aBreakpointClient.location.url, url, - "The breakpoint's client url is correct"); - is(aBreakpointClient.location.line, line, - "The breakpoint's client line is correct"); - - if (conditional) { - isnot(aBreakpointClient.conditionalExpression, undefined, - "The breakpoint on line " + line + " should have a conditional expression."); - } else { - is(aBreakpointClient.conditionalExpression, undefined, - "The breakpoint on line " + line + " should not have a conditional expression."); - } - - if (editor) { - is(gEditor.getCaretPosition().line + 1, line, - "The editor caret position is not situated on the proper line."); - is(gEditor.getCaretPosition().col, 0, - "The editor caret position is not situated on the proper column."); - } - } - - let bogusClient = { - location: { - url: null, - line: null - } - }; - - function waitForBreakpoint(expected, callback) { - // Poll every few milliseconds until expected breakpoint is hit. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the breakpoint."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if ((gSources.selectedBreakpointClient !== expected) && - (gSources.selectedBreakpointClient || bogusClient).location.line !== expected) { - return; - } - // We arrived at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - function waitForCaretPos(number, callback) - { - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gEditor.getCaretPosition().line != number) { - return; - } - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - function waitForPopup(state, callback) - { - // Poll every few milliseconds until the expression popup is shown. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the popup."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gSources._conditionalPopupVisible != state) { - return; - } - // We got the expression popup at the expected state, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); - } - - function clear() { - gSources._cbTextbox.focus(); - gSources._cbTextbox.value = ""; - } - - function write(text) { - clear(); - append(text); - } - - function append(text) { - gSources._cbTextbox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gBreakpoints = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js b/browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js deleted file mode 100644 index 9749073d1..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js +++ /dev/null @@ -1,129 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testNonEnumProperties(); - }); -} - -function testNonEnumProperties() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let testScope = gDebugger.DebuggerView.Variables.addScope("test-scope"); - let testVar = testScope.addItem("foo"); - - testVar.addItems({ - foo: { - value: "bar", - enumerable: true - }, - bar: { - value: "foo", - enumerable: false - } - }); - - // Expand the variable. - testScope.expand(); - testVar.expand(); - - executeSoon(function() { - let details = testVar._enum; - let nonenum = testVar._nonenum; - - is(details.childNodes.length, 1, - "There should be just one property in the .details container."); - - ok(details.hasAttribute("open"), - ".details container should be visible."); - - ok(nonenum.hasAttribute("open"), - ".nonenum container should be visible."); - - is(nonenum.childNodes.length, 1, - "There should be just one property in the .nonenum container."); - - // Uncheck 'show hidden properties'. - gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "true"); - gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum(); - - executeSoon(function() { - ok(details.hasAttribute("open"), - ".details container should stay visible."); - - ok(!nonenum.hasAttribute("open"), - ".nonenum container should become hidden."); - - // Check 'show hidden properties'. - gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "false"); - gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum(); - - executeSoon(function() { - ok(details.hasAttribute("open"), - ".details container should stay visible."); - - ok(nonenum.hasAttribute("open"), - ".nonenum container should become visible."); - - // Collapse the variable. - testVar.collapse(); - - executeSoon(function() { - ok(!details.hasAttribute("open"), - ".details container should be hidden."); - - ok(!nonenum.hasAttribute("open"), - ".nonenum container should be hidden."); - - // Uncheck 'show hidden properties'. - gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "true"); - gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum(); - - executeSoon(function() { - ok(!details.hasAttribute("open"), - ".details container should stay hidden."); - - ok(!nonenum.hasAttribute("open"), - ".nonenum container should stay hidden."); - - // Check 'show hidden properties'. - gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "false"); - gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum(); - - executeSoon(function() { - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }); - }); - }); - }); - }); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js b/browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js deleted file mode 100644 index d8222a3ff..000000000 --- a/browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js +++ /dev/null @@ -1,78 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that debugger's tab is highlighted when it is paused and not the -// currently selected tool. - -var gTab = null; -var gDebugger = null; -var gToolbox = null; -var gToolboxTab = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebugger = aPane.panelWin; - gToolbox = aPane._toolbox; - gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger"); - testPause(); - }); -} - -function testPause() { - is(gDebugger.DebuggerController.activeThread.paused, false, - "Should be running after debug_tab_pane."); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() { - Services.tm.currentThread.dispatch({ run: function() { - - gToolbox.selectTool("webconsole").then(() => { - ok(gToolboxTab.classList.contains("highlighted"), - "The highlighted class is present"); - ok(!gToolboxTab.hasAttribute("selected") || - gToolboxTab.getAttribute("selected") != "true", - "The tab is not selected"); - }).then(() => gToolbox.selectTool("jsdebugger")).then(() => { - ok(gToolboxTab.classList.contains("highlighted"), - "The highlighted class is present"); - ok(gToolboxTab.hasAttribute("selected") && - gToolboxTab.getAttribute("selected") == "true", - "and the tab is selected, so the orange glow will not be present."); - }).then(testResume); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); -} - -function testResume() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() { - Services.tm.currentThread.dispatch({ run: function() { - - gToolbox.selectTool("webconsole").then(() => { - ok(!gToolboxTab.classList.contains("highlighted"), - "The highlighted class is not present now after the resume"); - ok(!gToolboxTab.hasAttribute("selected") || - gToolboxTab.getAttribute("selected") != "true", - "The tab is not selected"); - }).then(closeDebuggerAndFinish); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gTab = null; - gDebugger = null; - gToolbox = null; - gToolboxTab = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js b/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js deleted file mode 100644 index 78e726e66..000000000 --- a/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js +++ /dev/null @@ -1,68 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that chrome debugging works. - -var gClient = null; -var gTab = null; -var gMozillaTab = null; -var gThreadClient = null; -var gNewGlobal = false; -var gAttached = false; -var gChromeSource = false; - -const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; - -function test() -{ - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { - gTab = addTab(DEBUGGER_TAB_URL, function() { - gClient.listTabs(function(aResponse) { - let dbg = aResponse.chromeDebugger; - ok(dbg, "Found a chrome debugging actor."); - - gClient.addOneTimeListener("newGlobal", function() gNewGlobal = true); - gClient.addListener("newSource", onNewSource); - - gClient.attachThread(dbg, function(aResponse, aThreadClient) { - gThreadClient = aThreadClient; - ok(!aResponse.error, "Attached to the chrome debugger."); - gAttached = true; - - // Ensure that a new global will be created. - gMozillaTab = gBrowser.addTab("about:mozilla"); - - finish_test(); - }); - }); - }); - }); -} - -function onNewSource(aEvent, aPacket) -{ - gChromeSource = aPacket.source.url.startsWith("chrome:"); - finish_test(); -} - -function finish_test() -{ - if (!gAttached || !gChromeSource) { - return; - } - gClient.removeListener("newSource", onNewSource); - gThreadClient.resume(function(aResponse) { - removeTab(gMozillaTab); - removeTab(gTab); - gClient.close(function() { - ok(gNewGlobal, "Received newGlobal event."); - ok(gChromeSource, "Received newSource event for a chrome: script."); - finish(); - }); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_clean-exit.js b/browser/devtools/debugger/test/browser_dbg_clean-exit.js deleted file mode 100644 index e80f75a2e..000000000 --- a/browser/devtools/debugger/test/browser_dbg_clean-exit.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - -var gPane = null; -var gTab = null; -var gDebugger = null; - -const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; - -function test() { - debug_tab_pane(DEBUGGER_TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - testCleanExit(); - }); -} - -function testCleanExit() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - is(gDebugger.DebuggerController.activeThread.paused, true, - "Should be paused after the debugger statement."); - - closeDebuggerAndFinish(); - }}, 0); - }); - - gTab.linkedBrowser.contentWindow.wrappedJSObject.runDebuggerStatement(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_cmd.html b/browser/devtools/debugger/test/browser_dbg_cmd.html deleted file mode 100644 index 30779660a..000000000 --- a/browser/devtools/debugger/test/browser_dbg_cmd.html +++ /dev/null @@ -1,48 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset='utf-8'/> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="application/javascript;version=1.7"/> - let output; - - function init() { - output = document.querySelector("input"); - output.value = ""; - } - - function doit() { - debugger; - stepIntoMe(); // step in - - output.value = "dbg continue"; - debugger; - } - - function stepIntoMe() { - output.value = "step in"; // step in - stepOverMe(); // step over - let x = 0; // step out - output.value = "step out"; - } - - function stepOverMe() { - output.value = "step over"; - } - </script> -</head> -<body onload="init()"> - <input type="text" value=""/> - <input type="button" value="DOIT" onclick="doit()"/> - <br /> - Use this file to test the following commands: - <ul> - <li>dbg interrupt</li> - <li>dbg continue</li> - <li>dbg step over</li> - <li>dbg step in</li> - <li>dbg step out</li> - </ul> -</body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_cmd.js b/browser/devtools/debugger/test/browser_dbg_cmd.js deleted file mode 100644 index 544eddbaa..000000000 --- a/browser/devtools/debugger/test/browser_dbg_cmd.js +++ /dev/null @@ -1,108 +0,0 @@ -/* vim: set ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function test() { - const TEST_URI = "http://example.com/browser/browser/devtools/debugger/" + - "test/browser_dbg_cmd.html"; - - helpers.addTabWithToolbar(TEST_URI, function(options) { - let deferred = Promise.defer(); - - let openDone = helpers.audit(options, [{ - setup: "dbg open", - exec: { output: "", completed: false } - }]); - - openDone.then(function() { - gDevTools.showToolbox(options.target, "jsdebugger").then(function(toolbox) { - let dbg = toolbox.getCurrentPanel(); - ok(dbg, "DebuggerPanel exists"); - - function cmd(typed, callback) { - dbg._controller.activeThread.addOneTimeListener("paused", callback); - helpers.audit(options, [{ - setup: typed, - exec: { output: "" } - }]); - } - - // Wait for the initial resume... - dbg.panelWin.gClient.addOneTimeListener("resumed", function() { - info("Starting tests"); - - let contentDoc = content.window.document; - let output = contentDoc.querySelector("input[type=text]"); - let btnDoit = contentDoc.querySelector("input[type=button]"); - - helpers.audit(options, [{ - setup: "dbg list", - exec: { output: /browser_dbg_cmd.html/ } - }]); - - cmd("dbg interrupt", function() { - ok(true, "debugger is paused"); - dbg._controller.activeThread.addOneTimeListener("resumed", function() { - ok(true, "debugger continued"); - dbg._controller.activeThread.addOneTimeListener("paused", function() { - cmd("dbg step in", function() { - cmd("dbg step in", function() { - cmd("dbg step in", function() { - is(output.value, "step in", "debugger stepped in"); - cmd("dbg step over", function() { - is(output.value, "step over", "debugger stepped over"); - cmd("dbg step out", function() { - is(output.value, "step out", "debugger stepped out"); - cmd("dbg continue", function() { - cmd("dbg continue", function() { - is(output.value, "dbg continue", "debugger continued"); - - function closeDebugger(cb) { - helpers.audit(options, [{ - setup: "dbg close", - completed: false, - exec: { output: "" } - }]); - - let toolbox = gDevTools.getToolbox(options.target); - if (!toolbox) { - ok(true, "Debugger was closed."); - cb(); - } else { - toolbox.on("destroyed", function () { - ok(true, "Debugger was closed."); - cb(); - }); - } - } - - // We're closing the debugger twice to make sure - // 'dbg close' doesn't error when toolbox is already - // closed. See bug 884638 for more info. - - closeDebugger(() => { - closeDebugger(() => deferred.resolve()); - }); - }); - }); - }); - }); - }); - }); - }); - }); - EventUtils.sendMouseEvent({type:"click"}, btnDoit); - }); - - helpers.audit(options, [{ - setup: "dbg continue", - exec: { output: "" } - }]); - }); - }); - }); - }); - - return deferred.promise; - }).then(finish); -}
\ No newline at end of file diff --git a/browser/devtools/debugger/test/browser_dbg_cmd_break.html b/browser/devtools/debugger/test/browser_dbg_cmd_break.html deleted file mode 100644 index 88e19d4ed..000000000 --- a/browser/devtools/debugger/test/browser_dbg_cmd_break.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset="utf-8"> - <title>Browser GCLI break command test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript"> - function firstCall() { - eval("window.line0 = Error().lineNumber; secondCall();"); - } - function secondCall() { - eval("debugger;"); - } - </script> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_cmd_break.js b/browser/devtools/debugger/test/browser_dbg_cmd_break.js deleted file mode 100644 index 93e45b615..000000000 --- a/browser/devtools/debugger/test/browser_dbg_cmd_break.js +++ /dev/null @@ -1,220 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the break command works as it should - -const TEST_URI = "http://example.com/browser/browser/devtools/debugger/" + - "test/browser_dbg_cmd_break.html"; - -function test() { - helpers.addTabWithToolbar(TEST_URI, function(options) { - // To help us run later commands, and clear up after ourselves - let client, line0; - - return helpers.audit(options, [ - { - setup: 'break', - check: { - input: 'break', - hints: '', - markup: 'IIIII', - status: 'ERROR', - }, - }, - { - setup: 'break add', - check: { - input: 'break add', - hints: '', - markup: 'IIIIIVIII', - status: 'ERROR' - }, - }, - { - setup: 'break add line', - check: { - input: 'break add line', - hints: ' <file> <line>', - markup: 'VVVVVVVVVVVVVV', - status: 'ERROR' - }, - }, - { - name: 'open toolbox', - setup: function() { - var deferred = Promise.defer(); - - var openDone = gDevTools.showToolbox(options.target, "jsdebugger"); - openDone.then(function(toolbox) { - let dbg = toolbox.getCurrentPanel(); - ok(dbg, "DebuggerPanel exists"); - - // Wait for the initial resume... - dbg.panelWin.gClient.addOneTimeListener("resumed", function() { - info("Starting tests"); - - client = dbg.panelWin.gClient; - client.activeThread.addOneTimeListener("framesadded", function() { - line0 = '' + options.window.wrappedJSObject.line0; - deferred.resolve(); - }); - - // Trigger newScript notifications using eval. - content.wrappedJSObject.firstCall(); - }); - }); - - return deferred.promise; - }, - post: function() { - ok(client, "Debugger client exists"); - is(line0, 10, "line0 is 10"); - }, - }, - { - name: 'break add line .../browser_dbg_cmd_break.html 10', - setup: function() { - // We have to setup in a function to allow line0 to be initialized - let line = 'break add line ' + TEST_URI + ' ' + line0; - return helpers.setInput(options, line); - }, - check: { - hints: '', - status: 'VALID', - message: '', - args: { - file: { value: TEST_URI, message: '' }, - line: { value: 10 } - } - }, - exec: { - output: 'Added breakpoint', - completed: false - }, - }, - { - setup: 'break add line http://example.com/browser/browser/devtools/debugger/test/browser_dbg_cmd_break.html 13', - check: { - hints: '', - status: 'VALID', - message: '', - args: { - file: { value: TEST_URI, message: '' }, - line: { value: 13 } - } - }, - exec: { - output: 'Added breakpoint', - completed: false - }, - }, - { - setup: 'break list', - check: { - input: 'break list', - hints: '', - markup: 'VVVVVVVVVV', - status: 'VALID' - }, - exec: { - output: [ - /Source/, /Remove/, - /cmd_break\.html:10/, - /cmd_break\.html:13/ - ] - }, - }, - { - name: 'cleanup', - setup: function() { - // a.k.a "return client.activeThread.resume();" - var deferred = Promise.defer(); - client.activeThread.resume(function() { - deferred.resolve(); - }); - return deferred.promise; - }, - }, - { - setup: 'break del 0', - check: { - input: 'break del 0', - hints: ' -> browser_dbg_cmd_break.html:10', - markup: 'VVVVVVVVVVI', - status: 'ERROR', - args: { - breakpoint: { - status: 'INCOMPLETE', - message: '' - }, - } - }, - }, - { - setup: 'break del browser_dbg_cmd_break.html:10', - check: { - input: 'break del browser_dbg_cmd_break.html:10', - hints: '', - markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', - status: 'VALID', - args: { - breakpoint: { arg: ' browser_dbg_cmd_break.html:10' }, - } - }, - exec: { - output: 'Breakpoint removed', - completed: false - }, - }, - { - setup: 'break list', - check: { - input: 'break list', - hints: '', - markup: 'VVVVVVVVVV', - status: 'VALID' - }, - exec: { - output: [ - /Source/, /Remove/, - /browser_dbg_cmd_break\.html:13/ - ] - }, - }, - { - setup: 'break del browser_dbg_cmd_break.html:13', - check: { - input: 'break del browser_dbg_cmd_break.html:13', - hints: '', - markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', - status: 'VALID', - args: { - breakpoint: { arg: ' browser_dbg_cmd_break.html:13' }, - } - }, - exec: { - output: 'Breakpoint removed', - completed: false - }, - }, - { - setup: 'break list', - check: { - input: 'break list', - hints: '', - markup: 'VVVVVVVVVV', - status: 'VALID' - }, - exec: { - output: 'No breakpoints set' - }, - post: function() { - client = undefined; - - let toolbox = gDevTools.getToolbox(options.target); - return toolbox.destroy(); - } - }, - ]); - }).then(finish); -} diff --git a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html deleted file mode 100644 index 19a71432e..000000000 --- a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Conditional Breakpoints Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript"> - function ermahgerd() { - var a = {}; - debugger; - a = "undefined"; - a = "null"; - a = "42"; - a = "true"; - a = "'nasu'"; - a = "/regexp/"; - a = "{}"; - a = "function() {}"; - a = "(function { return false; })()"; - a = "a"; - a = "a !== undefined"; - a = "a !== null"; - a = "b"; - } - </script> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_createChrome.js b/browser/devtools/debugger/test/browser_dbg_createChrome.js deleted file mode 100644 index a55a152e6..000000000 --- a/browser/devtools/debugger/test/browser_dbg_createChrome.js +++ /dev/null @@ -1,93 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that a chrome debugger can be created in a new process. - -var gProcess = null; -var gTab = null; -var gDebuggee = null; - -function test() { - // Windows XP test slaves are terribly slow at this test. - requestLongerTimeout(4); - - debug_chrome(STACK_URL, aOnClosing, function(aTab, aDebuggee, aProcess) { - gTab = aTab; - gDebuggee = aDebuggee; - gProcess = aProcess; - - info("Starting test"); - testSimpleCall(); - }); -} - -function testSimpleCall() { - Services.tm.currentThread.dispatch({ run: function() { - - ok(gProcess._dbgProcess, - "The remote debugger process wasn't created properly!"); - ok(gProcess._dbgProcess.isRunning, - "The remote debugger process isn't running!"); - is(typeof gProcess._dbgProcess.pid, "number", - "The remote debugger process doesn't have a pid (?!)"); - - info("process location: " + gProcess._dbgProcess.location); - info("process pid: " + gProcess._dbgProcess.pid); - info("process name: " + gProcess._dbgProcess.processName); - info("process sig: " + gProcess._dbgProcess.processSignature); - - ok(gProcess._dbgProfile, - "The remote debugger profile wasn't created properly!"); - ok(gProcess._dbgProfile.localDir, - "The remote debugger profile doesn't have a localDir..."); - ok(gProcess._dbgProfile.rootDir, - "The remote debugger profile doesn't have a rootDir..."); - ok(gProcess._dbgProfile.name, - "The remote debugger profile doesn't have a name..."); - - info("profile localDir: " + gProcess._dbgProfile.localDir.path); - info("profile rootDir: " + gProcess._dbgProfile.rootDir.path); - info("profile name: " + gProcess._dbgProfile.name); - - let profileService = Cc["@mozilla.org/toolkit/profile-service;1"] - .createInstance(Ci.nsIToolkitProfileService); - - let profile = profileService.getProfileByName(gProcess._dbgProfile.name); - - ok(profile, - "The remote debugger profile wasn't *actually* created properly!"); - is(profile.localDir.path, gProcess._dbgProfile.localDir.path, - "The remote debugger profile doesn't have the correct localDir!"); - is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path, - "The remote debugger profile doesn't have the correct rootDir!"); - - gProcess.close(); - }}, 0); -} - -function aOnClosing() { - ok(!gProcess._dbgProcess.isRunning, - "The remote debugger process isn't closed as it should be!"); - is(gProcess._dbgProcess.exitValue, (Services.appinfo.OS == "WINNT" ? 0 : 256), - "The remote debugger process didn't die cleanly."); - - info("process exit value: " + gProcess._dbgProcess.exitValue); - - info("profile localDir: " + gProcess._dbgProfile.localDir.path); - info("profile rootDir: " + gProcess._dbgProfile.rootDir.path); - info("profile name: " + gProcess._dbgProfile.name); - - executeSoon(function() { - finish(); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gProcess = null; - gTab = null; - gDebuggee = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.html b/browser/devtools/debugger/test/browser_dbg_debuggerstatement.html deleted file mode 100644 index a4bd8443b..000000000 --- a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head><meta charset='utf-8'/><title>Browser Debugger Test Tab</title> -<!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> -<script type="text/javascript"> - -function runDebuggerStatement() -{ - debugger; -} - -</script> -</head> - -<body></body> - -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.js b/browser/devtools/debugger/test/browser_dbg_debuggerstatement.js deleted file mode 100644 index de18429f0..000000000 --- a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.js +++ /dev/null @@ -1,70 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests the behavior of the debugger statement. - -var gClient = null; -var gTab = null; -const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; - -function test() -{ - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { - gTab = addTab(DEBUGGER_TAB_URL, function() { - attach_tab_actor_for_url(gClient, DEBUGGER_TAB_URL, function(actor, response) { - test_early_debugger_statement(response); - }); - }); - }); -} - -function test_early_debugger_statement(aActor) -{ - let paused = function(aEvent, aPacket) { - ok(false, "Pause shouldn't be called before we've attached!\n"); - finish_test(); - }; - gClient.addListener("paused", paused); - // This should continue without nesting an event loop and calling - // the onPaused hook, because we haven't attached yet. - gTab.linkedBrowser.contentWindow.wrappedJSObject.runDebuggerStatement(); - - gClient.removeListener("paused", paused); - - // Now attach and resume... - gClient.request({ to: aActor.threadActor, type: "attach" }, function(aResponse) { - gClient.request({ to: aActor.threadActor, type: "resume" }, function(aResponse) { - test_debugger_statement(aActor); - }); - }); -} - -function test_debugger_statement(aActor) -{ - var stopped = false; - gClient.addListener("paused", function(aEvent, aPacket) { - stopped = true; - - gClient.request({ to: aActor.threadActor, type: "resume" }, function() { - finish_test(); - }); - }); - - // Reach around the debugging protocol and execute the debugger - // statement. - gTab.linkedBrowser.contentWindow.wrappedJSObject.runDebuggerStatement(); - ok(stopped, "Should trigger the pause handler on a debugger statement."); -} - -function finish_test() -{ - removeTab(gTab); - gClient.close(function() { - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_displayName.html b/browser/devtools/debugger/test/browser_dbg_displayName.html deleted file mode 100644 index 3311a5ad1..000000000 --- a/browser/devtools/debugger/test/browser_dbg_displayName.html +++ /dev/null @@ -1,29 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head><meta charset='utf-8'/><title>Browser Debugger Test Tab</title> -<!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> -<script type="text/javascript"> - -var a = function() { - return function() { - debugger; - } -} - -var anon = a(); -anon.displayName = "anonFunc"; - -var inferred = a(); - -function evalCall() { - eval("anon();"); - eval("inferred();"); -} - -</script> -</head> - -<body></body> - -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_displayName.js b/browser/devtools/debugger/test/browser_dbg_displayName.js deleted file mode 100644 index 40f07a255..000000000 --- a/browser/devtools/debugger/test/browser_dbg_displayName.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that anonymous functions appear in the stack frame list with either -// their displayName property or a SpiderMonkey-inferred name. - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -const TAB_URL = EXAMPLE_URL + "browser_dbg_displayName.html"; - -function test() { - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testAnonCall(); - }); -} - -function testAnonCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 3, - "Should have three frames."); - - is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"), - "anonFunc", "Frame name should be anonFunc"); - - testInferredName(); - }}, 0); - }); - - gDebuggee.evalCall(); -} - -function testInferredName() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 3, - "Should have three frames."); - - is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"), - "a/<", "Frame name should be a/<"); - - resumeAndFinish(); - }}, 0); - }); - - gDebugger.DebuggerController.activeThread.resume(); -} - -function resumeAndFinish() { - gDebugger.DebuggerController.activeThread.resume(function() { - removeTab(gTab); - gPane = null; - gDebuggee = null; - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_frame-parameters.html b/browser/devtools/debugger/test/browser_dbg_frame-parameters.html deleted file mode 100644 index ed82aaad4..000000000 --- a/browser/devtools/debugger/test/browser_dbg_frame-parameters.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Debugger Function Call Parameter Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript"> - window.addEventListener("load", function() { - function test(aArg, bArg, cArg, dArg, eArg, fArg) { - var a = 1; - var b = { a: a }; - var c = { a: 1, b: "beta", c: true, d: b }; - var myVar = { - _prop: 42, - get prop() { return this._prop; }, - set prop(val) { this._prop = val; } - }; - - debugger; - } - function load() { - var a = { a: 1, b: "beta", c: true }; - var e = eval("test(a, 'beta', 3, false, null)"); - } - var button = document.querySelector("button"); - button.addEventListener("click", load, false); - var buttonAsProto = Object.create(button); - }); - </script> - - </head> - <body> - <button>Click me!</button> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_function-search-01.html b/browser/devtools/debugger/test/browser_dbg_function-search-01.html deleted file mode 100644 index 9d970a633..000000000 --- a/browser/devtools/debugger/test/browser_dbg_function-search-01.html +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE HTML> -<html> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Function Search</title> - <script type="text/javascript" src="test-function-search-01.js"></script> - <script type="text/javascript" src="test-function-search-02.js"></script> - <script type="text/javascript" src="test-function-search-03.js"></script> - </head> - - <body> - <p>Peanut butter jelly time!</p> - </body> - -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_function-search-02.html b/browser/devtools/debugger/test/browser_dbg_function-search-02.html deleted file mode 100644 index f06b19f1a..000000000 --- a/browser/devtools/debugger/test/browser_dbg_function-search-02.html +++ /dev/null @@ -1,29 +0,0 @@ -<!DOCTYPE HTML> -<html> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Function Search</title> - <script type="text/javascript" src="test-function-search-01.js"></script> - <script type="text/javascript" src="test-function-search-02.js"></script> - <script type="text/javascript" src="test-function-search-03.js"></script> - </head> - - <body> - <p>Peanut butter jelly time!</p> - - <script type="text/javascript;version=1.8"> - function inline() {} - let arrow = () => {} - - let foo = bar => {} - let foo2 = bar2 = baz2 => 42; - - setTimeout((foo, bar, baz) => {}); - setTimeout((foo, bar, baz) => 42); - </script> - - </body> - -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_function-search.js b/browser/devtools/debugger/test/browser_dbg_function-search.js deleted file mode 100644 index 4fbac5d81..000000000 --- a/browser/devtools/debugger/test/browser_dbg_function-search.js +++ /dev/null @@ -1,499 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_function-search-02.html"; - -/** - * Tests if the function searching works properly. - */ - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; -let gSearchBox = null; -let gFilteredFunctions = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - Services.tm.currentThread.dispatch({ run: testFunctionsFilter }, 0); - }); - }); -} - -function testFunctionsFilter() -{ - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - gFilteredFunctions = gDebugger.DebuggerView.FilteredFunctions; - - htmlSearch(function() { - showSource("test-function-search-01.js", function() { - firstSearch(function() { - showSource("test-function-search-02.js", function() { - secondSearch(function() { - showSource("test-function-search-03.js", function() { - thirdSearch(function() { - saveSearch(function() { - filterSearch(function() { - bogusSearch(function() { - anotherSearch(function() { - emptySearch(function() { - closeDebuggerAndFinish(); - }); - }) - }) - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -function htmlSearch(callback) { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - ok(gFilteredFunctions.selectedValue, - "An item should be selected in the filtered functions view"); - ok(gFilteredFunctions.selectedLabel, - "An item should be selected in the filtered functions view"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.html") != -1) { - - executeSoon(function() { - let expectedResults = [ - ["inline", "-02.html", "", 16, 15], - ["arrow", "-02.html", "", 17, 10], - ["foo", "-02.html", "", 19, 10], - ["foo2", "-02.html", "", 20, 10], - ["bar2", "-02.html", "", 20, 17] - ]; - - for (let [label, value, description, line, col] of expectedResults) { - is(gFilteredFunctions.selectedItem.label, - gDebugger.SourceUtils.trimUrlLength(label + "()"), - "The corect label (" + label + ") is currently selected."); - ok(gFilteredFunctions.selectedItem.value.contains(value), - "The corect value (" + value + ") is attached."); - is(gFilteredFunctions.selectedItem.description, description, - "The corect description (" + description + ") is currently shown."); - - info("Editor caret position: " + gEditor.getCaretPosition().toSource()); - ok(gEditor.getCaretPosition().line == line && - gEditor.getCaretPosition().col == col, - "The editor didn't jump to the correct line."); - - ok(gSources.selectedLabel, label, - "The current source isn't the correct one, according to the label."); - ok(gSources.selectedValue, value, - "The current source isn't the correct one, according to the value."); - - EventUtils.sendKey("DOWN", gDebugger); - } - - ok(gEditor.getCaretPosition().line == expectedResults[0][3] && - gEditor.getCaretPosition().col == expectedResults[0][4], - "The editor didn't jump to the correct line again."); - - executeSoon(callback); - }); - } else { - ok(false, "How did you get here? Go away, you."); - } - }); - - write("@"); -} - -function firstSearch(callback) { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - ok(gFilteredFunctions.selectedValue, - "An item should be selected in the filtered functions view"); - ok(gFilteredFunctions.selectedLabel, - "An item should be selected in the filtered functions view"); - - let url = gSources.selectedValue; - if (url.indexOf("-01.js") != -1) { - - executeSoon(function() { - let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; - let expectedResults = [ - ["test", "-01.js", "", 3, 9], - ["anonymousExpression", "-01.js", "test.prototype", 8, 2], - ["namedExpression" + s + "NAME", "-01.js", "test.prototype", 10, 2], - ["a_test", "-01.js", "foo", 21, 2], - ["n_test" + s + "x", "-01.js", "foo", 23, 2], - ["a_test", "-01.js", "foo.sub", 26, 4], - ["n_test" + s + "y", "-01.js", "foo.sub", 28, 4], - ["a_test", "-01.js", "foo.sub.sub", 31, 6], - ["n_test" + s + "z", "-01.js", "foo.sub.sub", 33, 6], - ["test_SAME_NAME", "-01.js", "foo.sub.sub.sub", 36, 8] - ]; - - for (let [label, value, description, line, col] of expectedResults) { - is(gFilteredFunctions.selectedItem.label, - gDebugger.SourceUtils.trimUrlLength(label + "()"), - "The corect label (" + label + ") is currently selected."); - ok(gFilteredFunctions.selectedItem.value.contains(value), - "The corect value (" + value + ") is attached."); - is(gFilteredFunctions.selectedItem.description, description, - "The corect description (" + description + ") is currently shown."); - - info("Editor caret position: " + gEditor.getCaretPosition().toSource()); - ok(gEditor.getCaretPosition().line == line && - gEditor.getCaretPosition().col == col, - "The editor didn't jump to the correct line."); - - ok(gSources.selectedLabel, label, - "The current source isn't the correct one, according to the label."); - ok(gSources.selectedValue, value, - "The current source isn't the correct one, according to the value."); - - EventUtils.sendKey("DOWN", gDebugger); - } - - ok(gEditor.getCaretPosition().line == expectedResults[0][3] && - gEditor.getCaretPosition().col == expectedResults[0][4], - "The editor didn't jump to the correct line again."); - - executeSoon(callback); - }); - } else { - ok(false, "How did you get here? Go away, you."); - } - }); - - write("@"); -} - -function secondSearch(callback) { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - ok(gFilteredFunctions.selectedValue, - "An item should be selected in the filtered functions view"); - ok(gFilteredFunctions.selectedLabel, - "An item should be selected in the filtered functions view"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - - executeSoon(function() { - let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; - let expectedResults = [ - ["test2", "-02.js", "", 3, 4], - ["test3" + s + "test3_NAME", "-02.js", "", 7, 4], - ["test4_SAME_NAME", "-02.js", "", 10, 4], - ["x" + s + "X", "-02.js", "test.prototype", 13, 0], - ["y" + s + "Y", "-02.js", "test.prototype.sub", 15, 0], - ["z" + s + "Z", "-02.js", "test.prototype.sub.sub", 17, 0], - ["t", "-02.js", "test.prototype.sub.sub.sub", 19, 0], - ["x", "-02.js", "", 19, 31], - ["y", "-02.js", "", 19, 40], - ["z", "-02.js", "", 19, 49] - ]; - - for (let [label, value, description, line, col] of expectedResults) { - is(gFilteredFunctions.selectedItem.label, - gDebugger.SourceUtils.trimUrlLength(label + "()"), - "The corect label (" + label + ") is currently selected."); - ok(gFilteredFunctions.selectedItem.value.contains(value), - "The corect value (" + value + ") is attached."); - is(gFilteredFunctions.selectedItem.description, description, - "The corect description (" + description + ") is currently shown."); - - info("Editor caret position: " + gEditor.getCaretPosition().toSource()); - ok(gEditor.getCaretPosition().line == line && - gEditor.getCaretPosition().col == col, - "The editor didn't jump to the correct line."); - - ok(gSources.selectedLabel, label, - "The current source isn't the correct one, according to the label."); - ok(gSources.selectedValue, value, - "The current source isn't the correct one, according to the value."); - - EventUtils.sendKey("DOWN", gDebugger); - } - - ok(gEditor.getCaretPosition().line == expectedResults[0][3] && - gEditor.getCaretPosition().col == expectedResults[0][4], - "The editor didn't jump to the correct line again."); - - executeSoon(callback); - }); - } else { - ok(false, "How did you get here? Go away, you."); - } - }); - - write("@"); -} - -function thirdSearch(callback) { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - ok(gFilteredFunctions.selectedValue, - "An item should be selected in the filtered functions view"); - ok(gFilteredFunctions.selectedLabel, - "An item should be selected in the filtered functions view"); - - let url = gSources.selectedValue; - if (url.indexOf("-03.js") != -1) { - - executeSoon(function() { - let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; - let expectedResults = [ - ["namedEventListener", "-03.js", "", 3, 42], - ["a" + s + "A", "-03.js", "bar", 9, 4], - ["b" + s + "B", "-03.js", "bar.alpha", 14, 4], - ["c" + s + "C", "-03.js", "bar.alpha.beta", 19, 4], - ["d" + s + "D", "-03.js", "theta", 24, 4], - ["fun", "-03.js", "", 28, 6], - ["foo", "-03.js", "", 28, 12], - ["bar", "-03.js", "", 28, 18], - ["t_foo", "-03.js", "", 28, 24], - ["w_bar" + s + "baz", "-03.js", "window", 28, 37] - ]; - - for (let [label, value, description, line, col] of expectedResults) { - is(gFilteredFunctions.selectedItem.label, - gDebugger.SourceUtils.trimUrlLength(label + "()"), - "The corect label (" + label + ") is currently selected."); - ok(gFilteredFunctions.selectedItem.value.contains(value), - "The corect value (" + value + ") is attached."); - is(gFilteredFunctions.selectedItem.description, description, - "The corect description (" + description + ") is currently shown."); - - info("Editor caret position: " + gEditor.getCaretPosition().toSource()); - ok(gEditor.getCaretPosition().line == line && - gEditor.getCaretPosition().col == col, - "The editor didn't jump to the correct line."); - - ok(gSources.selectedLabel, label, - "The current source isn't the correct one, according to the label."); - ok(gSources.selectedValue, value, - "The current source isn't the correct one, according to the value."); - - EventUtils.sendKey("DOWN", gDebugger); - } - - ok(gEditor.getCaretPosition().line == expectedResults[0][3] && - gEditor.getCaretPosition().col == expectedResults[0][4], - "The editor didn't jump to the correct line again."); - - executeSoon(callback); - }); - } else { - ok(false, "How did you get here? Go away, you."); - } - }); - - write("@"); -} - -function filterSearch(callback) { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - ok(gFilteredFunctions.selectedValue, - "An item should be selected in the filtered functions view"); - ok(gFilteredFunctions.selectedLabel, - "An item should be selected in the filtered functions view"); - - let url = gSources.selectedValue; - if (url.indexOf("-03.js") != -1) { - - executeSoon(function() { - let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; - let expectedResults = [ - ["namedEventListener", "-03.js", "", 3, 42], - ["a" + s + "A", "-03.js", "bar", 9, 4], - ["bar", "-03.js", "", 28, 18], - ["w_bar" + s + "baz", "-03.js", "window", 28, 37], - ["test3" + s + "test3_NAME", "-02.js", "", 7, 4], - ["test4_SAME_NAME", "-02.js", "", 10, 4], - ["anonymousExpression", "-01.js", "test.prototype", 8, 2], - ["namedExpression" + s + "NAME", "-01.js", "test.prototype", 10, 2], - ["a_test", "-01.js", "foo", 21, 2], - ["a_test", "-01.js", "foo.sub", 26, 4] - ]; - - for (let [label, value, description, line, col] of expectedResults) { - is(gFilteredFunctions.selectedItem.label, - gDebugger.SourceUtils.trimUrlLength(label + "()"), - "The corect label (" + label + ") is currently selected."); - ok(gFilteredFunctions.selectedItem.value.contains(value), - "The corect value (" + value + ") is attached."); - is(gFilteredFunctions.selectedItem.description, description, - "The corect description (" + description + ") is currently shown."); - - info("Editor caret position: " + gEditor.getCaretPosition().toSource()); - ok(gEditor.getCaretPosition().line == line && - gEditor.getCaretPosition().col == col, - "The editor didn't jump to the correct line."); - - ok(gSources.selectedLabel, label, - "The current source isn't the correct one, according to the label."); - ok(gSources.selectedValue, value, - "The current source isn't the correct one, according to the value."); - - EventUtils.sendKey("DOWN", gDebugger); - } - - ok(gEditor.getCaretPosition().line == expectedResults[0][3] && - gEditor.getCaretPosition().col == expectedResults[0][4], - "The editor didn't jump to the correct line again."); - - executeSoon(callback); - }); - } else { - ok(false, "How did you get here? Go away, you."); - } - }); - - write("@a"); -} - -function bogusSearch(callback) { - gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - ok(true, "Popup was successfully hidden after no matches were found!"); - executeSoon(callback); - }); - - write("@bogus"); -} - -function anotherSearch(callback) { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - ok(true, "Popup was successfully shown after some matches were found!"); - executeSoon(callback); - }); - - write("@NAME"); -} - -function emptySearch(callback) { - gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - ok(true, "Popup was successfully hidden when nothing was searched!"); - executeSoon(callback); - }); - - clear(); -} - -function showSource(label, callback) { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - executeSoon(callback); - }); - gSources.selectedLabel = label; -} - -function saveSearch(callback) { - gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - executeSoon(callback); - }); - if (Math.random() >= 0.5) { - EventUtils.sendKey("RETURN", gDebugger); - } else { - EventUtils.sendMouseEvent({ type: "click" }, - gFilteredFunctions.selectedItem.target, - gDebugger); - } -} - -function waitForCaretPos(number, callback) -{ - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - info("caret: " + gEditor.getCaretPosition().line); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gEditor.getCaretPosition().line != number) { - return; - } - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchBox = null; - gFilteredFunctions = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_globalactor-01.js b/browser/devtools/debugger/test/browser_dbg_globalactor-01.js deleted file mode 100644 index ab18c4562..000000000 --- a/browser/devtools/debugger/test/browser_dbg_globalactor-01.js +++ /dev/null @@ -1,65 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Check extension-added global actor API. - */ - -var gClient = null; - -function test() -{ - DebuggerServer.addActors("chrome://mochitests/content/browser/browser/devtools/debugger/test/testactors.js"); - - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { - is(aType, "browser", "Root actor should identify itself as a browser."); - gClient.listTabs(function(aResponse) { - let globalActor = aResponse.testGlobalActor1; - ok(globalActor, "Found the test tab actor.") - ok(globalActor.indexOf("testone") >= 0, - "testTabActor's actorPrefix should be used."); - gClient.request({ to: globalActor, type: "ping" }, function(aResponse) { - is(aResponse.pong, "pong", "Actor should respond to requests."); - // Send another ping to see if the same actor is used. - gClient.request({ to: globalActor, type: "ping" }, function(aResponse) { - is(aResponse.pong, "pong", "Actor should respond to requests."); - - // Make sure that lazily-created actors are created only once. - let conn = transport._serverConnection; - // First we look for the pool of global actors. - let extraPools = conn._extraPools; - - let globalPool; - for (let pool of extraPools) { - if (Object.keys(pool._actors).some(function(elem) { - // Tab actors are in the global pool. - let re = new RegExp(conn._prefix + "tab", "g"); - return elem.match(re) !== null; - })) { - globalPool = pool; - break; - } - } - // Then we look if the global pool contains only one test actor. - let actorPrefix = conn._prefix + "testone"; - let actors = Object.keys(globalPool._actors).join(); - info("Global actors: " + actors); - isnot(actors.indexOf(actorPrefix), -1, "The test actor exists in the pool."); - is(actors.indexOf(actorPrefix), actors.lastIndexOf(actorPrefix), - "Only one actor exists in the pool."); - - finish_test(); - }); - }); - }); - }); -} - -function finish_test() -{ - gClient.close(function() { - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_iframes.html b/browser/devtools/debugger/test/browser_dbg_iframes.html deleted file mode 100644 index e94dd2f65..000000000 --- a/browser/devtools/debugger/test/browser_dbg_iframes.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head><meta charset='utf-8'/><title>Browser Debugger IFrame Test Tab</title> -<!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> -</head> - -<body> - <iframe src="browser_dbg_debuggerstatement.html"></iframe> -</body> - -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_iframes.js b/browser/devtools/debugger/test/browser_dbg_iframes.js deleted file mode 100644 index 7f344c38a..000000000 --- a/browser/devtools/debugger/test/browser_dbg_iframes.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that iframes can be added as debuggees. - -var gPane = null; -var gTab = null; -var gDebugger = null; - -const TEST_URL = EXAMPLE_URL + "browser_dbg_iframes.html"; - -function test() { - debug_tab_pane(TEST_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - is(gDebugger.DebuggerController.activeThread.paused, false, - "Should be running after debug_tab_pane."); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.paused, true, - "Should be paused after an interrupt request."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have one frame in the stack."); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() { - Services.tm.currentThread.dispatch({ run: function() { - closeDebuggerAndFinish(); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); - }}, 0); - }); - - let iframe = gTab.linkedBrowser.contentWindow.wrappedJSObject.frames[0]; - is(iframe.document.title, "Browser Debugger Test Tab", "Found the iframe"); - - function handler() { - if (iframe.document.readyState != "complete") { - return; - } - iframe.window.removeEventListener("load", handler, false); - executeSoon(iframe.runDebuggerStatement); - }; - iframe.window.addEventListener("load", handler, false); - handler(); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_listtabs-01.js b/browser/devtools/debugger/test/browser_dbg_listtabs-01.js deleted file mode 100644 index 12b0ce77c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_listtabs-01.js +++ /dev/null @@ -1,102 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Make sure the listTabs request works as specified. - -var gTab1 = null; -var gTab1Actor = null; - -var gTab2 = null; -var gTab2Actor = null; - -var gClient = null; - -function test() -{ - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { - is(aType, "browser", "Root actor should identify itself as a browser."); - test_first_tab(); - }); -} - -/** - * Verify that a new tab shows up in a listTabs call. - */ -function test_first_tab() -{ - gTab1 = addTab(TAB1_URL, function() { - gClient.listTabs(function(aResponse) { - for each (let tab in aResponse.tabs) { - if (tab.url == TAB1_URL) { - gTab1Actor = tab.actor; - } - } - ok(gTab1Actor, "Should find a tab actor for tab1."); - test_second_tab(); - }); - }); -} - -function test_second_tab() -{ - gTab2 = addTab(TAB2_URL, function() { - gClient.listTabs(function(aResponse) { - // Verify that tab1 has the same actor it used to. - let foundTab1 = false; - for each (let tab in aResponse.tabs) { - if (tab.url == TAB1_URL) { - is(tab.actor, gTab1Actor, "Tab1's actor shouldn't have changed."); - foundTab1 = true; - } - if (tab.url == TAB2_URL) { - gTab2Actor = tab.actor; - } - } - ok(foundTab1, "Should have found an actor for tab 1."); - ok(gTab2Actor != null, "Should find an actor for tab2."); - - test_remove_tab(); - }); - }); -} - -function test_remove_tab() -{ - removeTab(gTab1); - gTab1 = null; - gClient.listTabs(function(aResponse) { - // Verify that tab1 is no longer included in listTabs. - let foundTab1 = false; - for each (let tab in aResponse.tabs) { - if (tab.url == TAB1_URL) { - ok(false, "Tab1 should be gone."); - } - } - ok(!foundTab1, "Tab1 should be gone."); - test_attach_removed_tab(); - }); -} - -function test_attach_removed_tab() -{ - removeTab(gTab2); - gTab2 = null; - gClient.addListener("paused", function(aEvent, aPacket) { - ok(false, "Attaching to an exited tab actor shouldn't generate a pause."); - finish_test(); - }); - - gClient.request({ to: gTab2Actor, type: "attach" }, function(aResponse) { - is(aResponse.type, "exited", "Tab should consider itself exited."); - finish_test(); - }); -} - -function finish_test() -{ - gClient.close(function() { - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_listtabs-02.js b/browser/devtools/debugger/test/browser_dbg_listtabs-02.js deleted file mode 100644 index c48d374ca..000000000 --- a/browser/devtools/debugger/test/browser_dbg_listtabs-02.js +++ /dev/null @@ -1,150 +0,0 @@ -/* 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/. */ - -// Make sure the root actor's live tab list implementation works as specified. - -let testPage = ("data:text/html;charset=utf-8," - + encodeURIComponent("<title>JS Debugger BrowserTabList test page</title>" + - "<body>Yo.</body>")); -// The tablist object whose behavior we observe. -let tabList; -let firstActor, actorA; -let tabA, tabB, tabC; -let newWin; -// Stock onListChanged handler. -let onListChangedCount = 0; -function onListChangedHandler() { - onListChangedCount++; -} - -function test() { - tabList = new DebuggerServer.BrowserTabList("fake DebuggerServerConnection"); - tabList._testing = true; - tabList.onListChanged = onListChangedHandler; - - checkSingleTab(); - // Open a new tab. We should be notified. - is(onListChangedCount, 0, "onListChanged handler call count"); - tabA = addTab(testPage, onTabA); -} - -function checkSingleTab() { - var tabActors = [t for (t of tabList)]; - is(tabActors.length, 1, "initial tab list: contains initial tab"); - firstActor = tabActors[0]; - is(firstActor.url, "about:blank", "initial tab list: initial tab URL is 'about:blank'"); - is(firstActor.title, "New Tab", "initial tab list: initial tab title is 'New Tab'"); -} - -function onTabA() { - is(onListChangedCount, 1, "onListChanged handler call count"); - - var tabActors = new Set([t for (t of tabList)]); - is(tabActors.size, 2, "tabA opened: two tabs in list"); - ok(tabActors.has(firstActor), "tabA opened: initial tab present"); - - info("actors: " + [a.url for (a of tabActors)]); - actorA = [a for (a of tabActors) if (a !== firstActor)][0]; - ok(actorA.url.match(/^data:text\/html;/), "tabA opened: new tab URL"); - is(actorA.title, "JS Debugger BrowserTabList test page", "tabA opened: new tab title"); - - tabB = addTab(testPage, onTabB); -} - -function onTabB() { - is(onListChangedCount, 2, "onListChanged handler call count"); - - var tabActors = new Set([t for (t of tabList)]); - is(tabActors.size, 3, "tabB opened: three tabs in list"); - - // Test normal close. - gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) { - gBrowser.tabContainer.removeEventListener("TabClose", onClose, false); - ok(!aEvent.detail, "This was a normal tab close"); - // Let the actor's TabClose handler finish first. - executeSoon(testTabClose); - }, false); - gBrowser.removeTab(tabA); -} - -function testTabClose() { - is(onListChangedCount, 3, "onListChanged handler call count"); - - var tabActors = new Set([t for (t of tabList)]); - is(tabActors.size, 2, "tabA closed: two tabs in list"); - ok(tabActors.has(firstActor), "tabA closed: initial tab present"); - - info("actors: " + [a.url for (a of tabActors)]); - actorA = [a for (a of tabActors) if (a !== firstActor)][0]; - ok(actorA.url.match(/^data:text\/html;/), "tabA closed: new tab URL"); - is(actorA.title, "JS Debugger BrowserTabList test page", "tabA closed: new tab title"); - - // Test tab close by moving tab to a window. - tabC = addTab(testPage, onTabC); -} - -function onTabC() { - is(onListChangedCount, 4, "onListChanged handler call count"); - - var tabActors = new Set([t for (t of tabList)]); - is(tabActors.size, 3, "tabC opened: three tabs in list"); - - gBrowser.tabContainer.addEventListener("TabClose", function onClose2(aEvent) { - gBrowser.tabContainer.removeEventListener("TabClose", onClose2, false); - ok(aEvent.detail, "This was a tab closed by moving"); - // Let the actor's TabClose handler finish first. - executeSoon(testWindowClose); - }, false); - newWin = gBrowser.replaceTabWithWindow(tabC); -} - -function testWindowClose() { - is(onListChangedCount, 5, "onListChanged handler call count"); - - var tabActors = new Set([t for (t of tabList)]); - is(tabActors.size, 3, "tabC closed: three tabs in list"); - ok(tabActors.has(firstActor), "tabC closed: initial tab present"); - - info("actors: " + [a.url for (a of tabActors)]); - actorA = [a for (a of tabActors) if (a !== firstActor)][0]; - ok(actorA.url.match(/^data:text\/html;/), "tabC closed: new tab URL"); - is(actorA.title, "JS Debugger BrowserTabList test page", "tabC closed: new tab title"); - - // Cleanup. - newWin.addEventListener("unload", function onUnload(aEvent) { - newWin.removeEventListener("unload", onUnload, false); - ok(!aEvent.detail, "This was a normal window close"); - // Let the actor's TabClose handler finish first. - executeSoon(checkWindowClose); - }, false); - newWin.close(); -} - -function checkWindowClose() { - is(onListChangedCount, 6, "onListChanged handler call count"); - - // Check that closing a XUL window leaves the other actors intact. - var tabActors = new Set([t for (t of tabList)]); - is(tabActors.size, 2, "newWin closed: two tabs in list"); - ok(tabActors.has(firstActor), "newWin closed: initial tab present"); - - info("actors: " + [a.url for (a of tabActors)]); - actorA = [a for (a of tabActors) if (a !== firstActor)][0]; - ok(actorA.url.match(/^data:text\/html;/), "newWin closed: new tab URL"); - is(actorA.title, "JS Debugger BrowserTabList test page", "newWin closed: new tab title"); - - // Test normal close. - gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) { - gBrowser.tabContainer.removeEventListener("TabClose", onClose, false); - ok(!aEvent.detail, "This was a normal tab close"); - // Let the actor's TabClose handler finish first. - executeSoon(finishTest); - }, false); - gBrowser.removeTab(tabB); -} - -function finishTest() { - checkSingleTab(); - finish(); -} diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-blank.js b/browser/devtools/debugger/test/browser_dbg_location-changes-blank.js deleted file mode 100644 index 478a7677b..000000000 --- a/browser/devtools/debugger/test/browser_dbg_location-changes-blank.js +++ /dev/null @@ -1,108 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that changing the tab location URL to a page with no scripts works. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("browser_dbg_stack") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.simpleCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0); - } - } -} - -function testSimpleCall() { - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have only one frame."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - isnot(gDebugger.DebuggerView.Sources.selectedValue, null, - "There should be a selected script."); - isnot(gDebugger.editor.getText().length, 0, - "The source editor should have some text displayed."); - isnot(gDebugger.editor.getText(), gDebugger.L10N.getStr("loadingText"), - "The source editor text should not be 'Loading...'"); - - testLocationChange(); -} - -function testLocationChange() -{ - gDebugger.DebuggerController.activeThread.resume(function() { - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired."); - info("Still attached to the tab."); - - gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - is(gDebugger.DebuggerView.Sources.selectedValue, "", - "There should be no selected script."); - is(gDebugger.editor.getText().length, 0, - "The source editor not have any text displayed."); - - let menulist = gDebugger.DebuggerView.Sources.widget; - let noScripts = gDebugger.L10N.getStr("noSourcesText"); - is(menulist.getAttribute("label"), noScripts, - "The menulist should display a notice that there are no scripts availalble."); - is(menulist.getAttribute("tooltiptext"), "", - "The menulist shouldn't have any tooltip text attributed when there are no scripts available."); - - closeDebuggerAndFinish(); - }); - }); - content.location = "about:blank"; - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-bp.js b/browser/devtools/debugger/test/browser_dbg_location-changes-bp.js deleted file mode 100644 index 569171fd7..000000000 --- a/browser/devtools/debugger/test/browser_dbg_location-changes-bp.js +++ /dev/null @@ -1,163 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that reloading a page with a breakpoint set does not cause it to - * fire more than once. - */ - -const TAB_URL = EXAMPLE_URL + "test-location-changes-bp.html"; -const SCRIPT_URL = EXAMPLE_URL + "test-location-changes-bp.js"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var sourcesShown = false; -var tabNavigated = false; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testAddBreakpoint(); - }); -} - -function testAddBreakpoint() -{ - let controller = gDebugger.DebuggerController; - controller.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(controller.activeThread.state, "paused", - "The debugger statement was reached."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have one frame."); - - gPane.addBreakpoint({ url: SCRIPT_URL, line: 5 }, testResume); - }}, 0); - }); - - gDebuggee.runDebuggerStatement(); -} - -function testResume() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The breakpoint wasn't hit yet."); - - let thread = gDebugger.DebuggerController.activeThread; - thread.addOneTimeListener("resumed", function() { - thread.addOneTimeListener("paused", function() { - executeSoon(testBreakpointHit); - }); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button")); - }); - - thread.resume(); -} - -function testBreakpointHit() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The breakpoint was hit."); - - let thread = gDebugger.DebuggerController.activeThread; - thread.addOneTimeListener("paused", function test(aEvent, aPacket) { - thread.addOneTimeListener("resumed", function() { - executeSoon(testReloadPage); - }); - - is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line."); - isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit."); - thread.resume(); - }); - - thread.resume(); -} - -function testReloadPage() -{ - let controller = gDebugger.DebuggerController; - controller._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - tabNavigated = true; - ok(true, "tabNavigated event was fired."); - info("Still attached to the tab."); - clickAgain(); - }); - - gDebugger.addEventListener("Debugger:SourceShown", function onSourcesShown() { - sourcesShown = true; - gDebugger.removeEventListener("Debugger:SourceShown", onSourcesShown); - clickAgain(); - }); - - content.location.reload(); -} - -function clickAgain() -{ - if (!sourcesShown || !tabNavigated) { - return; - } - - let controller = gDebugger.DebuggerController; - controller.activeThread.addOneTimeListener("framesadded", function() { - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The breakpoint was hit."); - - let thread = gDebugger.DebuggerController.activeThread; - thread.addOneTimeListener("paused", function test(aEvent, aPacket) { - thread.addOneTimeListener("resumed", function() { - executeSoon(closeDebuggerAndFinish); - }); - - is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line."); - isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit."); - thread.resume(); - }); - - thread.resume(); - }); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button")); -} - -function testBreakpointHitAfterReload() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "The breakpoint was hit."); - - let thread = gDebugger.DebuggerController.activeThread; - thread.addOneTimeListener("paused", function test(aEvent, aPacket) { - thread.addOneTimeListener("resumed", function() { - executeSoon(closeDebuggerAndFinish); - }); - - is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line."); - isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit."); - thread.resume(); - }); - - thread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-new.js b/browser/devtools/debugger/test/browser_dbg_location-changes-new.js deleted file mode 100644 index e2b1d8e2c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_location-changes-new.js +++ /dev/null @@ -1,108 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that changing the tab location URL to a page with other scripts works. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("browser_dbg_stack") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.simpleCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0); - } - } -} - -function testSimpleCall() { - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have only one frame."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - isnot(gDebugger.DebuggerView.Sources.selectedValue, null, - "There should be a selected script."); - isnot(gDebugger.editor.getText().length, 0, - "The source editor should have some text displayed."); - isnot(gDebugger.editor.getText(), gDebugger.L10N.getStr("loadingText"), - "The source editor text should not be 'Loading...'"); - - testLocationChange(); -} - -function testLocationChange() -{ - gDebugger.DebuggerController.activeThread.resume(function() { - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired."); - info("Still attached to the tab."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - isnot(gDebugger.DebuggerView.Sources.selectedValue, null, - "There should be a selected script."); - isnot(gDebugger.editor.getText().length, 0, - "The source editor should have some text displayed."); - - let menulist = gDebugger.DebuggerView.Sources.widget; - let noScripts = gDebugger.L10N.getStr("noSourcesText"); - isnot(menulist.getAttribute("label"), noScripts, - "The menulist should not display a notice that there are no scripts availalble."); - isnot(menulist.getAttribute("tooltiptext"), "", - "The menulist should have a tooltip text attributed."); - - closeDebuggerAndFinish(); - }); - }); - content.location = EXAMPLE_URL + "browser_dbg_iframes.html"; - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes.js b/browser/devtools/debugger/test/browser_dbg_location-changes.js deleted file mode 100644 index 5f1122e63..000000000 --- a/browser/devtools/debugger/test/browser_dbg_location-changes.js +++ /dev/null @@ -1,69 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that changing the tab location URL works. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() -{ - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ - run: function() { - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have only one frame."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - testLocationChange(); - } - }, 0); - }); - - gDebuggee.simpleCall(); -} - -function testLocationChange() -{ - gDebugger.DebuggerController.activeThread.resume(function() { - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired."); - info("Still attached to the tab."); - - closeDebuggerAndFinish(); - }); - content.location = TAB1_URL; - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_menustatus.js b/browser/devtools/debugger/test/browser_dbg_menustatus.js deleted file mode 100644 index 07472654f..000000000 --- a/browser/devtools/debugger/test/browser_dbg_menustatus.js +++ /dev/null @@ -1,45 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// We make sure the menuitems in the application menubar -// are checked. - -function test() { - var tab1 = addTab("about:blank", function() { - var tab2 = addTab("about:blank", function() { - gBrowser.selectedTab = tab2; - - let pane = DebuggerUI.toggleDebugger(); - ok(pane, "toggleDebugger() should return a pane."); - let frame = pane._frame; - - wait_for_connect_and_resume(function() { - let cmd = document.getElementById("Tools:Debugger"); - is(cmd.getAttribute("checked"), "true", "<command Tools:Debugger> is checked."); - - gBrowser.selectedTab = tab1; - - is(cmd.getAttribute("checked"), "false", "<command Tools:Debugger> is unchecked after tab switch."); - - gBrowser.selectedTab = tab2; - - is(cmd.getAttribute("checked"), "true", "<command Tools:Debugger> is checked."); - - let pane = DebuggerUI.toggleDebugger(); - - is(cmd.getAttribute("checked"), "false", "<command Tools:Debugger> is unchecked once closed."); - }); - - window.addEventListener("Debugger:Shutdown", function dbgShutdown() { - window.removeEventListener("Debugger:Shutdown", dbgShutdown, true); - removeTab(tab1); - removeTab(tab2); - - finish(); - }, true); - }); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_multiple-windows.js b/browser/devtools/debugger/test/browser_dbg_multiple-windows.js deleted file mode 100644 index aab2d046c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_multiple-windows.js +++ /dev/null @@ -1,115 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Make sure that the debugger attaches to the right tab when multiple windows -// are open. - -var gTab1 = null; -var gTab1Actor = null; - -var gSecondWindow = null; - -var gClient = null; -var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"] - .getService(Ci.nsIWindowMediator); - -function test() -{ - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { - is(aType, "browser", "Root actor should identify itself as a browser."); - test_first_tab(); - }); -} - -function test_first_tab() -{ - gTab1 = addTab(TAB1_URL, function() { - gClient.listTabs(function(aResponse) { - for each (let tab in aResponse.tabs) { - if (tab.url == TAB1_URL) { - gTab1Actor = tab.actor; - } - } - ok(gTab1Actor, "Should find a tab actor for tab1."); - is(aResponse.selected, 1, "Tab1 is selected."); - test_open_window(); - }); - }); -} - -function test_open_window() -{ - gSecondWindow = window.open(TAB2_URL, "secondWindow"); - ok(!!gSecondWindow, "Second window created."); - gSecondWindow.focus(); - let top = windowMediator.getMostRecentWindow("navigator:browser"); - var main2 = gSecondWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIWebNavigation) - .QueryInterface(Components.interfaces.nsIDocShellTreeItem) - .rootTreeItem - .QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindow); - is(top, main2, "The second window is on top."); - executeSoon(function() { - gClient.listTabs(function(aResponse) { - is(aResponse.selected, 2, "Tab2 is selected."); - - test_focus_first(); - }); - }); -} - -function test_focus_first() -{ - window.content.addEventListener("focus", function onFocus() { - window.content.removeEventListener("focus", onFocus, false); - let top = windowMediator.getMostRecentWindow("navigator:browser"); - var main1 = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIWebNavigation) - .QueryInterface(Components.interfaces.nsIDocShellTreeItem) - .rootTreeItem - .QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindow); - is(top, main1, "The first window is on top."); - - gClient.listTabs(function(aResponse) { - is(aResponse.selected, 1, "Tab1 is selected after focusing on it."); - - test_remove_tab(); - }); - }, false); - window.content.focus(); -} - -function test_remove_tab() -{ - gSecondWindow.close(); - gSecondWindow = null; - removeTab(gTab1); - gTab1 = null; - gClient.listTabs(function(aResponse) { - // Verify that tabs are no longer included in listTabs. - let foundTab1 = false; - let foundTab2 = false; - for (let tab of aResponse.tabs) { - if (tab.url == TAB1_URL) { - foundTab1 = true; - } else if (tab.url == TAB2_URL) { - foundTab2 = true; - } - } - ok(!foundTab1, "Tab1 should be gone."); - ok(!foundTab2, "Tab2 should be gone."); - is(aResponse.selected, 0, "The original tab is selected."); - finish_test(); - }); -} - -function finish_test() -{ - gClient.close(function() { - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_nav-01.js b/browser/devtools/debugger/test/browser_dbg_nav-01.js deleted file mode 100644 index 3e3d4f432..000000000 --- a/browser/devtools/debugger/test/browser_dbg_nav-01.js +++ /dev/null @@ -1,54 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Check tab attach/navigation. - */ - -var gTab1 = null; -var gTab1Actor = null; - -var gClient = null; - -function test() -{ - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { - is(aType, "browser", "Root actor should identify itself as a browser."); - get_tab(); - }); -} - -function get_tab() -{ - gTab1 = addTab(TAB1_URL, function() { - get_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) { - gTab1Actor = aGrip.actor; - gClient.request({ to: aGrip.actor, type: "attach" }, function(aResponse) { - gClient.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) { - dump("onTabNavigated state " + aPacket.state + "\n"); - if (aPacket.state == "start") { - return; - } - gClient.removeListener("tabNavigated", onTabNavigated); - - is(aPacket.url, TAB2_URL, "Got a tab navigation notification."); - gClient.addOneTimeListener("tabDetached", function (aEvent, aPacket) { - ok(true, "Got a tab detach notification."); - finish_test(); - }); - removeTab(gTab1); - }); - gTab1.linkedBrowser.loadURI(TAB2_URL); - }); - }); - }); -} - -function finish_test() -{ - gClient.close(function() { - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_pane-collapse.js b/browser/devtools/debugger/test/browser_dbg_pane-collapse.js deleted file mode 100644 index b53b74fed..000000000 --- a/browser/devtools/debugger/test/browser_dbg_pane-collapse.js +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that the debugger panes collapse properly. - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gView = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gView = gDebugger.DebuggerView; - - testPanesState(); - - gView.toggleInstrumentsPane({ visible: true, animated: false }); - testInstrumentsPaneCollapse(); - testPanesStartupPref(); - }); -} - -function testPanesState() { - let instrumentsPane = - gDebugger.document.getElementById("instruments-pane"); - let instrumentsPaneToggleButton = - gDebugger.document.getElementById("instruments-pane-toggle"); - - ok(instrumentsPane.hasAttribute("pane-collapsed") && - instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The debugger view instruments pane should initially be hidden."); - is(gDebugger.Prefs.panesVisibleOnStartup, false, - "The debugger view instruments pane should initially be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true", - "The options menu item should not be checked."); -} - -function testInstrumentsPaneCollapse() { - let instrumentsPane = - gDebugger.document.getElementById("instruments-pane"); - let instrumentsPaneToggleButton = - gDebugger.document.getElementById("instruments-pane-toggle"); - - let width = parseInt(instrumentsPane.getAttribute("width")); - is(width, gDebugger.Prefs.instrumentsWidth, - "The instruments pane has an incorrect width."); - is(instrumentsPane.style.marginLeft, "0px", - "The instruments pane has an incorrect left margin."); - is(instrumentsPane.style.marginRight, "0px", - "The instruments pane has an incorrect right margin."); - ok(!instrumentsPane.hasAttribute("animated"), - "The instruments pane has an incorrect animated attribute."); - ok(!instrumentsPane.hasAttribute("pane-collapsed") && - !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The instruments pane should at this point be visible."); - - gView.toggleInstrumentsPane({ visible: false, animated: true }); - - is(gDebugger.Prefs.panesVisibleOnStartup, false, - "The debugger view panes should still initially be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true", - "The options menu item should still not be checked."); - - let margin = -(width + 1) + "px"; - is(width, gDebugger.Prefs.instrumentsWidth, - "The instruments pane has an incorrect width after collapsing."); - is(instrumentsPane.style.marginLeft, margin, - "The instruments pane has an incorrect left margin after collapsing."); - is(instrumentsPane.style.marginRight, margin, - "The instruments pane has an incorrect right margin after collapsing."); - ok(instrumentsPane.hasAttribute("animated"), - "The instruments pane has an incorrect attribute after an animated collapsing."); - ok(instrumentsPane.hasAttribute("pane-collapsed") && - instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The instruments pane should not be visible after collapsing."); - - gView.toggleInstrumentsPane({ visible: true, animated: false }); - - is(gDebugger.Prefs.panesVisibleOnStartup, false, - "The debugger view panes should still initially be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true", - "The options menu item should still not be checked."); - - is(width, gDebugger.Prefs.instrumentsWidth, - "The instruments pane has an incorrect width after uncollapsing."); - is(instrumentsPane.style.marginLeft, "0px", - "The instruments pane has an incorrect left margin after uncollapsing."); - is(instrumentsPane.style.marginRight, "0px", - "The instruments pane has an incorrect right margin after uncollapsing."); - ok(!instrumentsPane.hasAttribute("animated"), - "The instruments pane has an incorrect attribute after an unanimated uncollapsing."); - ok(!instrumentsPane.hasAttribute("pane-collapsed") && - !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The instruments pane should be visible again after uncollapsing."); -} - -function testPanesStartupPref() { - let instrumentsPane = - gDebugger.document.getElementById("instruments-pane"); - let instrumentsPaneToggleButton = - gDebugger.document.getElementById("instruments-pane-toggle"); - - is(gDebugger.Prefs.panesVisibleOnStartup, false, - "The debugger view panes should still initially be preffed as hidden."); - - ok(!instrumentsPane.hasAttribute("pane-collapsed") && - !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The debugger instruments pane should at this point be visible."); - is(gDebugger.Prefs.panesVisibleOnStartup, false, - "The debugger view panes should initially be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true", - "The options menu item should still not be checked."); - - gDebugger.DebuggerView.Options._showPanesOnStartupItem.setAttribute("checked", "true"); - gDebugger.DebuggerView.Options._toggleShowPanesOnStartup(); - - executeSoon(function() { - ok(!instrumentsPane.hasAttribute("pane-collapsed") && - !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The debugger instruments pane should at this point be visible."); - is(gDebugger.Prefs.panesVisibleOnStartup, true, - "The debugger view panes should now be preffed as visible."); - is(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true", - "The options menu item should now be checked."); - - gDebugger.DebuggerView.Options._showPanesOnStartupItem.setAttribute("checked", "false"); - gDebugger.DebuggerView.Options._toggleShowPanesOnStartup(); - - executeSoon(function() { - ok(!instrumentsPane.hasAttribute("pane-collapsed") && - !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"), - "The debugger instruments pane should at this point be visible."); - is(gDebugger.Prefs.panesVisibleOnStartup, false, - "The debugger view panes should now be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true", - "The options menu item should now be unchecked."); - - executeSoon(function() { - closeDebuggerAndFinish(); - }); - }); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gView = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_panesize-inner.js b/browser/devtools/debugger/test/browser_dbg_panesize-inner.js deleted file mode 100644 index ead34bec9..000000000 --- a/browser/devtools/debugger/test/browser_dbg_panesize-inner.js +++ /dev/null @@ -1,77 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function test() { - var tab1 = addTab(TAB1_URL, function() { - gBrowser.selectedTab = tab1; - let target1 = TargetFactory.forTab(tab1); - - ok(!gDevTools.getToolbox(target1), - "Shouldn't have a debugger panel for this tab yet."); - - gDevTools.showToolbox(target1, "jsdebugger").then(function(toolbox) { - let dbg = toolbox.getCurrentPanel(); - ok(dbg, "We should have a debugger panel."); - - let preferredSw = Services.prefs.getIntPref("devtools.debugger.ui.panes-sources-width"); - let preferredIw = Services.prefs.getIntPref("devtools.debugger.ui.panes-instruments-width"); - let someWidth1, someWidth2; - - do { - someWidth1 = parseInt(Math.random() * 200) + 100; - someWidth2 = parseInt(Math.random() * 200) + 100; - } while (someWidth1 == preferredSw || - someWidth2 == preferredIw) - - let someWidth1 = parseInt(Math.random() * 200) + 100; - let someWidth2 = parseInt(Math.random() * 200) + 100; - - info("Preferred sources width: " + preferredSw); - info("Preferred instruments width: " + preferredIw); - info("Generated sources width: " + someWidth1); - info("Generated instruments width: " + someWidth2); - - let content = dbg.panelWin; - let sources; - let instruments; - - wait_for_connect_and_resume(function() { - ok(content.Prefs.sourcesWidth, - "The debugger preferences should have a saved sourcesWidth value."); - ok(content.Prefs.instrumentsWidth, - "The debugger preferences should have a saved instrumentsWidth value."); - - sources = content.document.getElementById("sources-pane"); - instruments = content.document.getElementById("instruments-pane"); - - is(content.Prefs.sourcesWidth, sources.getAttribute("width"), - "The sources pane width should be the same as the preferred value."); - is(content.Prefs.instrumentsWidth, instruments.getAttribute("width"), - "The instruments pane width should be the same as the preferred value."); - - sources.setAttribute("width", someWidth1); - instruments.setAttribute("width", someWidth2); - - removeTab(tab1); - }, tab1); - - window.addEventListener("Debugger:Shutdown", function dbgShutdown() { - window.removeEventListener("Debugger:Shutdown", dbgShutdown, true); - - is(content.Prefs.sourcesWidth, sources.getAttribute("width"), - "The sources pane width should have been saved by now."); - is(content.Prefs.instrumentsWidth, instruments.getAttribute("width"), - "The instruments pane width should have been saved by now."); - - // Cleanup after ourselves! - Services.prefs.setIntPref("devtools.debugger.ui.panes-sources-width", preferredSw); - Services.prefs.setIntPref("devtools.debugger.ui.panes-instruments-width", preferredIw); - - finish(); - }, true); - }); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.html b/browser/devtools/debugger/test/browser_dbg_pause-exceptions.html deleted file mode 100644 index 31bcfa922..000000000 --- a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Debugger Pause on Exceptions Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - </head> - <body> - <button>Click me!</button> - <ul></ul> - </body> - <script type="text/javascript"> - window.addEventListener("load", function() { - function load() { - try { - debugger; - throw new Error("boom"); - } catch (e) { - var list = document.querySelector("ul"); - var item = document.createElement("li"); - item.innerHTML = e.message; - list.appendChild(item); - } - } - var button = document.querySelector("button"); - button.addEventListener("click", load, false); - }); - </script> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.js b/browser/devtools/debugger/test/browser_dbg_pause-exceptions.js deleted file mode 100644 index 7aac1b7d0..000000000 --- a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.js +++ /dev/null @@ -1,135 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the pause-on-exceptions toggle works. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_pause-exceptions.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gPrevPref = null; - -requestLongerTimeout(2); - -function test() -{ - gPrevPref = Services.prefs.getBoolPref( - "devtools.debugger.pause-on-exceptions"); - Services.prefs.setBoolPref( - "devtools.debugger.pause-on-exceptions", true); - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - testWithFrame(); - }); -} - -function testWithFrame() -{ - let count = 0; - gPane.panelWin.gClient.addOneTimeListener("paused", function() { - gDebugger.addEventListener("Debugger:FetchedVariables", function testA() { - // We expect 2 Debugger:FetchedVariables events, one from the global object - // scope and the regular one. - if (++count < 2) { - is(count, 1, "A. First Debugger:FetchedVariables event received."); - return; - } - is(count, 2, "A. Second Debugger:FetchedVariables event received."); - gDebugger.removeEventListener("Debugger:FetchedVariables", testA, false); - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should be paused now."); - - // Pause on exceptions should be already enabled. - is(gPrevPref, false, - "The pause-on-exceptions functionality should be disabled by default."); - is(gDebugger.Prefs.pauseOnExceptions, true, - "The pause-on-exceptions pref should be true from startup."); - is(gDebugger.DebuggerView.Options._pauseOnExceptionsItem.getAttribute("checked"), "true", - "Pause on exceptions should be enabled from startup. ") - - count = 0; - gPane.panelWin.gClient.addOneTimeListener("resumed", function() { - gDebugger.addEventListener("Debugger:FetchedVariables", function testB() { - // We expect 2 Debugger:FetchedVariables events, one from the global object - // scope and the regular one. - if (++count < 2) { - is(count, 1, "B. First Debugger:FetchedVariables event received."); - return; - } - is(count, 2, "B. Second Debugger:FetchedVariables event received."); - gDebugger.removeEventListener("Debugger:FetchedVariables", testB, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.firstChild, - innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have one frame."); - - is(scopes.children.length, 3, "Should have 3 variable scopes."); - - is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>", - "Should have the right property name for the exception."); - - is(innerNodes[0].querySelector(".value").getAttribute("value"), "[object Error]", - "Should have the right property value for the exception."); - - // Disable pause on exceptions. - gDebugger.DebuggerView.Options._pauseOnExceptionsItem.setAttribute("checked", "false"); - gDebugger.DebuggerView.Options._togglePauseOnExceptions(); - - is(gDebugger.Prefs.pauseOnExceptions, false, - "The pause-on-exceptions pref should have been set to false."); - - resumeAndFinish(); - - }}, 0); - }, false); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); - }, false); - }); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function resumeAndFinish() { - gPane.panelWin.gClient.addOneTimeListener("resumed", function() { - Services.tm.currentThread.dispatch({ run: function() { - - closeDebuggerAndFinish(); - - }}, 0); - }); - - // Resume to let the exception reach it's catch clause. - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_pause-resume.js b/browser/devtools/debugger/test/browser_dbg_pause-resume.js deleted file mode 100644 index 1f886cd17..000000000 --- a/browser/devtools/debugger/test/browser_dbg_pause-resume.js +++ /dev/null @@ -1,93 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gView = null; -var gLH = null; -var gL10N = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gView = gDebugger.DebuggerView; - gLH = gDebugger.LayoutHelpers; - gL10N = gDebugger.L10N; - - testPause(); - }); -} - -function testPause() { - is(gDebugger.DebuggerController.activeThread.paused, false, - "Should be running after debug_tab_pane."); - - let button = gDebugger.document.getElementById("resume"); - is(button.getAttribute("tooltiptext"), - gL10N.getFormatStr("pauseButtonTooltip", - gLH.prettyKey(gDebugger.document.getElementById("resumeKey"))), - "Button tooltip should be pause when running."); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.paused, true, - "Should be paused after an interrupt request."); - - is(button.getAttribute("tooltiptext"), - gL10N.getFormatStr("resumeButtonTooltip", - gLH.prettyKey(gDebugger.document.getElementById("resumeKey"))), - "Button tooltip should be resume when paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames when paused in the main loop."); - - testResume(); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); -} - -function testResume() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() { - Services.tm.currentThread.dispatch({ run: function() { - - is(gDebugger.DebuggerController.activeThread.paused, false, - "Should be paused after an interrupt request."); - - let button = gDebugger.document.getElementById("resume"); - is(button.getAttribute("tooltiptext"), - gL10N.getFormatStr("pauseButtonTooltip", - gLH.prettyKey(gDebugger.document.getElementById("resumeKey"))), - "Button tooltip should be pause when running."); - - closeDebuggerAndFinish(); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gView = null; - gLH = null; - gL10N = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_pause-warning.js b/browser/devtools/debugger/test/browser_dbg_pause-warning.js deleted file mode 100644 index c72363343..000000000 --- a/browser/devtools/debugger/test/browser_dbg_pause-warning.js +++ /dev/null @@ -1,97 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gView = null; -var gToolbox = null; -var gTarget = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gView = gDebugger.DebuggerView; - - gTarget = TargetFactory.forTab(gBrowser.selectedTab); - gToolbox = gDevTools.getToolbox(gTarget); - - testPause(); - }); -} - -function testPause() { - let button = gDebugger.document.getElementById("resume"); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() { - Services.tm.currentThread.dispatch({ run: function() { - is(gDebugger.DebuggerController.activeThread.paused, true, - "Debugger is paused."); - - ok(gTarget.isThreadPaused, "target.isThreadPaused has been updated"); - - gToolbox.once("inspector-selected", testNotificationIsUp1); - gToolbox.selectTool("inspector"); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); -} - -function testNotificationIsUp1() { - let notificationBox = gToolbox.getNotificationBox(); - let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); - ok(notification, "Notification is present"); - gToolbox.once("jsdebugger-selected", testNotificationIsHidden); - gToolbox.selectTool("jsdebugger"); -} - -function testNotificationIsHidden() { - let notificationBox = gToolbox.getNotificationBox(); - let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); - ok(!notification, "Notification is hidden"); - gToolbox.once("inspector-selected", testNotificationIsUp2); - gToolbox.selectTool("inspector"); -} - -function testNotificationIsUp2() { - let notificationBox = gToolbox.getNotificationBox(); - let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); - ok(notification, "Notification is present"); - testResume(); -} - -function testResume() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() { - Services.tm.currentThread.dispatch({ run: function() { - - ok(!gTarget.isThreadPaused, "target.isThreadPaused has been updated"); - let notificationBox = gToolbox.getNotificationBox(); - let notification = notificationBox.getNotificationWithValue("inspector-script-paused"); - ok(!notification, "No notification once debugger resumed"); - - closeDebuggerAndFinish(); - }}, 0); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("resume"), - gDebugger); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gView = null; - gToolbox = null; - gTarget = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js b/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js deleted file mode 100644 index 76f934df7..000000000 --- a/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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). - -var gPane = null; -var gTab = null; -var gOldListener = null; - -const TEST_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -function test() { - installListener(); - - debug_tab_pane(TEST_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - let gDebugger = gPane.panelWin; - - is(gDebugger.DebuggerController._isInitialized, true, - "Controller should be initialized after debug_tab_pane."); - is(gDebugger.DebuggerView._isInitialized, true, - "View should be initialized after debug_tab_pane."); - - closeDebuggerAndFinish(); - }); -} - -// This is taken almost verbatim from bug 771655. -function installListener() { - if ("_testPL" in window) { - gOldListener = _testPL; - Cc['@mozilla.org/docloaderservice;1'].getService(Ci.nsIWebProgress) - .removeProgressListener(_testPL); - } - - window._testPL = { - START_DOC: Ci.nsIWebProgressListener.STATE_START | - Ci.nsIWebProgressListener.STATE_IS_DOCUMENT, - onStateChange: function(wp, req, stateFlags, status) { - if ((stateFlags & this.START_DOC) === this.START_DOC) { - // This DOMWindow access triggers the unload event. - wp.DOMWindow; - } - }, - QueryInterface: function(iid) { - if (iid.equals(Ci.nsISupportsWeakReference) || - iid.equals(Ci.nsIWebProgressListener)) - return this; - throw Cr.NS_ERROR_NO_INTERFACE; - } - } - - Cc['@mozilla.org/docloaderservice;1'].getService(Ci.nsIWebProgress) - .addProgressListener(_testPL, Ci.nsIWebProgress.NOTIFY_STATE_REQUEST); -} - -registerCleanupFunction(function() { - if (gOldListener) { - window._testPL = gOldListener; - } else { - delete window._testPL; - } - removeTab(gTab); - gPane = null; - gTab = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-01.js deleted file mode 100644 index 8a018fbf9..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js +++ /dev/null @@ -1,165 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - testlabelshortening(); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -function testlabelshortening() { - gDebugger.DebuggerController.activeThread.resume(function() { - let sv = gDebugger.SourceUtils; - let vs = gDebugger.DebuggerView.Sources; - let ss = gDebugger.DebuggerController.SourceScripts; - vs.empty(); - vs.widget.removeEventListener("select", vs._onScriptsChange, false); - - is(sv.trimUrlQuery("a/b/c.d?test=1&random=4#reference"), "a/b/c.d", - "Trimming the url query isn't done properly."); - - let ellipsis = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString); - let nanana = new Array(20).join(NaN); - - let superLargeLabel = new Array(100).join("Beer can in Jamaican sounds like Bacon!"); - let trimmedLargeLabel = sv.trimUrlLength(superLargeLabel, 1234); - is(trimmedLargeLabel.length, 1235, - "Trimming large labels isn't done properly."); - ok(trimmedLargeLabel.endsWith(ellipsis), - "Trimming large labels should add an ellipsis at the end."); - - let urls = [ - { href: "http://some.address.com/random/", leaf: "subrandom/" }, - { href: "http://some.address.com/random/", leaf: "suprandom/?a=1" }, - { href: "http://some.address.com/random/", leaf: "?a=1" }, - { href: "https://another.address.org/random/subrandom/", leaf: "page.html" }, - - { href: "ftp://interesting.address.org/random/", leaf: "script.js" }, - { href: "ftp://interesting.address.com/random/", leaf: "script.js" }, - { href: "ftp://interesting.address.com/random/", leaf: "x/script.js" }, - { href: "ftp://interesting.address.com/random/", leaf: "x/y/script.js?a=1" }, - { href: "ftp://interesting.address.com/random/x/", leaf: "y/script.js?a=1&b=2" }, - { href: "ftp://interesting.address.com/random/x/y/", leaf: "script.js?a=1&b=2&c=3" }, - { href: "ftp://interesting.address.com/random/", leaf: "x/y/script.js?a=2" }, - { href: "ftp://interesting.address.com/random/x/", leaf: "y/script.js?a=2&b=3" }, - { href: "ftp://interesting.address.com/random/x/y/", leaf: "script.js?a=2&b=3&c=4" }, - - { href: "file://random/", leaf: "script_t1.js&a=1&b=2&c=3" }, - { href: "file://random/", leaf: "script_t2_1.js#id" }, - { href: "file://random/", leaf: "script_t2_2.js?a" }, - { href: "file://random/", leaf: "script_t2_3.js&b" }, - { href: "resource://random/", leaf: "script_t3_1.js#id?a=1&b=2" }, - { href: "resource://random/", leaf: "script_t3_2.js?a=1&b=2#id" }, - { href: "resource://random/", leaf: "script_t3_3.js&a=1&b=2#id" }, - - { href: nanana, leaf: "Batman!" + "{trim me, now and forevermore}" } - ]; - - urls.forEach(function(url) { - executeSoon(function() { - let loc = url.href + url.leaf; - vs.push([sv.trimUrlLength(sv.getSourceLabel(loc)), loc], { forced: true }); - }); - }); - - executeSoon(function() { - info("Script labels:"); - info(vs.labels.toSource()); - - info("Script locations:"); - info(vs.values.toSource()); - - urls.forEach(function(url) { - let loc = url.href + url.leaf; - if (url.dupe) { - ok(!vs.containsValue(loc), "Shouldn't contain script: " + loc); - } else { - ok(vs.containsValue(loc), "Should contain script: " + loc); - } - }); - - ok(vs.containsLabel("random/subrandom/"), - "Script (0) label is incorrect."); - ok(vs.containsLabel("random/suprandom/?a=1"), - "Script (1) label is incorrect."); - ok(vs.containsLabel("random/?a=1"), - "Script (2) label is incorrect."); - ok(vs.containsLabel("page.html"), - "Script (3) label is incorrect."); - - ok(vs.containsLabel("script.js"), - "Script (4) label is incorrect."); - ok(vs.containsLabel("random/script.js"), - "Script (5) label is incorrect."); - ok(vs.containsLabel("random/x/script.js"), - "Script (6) label is incorrect."); - ok(vs.containsLabel("script.js?a=1"), - "Script (7) label is incorrect."); - - ok(vs.containsLabel("script_t1.js"), - "Script (8) label is incorrect."); - ok(vs.containsLabel("script_t2_1.js"), - "Script (9) label is incorrect."); - ok(vs.containsLabel("script_t2_2.js"), - "Script (10) label is incorrect."); - ok(vs.containsLabel("script_t2_3.js"), - "Script (11) label is incorrect."); - ok(vs.containsLabel("script_t3_1.js"), - "Script (12) label is incorrect."); - ok(vs.containsLabel("script_t3_2.js"), - "Script (13) label is incorrect."); - ok(vs.containsLabel("script_t3_3.js"), - "Script (14) label is incorrect."); - - ok(vs.containsLabel(nanana + "Batman!" + ellipsis), - "Script (15) label is incorrect."); - - is(vs.itemCount, urls.filter(function(url) !url.dupe).length, - "Didn't get the correct number of scripts in the list."); - - is(vs.getItemByValue("http://some.address.com/random/subrandom/").label, "random/subrandom/", - "Scripts.getItemByValue isn't functioning properly (0)."); - is(vs.getItemByValue("http://some.address.com/random/suprandom/?a=1").label, "random/suprandom/?a=1", - "Scripts.getItemByValue isn't functioning properly (1)."); - - is(vs.getItemByLabel("random/subrandom/").value, "http://some.address.com/random/subrandom/", - "Scripts.getItemByLabel isn't functioning properly (0)."); - is(vs.getItemByLabel("random/suprandom/?a=1").value, "http://some.address.com/random/suprandom/?a=1", - "Scripts.getItemByLabel isn't functioning properly (1)."); - - - closeDebuggerAndFinish(); - }); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-02.js b/browser/devtools/debugger/test/browser_dbg_propertyview-02.js deleted file mode 100644 index e2a6bdd08..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-02.js +++ /dev/null @@ -1,134 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let testScope = gDebugger.DebuggerView.Variables.addScope("test"); - - ok(testScope, - "Should have created a scope."); - - is(testScope.id.substring(0, 4), "test", - "The newly created scope should have the default id set."); - - is(testScope.target.querySelector(".name").getAttribute("value"), "test", - "Any new scope should have the designated title."); - - is(testScope.target.querySelector(".variables-view-element-details").childNodes.length, 0, - "Any new scope should have a container with no child nodes."); - - is(gDebugger.DebuggerView.Variables._list.childNodes.length, 3, - "Should have 3 scopes created."); - - - ok(!testScope.expanded, - "Any new created scope should be initially collapsed."); - - ok(testScope.visible, - "Any new created scope should be initially visible."); - - let expandCallbackSender = null; - let collapseCallbackSender = null; - let toggleCallbackSender = null; - let hideCallbackSender = null; - let showCallbackSender = null; - - testScope.onexpand = function(sender) { expandCallbackSender = sender; }; - testScope.oncollapse = function(sender) { collapseCallbackSender = sender; }; - testScope.ontoggle = function(sender) { toggleCallbackSender = sender; }; - testScope.onhide = function(sender) { hideCallbackSender = sender; }; - testScope.onshow = function(sender) { showCallbackSender = sender; }; - - testScope.expand(); - ok(testScope.expanded, - "The testScope shouldn't be collapsed anymore."); - is(expandCallbackSender, testScope, - "The expandCallback wasn't called as it should."); - - testScope.collapse(); - ok(!testScope.expanded, - "The testScope should be collapsed again."); - is(collapseCallbackSender, testScope, - "The collapseCallback wasn't called as it should."); - - testScope.expanded = true; - ok(testScope.expanded, - "The testScope shouldn't be collapsed anymore."); - - testScope.toggle(); - ok(!testScope.expanded, - "The testScope should be collapsed again."); - is(toggleCallbackSender, testScope, - "The toggleCallback wasn't called as it should."); - - - testScope.hide(); - ok(!testScope.visible, - "The testScope should be invisible after hiding."); - is(hideCallbackSender, testScope, - "The hideCallback wasn't called as it should."); - - testScope.show(); - ok(testScope.visible, - "The testScope should be visible again."); - is(showCallbackSender, testScope, - "The showCallback wasn't called as it should."); - - testScope.visible = false; - ok(!testScope.visible, - "The testScope should be invisible after hiding."); - - - ok(!testScope.expanded, - "The testScope should remember it is collapsed even if it is hidden."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testScope.target.querySelector(".title"), - gDebugger); - - ok(testScope.expanded, - "Clicking the testScope tilte should expand it."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testScope.target.querySelector(".title"), - gDebugger); - - ok(!testScope.expanded, - "Clicking again the testScope tilte should collapse it."); - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-03.js b/browser/devtools/debugger/test/browser_dbg_propertyview-03.js deleted file mode 100644 index 684af5fb7..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-03.js +++ /dev/null @@ -1,211 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let testScope = gDebugger.DebuggerView.Variables.addScope("test-scope"); - let testVar = testScope.addItem("something"); - let duplVar = testScope.addItem("something"); - - info("Scope id: " + testScope.target.id); - info("Scope name: " + testScope.target.name); - info("Variable id: " + testVar.target.id); - info("Variable name: " + testVar.target.name); - - ok(testScope, - "Should have created a scope."); - ok(testVar, - "Should have created a variable."); - - ok(testScope.id.contains("test-scope"), - "Should have the correct scope id."); - ok(testScope.target.id.contains("test-scope"), - "Should have the correct scope id on the element."); - is(testScope.name, "test-scope", - "Should have the correct scope name."); - - ok(testVar.id.contains("something"), - "Should have the correct variable id."); - ok(testVar.target.id.contains("something"), - "Should have the correct variable id on the element."); - is(testVar.name, "something", - "Should have the correct variable name."); - - is(duplVar, null, - "Shouldn't be able to duplicate variables in the same scope."); - - is(testVar.target.querySelector(".name").getAttribute("value"), "something", - "Any new variable should have the designated title."); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0, - "Any new variable should have a details container with no child nodes."); - - - let properties = testVar.addItems({ "child": { "value": { "type": "object", - "class": "Object" } } }); - - - ok(!testVar.expanded, - "Any new created variable should be initially collapsed."); - - ok(testVar.visible, - "Any new created variable should be initially visible."); - - - testVar.expand(); - ok(testVar.expanded, - "The testVar shouldn't be collapsed anymore."); - - testVar.collapse(); - ok(!testVar.expanded, - "The testVar should be collapsed again."); - - testVar.expanded = true; - ok(testVar.expanded, - "The testVar shouldn't be collapsed anymore."); - - testVar.toggle(); - ok(!testVar.expanded, - "The testVar should be collapsed again."); - - - testVar.hide(); - ok(!testVar.visible, - "The testVar should be invisible after hiding."); - - testVar.show(); - ok(testVar.visible, - "The testVar should be visible again."); - - testVar.visible = false; - ok(!testVar.visible, - "The testVar should be invisible after hiding."); - - - ok(!testVar.expanded, - "The testVar should remember it is collapsed even if it is hidden."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.target.querySelector(".name"), - gDebugger); - - ok(testVar.expanded, - "Clicking the testVar name should expand it."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.target.querySelector(".name"), - gDebugger); - - ok(!testVar.expanded, - "Clicking again the testVar name should collapse it."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.target.querySelector(".arrow"), - gDebugger); - - ok(testVar.expanded, - "Clicking the testVar arrow should expand it."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.target.querySelector(".arrow"), - gDebugger); - - ok(!testVar.expanded, - "Clicking again the testVar arrow should collapse it."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.target.querySelector(".title"), - gDebugger); - - ok(testVar.expanded, - "Clicking the testVar title div should expand it again."); - - - testScope.show(); - testScope.expand(); - testVar.show(); - testVar.expand(); - - ok(!testVar.get("child").expanded, - "The testVar child property should remember it is collapsed even if it is hidden."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.get("child").target.querySelector(".name"), - gDebugger); - - ok(testVar.get("child").expanded, - "Clicking the testVar child property name should expand it."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.get("child").target.querySelector(".name"), - gDebugger); - - ok(!testVar.get("child").expanded, - "Clicking again the testVar child property name should collapse it."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.get("child").target.querySelector(".arrow"), - gDebugger); - - ok(testVar.get("child").expanded, - "Clicking the testVar child property arrow should expand it."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.get("child").target.querySelector(".arrow"), - gDebugger); - - ok(!testVar.get("child").expanded, - "Clicking again the testVar child property arrow should collapse it."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - testVar.get("child").target.querySelector(".title"), - gDebugger); - - ok(testVar.get("child").expanded, - "Clicking the testVar child property title div should expand it again."); - - - gDebugger.DebuggerView.Variables.empty(); - is(gDebugger.DebuggerView.Variables._list.childNodes.length, 0, - "The scopes should have been removed from the parent container tree."); - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-04.js b/browser/devtools/debugger/test/browser_dbg_propertyview-04.js deleted file mode 100644 index 47ab452c7..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-04.js +++ /dev/null @@ -1,78 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let testScope = gDebugger.DebuggerView.Variables.addScope("test"); - let testVar = testScope.addItem("something"); - - let properties = testVar.addItems({ - "child": { - "value": { - "type": "object", - "class": "Object" - }, - "enumerable": true - } - }); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1, - "A new detail node should have been added in the variable tree."); - - ok(testVar.get("child"), - "The added detail property should be accessible from the variable."); - - - let properties2 = testVar.get("child").addItems({ - "grandchild": { - "value": { - "type": "object", - "class": "Object" - }, - "enumerable": true - } - }); - - is(testVar.get("child").target.querySelector(".variables-view-element-details").childNodes.length, 1, - "A new detail node should have been added in the variable tree."); - - ok(testVar.get("child").get("grandchild"), - "The added detail property should be accessible from the variable."); - - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-05.js b/browser/devtools/debugger/test/browser_dbg_propertyview-05.js deleted file mode 100644 index 74e172ef7..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-05.js +++ /dev/null @@ -1,95 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - requestLongerTimeout(3); - - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let testScope = gDebugger.DebuggerView.Variables.addScope("test"); - let testVar = testScope.addItem("something"); - - testVar.setGrip(1.618); - - is(testVar.target.querySelector(".value").getAttribute("value"), "1.618", - "The grip information for the variable wasn't set correctly."); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0, - "Adding a value property shouldn't add any new tree nodes."); - - - testVar.setGrip({ "type": "object", "class": "Window" }); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0, - "Adding type and class properties shouldn't add any new tree nodes."); - - is(testVar.target.querySelector(".value").getAttribute("value"), "[object Window]", - "The information for the variable wasn't set correctly."); - - - testVar.addItems({ "helloWorld": { "value": "hello world", "enumerable": true } }); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1, - "A new detail node should have been added in the variable tree."); - - - testVar.addItems({ "helloWorld": { "value": "hello jupiter", "enumerable": true } }); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1, - "Shouldn't be able to duplicate nodes added in the variable tree."); - - - testVar.addItems({ "someProp0": { "value": "random string", "enumerable": true }, - "someProp1": { "value": "another string", "enumerable": true } }); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 3, - "Two new detail nodes should have been added in the variable tree."); - - - testVar.addItems({ "someProp2": { "value": { "type": "null" }, "enumerable": true }, - "someProp3": { "value": { "type": "undefined" }, "enumerable": true }, - "someProp4": { - "value": { "type": "object", "class": "Object" }, - "enumerable": true - } - }); - - is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 6, - "Three new detail nodes should have been added in the variable tree."); - - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-06.js b/browser/devtools/debugger/test/browser_dbg_propertyview-06.js deleted file mode 100644 index a36eee392..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-06.js +++ /dev/null @@ -1,198 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let globalScope = gDebugger.DebuggerView.Variables.addScope("Test-Global"); - let localScope = gDebugger.DebuggerView.Variables.addScope("Test-Local"); - - let windowVar = globalScope.addItem("window"); - let documentVar = globalScope.addItem("document"); - let localVar0 = localScope.addItem("localVariable"); - - let localVar1 = localScope.addItem("localVar1"); - let localVar2 = localScope.addItem("localVar2"); - let localVar3 = localScope.addItem("localVar3"); - let localVar4 = localScope.addItem("localVar4"); - let localVar5 = localScope.addItem("localVar5"); - - localVar0.setGrip(42); - localVar1.setGrip(true); - localVar2.setGrip("nasu"); - - localVar3.setGrip({ "type": "undefined" }); - localVar4.setGrip({ "type": "null" }); - localVar5.setGrip({ "type": "object", "class": "Object" }); - - localVar5.addItems({ - "someProp0": { "value": 42, "enumerable": true }, - "someProp1": { "value": true , "enumerable": true}, - "someProp2": { "value": "nasu", "enumerable": true}, - "someProp3": { "value": { "type": "undefined" }, "enumerable": true}, - "someProp4": { "value": { "type": "null" }, "enumerable": true }, - "someProp5": { - "value": { "type": "object", "class": "Object" }, - "enumerable": true - }, - "someUndefined": { - "value": { "type": "undefined" }, - "enumerable": true - }, - "someAccessor": { - "get": { "type": "object", "class": "Function" }, - "set": { "type": "undefined" }, - "enumerable": true - } - }); - - localVar5.get("someProp5").addItems({ - "someProp0": { "value": 42, "enumerable": true }, - "someProp1": { "value": true, "enumerable": true }, - "someProp2": { "value": "nasu", "enumerable": true }, - "someProp3": { "value": { "type": "undefined" }, "enumerable": true }, - "someProp4": { "value": { "type": "null" }, "enumerable": true }, - "someProp5": { - "value": { "type": "object", "class": "Object" }, - "enumerable": true - }, - "someUndefined": { - "value": { "type": "undefined" }, - "enumerable": true - }, - "someAccessor": { - "get": { "type": "object", "class": "Function" }, - "set": { "type": "undefined" }, - "enumerable": true - } - }); - - windowVar.setGrip({ "type": "object", "class": "Window" }); - windowVar.addItems({ - "helloWorld": { "value": "hello world" } - }); - - documentVar.setGrip({ "type": "object", "class": "HTMLDocument" }); - documentVar.addItems({ - "onload": { "value": { "type": "null" } }, - "onunload": { "value": { "type": "null" } }, - "onfocus": { "value": { "type": "null" } }, - "onblur": { "value": { "type": "null" } }, - "onclick": { "value": { "type": "null" } }, - "onkeypress": { "value": { "type": "null" } } - }); - - - ok(windowVar, "The windowVar hasn't been created correctly."); - ok(documentVar, "The documentVar hasn't been created correctly."); - ok(localVar0, "The localVar0 hasn't been created correctly."); - ok(localVar1, "The localVar1 hasn't been created correctly."); - ok(localVar2, "The localVar2 hasn't been created correctly."); - ok(localVar3, "The localVar3 hasn't been created correctly."); - ok(localVar4, "The localVar4 hasn't been created correctly."); - ok(localVar5, "The localVar5 hasn't been created correctly."); - - for each (let elt in globalScope.target.querySelector(".nonenum").childNodes) { - info("globalScope :: " + { id: elt.id, className: elt.className }.toSource()); - } - is(globalScope.target.querySelector(".nonenum").childNodes.length, 2, - "The globalScope doesn't contain all the created variable elements."); - - for each (let elt in localScope.target.querySelector(".nonenum").childNodes) { - info("localScope :: " + { id: elt.id, className: elt.className }.toSource()); - } - is(localScope.target.querySelector(".nonenum").childNodes.length, 6, - "The localScope doesn't contain all the created variable elements."); - - is(localVar5.target.querySelector(".variables-view-element-details").childNodes.length, 8, - "The localVar5 doesn't contain all the created properties."); - is(localVar5.get("someProp5").target.querySelector(".variables-view-element-details").childNodes.length, 8, - "The localVar5.someProp5 doesn't contain all the created properties."); - - is(windowVar.target.querySelector(".value").getAttribute("value"), "[object Window]", - "The grip information for the windowVar wasn't set correctly."); - is(documentVar.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]", - "The grip information for the documentVar wasn't set correctly."); - - is(localVar0.target.querySelector(".value").getAttribute("value"), "42", - "The grip information for the localVar0 wasn't set correctly."); - is(localVar1.target.querySelector(".value").getAttribute("value"), "true", - "The grip information for the localVar1 wasn't set correctly."); - is(localVar2.target.querySelector(".value").getAttribute("value"), "\"nasu\"", - "The grip information for the localVar2 wasn't set correctly."); - is(localVar3.target.querySelector(".value").getAttribute("value"), "undefined", - "The grip information for the localVar3 wasn't set correctly."); - is(localVar4.target.querySelector(".value").getAttribute("value"), "null", - "The grip information for the localVar4 wasn't set correctly."); - is(localVar5.target.querySelector(".value").getAttribute("value"), "[object Object]", - "The grip information for the localVar5 wasn't set correctly."); - - is(localVar5.get("someProp0").target.querySelector(".value").getAttribute("value"), "42", - "The grip information for the localVar0 wasn't set correctly."); - is(localVar5.get("someProp1").target.querySelector(".value").getAttribute("value"), "true", - "The grip information for the localVar1 wasn't set correctly."); - is(localVar5.get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"", - "The grip information for the localVar2 wasn't set correctly."); - is(localVar5.get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined", - "The grip information for the localVar3 wasn't set correctly."); - is(localVar5.get("someProp4").target.querySelector(".value").getAttribute("value"), "null", - "The grip information for the localVar4 wasn't set correctly."); - is(localVar5.get("someProp5").target.querySelector(".value").getAttribute("value"), "[object Object]", - "The grip information for the localVar5 wasn't set correctly."); - is(localVar5.get("someUndefined").target.querySelector(".value").getAttribute("value"), "undefined", - "The grip information for the someUndefined wasn't set correctly."); - is(localVar5.get("someAccessor").target.querySelector(".value").getAttribute("value"), "", - "The grip information for the someAccessor wasn't set correctly."); - - is(localVar5.get("someProp5").get("someProp0").target.querySelector(".value").getAttribute("value"), "42", - "The grip information for the sub-localVar0 wasn't set correctly."); - is(localVar5.get("someProp5").get("someProp1").target.querySelector(".value").getAttribute("value"), "true", - "The grip information for the sub-localVar1 wasn't set correctly."); - is(localVar5.get("someProp5").get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"", - "The grip information for the sub-localVar2 wasn't set correctly."); - is(localVar5.get("someProp5").get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined", - "The grip information for the sub-localVar3 wasn't set correctly."); - is(localVar5.get("someProp5").get("someProp4").target.querySelector(".value").getAttribute("value"), "null", - "The grip information for the sub-localVar4 wasn't set correctly."); - is(localVar5.get("someProp5").get("someProp5").target.querySelector(".value").getAttribute("value"), "[object Object]", - "The grip information for the sub-localVar5 wasn't set correctly."); - is(localVar5.get("someProp5").get("someUndefined").target.querySelector(".value").getAttribute("value"), "undefined", - "The grip information for the sub-someUndefined wasn't set correctly."); - is(localVar5.get("someProp5").get("someAccessor").target.querySelector(".value").getAttribute("value"), "", - "The grip information for the sub-someAccessor wasn't set correctly."); - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-07.js b/browser/devtools/debugger/test/browser_dbg_propertyview-07.js deleted file mode 100644 index b8dfce0af..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-07.js +++ /dev/null @@ -1,106 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view displays function parameters. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - testFrameParameters(); - }); -} - -function testFrameParameters() -{ - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"), - localNodes = localScope.querySelector(".variables-view-element-details").childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 3, - "Should have three frames."); - - is(localNodes.length, 12, - "The localScope should contain all the created variable elements."); - - is(localNodes[0].querySelector(".value").getAttribute("value"), "[object Window]", - "Should have the right property value for 'this'."); - - is(localNodes[1].querySelector(".value").getAttribute("value"), "[object Object]", - "Should have the right property value for 'aArg'."); - - is(localNodes[2].querySelector(".value").getAttribute("value"), '"beta"', - "Should have the right property value for 'bArg'."); - - is(localNodes[3].querySelector(".value").getAttribute("value"), "3", - "Should have the right property value for 'cArg'."); - - is(localNodes[4].querySelector(".value").getAttribute("value"), "false", - "Should have the right property value for 'dArg'."); - - is(localNodes[5].querySelector(".value").getAttribute("value"), "null", - "Should have the right property value for 'eArg'."); - - is(localNodes[6].querySelector(".value").getAttribute("value"), "undefined", - "Should have the right property value for 'fArg'."); - - is(localNodes[7].querySelector(".value").getAttribute("value"), "1", - "Should have the right property value for 'a'."); - - is(localNodes[8].querySelector(".value").getAttribute("value"), "[object Arguments]", - "Should have the right property value for 'arguments'."); - - is(localNodes[9].querySelector(".value").getAttribute("value"), "[object Object]", - "Should have the right property value for 'b'."); - - is(localNodes[10].querySelector(".value").getAttribute("value"), "[object Object]", - "Should have the right property value for 'c'."); - - resumeAndFinish(); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function resumeAndFinish() { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - - var frames = gDebugger.DebuggerView.StackFrames.widget._list; - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames."); - - closeDebuggerAndFinish(); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-08.js b/browser/devtools/debugger/test/browser_dbg_propertyview-08.js deleted file mode 100644 index c050676ab..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-08.js +++ /dev/null @@ -1,244 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view displays the properties of objects. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - testFrameParameters(); - }); -} - -function testFrameParameters() -{ - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[0], - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - localNonEnums = localScope.querySelector(".nonenum").childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 3, - "Should have three frames."); - - is(localNodes.length + localNonEnums.length, 12, - "The localScope and localNonEnums should contain all the created variable elements."); - - is(localNodes[0].querySelector(".value").getAttribute("value"), "[object Window]", - "Should have the right property value for 'this'."); - is(localNodes[8].querySelector(".value").getAttribute("value"), "[object Arguments]", - "Should have the right property value for 'arguments'."); - is(localNodes[10].querySelector(".value").getAttribute("value"), "[object Object]", - "Should have the right property value for 'c'."); - - - let gVars = gDebugger.DebuggerView.Variables; - - is(gVars.getScopeForNode( - gVars._list.querySelectorAll(".variables-view-scope")[0]).target, - gVars._list.querySelectorAll(".variables-view-scope")[0], - "getScopeForNode([0]) didn't return the expected scope."); - is(gVars.getScopeForNode( - gVars._list.querySelectorAll(".variables-view-scope")[1]).target, - gVars._list.querySelectorAll(".variables-view-scope")[1], - "getScopeForNode([1]) didn't return the expected scope."); - is(gVars.getScopeForNode( - gVars._list.querySelectorAll(".variables-view-scope")[2]).target, - gVars._list.querySelectorAll(".variables-view-scope")[2], - "getScopeForNode([2]) didn't return the expected scope."); - - is(gVars.getScopeForNode(gVars._list.querySelectorAll(".variables-view-scope")[0]).expanded, true, - "The local scope should be expanded by default."); - is(gVars.getScopeForNode(gVars._list.querySelectorAll(".variables-view-scope")[1]).expanded, false, - "The block scope should be collapsed by default."); - is(gVars.getScopeForNode(gVars._list.querySelectorAll(".variables-view-scope")[2]).expanded, false, - "The global scope should be collapsed by default."); - - - let thisNode = gVars.getItemForNode(localNodes[0]); - let argumentsNode = gVars.getItemForNode(localNodes[8]); - let cNode = gVars.getItemForNode(localNodes[10]); - - is(thisNode.expanded, false, - "The thisNode should not be expanded at this point."); - is(argumentsNode.expanded, false, - "The argumentsNode should not be expanded at this point."); - is(cNode.expanded, false, - "The cNode should not be expanded at this point."); - - // Expand the 'this', 'arguments' and 'c' tree nodes. This causes - // their properties to be retrieved and displayed. - thisNode.expand(); - argumentsNode.expand(); - cNode.expand(); - - is(thisNode.expanded, true, - "The thisNode should be expanded at this point."); - is(argumentsNode.expanded, true, - "The argumentsNode should be expanded at this point."); - is(cNode.expanded, true, - "The cNode should be expanded at this point."); - - // Poll every few milliseconds until the properties are retrieved. - // It's important to set the timer in the chrome window, because the - // content window timers are disabled while the debuggee is paused. - let count = 0; - let intervalID = window.setInterval(function(){ - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the properties."); - window.clearInterval(intervalID); - return resumeAndFinish(); - } - if (!thisNode._retrieved || - !argumentsNode._retrieved || - !cNode._retrieved) { - return; - } - window.clearInterval(intervalID); - - is(thisNode.target.querySelector(".value") - .getAttribute("value"), "[object Window]", - "Should have the right property value for 'this'."); - - is(thisNode.get("window").target.querySelector(".name") - .getAttribute("value"), "window", - "Should have the right property name for 'window'."); - ok(thisNode.get("window").target.querySelector(".value") - .getAttribute("value").search(/object/) != -1, - "'window' should be an object."); - - is(thisNode.get("document").target.querySelector(".name") - .getAttribute("value"), "document", - "Should have the right property name for 'document'."); - ok(thisNode.get("document").target.querySelector(".value") - .getAttribute("value").search(/object/) != -1, - "'document' should be an object."); - - - is(argumentsNode.target.querySelector(".value") - .getAttribute("value"), "[object Arguments]", - "Should have the right property value for 'arguments'."); - - is(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .name")[0] - .getAttribute("value"), "0", - "Should have the right property name for 'arguments[0]'."); - ok(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .value")[0] - .getAttribute("value").search(/object/) != -1, - "'arguments[0]' should be an object."); - - is(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .name")[7] - .getAttribute("value"), "__proto__", - "Should have the right property name for '__proto__'."); - ok(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .value")[7] - .getAttribute("value").search(/object/) != -1, - "'__proto__' should be an object."); - - - is(cNode.target.querySelector(".value") - .getAttribute("value"), "[object Object]", - "Should have the right property value for 'c'."); - - is(cNode.target.querySelectorAll(".variables-view-property > .title > .name")[0] - .getAttribute("value"), "a", - "Should have the right property name for 'c.a'."); - is(cNode.target.querySelectorAll(".variables-view-property > .title > .value")[0] - .getAttribute("value"), "1", - "Should have the right value for 'c.a'."); - - is(cNode.target.querySelectorAll(".variables-view-property > .title > .name")[1] - .getAttribute("value"), "b", - "Should have the right property name for 'c.b'."); - is(cNode.target.querySelectorAll(".variables-view-property > .title > .value")[1] - .getAttribute("value"), "\"beta\"", - "Should have the right value for 'c.b'."); - - is(cNode.target.querySelectorAll(".variables-view-property > .title > .name")[2] - .getAttribute("value"), "c", - "Should have the right property name for 'c.c'."); - is(cNode.target.querySelectorAll(".variables-view-property > .title > .value")[2] - .getAttribute("value"), "true", - "Should have the right value for 'c.c'."); - - - is(gVars.getItemForNode( - cNode.target.querySelectorAll(".variables-view-property")[0]).target, - cNode.target.querySelectorAll(".variables-view-property")[0], - "getItemForNode([0]) didn't return the expected property."); - - is(gVars.getItemForNode( - cNode.target.querySelectorAll(".variables-view-property")[1]).target, - cNode.target.querySelectorAll(".variables-view-property")[1], - "getItemForNode([1]) didn't return the expected property."); - - is(gVars.getItemForNode( - cNode.target.querySelectorAll(".variables-view-property")[2]).target, - cNode.target.querySelectorAll(".variables-view-property")[2], - "getItemForNode([2]) didn't return the expected property."); - - - is(cNode.find( - cNode.target.querySelectorAll(".variables-view-property")[0]).target, - cNode.target.querySelectorAll(".variables-view-property")[0], - "find([0]) didn't return the expected property."); - - is(cNode.find( - cNode.target.querySelectorAll(".variables-view-property")[1]).target, - cNode.target.querySelectorAll(".variables-view-property")[1], - "find([1]) didn't return the expected property."); - - is(cNode.find( - cNode.target.querySelectorAll(".variables-view-property")[2]).target, - cNode.target.querySelectorAll(".variables-view-property")[2], - "find([2]) didn't return the expected property."); - - - resumeAndFinish(); - }, 100); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function resumeAndFinish() { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - - var frames = gDebugger.DebuggerView.StackFrames.widget._list; - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames."); - - closeDebuggerAndFinish(); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-09.js b/browser/devtools/debugger/test/browser_dbg_propertyview-09.js deleted file mode 100644 index c0f486d36..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-09.js +++ /dev/null @@ -1,105 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view populates the global scope pane. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - testFrameParameters(); - }); -} - -function testFrameParameters() -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 2 Debugger:FetchedVariables events, one from the global object - // scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - globalScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[2], - globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 3, - "Should have three frames."); - - is(globalNodes[1].querySelector(".name").getAttribute("value"), "SpecialPowers", - "Should have the right property name for |SpecialPowers|."); - - is(globalNodes[1].querySelector(".value").getAttribute("value"), "[object Object]", - "Should have the right property value for |SpecialPowers|."); - - let globalScopeObject = gDebugger.DebuggerView.Variables.getScopeForNode(globalScope); - let documentNode = globalScopeObject.get("document"); - - is(documentNode.target.querySelector(".name").getAttribute("value"), "document", - "Should have the right property name for |document|."); - - is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]", - "Should have the right property value for |document|."); - - let len = globalNodes.length - 1; - is(globalNodes[len].querySelector(".name").getAttribute("value"), "window", - "Should have the right property name for |window|."); - - is(globalNodes[len].querySelector(".value").getAttribute("value"), "[object Window]", - "Should have the right property value for |window|."); - - resumeAndFinish(); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function resumeAndFinish() { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - Services.tm.currentThread.dispatch({ run: function() { - var frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames."); - - closeDebuggerAndFinish(); - }}, 0); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-10.js b/browser/devtools/debugger/test/browser_dbg_propertyview-10.js deleted file mode 100644 index d62a09c4f..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-10.js +++ /dev/null @@ -1,110 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view is correctly populated in |with| frames. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - testWithFrame(); - }); -} - -function testWithFrame() -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 4 Debugger:FetchedVariables events, one from the global object - // scope, two from the |with| scopes and the regular one. - if (++count < 4) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4], - innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes, - globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 2, - "Should have three frames."); - - is(scopes.childNodes.length, 5, "Should have 5 variable scopes."); - - is(innerNodes[1].querySelector(".name").getAttribute("value"), "one", - "Should have the right property name for |one|."); - - is(innerNodes[1].querySelector(".value").getAttribute("value"), "1", - "Should have the right property value for |one|."); - - let globalScopeObject = gDebugger.DebuggerView.Variables.getScopeForNode(globalScope); - let documentNode = globalScopeObject.get("document"); - - is(documentNode.target.querySelector(".name").getAttribute("value"), "document", - "Should have the right property name for |document|."); - - is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]", - "Should have the right property value for |document|."); - - let len = globalNodes.length - 1; - is(globalNodes[len].querySelector(".name").getAttribute("value"), "window", - "Should have the right property name for |window|."); - - is(globalNodes[len].querySelector(".value").getAttribute("value"), "[object Window]", - "Should have the right property value for |window|."); - - resumeAndFinish(); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function resumeAndFinish() { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - Services.tm.currentThread.dispatch({ run: function() { - var frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames."); - - closeDebuggerAndFinish(); - }}, 0); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-11.js b/browser/devtools/debugger/test/browser_dbg_propertyview-11.js deleted file mode 100644 index 219a98096..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-11.js +++ /dev/null @@ -1,241 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly displays WebIDL attributes in DOM - * objects. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -let gPane = null; -let gTab = null; -let gDebugger = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = true; - testFrameParameters(); - }); -} - -function testFrameParameters() -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 2 Debugger:FetchedVariables events, one from the global object - // scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - let anonymousScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1], - globalScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[2], - anonymousNodes = anonymousScope.querySelector(".variables-view-element-details").childNodes, - globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes, - gVars = gDebugger.DebuggerView.Variables; - - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(anonymousNodes[1].querySelector(".name").getAttribute("value"), "button", - "Should have the right property name for |button|."); - - is(anonymousNodes[1].querySelector(".value").getAttribute("value"), "[object HTMLButtonElement]", - "Should have the right property value for |button|."); - - is(anonymousNodes[2].querySelector(".name").getAttribute("value"), "buttonAsProto", - "Should have the right property name for |buttonAsProto|."); - - is(anonymousNodes[2].querySelector(".value").getAttribute("value"), "[object Object]", - "Should have the right property value for |buttonAsProto|."); - - let globalScopeObject = gVars.getScopeForNode(globalScope); - let documentNode = globalScopeObject.get("document"); - - is(documentNode.target.querySelector(".name").getAttribute("value"), "document", - "Should have the right property name for |document|."); - - is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]", - "Should have the right property value for |document|."); - - let buttonNode = gVars.getItemForNode(anonymousNodes[1]); - let buttonAsProtoNode = gVars.getItemForNode(anonymousNodes[2]); - - is(buttonNode.expanded, false, - "The buttonNode should not be expanded at this point."); - is(buttonAsProtoNode.expanded, false, - "The buttonAsProtoNode should not be expanded at this point."); - is(documentNode.expanded, false, - "The documentNode should not be expanded at this point."); - - // Expand the 'button', 'buttonAsProto' and 'document' tree nodes. This - // causes their properties to be retrieved and displayed. - buttonNode.expand(); - buttonAsProtoNode.expand(); - documentNode.expand(); - - is(buttonNode.expanded, true, - "The buttonNode should be expanded at this point."); - is(buttonAsProtoNode.expanded, true, - "The buttonAsProtoNode should be expanded at this point."); - is(documentNode.expanded, true, - "The documentNode should be expanded at this point."); - - // Poll every few milliseconds until the properties are retrieved. - // It's important to set the timer in the chrome window, because the - // content window timers are disabled while the debuggee is paused. - let count1 = 0; - let intervalID = window.setInterval(function(){ - info("count1: " + count1); - if (++count1 > 50) { - ok(false, "Timed out while polling for the properties."); - window.clearInterval(intervalID); - return resumeAndFinish(); - } - if (!buttonNode._retrieved || - !buttonAsProtoNode._retrieved || - !documentNode._retrieved) { - return; - } - window.clearInterval(intervalID); - - // Test the prototypes of these objects. - is(buttonNode.get("__proto__").target.querySelector(".name") - .getAttribute("value"), "__proto__", - "Should have the right property name for '__proto__' in buttonNode."); - ok(buttonNode.get("__proto__").target.querySelector(".value") - .getAttribute("value").search(/object/) != -1, - "'__proto__' in buttonNode should be an object."); - - is(buttonAsProtoNode.get("__proto__").target.querySelector(".name") - .getAttribute("value"), "__proto__", - "Should have the right property name for '__proto__' in buttonAsProtoNode."); - ok(buttonAsProtoNode.get("__proto__").target.querySelector(".value") - .getAttribute("value").search(/object/) != -1, - "'__proto__' in buttonAsProtoNode should be an object."); - - is(documentNode.get("__proto__").target.querySelector(".name") - .getAttribute("value"), "__proto__", - "Should have the right property name for '__proto__' in documentNode."); - ok(documentNode.get("__proto__").target.querySelector(".value") - .getAttribute("value").search(/object/) != -1, - "'__proto__' in documentNode should be an object."); - - // Now the main course: make sure that the native getters for WebIDL - // attributes have been called and a value has been returned. - is(buttonNode.get("type").target.querySelector(".name") - .getAttribute("value"), "type", - "Should have the right property name for 'type' in buttonProtoNode."); - is(buttonNode.get("type").target.querySelector(".value") - .getAttribute("value"), '"submit"', - "'type' in buttonProtoNode should have the right value."); - is(buttonNode.get("formMethod").target.querySelector(".name") - .getAttribute("value"), "formMethod", - "Should have the right property name for 'formMethod' in buttonProtoNode."); - is(buttonNode.get("formMethod").target.querySelector(".value") - .getAttribute("value"), '""', - "'formMethod' in buttonProtoNode should have the right value."); - - is(documentNode.get("domain").target.querySelector(".name") - .getAttribute("value"), "domain", - "Should have the right property name for 'domain' in documentProtoNode."); - is(documentNode.get("domain").target.querySelector(".value") - .getAttribute("value"), '"example.com"', - "'domain' in documentProtoNode should have the right value."); - is(documentNode.get("cookie").target.querySelector(".name") - .getAttribute("value"), "cookie", - "Should have the right property name for 'cookie' in documentProtoNode."); - is(documentNode.get("cookie").target.querySelector(".value") - .getAttribute("value"), '""', - "'cookie' in documentProtoNode should have the right value."); - - let buttonAsProtoProtoNode = buttonAsProtoNode.get("__proto__"); - - is(buttonAsProtoProtoNode.expanded, false, - "The buttonAsProtoProtoNode should not be expanded at this point."); - - // Expand the prototypes of 'button', 'buttonAsProto' and 'document' - // tree nodes. This causes their properties to be retrieved and - // displayed. - buttonAsProtoProtoNode.expand(); - - is(buttonAsProtoProtoNode.expanded, true, - "The buttonAsProtoProtoNode should be expanded at this point."); - - - // Poll every few milliseconds until the properties are retrieved. - // It's important to set the timer in the chrome window, because the - // content window timers are disabled while the debuggee is paused. - let count2 = 0; - let intervalID1 = window.setInterval(function(){ - info("count2: " + count2); - if (++count2 > 50) { - ok(false, "Timed out while polling for the properties."); - window.clearInterval(intervalID1); - return resumeAndFinish(); - } - if (!buttonAsProtoProtoNode._retrieved) { - return; - } - window.clearInterval(intervalID1); - - // Test this more involved case that reuses an object that is - // present in another cache line. - is(buttonAsProtoProtoNode.get("type").target.querySelector(".name") - .getAttribute("value"), "type", - "Should have the right property name for 'type' in buttonAsProtoProtoProtoNode."); - is(buttonAsProtoProtoNode.get("type").target.querySelector(".value") - .getAttribute("value"), '"submit"', - "'type' in buttonAsProtoProtoProtoNode should have the right value."); - is(buttonAsProtoProtoNode.get("formMethod").target.querySelector(".name") - .getAttribute("value"), "formMethod", - "Should have the right property name for 'formMethod' in buttonAsProtoProtoProtoNode."); - is(buttonAsProtoProtoNode.get("formMethod").target.querySelector(".value") - .getAttribute("value"), '""', - "'formMethod' in buttonAsProtoProtoProtoNode should have the right value."); - - resumeAndFinish(); - }, 100); - }, 100); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function resumeAndFinish() { - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - Services.tm.currentThread.dispatch({ run: function() { - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames."); - - closeDebuggerAndFinish(); - }}, 0); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-12.js b/browser/devtools/debugger/test/browser_dbg_propertyview-12.js deleted file mode 100644 index 192bcfcc9..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-12.js +++ /dev/null @@ -1,95 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This test checks that we properly set the frozen, sealed, and non-extensbile -// attributes on variables so that the F/S/N is shown in the variables view. - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testFSN(); - }); -} - -function testFSN() { - gDebugger.addEventListener("Debugger:FetchedVariables", function _onFetchedVariables() { - gDebugger.removeEventListener("Debugger:FetchedVariables", _onFetchedVariables, false); - runTest(); - }, false); - - gDebuggee.eval("(" + function () { - var frozen = Object.freeze({}); - var sealed = Object.seal({}); - var nonExtensible = Object.preventExtensions({}); - var extensible = {}; - var string = "foo bar baz"; - - debugger; - } + "())"); -} - -function runTest() { - let hasNoneTester = function (aVariable) { - ok(!aVariable.hasAttribute("frozen"), - "The variable should not be frozen"); - ok(!aVariable.hasAttribute("sealed"), - "The variable should not be sealed"); - ok(!aVariable.hasAttribute("non-extensible"), - "The variable should be extensible"); - }; - - let testers = { - frozen: function (aVariable) { - ok(aVariable.hasAttribute("frozen"), - "The variable should be frozen") - }, - sealed: function (aVariable) { - ok(aVariable.hasAttribute("sealed"), - "The variable should be sealed") - }, - nonExtensible: function (aVariable) { - ok(aVariable.hasAttribute("non-extensible"), - "The variable should be non-extensible") - }, - extensible: hasNoneTester, - string: hasNoneTester, - arguments: hasNoneTester, - this: hasNoneTester - }; - - let variables = gDebugger.DebuggerView.Variables._parent - .querySelectorAll(".variable-or-property"); - - for (let v of variables) { - let name = v.querySelector(".name").getAttribute("value"); - let tester = testers[name]; - delete testers[name]; - ok(tester, "We should have a tester for the '" + name + "' variable."); - tester(v); - } - - is(Object.keys(testers).length, 0, - "We should have run and removed all the testers."); - - closeDebuggerAndFinish(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js deleted file mode 100644 index 5a4ce4a62..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js +++ /dev/null @@ -1,147 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view remains responsive when faced with - * huge ammounts of data. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_big-data.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; - -requestLongerTimeout(10); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - gDebugger.DebuggerView.Variables.lazyAppend = true; - testWithFrame(); - }); -} - -function testWithFrame() -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test1() { - // We expect 2 Debugger:FetchedVariables events, one from the global object - // scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test1, false); - Services.tm.currentThread.dispatch({ run: function() { - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - loadScope = scopes.querySelectorAll(".variables-view-scope")[1], - globalScope = scopes.querySelectorAll(".variables-view-scope")[2], - innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes, - arrayNodes = innerNodes[4].querySelector(".variables-view-element-details").childNodes; - - is(innerNodes[3].querySelector(".name").getAttribute("value"), "buffer", - "Should have the right property name for |buffer|."); - - is(innerNodes[3].querySelector(".value").getAttribute("value"), "[object ArrayBuffer]", - "Should have the right property value for |buffer|."); - - is(innerNodes[4].querySelector(".name").getAttribute("value"), "z", - "Should have the right property name for |z|."); - - is(innerNodes[4].querySelector(".value").getAttribute("value"), "[object Int8Array]", - "Should have the right property value for |z|."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, innerNodes[3].querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, innerNodes[4].querySelector(".arrow"), gDebugger); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test2() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false); - Services.tm.currentThread.dispatch({ run: function() { - - let total = 10000; - let loaded = 0; - let paints = 0; - - waitForProperties(total, { - onLoading: function(count) { - ok(count >= loaded, "Should have loaded more properties."); - info("Displayed " + count + " properties, not finished yet."); - info("Remaining " + (total - count) + " properties to display."); - loaded = count; - paints++; - - loadScope.hidden = true; - globalScope.hidden = true; - scopes.parentNode.scrollTop = scopes.parentNode.scrollHeight; - }, - onFinished: function(count) { - ok(count == total, "Displayed all the properties."); - isnot(paints, 0, "Debugger was unresponsive, sad panda."); - - for (let i = 0; i < arrayNodes.length; i++) { - let node = arrayNodes[i]; - let name = node.querySelector(".name").getAttribute("value"); - // Don't make the test runner dump to the console for every test - // unless something goes wrong. - if (name !== i + "") { - ok(false, "The array items aren't in the correct order."); - } - } - - closeDebuggerAndFinish(); - } - }); - }}, 0); - }, false); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function waitForProperties(total, callbacks) -{ - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes, - arrayNodes = innerNodes[4].querySelector(".variables-view-element-details").childNodes; - - // Poll every few milliseconds until the properties are retrieved. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > total) { - ok(false, "Timed out while polling for the properties."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - // Still need to wait for a few more properties to be fetched. - if (arrayNodes.length < total) { - callbacks.onLoading(arrayNodes.length); - return; - } - // We got all the properties, it's safe to callback. - window.clearInterval(intervalID); - callbacks.onFinished(arrayNodes.length); - }, 100); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js deleted file mode 100644 index b50df0930..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js +++ /dev/null @@ -1,352 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view knows how to edit getters and setters. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gVars = null; -var gWatch = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gVars = gDebugger.DebuggerView.Variables; - gWatch = gDebugger.DebuggerView.WatchExpressions; - - gVars.switch = function() {}; - gVars.delete = function() {}; - - prepareVariablesView(); - }); -} - -function prepareVariablesView() { - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - testVariablesView(); - - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function testVariablesView() -{ - executeSoon(function() { - addWatchExpressions(function() { - testEdit("set", "this._prop = value + ' BEER CAN'", function() { - testEdit("set", "{ this._prop = value + ' BEACON' }", function() { - testEdit("set", "{ this._prop = value + ' BEACON;'; }", function() { - testEdit("set", "{ return this._prop = value + ' BEACON;;'; }", function() { - testEdit("set", "function(value) { this._prop = value + ' BACON' }", function() { - testEdit("get", "'brelx BEER CAN'", function() { - testEdit("get", "{ 'brelx BEACON' }", function() { - testEdit("get", "{ 'brelx BEACON;'; }", function() { - testEdit("get", "{ return 'brelx BEACON;;'; }", function() { - testEdit("get", "function() { return 'brelx BACON'; }", function() { - testEdit("get", "bogus", function() { - testEdit("set", "sugob", function() { - testEdit("get", "", function() { - testEdit("set", "", function() { - waitForWatchExpressions(function() { - testEdit("self", "2507", function() { - closeDebuggerAndFinish(); - }, { - "myVar.prop": 2507, - "myVar.prop + 42": "250742" - }); - }) - gWatch.deleteExpression({ name: "myVar.prop = 'xlerb'" }); - }, { - "myVar.prop": "xlerb", - "myVar.prop + 42": NaN, - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": undefined, - "myVar.prop + 42": NaN, - "myVar.prop = 'xlerb'": "ReferenceError: sugob is not defined" - }); - }, { - "myVar.prop": "ReferenceError: bogus is not defined", - "myVar.prop + 42": "ReferenceError: bogus is not defined", - "myVar.prop = 'xlerb'": "ReferenceError: sugob is not defined" - }); - }, { - "myVar.prop": "ReferenceError: bogus is not defined", - "myVar.prop + 42": "ReferenceError: bogus is not defined", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "brelx BACON", - "myVar.prop + 42": "brelx BACON42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "brelx BEACON;;", - "myVar.prop + 42": "brelx BEACON;;42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": undefined, - "myVar.prop + 42": NaN, - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": undefined, - "myVar.prop + 42": NaN, - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "brelx BEER CAN", - "myVar.prop + 42": "brelx BEER CAN42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "xlerb BACON", - "myVar.prop + 42": "xlerb BACON42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "xlerb BEACON;;", - "myVar.prop + 42": "xlerb BEACON;;42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "xlerb BEACON;", - "myVar.prop + 42": "xlerb BEACON;42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "xlerb BEACON", - "myVar.prop + 42": "xlerb BEACON42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }, { - "myVar.prop": "xlerb BEER CAN", - "myVar.prop + 42": "xlerb BEER CAN42", - "myVar.prop = 'xlerb'": "xlerb" - }); - }); - }); -} - -function addWatchExpressions(callback) -{ - waitForWatchExpressions(function() { - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 1, "There should be 1 evaluation availalble"); - - let w1 = scope.get("myVar.prop"); - let w2 = scope.get("myVar.prop + 42"); - let w3 = scope.get("myVar.prop = 'xlerb'"); - - ok(w1, "The first watch expression should be present in the scope"); - ok(!w2, "The second watch expression should not be present in the scope"); - ok(!w3, "The third watch expression should not be present in the scope"); - - is(w1.value, 42, "The first value is correct."); - - - waitForWatchExpressions(function() { - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 2, "There should be 2 evaluations availalble"); - - let w1 = scope.get("myVar.prop"); - let w2 = scope.get("myVar.prop + 42"); - let w3 = scope.get("myVar.prop = 'xlerb'"); - - ok(w1, "The first watch expression should be present in the scope"); - ok(w2, "The second watch expression should be present in the scope"); - ok(!w3, "The third watch expression should not be present in the scope"); - - is(w1.value, "42", "The first expression value is correct."); - is(w2.value, "84", "The second expression value is correct."); - - - waitForWatchExpressions(function() { - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 3, "There should be 3 evaluations availalble"); - - let w1 = scope.get("myVar.prop"); - let w2 = scope.get("myVar.prop + 42"); - let w3 = scope.get("myVar.prop = 'xlerb'"); - - ok(w1, "The first watch expression should be present in the scope"); - ok(w2, "The second watch expression should be present in the scope"); - ok(w3, "The third watch expression should be present in the scope"); - - is(w1.value, "xlerb", "The first expression value is correct."); - is(w2.value, "xlerb42", "The second expression value is correct."); - is(w3.value, "xlerb", "The third expression value is correct."); - - callback(); - }); - - gWatch.addExpression("myVar.prop = 'xlerb'"); - gDebugger.editor.focus(); - }); - - gWatch.addExpression("myVar.prop + 42"); - gDebugger.editor.focus(); - }); - - gWatch.addExpression("myVar.prop"); - gDebugger.editor.focus(); -} - -function testEdit(what, string, callback, expected) -{ - let localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1], - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - myVar = gVars.getItemForNode(localNodes[11]); - - waitForProperties(function() { - let prop = myVar.get("prop"); - let getterOrSetter = (what != "self" ? prop.get(what) : prop); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - getterOrSetter._target.querySelector(".title > .value"), - gDebugger); - - waitForElement(".element-value-input", true, function() { - waitForWatchExpressions(function() { - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - let w1 = scope.get(Object.keys(expected)[0]); - let w2 = scope.get(Object.keys(expected)[1]); - let w3 = scope.get(Object.keys(expected)[2]); - - if (w1) { - if (isNaN(expected[w1.name]) && typeof expected[w1.name] == "number") { - ok(isNaN(w1.value), - "The first expression value is correct after the edit (NaN)."); - } else if (expected[w1.name] === undefined) { - is(w1.value.type, "undefined", - "The first expression value is correct after the edit (undefined)."); - } else { - is(w1.value, expected[w1.name], - "The first expression value is correct after the edit."); - } - info(w1.value + " is equal to " + expected[w1.name]); - } - if (w2) { - if (isNaN(expected[w2.name]) && typeof expected[w2.name] == "number") { - ok(isNaN(w2.value), - "The second expression value is correct after the edit (NaN)."); - } else if (expected[w2.name] === undefined) { - is(w2.value.type, "undefined", - "The second expression value is correct after the edit (undefined)."); - } else { - is(w2.value, expected[w2.name], - "The second expression value is correct after the edit."); - } - info(w2.value + " is equal to " + expected[w2.name]); - } - if (w3) { - if (isNaN(expected[w3.name]) && typeof expected[w3.name] == "number") { - ok(isNaN(w3.value), - "The third expression value is correct after the edit (NaN)."); - } else if (expected[w3.name] === undefined) { - is(w3.value.type, "undefined", - "The third expression value is correct after the edit (undefined)."); - } else { - is(w3.value, expected[w3.name], - "The third expression value is correct after the edit."); - } - info(w3.value + " is equal to " + expected[w3.name]); - } - - callback(); - }); - - info("Changing the " + what + "ter with '" + string + "'."); - - write(string); - EventUtils.sendKey("RETURN", gDebugger); - }); - }); - - myVar.expand(); - gVars.clearHierarchy(); -} - -function waitForWatchExpressions(callback) { - gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function onFetch() { - gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", onFetch, false); - executeSoon(callback); - }, false); -} - -function waitForProperties(callback) { - gDebugger.addEventListener("Debugger:FetchedProperties", function onFetch() { - gDebugger.removeEventListener("Debugger:FetchedProperties", onFetch, false); - executeSoon(callback); - }, false); -} - -function waitForElement(selector, exists, callback) -{ - // Poll every few milliseconds until the element are retrieved. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the element."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (!!gVars._list.querySelector(selector) != exists) { - return; - } - // We got the element, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); -} - -function write(text) { - if (!text) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - return; - } - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gVars = null; - gWatch = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js deleted file mode 100644 index 81b0d3b75..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js +++ /dev/null @@ -1,185 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view is able to override getter properties - * to plain value properties. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gVars = null; -var gWatch = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gVars = gDebugger.DebuggerView.Variables; - gWatch = gDebugger.DebuggerView.WatchExpressions; - - gVars.switch = function() {}; - gVars.delete = function() {}; - - prepareVariablesView(); - }); -} - -function prepareVariablesView() { - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - testVariablesView(); - - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function testVariablesView() -{ - executeSoon(function() { - addWatchExpressions(function() { - testEdit("\"xlerb\"", "xlerb", function() { - closeDebuggerAndFinish(); - }); - }); - }); -} - -function addWatchExpressions(callback) -{ - waitForWatchExpressions(function() { - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 1, "There should be 1 evaluation availalble"); - - let expr = scope.get("myVar.prop"); - ok(expr, "The watch expression should be present in the scope"); - is(expr.value, 42, "The value is correct."); - - callback(); - }); - - gWatch.addExpression("myVar.prop"); - gDebugger.editor.focus(); -} - -function testEdit(string, expected, callback) -{ - let localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1], - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - myVar = gVars.getItemForNode(localNodes[11]); - - waitForProperties(function() { - let prop = myVar.get("prop"); - - is(prop.ownerView.name, "myVar", - "The right owner property name wasn't found."); - is(prop.name, "prop", - "The right property name wasn't found."); - - is(prop.ownerView.value.type, "object", - "The right owner property value type wasn't found."); - is(prop.ownerView.value.class, "Object", - "The right owner property value class wasn't found."); - - is(prop.name, "prop", - "The right property name wasn't found."); - is(prop.value, undefined, - "The right property value wasn't found."); - ok(prop.getter, - "The right property getter wasn't found."); - ok(prop.setter, - "The right property setter wasn't found."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - prop._target.querySelector(".variables-view-edit"), - gDebugger); - - waitForElement(".element-value-input", true, function() { - waitForWatchExpressions(function() { - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - let expr = scope.get("myVar.prop"); - is(expr.value, expected, "The value is correct."); - - callback(); - }); - - write(string); - EventUtils.sendKey("RETURN", gDebugger); - }); - }); - - myVar.expand(); - gVars.clearHierarchy(); -} - -function waitForWatchExpressions(callback) { - gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function onFetch() { - gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", onFetch, false); - executeSoon(callback); - }, false); -} - -function waitForProperties(callback) { - gDebugger.addEventListener("Debugger:FetchedProperties", function onFetch() { - gDebugger.removeEventListener("Debugger:FetchedProperties", onFetch, false); - executeSoon(callback); - }, false); -} - -function waitForElement(selector, exists, callback) -{ - // Poll every few milliseconds until the element are retrieved. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the element."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (!!gVars._list.querySelector(selector) != exists) { - return; - } - // We got the element, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); -} - -function write(text) { - if (!text) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - return; - } - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gVars = null; - gWatch = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data.js deleted file mode 100644 index 6cf2c0560..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-data.js +++ /dev/null @@ -1,888 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly populates itself. - */ - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gVariablesView = null; -var gScope = null; -var gVariable = null; - -function test() -{ - debug_tab_pane(TAB1_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gVariablesView = gDebugger.DebuggerView.Variables; - - gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false }); - testVariablesView(); - }); -} - -function testVariablesView() -{ - let arr = [ - 42, - true, - "nasu", - undefined, - null, - [0, 1, 2], - { prop1: 9, prop2: 8 } - ]; - - let obj = { - "p0": 42, - "p1": true, - "p2": "nasu", - "p3": undefined, - "p4": null, - "p5": [3, 4, 5], - "p6": { prop1: 7, prop2: 6 }, - get p7() { return arr; }, - set p8(value) { arr[0] = value } - }; - - let test = { - someProp0: 42, - someProp1: true, - someProp2: "nasu", - someProp3: undefined, - someProp4: null, - someProp5: arr, - someProp6: obj, - get someProp7() { return arr; }, - set someProp7(value) { arr[0] = value } - }; - - gVariablesView.eval = function() {}; - gVariablesView.switch = function() {}; - gVariablesView.delete = function() {}; - gVariablesView.rawObject = test; - - testHierarchy(); - testHeader(); - testFirstLevelContents(); - testSecondLevelContents(); - testThirdLevelContents(); - testIntegrity(arr, obj); - - let fooScope = gVariablesView.addScope("foo"); - let anonymousVar = fooScope.addItem(); - - let anonymousScope = gVariablesView.addScope(); - let barVar = anonymousScope.addItem("bar"); - let bazProperty = barVar.addItem("baz"); - - testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty); - testPropertyInheritance(fooScope, anonymousVar, anonymousScope, barVar, bazProperty); - - executeSoon(function() { - testKeyboardAccessibility(function() { - testClearHierarchy(); - - closeDebuggerAndFinish(); - }); - }); -} - -function testHierarchy() { - is(gVariablesView._currHierarchy.size, 13, - "There should be 1 scope, 1 var, 1 proto, 8 props, 1 getter and 1 setter."); - - gScope = gVariablesView._currHierarchy.get(""); - gVariable = gVariablesView._currHierarchy.get("[\"\"]"); - - is(gVariablesView._store.length, 1, - "There should be only one scope in the view"); - is(gScope._store.size, 1, - "There should be only one variable in the scope"); - is(gVariable._store.size, 9, - "There should be 1 __proto__ and 8 properties in the variable"); -} - -function testHeader() { - is(gScope.header, false, - "The scope title header should be hidden"); - is(gVariable.header, false, - "The variable title header should be hidden"); - - gScope.showHeader(); - gVariable.showHeader(); - - is(gScope.header, false, - "The scope title header should still not be visible"); - is(gVariable.header, false, - "The variable title header should still not be visible"); - - gScope.hideHeader(); - gVariable.hideHeader(); - - is(gScope.header, false, - "The scope title header should now still be hidden"); - is(gVariable.header, false, - "The variable title header should now still be hidden"); -} - -function testFirstLevelContents() { - let someProp0 = gVariable.get("someProp0"); - let someProp1 = gVariable.get("someProp1"); - let someProp2 = gVariable.get("someProp2"); - let someProp3 = gVariable.get("someProp3"); - let someProp4 = gVariable.get("someProp4"); - let someProp5 = gVariable.get("someProp5"); - let someProp6 = gVariable.get("someProp6"); - let someProp7 = gVariable.get("someProp7"); - let __proto__ = gVariable.get("__proto__"); - - is(someProp0.visible, true, "The first property visible state is correct."); - is(someProp1.visible, true, "The second property visible state is correct."); - is(someProp2.visible, true, "The third property visible state is correct."); - is(someProp3.visible, true, "The fourth property visible state is correct."); - is(someProp4.visible, true, "The fifth property visible state is correct."); - is(someProp5.visible, true, "The sixth property visible state is correct."); - is(someProp6.visible, true, "The seventh property visible state is correct."); - is(someProp7.visible, true, "The eight property visible state is correct."); - is(__proto__.visible, true, "The __proto__ property visible state is correct."); - - is(someProp0.expanded, false, "The first property expanded state is correct."); - is(someProp1.expanded, false, "The second property expanded state is correct."); - is(someProp2.expanded, false, "The third property expanded state is correct."); - is(someProp3.expanded, false, "The fourth property expanded state is correct."); - is(someProp4.expanded, false, "The fifth property expanded state is correct."); - is(someProp5.expanded, false, "The sixth property expanded state is correct."); - is(someProp6.expanded, false, "The seventh property expanded state is correct."); - is(someProp7.expanded, true, "The eight property expanded state is correct."); - is(__proto__.expanded, false, "The __proto__ property expanded state is correct."); - - is(someProp0.header, true, "The first property header state is correct."); - is(someProp1.header, true, "The second property header state is correct."); - is(someProp2.header, true, "The third property header state is correct."); - is(someProp3.header, true, "The fourth property header state is correct."); - is(someProp4.header, true, "The fifth property header state is correct."); - is(someProp5.header, true, "The sixth property header state is correct."); - is(someProp6.header, true, "The seventh property header state is correct."); - is(someProp7.header, true, "The eight property header state is correct."); - is(__proto__.header, true, "The __proto__ property header state is correct."); - - is(someProp0.twisty, false, "The first property twisty state is correct."); - is(someProp1.twisty, false, "The second property twisty state is correct."); - is(someProp2.twisty, false, "The third property twisty state is correct."); - is(someProp3.twisty, false, "The fourth property twisty state is correct."); - is(someProp4.twisty, false, "The fifth property twisty state is correct."); - is(someProp5.twisty, true, "The sixth property twisty state is correct."); - is(someProp6.twisty, true, "The seventh property twisty state is correct."); - is(someProp7.twisty, true, "The eight property twisty state is correct."); - is(__proto__.twisty, true, "The __proto__ property twisty state is correct."); - - is(someProp0.name, "someProp0", "The first property name is correct."); - is(someProp1.name, "someProp1", "The second property name is correct."); - is(someProp2.name, "someProp2", "The third property name is correct."); - is(someProp3.name, "someProp3", "The fourth property name is correct."); - is(someProp4.name, "someProp4", "The fifth property name is correct."); - is(someProp5.name, "someProp5", "The sixth property name is correct."); - is(someProp6.name, "someProp6", "The seventh property name is correct."); - is(someProp7.name, "someProp7", "The eight property name is correct."); - is(__proto__.name, "__proto__", "The __proto__ property name is correct."); - - is(someProp0.value, 42, "The first property value is correct."); - is(someProp1.value, true, "The second property value is correct."); - is(someProp2.value, "nasu", "The third property value is correct."); - is(someProp3.value.type, "undefined", "The fourth property value is correct."); - is(someProp4.value.type, "null", "The fifth property value is correct."); - is(someProp5.value.type, "object", "The sixth property value type is correct."); - is(someProp5.value.class, "Array", "The sixth property value class is correct."); - is(someProp6.value.type, "object", "The seventh property value type is correct."); - is(someProp6.value.class, "Object", "The seventh property value class is correct."); - is(someProp7.value, null, "The eight property value is correct."); - isnot(someProp7.getter, null, "The eight property getter is correct."); - isnot(someProp7.setter, null, "The eight property setter is correct."); - is(someProp7.getter.type, "object", "The eight property getter type is correct."); - is(someProp7.getter.class, "Function", "The eight property getter class is correct."); - is(someProp7.setter.type, "object", "The eight property setter type is correct."); - is(someProp7.setter.class, "Function", "The eight property setter class is correct."); - is(__proto__.value.type, "object", "The __proto__ property value type is correct."); - is(__proto__.value.class, "Object", "The __proto__ property value class is correct."); - - - someProp0.expand(); - someProp1.expand(); - someProp2.expand(); - someProp3.expand(); - someProp4.expand(); - someProp7.expand(); - - ok(!someProp0.get("__proto__"), "Number primitives should not have a prototype"); - ok(!someProp1.get("__proto__"), "Boolean primitives should not have a prototype"); - ok(!someProp2.get("__proto__"), "String literals should not have a prototype"); - ok(!someProp3.get("__proto__"), "Undefined values should not have a prototype"); - ok(!someProp4.get("__proto__"), "Null values should not have a prototype"); - ok(!someProp7.get("__proto__"), "Getter properties should not have a prototype"); -} - -function testSecondLevelContents() { - let someProp5 = gVariable.get("someProp5"); - - is(someProp5._store.size, 0, "No properties should be in someProp5 before expanding"); - someProp5.expand(); - is(someProp5._store.size, 9, "Some properties should be in someProp5 before expanding"); - - let arrayItem0 = someProp5.get("0"); - let arrayItem1 = someProp5.get("1"); - let arrayItem2 = someProp5.get("2"); - let arrayItem3 = someProp5.get("3"); - let arrayItem4 = someProp5.get("4"); - let arrayItem5 = someProp5.get("5"); - let arrayItem6 = someProp5.get("6"); - let __proto__ = someProp5.get("__proto__"); - - is(arrayItem0.visible, true, "The first array item visible state is correct."); - is(arrayItem1.visible, true, "The second array item visible state is correct."); - is(arrayItem2.visible, true, "The third array item visible state is correct."); - is(arrayItem3.visible, true, "The fourth array item visible state is correct."); - is(arrayItem4.visible, true, "The fifth array item visible state is correct."); - is(arrayItem5.visible, true, "The sixth array item visible state is correct."); - is(arrayItem6.visible, true, "The seventh array item visible state is correct."); - is(__proto__.visible, true, "The __proto__ property visible state is correct."); - - is(arrayItem0.expanded, false, "The first array item expanded state is correct."); - is(arrayItem1.expanded, false, "The second array item expanded state is correct."); - is(arrayItem2.expanded, false, "The third array item expanded state is correct."); - is(arrayItem3.expanded, false, "The fourth array item expanded state is correct."); - is(arrayItem4.expanded, false, "The fifth array item expanded state is correct."); - is(arrayItem5.expanded, false, "The sixth array item expanded state is correct."); - is(arrayItem6.expanded, false, "The seventh array item expanded state is correct."); - is(__proto__.expanded, false, "The __proto__ property expanded state is correct."); - - is(arrayItem0.header, true, "The first array item header state is correct."); - is(arrayItem1.header, true, "The second array item header state is correct."); - is(arrayItem2.header, true, "The third array item header state is correct."); - is(arrayItem3.header, true, "The fourth array item header state is correct."); - is(arrayItem4.header, true, "The fifth array item header state is correct."); - is(arrayItem5.header, true, "The sixth array item header state is correct."); - is(arrayItem6.header, true, "The seventh array item header state is correct."); - is(__proto__.header, true, "The __proto__ property header state is correct."); - - is(arrayItem0.twisty, false, "The first array item twisty state is correct."); - is(arrayItem1.twisty, false, "The second array item twisty state is correct."); - is(arrayItem2.twisty, false, "The third array item twisty state is correct."); - is(arrayItem3.twisty, false, "The fourth array item twisty state is correct."); - is(arrayItem4.twisty, false, "The fifth array item twisty state is correct."); - is(arrayItem5.twisty, true, "The sixth array item twisty state is correct."); - is(arrayItem6.twisty, true, "The seventh array item twisty state is correct."); - is(__proto__.twisty, true, "The __proto__ property twisty state is correct."); - - is(arrayItem0.name, "0", "The first array item name is correct."); - is(arrayItem1.name, "1", "The second array item name is correct."); - is(arrayItem2.name, "2", "The third array item name is correct."); - is(arrayItem3.name, "3", "The fourth array item name is correct."); - is(arrayItem4.name, "4", "The fifth array item name is correct."); - is(arrayItem5.name, "5", "The sixth array item name is correct."); - is(arrayItem6.name, "6", "The seventh array item name is correct."); - is(__proto__.name, "__proto__", "The __proto__ property name is correct."); - - is(arrayItem0.value, 42, "The first array item value is correct."); - is(arrayItem1.value, true, "The second array item value is correct."); - is(arrayItem2.value, "nasu", "The third array item value is correct."); - is(arrayItem3.value.type, "undefined", "The fourth array item value is correct."); - is(arrayItem4.value.type, "null", "The fifth array item value is correct."); - is(arrayItem5.value.type, "object", "The sixth array item value type is correct."); - is(arrayItem5.value.class, "Array", "The sixth array item value class is correct."); - is(arrayItem6.value.type, "object", "The seventh array item value type is correct."); - is(arrayItem6.value.class, "Object", "The seventh array item value class is correct."); - is(__proto__.value.type, "object", "The __proto__ property value type is correct."); - is(__proto__.value.class, "Array", "The __proto__ property value class is correct."); - - - let someProp6 = gVariable.get("someProp6"); - - is(someProp6._store.size, 0, "No properties should be in someProp6 before expanding"); - someProp6.expand(); - is(someProp6._store.size, 10, "Some properties should be in someProp6 before expanding"); - - let objectItem0 = someProp6.get("p0"); - let objectItem1 = someProp6.get("p1"); - let objectItem2 = someProp6.get("p2"); - let objectItem3 = someProp6.get("p3"); - let objectItem4 = someProp6.get("p4"); - let objectItem5 = someProp6.get("p5"); - let objectItem6 = someProp6.get("p6"); - let objectItem7 = someProp6.get("p7"); - let objectItem8 = someProp6.get("p8"); - let __proto__ = someProp6.get("__proto__"); - - is(objectItem0.visible, true, "The first object item visible state is correct."); - is(objectItem1.visible, true, "The second object item visible state is correct."); - is(objectItem2.visible, true, "The third object item visible state is correct."); - is(objectItem3.visible, true, "The fourth object item visible state is correct."); - is(objectItem4.visible, true, "The fifth object item visible state is correct."); - is(objectItem5.visible, true, "The sixth object item visible state is correct."); - is(objectItem6.visible, true, "The seventh object item visible state is correct."); - is(objectItem7.visible, true, "The eight object item visible state is correct."); - is(objectItem8.visible, true, "The ninth object item visible state is correct."); - is(__proto__.visible, true, "The __proto__ property visible state is correct."); - - is(objectItem0.expanded, false, "The first object item expanded state is correct."); - is(objectItem1.expanded, false, "The second object item expanded state is correct."); - is(objectItem2.expanded, false, "The third object item expanded state is correct."); - is(objectItem3.expanded, false, "The fourth object item expanded state is correct."); - is(objectItem4.expanded, false, "The fifth object item expanded state is correct."); - is(objectItem5.expanded, false, "The sixth object item expanded state is correct."); - is(objectItem6.expanded, false, "The seventh object item expanded state is correct."); - is(objectItem7.expanded, true, "The eight object item expanded state is correct."); - is(objectItem8.expanded, true, "The ninth object item expanded state is correct."); - is(__proto__.expanded, false, "The __proto__ property expanded state is correct."); - - is(objectItem0.header, true, "The first object item header state is correct."); - is(objectItem1.header, true, "The second object item header state is correct."); - is(objectItem2.header, true, "The third object item header state is correct."); - is(objectItem3.header, true, "The fourth object item header state is correct."); - is(objectItem4.header, true, "The fifth object item header state is correct."); - is(objectItem5.header, true, "The sixth object item header state is correct."); - is(objectItem6.header, true, "The seventh object item header state is correct."); - is(objectItem7.header, true, "The eight object item header state is correct."); - is(objectItem8.header, true, "The ninth object item header state is correct."); - is(__proto__.header, true, "The __proto__ property header state is correct."); - - is(objectItem0.twisty, false, "The first object item twisty state is correct."); - is(objectItem1.twisty, false, "The second object item twisty state is correct."); - is(objectItem2.twisty, false, "The third object item twisty state is correct."); - is(objectItem3.twisty, false, "The fourth object item twisty state is correct."); - is(objectItem4.twisty, false, "The fifth object item twisty state is correct."); - is(objectItem5.twisty, true, "The sixth object item twisty state is correct."); - is(objectItem6.twisty, true, "The seventh object item twisty state is correct."); - is(objectItem7.twisty, true, "The eight object item twisty state is correct."); - is(objectItem8.twisty, true, "The ninth object item twisty state is correct."); - is(__proto__.twisty, true, "The __proto__ property twisty state is correct."); - - is(objectItem0.name, "p0", "The first object item name is correct."); - is(objectItem1.name, "p1", "The second object item name is correct."); - is(objectItem2.name, "p2", "The third object item name is correct."); - is(objectItem3.name, "p3", "The fourth object item name is correct."); - is(objectItem4.name, "p4", "The fifth object item name is correct."); - is(objectItem5.name, "p5", "The sixth object item name is correct."); - is(objectItem6.name, "p6", "The seventh object item name is correct."); - is(objectItem7.name, "p7", "The eight seventh object item name is correct."); - is(objectItem8.name, "p8", "The ninth seventh object item name is correct."); - is(__proto__.name, "__proto__", "The __proto__ property name is correct."); - - is(objectItem0.value, 42, "The first object item value is correct."); - is(objectItem1.value, true, "The second object item value is correct."); - is(objectItem2.value, "nasu", "The third object item value is correct."); - is(objectItem3.value.type, "undefined", "The fourth object item value is correct."); - is(objectItem4.value.type, "null", "The fifth object item value is correct."); - is(objectItem5.value.type, "object", "The sixth object item value type is correct."); - is(objectItem5.value.class, "Array", "The sixth object item value class is correct."); - is(objectItem6.value.type, "object", "The seventh object item value type is correct."); - is(objectItem6.value.class, "Object", "The seventh object item value class is correct."); - is(objectItem7.value, null, "The eight object item value is correct."); - isnot(objectItem7.getter, null, "The eight object item getter is correct."); - isnot(objectItem7.setter, null, "The eight object item setter is correct."); - is(objectItem7.setter.type, "undefined", "The eight object item setter type is correct."); - is(objectItem7.getter.type, "object", "The eight object item getter type is correct."); - is(objectItem7.getter.class, "Function", "The eight object item getter class is correct."); - is(objectItem8.value, null, "The ninth object item value is correct."); - isnot(objectItem8.getter, null, "The ninth object item getter is correct."); - isnot(objectItem8.setter, null, "The ninth object item setter is correct."); - is(objectItem8.getter.type, "undefined", "The eight object item getter type is correct."); - is(objectItem8.setter.type, "object", "The ninth object item setter type is correct."); - is(objectItem8.setter.class, "Function", "The ninth object item setter class is correct."); - is(__proto__.value.type, "object", "The __proto__ property value type is correct."); - is(__proto__.value.class, "Object", "The __proto__ property value class is correct."); -} - -function testThirdLevelContents() { - (function() { - let someProp5 = gVariable.get("someProp5"); - let arrayItem5 = someProp5.get("5"); - let arrayItem6 = someProp5.get("6"); - - is(arrayItem5._store.size, 0, "No properties should be in arrayItem5 before expanding"); - arrayItem5.expand(); - is(arrayItem5._store.size, 5, "Some properties should be in arrayItem5 before expanding"); - - is(arrayItem6._store.size, 0, "No properties should be in arrayItem6 before expanding"); - arrayItem6.expand(); - is(arrayItem6._store.size, 3, "Some properties should be in arrayItem6 before expanding"); - - let arraySubItem0 = arrayItem5.get("0"); - let arraySubItem1 = arrayItem5.get("1"); - let arraySubItem2 = arrayItem5.get("2"); - let objectSubItem0 = arrayItem6.get("prop1"); - let objectSubItem1 = arrayItem6.get("prop2"); - - is(arraySubItem0.value, 0, "The first array sub-item value is correct."); - is(arraySubItem1.value, 1, "The second array sub-item value is correct."); - is(arraySubItem2.value, 2, "The third array sub-item value is correct."); - - is(objectSubItem0.value, 9, "The first object sub-item value is correct."); - is(objectSubItem1.value, 8, "The second object sub-item value is correct."); - - let array__proto__ = arrayItem5.get("__proto__"); - let object__proto__ = arrayItem6.get("__proto__"); - - ok(array__proto__, "The array should have a __proto__ property"); - ok(object__proto__, "The object should have a __proto__ property"); - })(); - - (function() { - let someProp6 = gVariable.get("someProp6"); - let objectItem5 = someProp6.get("p5"); - let objectItem6 = someProp6.get("p6"); - - is(objectItem5._store.size, 0, "No properties should be in objectItem5 before expanding"); - objectItem5.expand(); - is(objectItem5._store.size, 5, "Some properties should be in objectItem5 before expanding"); - - is(objectItem6._store.size, 0, "No properties should be in objectItem6 before expanding"); - objectItem6.expand(); - is(objectItem6._store.size, 3, "Some properties should be in objectItem6 before expanding"); - - let arraySubItem0 = objectItem5.get("0"); - let arraySubItem1 = objectItem5.get("1"); - let arraySubItem2 = objectItem5.get("2"); - let objectSubItem0 = objectItem6.get("prop1"); - let objectSubItem1 = objectItem6.get("prop2"); - - is(arraySubItem0.value, 3, "The first array sub-item value is correct."); - is(arraySubItem1.value, 4, "The second array sub-item value is correct."); - is(arraySubItem2.value, 5, "The third array sub-item value is correct."); - - is(objectSubItem0.value, 7, "The first object sub-item value is correct."); - is(objectSubItem1.value, 6, "The second object sub-item value is correct."); - - let array__proto__ = objectItem5.get("__proto__"); - let object__proto__ = objectItem6.get("__proto__"); - - ok(array__proto__, "The array should have a __proto__ property"); - ok(object__proto__, "The object should have a __proto__ property"); - })(); -} - -function testIntegrity(arr, obj) { - is(arr[0], 42, "The first array item should not have changed"); - is(arr[1], true, "The second array item should not have changed"); - is(arr[2], "nasu", "The third array item should not have changed"); - is(arr[3], undefined, "The fourth array item should not have changed"); - is(arr[4], null, "The fifth array item should not have changed"); - ok(arr[5] instanceof Array, "The sixth array item should be an Array"); - is(arr[5][0], 0, "The sixth array item should not have changed"); - is(arr[5][1], 1, "The sixth array item should not have changed"); - is(arr[5][2], 2, "The sixth array item should not have changed"); - ok(arr[6] instanceof Object, "The seventh array item should be an Object"); - is(arr[6].prop1, 9, "The seventh array item should not have changed"); - is(arr[6].prop2, 8, "The seventh array item should not have changed"); - - is(obj.p0, 42, "The first object property should not have changed"); - is(obj.p1, true, "The first object property should not have changed"); - is(obj.p2, "nasu", "The first object property should not have changed"); - is(obj.p3, undefined, "The first object property should not have changed"); - is(obj.p4, null, "The first object property should not have changed"); - ok(obj.p5 instanceof Array, "The sixth object property should be an Array"); - is(obj.p5[0], 3, "The sixth object property should not have changed"); - is(obj.p5[1], 4, "The sixth object property should not have changed"); - is(obj.p5[2], 5, "The sixth object property should not have changed"); - ok(obj.p6 instanceof Object, "The seventh object property should be an Object"); - is(obj.p6.prop1, 7, "The seventh object property should not have changed"); - is(obj.p6.prop2, 6, "The seventh object property should not have changed"); -} - -function testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) { - is(fooScope.header, true, - "A named scope should have a header visible."); - is(fooScope.target.hasAttribute("non-header"), false, - "The non-header attribute should not be applied to scopes with headers."); - - is(anonymousScope.header, false, - "An anonymous scope should have a header visible."); - is(anonymousScope.target.hasAttribute("non-header"), true, - "The non-header attribute should not be applied to scopes without headers."); - - is(barVar.header, true, - "A named variable should have a header visible."); - is(barVar.target.hasAttribute("non-header"), false, - "The non-header attribute should not be applied to variables with headers."); - - is(anonymousVar.header, false, - "An anonymous variable should have a header visible."); - is(anonymousVar.target.hasAttribute("non-header"), true, - "The non-header attribute should not be applied to variables without headers."); -} - -function testPropertyInheritance(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) { - is(fooScope.editableValueTooltip, gVariablesView.editableValueTooltip, - "The editableValueTooltip property should persist from the view to all scopes."); - is(fooScope.editableNameTooltip, gVariablesView.editableNameTooltip, - "The editableNameTooltip property should persist from the view to all scopes."); - is(fooScope.deleteButtonTooltip, gVariablesView.deleteButtonTooltip, - "The deleteButtonTooltip property should persist from the view to all scopes."); - is(fooScope.descriptorTooltip, gVariablesView.descriptorTooltip, - "The descriptorTooltip property should persist from the view to all scopes."); - is(fooScope.contextMenuId, gVariablesView.contextMenuId, - "The contextMenuId property should persist from the view to all scopes."); - is(fooScope.separatorStr, gVariablesView.separatorStr, - "The separatorStr property should persist from the view to all scopes."); - is(fooScope.eval, gVariablesView.eval, - "The eval property should persist from the view to all scopes."); - is(fooScope.switch, gVariablesView.switch, - "The switch property should persist from the view to all scopes."); - is(fooScope.delete, gVariablesView.delete, - "The delete property should persist from the view to all scopes."); - isnot(fooScope.eval, fooScope.switch, - "The eval and switch functions got mixed up in the scope."); - isnot(fooScope.switch, fooScope.delete, - "The eval and switch functions got mixed up in the scope."); - - is(barVar.editableValueTooltip, gVariablesView.editableValueTooltip, - "The editableValueTooltip property should persist from the view to all variables."); - is(barVar.editableNameTooltip, gVariablesView.editableNameTooltip, - "The editableNameTooltip property should persist from the view to all variables."); - is(barVar.deleteButtonTooltip, gVariablesView.deleteButtonTooltip, - "The deleteButtonTooltip property should persist from the view to all variables."); - is(barVar.descriptorTooltip, gVariablesView.descriptorTooltip, - "The descriptorTooltip property should persist from the view to all variables."); - is(barVar.contextMenuId, gVariablesView.contextMenuId, - "The contextMenuId property should persist from the view to all variables."); - is(barVar.separatorStr, gVariablesView.separatorStr, - "The separatorStr property should persist from the view to all variables."); - is(barVar.eval, gVariablesView.eval, - "The eval property should persist from the view to all variables."); - is(barVar.switch, gVariablesView.switch, - "The switch property should persist from the view to all variables."); - is(barVar.delete, gVariablesView.delete, - "The delete property should persist from the view to all variables."); - isnot(barVar.eval, barVar.switch, - "The eval and switch functions got mixed up in the variable."); - isnot(barVar.switch, barVar.delete, - "The eval and switch functions got mixed up in the variable."); - - is(bazProperty.editableValueTooltip, gVariablesView.editableValueTooltip, - "The editableValueTooltip property should persist from the view to all properties."); - is(bazProperty.editableNameTooltip, gVariablesView.editableNameTooltip, - "The editableNameTooltip property should persist from the view to all properties."); - is(bazProperty.deleteButtonTooltip, gVariablesView.deleteButtonTooltip, - "The deleteButtonTooltip property should persist from the view to all properties."); - is(bazProperty.descriptorTooltip, gVariablesView.descriptorTooltip, - "The descriptorTooltip property should persist from the view to all properties."); - is(bazProperty.contextMenuId, gVariablesView.contextMenuId, - "The contextMenuId property should persist from the view to all properties."); - is(bazProperty.separatorStr, gVariablesView.separatorStr, - "The separatorStr property should persist from the view to all properties."); - is(bazProperty.eval, gVariablesView.eval, - "The eval property should persist from the view to all properties."); - is(bazProperty.switch, gVariablesView.switch, - "The switch property should persist from the view to all properties."); - is(bazProperty.delete, gVariablesView.delete, - "The delete property should persist from the view to all properties."); - isnot(bazProperty.eval, bazProperty.switch, - "The eval and switch functions got mixed up in the property."); - isnot(bazProperty.switch, bazProperty.delete, - "The eval and switch functions got mixed up in the property."); -} - -function testKeyboardAccessibility(callback) { - gDebugger.DebuggerView.Filtering._doVariablesFocus(); - gDebugger.DebuggerView.Variables.pageSize = 5; - - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should be focused."); - - gVariablesView.focusNextItem(); - is(gVariablesView.getFocusedItem().name, "someProp1", - "The someProp1 item should be focused."); - - gVariablesView.focusPrevItem(); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should be focused again."); - - - ok(!gVariablesView._list.querySelector(".element-value-input"), - "There shouldn't be a value input element created."); - - EventUtils.synthesizeKey("VK_ENTER", {}, gDebugger); - waitForElement(".element-value-input", true, function() { - - ok(gVariablesView._list.querySelector(".element-value-input"), - "There should be a value input element created."); - - EventUtils.sendKey("ESCAPE", gDebugger); - waitForElement(".element-value-input", false, function() { - - ok(!gVariablesView._list.querySelector(".element-value-input"), - "There shouldn't be a value input element anymore."); - - ok(!gVariablesView._list.querySelector(".element-name-input"), - "There shouldn't be a name input element created."); - - EventUtils.synthesizeKey("VK_ENTER", { shiftKey: true }, gDebugger); - waitForElement(".element-name-input", true, function() { - - ok(gVariablesView._list.querySelector(".element-name-input"), - "There should be a name input element created."); - - EventUtils.sendKey("ESCAPE", gDebugger); - waitForElement(".element-name-input", false, function() { - - ok(!gVariablesView._list.querySelector(".element-name-input"), - "There shouldn't be a name input element anymore."); - - - EventUtils.sendKey("DOWN", gDebugger); - executeSoon(function() { - is(gVariablesView._parent.scrollTop, 0, - "The variables view shouldn't scroll when pressing the DOWN key."); - - EventUtils.sendKey("UP", gDebugger); - executeSoon(function() { - is(gVariablesView._parent.scrollTop, 0, - "The variables view shouldn't scroll when pressing the UP key."); - - EventUtils.sendKey("PAGE_DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp5", - "The someProp5 item should be focused now."); - - EventUtils.sendKey("DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "0", - "The 0 item should be focused now."); - - EventUtils.sendKey("END", gDebugger); - is(gVariablesView.getFocusedItem().name, "bar", - "The bar item should be focused now."); - - EventUtils.sendKey("DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "bar", - "The bar item should still be focused now."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo item should be focused now."); - - EventUtils.sendKey("RIGHT", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo item should still be focused now."); - - EventUtils.sendKey("PAGE_DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "bar", - "The bar item should be focused now."); - - EventUtils.sendKey("PAGE_UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp7", - "The someProp7 item should be focused now."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "__proto__", - "The __proto__ item should be focused now."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "set", - "The set item should be focused now."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "get", - "The get item should be focused now."); - - EventUtils.sendKey("HOME", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should be focused now."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should still be focused now."); - - EventUtils.sendKey("LEFT", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should still be focused now."); - - EventUtils.sendKey("PAGE_UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should still be focused now."); - - for (let i = 0; i < 16; i++) { - // Advance to the first collapsed __proto__ property. - EventUtils.sendKey("DOWN", gDebugger); - } - is(gVariablesView.getFocusedItem().name, "__proto__", - "The __proto__ item should be focused now."); - is(gVariablesView.getFocusedItem().expanded, false, - "The __proto__ item shouldn't be expanded yet."); - - EventUtils.sendKey("RIGHT", gDebugger); - is(gVariablesView.getFocusedItem().name, "__proto__", - "The __proto__ item should still be focused."); - is(gVariablesView.getFocusedItem().expanded, true, - "The __proto__ item should be expanded now."); - - for (let i = 0; i < 3; i++) { - // Advance to the fifth top-level someProp5 property. - EventUtils.sendKey("LEFT", gDebugger); - } - is(gVariablesView.getFocusedItem().name, "5", - "The fifth array item should be focused."); - is(gVariablesView.getFocusedItem().expanded, false, - "The fifth array item should not be expanded now."); - - for (let i = 0; i < 6; i++) { - // Advance to the fifth top-level someProp5 property. - EventUtils.sendKey("UP", gDebugger); - } - is(gVariablesView.getFocusedItem().name, "someProp5", - "The someProp5 item should be focused now."); - is(gVariablesView.getFocusedItem().expanded, true, - "The someProp5 item should already be expanded."); - - EventUtils.sendKey("LEFT", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp5", - "The someProp5 item should still be focused."); - is(gVariablesView.getFocusedItem().expanded, false, - "The someProp5 item should not be expanded now."); - - EventUtils.sendKey("LEFT", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp5", - "The someProp5 item should still be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp4", - "The someProp4 item should be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp3", - "The someProp3 item should be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp2", - "The someProp2 item should be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp1", - "The someProp1 item should be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "someProp0", - "The someProp0 item should still be focused."); - - for (let i = 0; i < 32; i++) { - // Advance to the last property in this scope. - EventUtils.sendKey("DOWN", gDebugger); - } - is(gVariablesView.getFocusedItem().name, "__proto__", - "The top-level __proto__ item should be focused."); - - EventUtils.sendKey("DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo scope should be focused now."); - is(gVariablesView.getFocusedItem().expanded, true, - "The foo scope should already be expanded."); - - EventUtils.sendKey("LEFT", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo scope should be focused now."); - is(gVariablesView.getFocusedItem().expanded, false, - "The foo scope shouldn't be expanded now."); - - EventUtils.sendKey("DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "bar", - "The bar variable should be focused."); - is(gVariablesView.getFocusedItem().expanded, false, - "The bar variable shouldn't be expanded."); - is(gVariablesView.getFocusedItem().visible, true, - "The bar variable shouldn't be hidden."); - - EventUtils.sendKey("BACK_SPACE", gDebugger); - is(gVariablesView.getFocusedItem().name, "bar", - "The bar variable should still be focused."); - is(gVariablesView.getFocusedItem().expanded, false, - "The bar variable should still not be expanded."); - is(gVariablesView.getFocusedItem().visible, false, - "The bar variable should be hidden."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo scope should be focused."); - - EventUtils.sendKey("UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "__proto__", - "The top-level __proto__ item should be focused."); - is(gVariablesView.getFocusedItem().expanded, false, - "The top-level __proto__ item should not be expanded."); - - EventUtils.sendKey("RIGHT", gDebugger); - is(gVariablesView.getFocusedItem().name, "__proto__", - "The top-level __proto__ item should still be focused."); - is(gVariablesView.getFocusedItem().expanded, true, - "The top-level __proto__ item should be expanded."); - - EventUtils.sendKey("LEFT", gDebugger); - is(gVariablesView.getFocusedItem().name, "__proto__", - "The top-level __proto__ item should still be focused."); - is(gVariablesView.getFocusedItem().expanded, false, - "The top-level __proto__ item should not be expanded."); - - EventUtils.sendKey("END", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo scope should be focused."); - - EventUtils.sendKey("PAGE_UP", gDebugger); - is(gVariablesView.getFocusedItem().name, "__proto__", - "The __proto__ property should be focused."); - - EventUtils.sendKey("PAGE_DOWN", gDebugger); - is(gVariablesView.getFocusedItem().name, "foo", - "The foo scope should be focused."); - - executeSoon(callback); - }); - }); - }); - }); - }); - }); -} - -function waitForElement(selector, exists, callback) -{ - // Poll every few milliseconds until the element are retrieved. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the element."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (!!gVariablesView._list.querySelector(selector) != exists) { - return; - } - // We got the element, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); -} - -function testClearHierarchy() { - gVariablesView.clearHierarchy(); - ok(!gVariablesView._prevHierarchy.size, - "The previous hierarchy should have been cleared."); - ok(!gVariablesView._currHierarchy.size, - "The current hierarchy should have been cleared."); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gVariablesView = null; - gScope = null; - gVariable = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js b/browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js deleted file mode 100644 index 6dba43421..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js +++ /dev/null @@ -1,119 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Make sure that the editing variables or properties values works properly. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -requestLongerTimeout(3); - -function test() { - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - testFrameEval(); - }); -} - -function testFrameEval() { - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - var localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"), - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - varA = localNodes[7]; - - is(varA.querySelector(".name").getAttribute("value"), "a", - "Should have the right name for 'a'."); - - is(varA.querySelector(".value").getAttribute("value"), 1, - "Should have the right initial value for 'a'."); - - testModification(varA, function(aVar) { - testModification(aVar, function(aVar) { - testModification(aVar, function(aVar) { - resumeAndFinish(); - }, "document.title", '"Debugger Function Call Parameter Test"'); - }, "b", "[object Object]"); - }, "{ a: 1 }", "[object Object]"); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.querySelector("button"), - content.window); -} - -function testModification(aVar, aCallback, aNewValue, aNewResult) { - function makeChangesAndExitInputMode() { - EventUtils.sendString(aNewValue, gDebugger); - EventUtils.sendKey("RETURN", gDebugger); - } - - EventUtils.sendMouseEvent({ type: "mousedown" }, - aVar.querySelector(".value"), - gDebugger); - - executeSoon(function() { - ok(aVar.querySelector(".element-value-input"), - "There should be an input element created."); - - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 2 Debugger:FetchedVariables events, one from the global - // object scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - // Get the variable reference anew, since the old ones were discarded when - // we resumed. - var localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"), - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - varA = localNodes[7]; - - is(varA.querySelector(".value").getAttribute("value"), aNewResult, - "Should have the right value for 'a'."); - - executeSoon(function() { - aCallback(varA); - }); - }, false); - - makeChangesAndExitInputMode(); - }); -} - -function resumeAndFinish() { - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js b/browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js deleted file mode 100644 index 231b3a83a..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js +++ /dev/null @@ -1,514 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -/** - * Make sure that the editing or removing watch expressions works properly. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_watch-expressions.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gWatch = null; -var gVars = null; - -requestLongerTimeout(3); - -function test() { - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gWatch = gDebugger.DebuggerView.WatchExpressions; - gVars = gDebugger.DebuggerView.Variables; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - testFrameEval(); - }); -} - -function testFrameEval() { - gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function test() { - gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - var localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1], - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - aArg = localNodes[1], - varT = localNodes[3]; - - is(aArg.querySelector(".name").getAttribute("value"), "aArg", - "Should have the right name for 'aArg'."); - is(varT.querySelector(".name").getAttribute("value"), "t", - "Should have the right name for 't'."); - - is(aArg.querySelector(".value").getAttribute("value"), "undefined", - "Should have the right initial value for 'aArg'."); - is(varT.querySelector(".value").getAttribute("value"), "\"Browser Debugger Watch Expressions Test\"", - "Should have the right initial value for 't'."); - - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5, - "There should be 5 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 5, "There should be 5 evaluations availalble"); - - is(scope.get("this")._isContentVisible, true, - "Should have the right visibility state for 'this'."); - is(scope.get("this").target.querySelectorAll(".variables-view-delete").length, 1, - "Should have the one close button visible for 'this'."); - is(scope.get("this").name, "this", - "Should have the right name for 'this'."); - is(scope.get("this").value.type, "object", - "Should have the right value type for 'this'."); - is(scope.get("this").value.class, "Window", - "Should have the right value type for 'this'."); - - is(scope.get("ermahgerd")._isContentVisible, true, - "Should have the right visibility state for 'ermahgerd'."); - is(scope.get("ermahgerd").target.querySelectorAll(".variables-view-delete").length, 1, - "Should have the one close button visible for 'ermahgerd'."); - is(scope.get("ermahgerd").name, "ermahgerd", - "Should have the right name for 'ermahgerd'."); - is(scope.get("ermahgerd").value.type, "object", - "Should have the right value type for 'ermahgerd'."); - is(scope.get("ermahgerd").value.class, "Function", - "Should have the right value type for 'ermahgerd'."); - - is(scope.get("aArg")._isContentVisible, true, - "Should have the right visibility state for 'aArg'."); - is(scope.get("aArg").target.querySelectorAll(".variables-view-delete").length, 1, - "Should have the one close button visible for 'aArg'."); - is(scope.get("aArg").name, "aArg", - "Should have the right name for 'aArg'."); - is(scope.get("aArg").value.type, "undefined", - "Should have the right value for 'aArg'."); - is(scope.get("aArg").value.class, undefined, - "Should have the right value for 'aArg'."); - - is(scope.get("document.title")._isContentVisible, true, - "Should have the right visibility state for 'document.title'."); - is(scope.get("document.title").target.querySelectorAll(".variables-view-delete").length, 1, - "Should have the one close button visible for 'document.title'."); - is(scope.get("document.title").name, "document.title", - "Should have the right name for 'document.title'."); - is(scope.get("document.title").value, "42", - "Should have the right value for 'document.title'."); - is(typeof scope.get("document.title").value, "string", - "Should have the right value type for 'document.title'."); - - is(scope.get("document.title = 42")._isContentVisible, true, - "Should have the right visibility state for 'document.title = 42'."); - is(scope.get("document.title = 42").target.querySelectorAll(".variables-view-delete").length, 1, - "Should have the one close button visible for 'document.title = 42'."); - is(scope.get("document.title = 42").name, "document.title = 42", - "Should have the right name for 'document.title = 42'."); - is(scope.get("document.title = 42").value, 42, - "Should have the right value for 'document.title = 42'."); - is(typeof scope.get("document.title = 42").value, "number", - "Should have the right value type for 'document.title = 42'."); - - testModification(scope.get("document.title = 42").target, test1, function(scope) { - testModification(scope.get("aArg").target, test2, function(scope) { - testModification(scope.get("aArg = 44").target, test3, function(scope) { - testModification(scope.get("document.title = 43").target, test4, function(scope) { - testModification(scope.get("document.title").target, test5, function(scope) { - testExprDeletion(scope.get("this").target, test6, function(scope) { - testExprDeletion(null, test7, function(scope) { - resumeAndFinish(); - }, 44, 0, true, true); - }, 44); - }, " \t\r\n", "\"43\"", 44, 1, true); - }, " \t\r\ndocument.title \t\r\n", "\"43\"", 44); - }, " \t\r\ndocument.title \t\r\n", "\"43\"", 44); - }, "aArg = 44", 44, 44); - }, "document.title = 43", 43, "undefined"); - }}, 0); - }, false); - - addWatchExpression("this"); - addWatchExpression("ermahgerd"); - addWatchExpression("aArg"); - addWatchExpression("document.title"); - addCmdWatchExpression("document.title = 42"); - - executeSoon(function() { - gDebuggee.ermahgerd(); // ermahgerd!! - }); -} - -function testModification(aVar, aTest, aCallback, aNewValue, aNewResult, aArgResult, - aLocalScopeIndex = 1, aDeletionFlag = null) -{ - function makeChangesAndExitInputMode() { - EventUtils.sendString(aNewValue, gDebugger); - EventUtils.sendKey("RETURN", gDebugger); - } - - EventUtils.sendMouseEvent({ type: "dblclick" }, - aVar.querySelector(".name"), - gDebugger); - - executeSoon(function() { - ok(aVar.querySelector(".element-name-input"), - "There should be an input element created."); - - let testContinued = false; - let fetchedVariables = false; - let fetchedExpressions = false; - - let countV = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function testV() { - // We expect 2 Debugger:FetchedVariables events, one from the global - // object scope and the regular one. - if (++countV < 2) { - info("Number of received Debugger:FetchedVariables events: " + countV); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", testV, false); - fetchedVariables = true; - executeSoon(continueTest); - }, false); - - let countE = 0; - gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function testE() { - // We expect only one Debugger:FetchedWatchExpressions event, since all - // expressions are evaluated at the same time. - if (++countE < 1) { - info("Number of received Debugger:FetchedWatchExpressions events: " + countE); - return; - } - gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", testE, false); - fetchedExpressions = true; - executeSoon(continueTest); - }, false); - - function continueTest() { - if (testContinued || !fetchedVariables || !fetchedExpressions) { - return; - } - testContinued = true; - - // Get the variable reference anew, since the old ones were discarded when - // we resumed. - var localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[aLocalScopeIndex], - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - aArg = localNodes[1]; - - is(aArg.querySelector(".value").getAttribute("value"), aArgResult, - "Should have the right value for 'aArg'."); - - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - info("Found the watch expressions scope: " + scope); - - let aExp = scope.get(aVar.querySelector(".name").getAttribute("value")); - info("Found the watch expression variable: " + aExp); - - if (aDeletionFlag) { - ok(fetchedVariables, "The variables should have been fetched."); - ok(fetchedExpressions, "The variables should have been fetched."); - is(aExp, undefined, "The watch expression should not have been found."); - performCallback(scope); - return; - } - - is(aExp.target.querySelector(".name").getAttribute("value"), aNewValue.trim(), - "Should have the right name for '" + aNewValue + "'."); - is(aExp.target.querySelector(".value").getAttribute("value"), aNewResult, - "Should have the right value for '" + aNewValue + "'."); - - performCallback(scope); - } - - makeChangesAndExitInputMode(); - }); - - function performCallback(scope) { - executeSoon(function() { - aTest(scope); - aCallback(scope); - }); - } -} - -function testExprDeletion(aVar, aTest, aCallback, aArgResult, - aLocalScopeIndex = 1, aFinalFlag = null, aRemoveAllFlag = null) -{ - let testContinued = false; - let fetchedVariables = false; - let fetchedExpressions = false; - - let countV = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function testV() { - // We expect 2 Debugger:FetchedVariables events, one from the global - // object scope and the regular one. - if (++countV < 2) { - info("Number of received Debugger:FetchedVariables events: " + countV); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", testV, false); - fetchedVariables = true; - executeSoon(continueTest); - }, false); - - let countE = 0; - gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function testE() { - // We expect only one Debugger:FetchedWatchExpressions event, since all - // expressions are evaluated at the same time. - if (++countE < 1) { - info("Number of received Debugger:FetchedWatchExpressions events: " + countE); - return; - } - gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", testE, false); - fetchedExpressions = true; - executeSoon(continueTest); - }, false); - - function continueTest() { - if ((testContinued || !fetchedVariables || !fetchedExpressions) && !aFinalFlag) { - return; - } - testContinued = true; - - // Get the variable reference anew, since the old ones were discarded when - // we resumed. - var localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[aLocalScopeIndex], - localNodes = localScope.querySelector(".variables-view-element-details").childNodes, - aArg = localNodes[1]; - - is(aArg.querySelector(".value").getAttribute("value"), aArgResult, - "Should have the right value for 'aArg'."); - - let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel"); - let scope = gVars._currHierarchy.get(label); - info("Found the watch expressions scope: " + scope); - - if (aFinalFlag) { - ok(fetchedVariables, "The variables should have been fetched."); - ok(!fetchedExpressions, "The variables should never have been fetched."); - is(scope, undefined, "The watch expressions scope should not have been found."); - performCallback(scope); - return; - } - - let aExp = scope.get(aVar.querySelector(".name").getAttribute("value")); - info("Found the watch expression variable: " + aExp); - - is(aExp, undefined, "Should not have found the watch expression after deletion."); - performCallback(scope); - } - - function performCallback(scope) { - executeSoon(function() { - aTest(scope); - aCallback(scope); - }); - } - - if (aRemoveAllFlag) { - gWatch._onCmdRemoveAllExpressions(); - return; - } - - EventUtils.sendMouseEvent({ type: "click" }, - aVar.querySelector(".variables-view-delete"), - gDebugger); -} - -function test1(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5, - "There should be 5 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 5, "There should be 5 evaluations availalble"); - - is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title = 43", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "document.title", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "aArg", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(3).attachment.inputNode.value, "ermahgerd", - "The fourth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd", - "The fourth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(4).attachment.inputNode.value, "this", - "The fifth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this", - "The fifth textbox input value is not the correct one"); -} - -function test2(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5, - "There should be 5 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 5, "There should be 5 evaluations availalble"); - - is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title = 43", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "document.title", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "aArg = 44", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg = 44", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(3).attachment.inputNode.value, "ermahgerd", - "The fourth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd", - "The fourth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(4).attachment.inputNode.value, "this", - "The fifth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this", - "The fifth textbox input value is not the correct one"); -} - -function test3(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 4, - "There should be 4 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 4, "There should be 4 evaluations availalble"); - - is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title = 43", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "document.title", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "ermahgerd", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.currentExpression, "ermahgerd", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(3).attachment.inputNode.value, "this", - "The fourth textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(3).attachment.currentExpression, "this", - "The fourth textbox input value is not the correct one"); -} - -function test4(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 3, - "There should be 3 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 3, "There should be 3 evaluations availalble"); - - is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title", - "The first textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "ermahgerd", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.currentExpression, "ermahgerd", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "this", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(2).attachment.currentExpression, "this", - "The third textbox input value is not the correct one"); -} - -function test5(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 2, - "There should be 2 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 2, "There should be 2 evaluations availalble"); - - is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "ermahgerd", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(0).attachment.currentExpression, "ermahgerd", - "The second textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "this", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(1).attachment.currentExpression, "this", - "The third textbox input value is not the correct one"); -} - -function test6(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 1, - "There should be 1 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - ok(scope, "There should be a wach expressions scope in the variables view"); - is(scope._store.size, 1, "There should be 1 evaluation availalble"); - - is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "ermahgerd", - "The third textbox input value is not the correct one"); - is(gWatch.getItemAtIndex(0).attachment.currentExpression, "ermahgerd", - "The third textbox input value is not the correct one"); -} - -function test7(scope) { - is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0, - "There should be 0 hidden nodes in the watch expressions container"); - is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0, - "There should be 0 visible nodes in the watch expressions container"); - - is(scope, undefined, "There should be no watch expressions scope available."); - is(gWatch.itemCount, 0, "The watch expressions container should be empty."); -} - -function addWatchExpression(string) { - gWatch.addExpression(string); - gDebugger.editor.focus(); -} - -function addCmdWatchExpression(string) { - gWatch._onCmdAddExpression(string); - gDebugger.editor.focus(); -} - -function resumeAndFinish() { - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gWatch = null; - gVars = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js deleted file mode 100644 index 1763916d3..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js +++ /dev/null @@ -1,516 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly filters nodes by name. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gSearchBox = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.delayedSearch = false; - testSearchbox(); - prepareVariables(testVariablesFiltering); - }); -} - -function testSearchbox() -{ - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There should not initially be a searchbox available in the variables view."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should not be found."); - - gDebugger.DebuggerView.Variables._enableSearch(); - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available after enabling."); - ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should be hidden at this point."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should be found."); - - - gDebugger.DebuggerView.Variables._disableSearch(); - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There shouldn't be a searchbox available after disabling."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should not be found."); - - gDebugger.DebuggerView.Variables._enableSearch(); - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available after enabling."); - ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should be hidden at this point."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should be found."); - - - let placeholder = "freshly squeezed mango juice"; - - gDebugger.DebuggerView.Variables.searchPlaceholder = placeholder; - is(gDebugger.DebuggerView.Variables.searchPlaceholder, placeholder, - "The placeholder getter didn't return the expected string"); - - ok(gDebugger.DebuggerView.Variables._searchboxNode.getAttribute("placeholder"), - placeholder, "There correct placeholder should be applied to the searchbox."); - - - gDebugger.DebuggerView.Variables._disableSearch(); - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There shouldn't be a searchbox available after disabling again."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should not be found."); - - gDebugger.DebuggerView.Variables._enableSearch(); - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available after enabling again."); - ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should be hidden at this point."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should be found."); - - ok(gDebugger.DebuggerView.Variables._searchboxNode.getAttribute("placeholder"), - placeholder, "There correct placeholder should be applied to the searchbox again."); - - - gDebugger.DebuggerView.Variables.searchEnabled = false; - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There shouldn't be a searchbox available after disabling again."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should not be found."); - - gDebugger.DebuggerView.Variables.searchEnabled = true; - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available after enabling again."); - ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should be hidden at this point."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should be found."); - - ok(gDebugger.DebuggerView.Variables._searchboxNode.getAttribute("placeholder"), - placeholder, "There correct placeholder should be applied to the searchbox again."); -} - -function testVariablesFiltering() -{ - ok(!gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should not be hidden at this point."); - - function test1() - { - write("location"); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded"); - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded"); - - ignoreExtraMatchedProperties(); - locationItem.toggle(); - locationItem.toggle(); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 3, - "There should be 3 variables displayed in the global scope"); - - ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 6, - "There should be more than 6 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the global scope"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "this", "The only inner variable displayed should be 'this'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"), - "window", "The third inner property displayed should be 'window'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[3].getAttribute("value"), - "document", "The fourth inner property displayed should be 'document'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[4].getAttribute("value"), - "location", "The fifth inner property displayed should be 'location'"); - - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "location", "The first global variable displayed should be 'location'"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), - "locationbar", "The second global variable displayed should be 'locationbar'"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"), - "Location", "The third global variable displayed should be 'Location'"); - } - - function test2() - { - innerScopeItem.collapse(); - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - thisItem.collapse(); - windowItem.collapse(); - documentItem.collapse(); - locationItem.collapse(); - - is(innerScopeItem.expanded, false, - "The innerScope expanded getter should return false"); - is(mathScopeItem.expanded, false, - "The mathScope expanded getter should return false"); - is(testScopeItem.expanded, false, - "The testScope expanded getter should return false"); - is(loadScopeItem.expanded, false, - "The loadScope expanded getter should return false"); - is(globalScopeItem.expanded, false, - "The globalScope expanded getter should return false"); - - is(thisItem.expanded, false, - "The local scope 'this' should not be expanded"); - is(windowItem.expanded, false, - "The local scope 'this.window' should not be expanded"); - is(documentItem.expanded, false, - "The local scope 'this.window.document' should not be expanded"); - is(locationItem.expanded, false, - "The local scope 'this.window.document.location' should not be expanded"); - - write("location"); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded"); - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded"); - - ignoreExtraMatchedProperties(); - locationItem.toggle(); - locationItem.toggle(); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 3, - "There should be 3 variables displayed in the global scope"); - - ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 6, - "There should be more than 6 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the global scope"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "this", "The only inner variable displayed should be 'this'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"), - "window", "The third inner property displayed should be 'window'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[3].getAttribute("value"), - "document", "The fourth inner property displayed should be 'document'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[4].getAttribute("value"), - "location", "The fifth inner property displayed should be 'location'"); - - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "location", "The first global variable displayed should be 'location'"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), - "locationbar", "The second global variable displayed should be 'locationbar'"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"), - "Location", "The second global variable displayed should be 'Location'"); - } - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - let thisItem = innerScopeItem.get("this"); - let windowItem = thisItem.get("window"); - let documentItem = windowItem.get("document"); - let locationItem = documentItem.get("location"); - - gSearchBox = gDebugger.DebuggerView.Variables._searchboxNode; - - executeSoon(function() { - test1(); - executeSoon(function() { - test2(); - executeSoon(function() { - closeDebuggerAndFinish(); - }); - }); - }); -} - -function prepareVariables(aCallback) -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 4 Debugger:FetchedVariables events, one from the global object - // scope, two from the |with| scopes and the regular one. - if (++count < 4) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, false, - "The mathScope expanded getter should return false"); - is(testScopeItem.expanded, false, - "The testScope expanded getter should return false"); - is(loadScopeItem.expanded, false, - "The loadScope expanded getter should return false"); - is(globalScopeItem.expanded, false, - "The globalScope expanded getter should return false"); - - EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - - let thisItem = innerScopeItem.get("this"); - is(thisItem.expanded, false, - "The local scope 'this' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test2() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false); - Services.tm.currentThread.dispatch({ run: function() { - - let windowItem = thisItem.get("window"); - is(windowItem.expanded, false, - "The local scope 'this.window' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test3() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false); - Services.tm.currentThread.dispatch({ run: function() { - - let documentItem = windowItem.get("document"); - is(documentItem.expanded, false, - "The local scope 'this.window.document' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test4() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false); - Services.tm.currentThread.dispatch({ run: function() { - - let locationItem = documentItem.get("location"); - is(locationItem.expanded, false, - "The local scope 'this.window.document.location' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test5() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false); - Services.tm.currentThread.dispatch({ run: function() { - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded"); - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded"); - - executeSoon(function() { - aCallback(); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - locationItem.target.querySelector(".arrow"), - gDebugger); - - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - documentItem.target.querySelector(".arrow"), - gDebugger); - - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - windowItem.target.querySelector(".arrow"), - gDebugger); - - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - thisItem.target.querySelector(".arrow"), - gDebugger); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded now"); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -function ignoreExtraMatchedProperties() -{ - for (let [, item] of gDebugger.DebuggerView.Variables._currHierarchy) { - let name = item.name.toLowerCase(); - let value = item._valueString || ""; - - if ((name.contains("tracemallocdumpallocations")) || - (name.contains("geolocation")) || - (name.contains("webgl"))) { - item.target.setAttribute("non-match", ""); - } - } -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js deleted file mode 100644 index ec5f8c07e..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js +++ /dev/null @@ -1,438 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly filters nodes by value. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gSearchBox = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.delayedSearch = false; - testSearchbox(); - prepareVariables(testVariablesFiltering); - }); -} - -function testSearchbox() -{ - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There should not initially be a searchbox available in the variables view."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should not be found."); - - gDebugger.DebuggerView.Variables._enableSearch(); - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available after enabling."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "The searchbox element should be found."); - ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should be hidden at this point."); -} - -function testVariablesFiltering() -{ - ok(!gDebugger.DebuggerView.Variables._searchboxContainer.hidden, - "The searchbox container should not be hidden at this point."); - - function test1() - { - write("htmldocument"); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded"); - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded"); - - locationItem.toggle(); - locationItem.toggle(); - documentItem.toggle(); - documentItem.toggle(); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 2, - "There should be 2 variables displayed in the global scope"); - - ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 3, - "There should be more than 3 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the global scope"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "this", "The only inner variable displayed should be 'this'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"), - "document", "The first inner property displayed should be 'document'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"), - "window", "The second inner property displayed should be 'window'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"), - "document", "The third inner property displayed should be 'document'"); - - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "document", "The first global variable displayed should be 'document'"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), - "HTMLDocument", "The first global variable displayed should be 'HTMLDocument'"); - } - - function test2() - { - innerScopeItem.collapse(); - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - thisItem.collapse(); - windowItem.collapse(); - documentItem.collapse(); - locationItem.collapse(); - - is(innerScopeItem.expanded, false, - "The innerScope expanded getter should return false"); - is(mathScopeItem.expanded, false, - "The mathScope expanded getter should return false"); - is(testScopeItem.expanded, false, - "The testScope expanded getter should return false"); - is(loadScopeItem.expanded, false, - "The loadScope expanded getter should return false"); - is(globalScopeItem.expanded, false, - "The globalScope expanded getter should return false"); - - is(thisItem.expanded, false, - "The local scope 'this' should not be expanded"); - is(windowItem.expanded, false, - "The local scope 'this.window' should not be expanded"); - is(documentItem.expanded, false, - "The local scope 'this.window.document' should not be expanded"); - is(locationItem.expanded, false, - "The local scope 'this.window.document.location' should not be expanded"); - - write("htmldocument"); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded"); - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded"); - - documentItem.toggle(); - documentItem.toggle(); - locationItem.toggle(); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 2, - "There should be 2 variables displayed in the global scope"); - - ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 3, - "There should be more than 3 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the load scope"); - is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the global scope"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "this", "The only inner variable displayed should be 'this'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"), - "document", "The first inner property displayed should be 'document'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"), - "window", "The second inner property displayed should be 'window'"); - is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"), - "document", "The third inner property displayed should be 'document'"); - - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "document", "The first global variable displayed should be 'document'"); - is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), - "HTMLDocument", "The first global variable displayed should be 'HTMLDocument'"); - } - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - let thisItem = innerScopeItem.get("this"); - let windowItem = thisItem.get("window"); - let documentItem = windowItem.get("document"); - let locationItem = documentItem.get("location"); - - gSearchBox = gDebugger.DebuggerView.Variables._searchboxNode; - - executeSoon(function() { - test1(); - executeSoon(function() { - test2(); - executeSoon(function() { - closeDebuggerAndFinish(); - }); - }); - }); -} - -function prepareVariables(aCallback) -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 4 Debugger:FetchedVariables events, one from the global object - // scope, two from the |with| scopes and the regular one. - if (++count < 4) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, false, - "The mathScope expanded getter should return false"); - is(testScopeItem.expanded, false, - "The testScope expanded getter should return false"); - is(loadScopeItem.expanded, false, - "The loadScope expanded getter should return false"); - is(globalScopeItem.expanded, false, - "The globalScope expanded getter should return false"); - - EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - - let thisItem = innerScopeItem.get("this"); - is(thisItem.expanded, false, - "The local scope 'this' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test2() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false); - Services.tm.currentThread.dispatch({ run: function() { - - let windowItem = thisItem.get("window"); - is(windowItem.expanded, false, - "The local scope 'this.window' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test3() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false); - Services.tm.currentThread.dispatch({ run: function() { - - let documentItem = windowItem.get("document"); - is(documentItem.expanded, false, - "The local scope 'this.window.document' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test4() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false); - Services.tm.currentThread.dispatch({ run: function() { - - let locationItem = documentItem.get("location"); - is(locationItem.expanded, false, - "The local scope 'this.window.document.location' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test5() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false); - Services.tm.currentThread.dispatch({ run: function() { - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded"); - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded"); - - executeSoon(function() { - aCallback(); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - locationItem.target.querySelector(".arrow"), - gDebugger); - - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - documentItem.target.querySelector(".arrow"), - gDebugger); - - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - windowItem.target.querySelector(".arrow"), - gDebugger); - - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - thisItem.target.querySelector(".arrow"), - gDebugger); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded now"); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js deleted file mode 100644 index 7f92b9325..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js +++ /dev/null @@ -1,93 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view filter prefs work properly. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gPrevPref = null; - -function test() -{ - gPrevPref = Services.prefs.getBoolPref( - "devtools.debugger.ui.variables-searchbox-visible"); - Services.prefs.setBoolPref( - "devtools.debugger.ui.variables-searchbox-visible", false); - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - testSearchbox(); - testPref(); - }); -} - -function testSearchbox() -{ - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There should not initially be a searchbox available in the variables view."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "There searchbox element should not be found."); -} - -function testPref() -{ - is(gDebugger.Prefs.variablesSearchboxVisible, false, - "The debugger searchbox should be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true", - "The options menu item should not be checked."); - - gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "true"); - gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox(); - - executeSoon(function() { - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available in the variables view."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "There searchbox element should be found."); - is(gDebugger.Prefs.variablesSearchboxVisible, true, - "The debugger searchbox should now be preffed as visible."); - is(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true", - "The options menu item should now be checked."); - - gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "false"); - gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox(); - - executeSoon(function() { - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There should not be a searchbox available in the variables view."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "There searchbox element should not be found."); - is(gDebugger.Prefs.variablesSearchboxVisible, false, - "The debugger searchbox should now be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true", - "The options menu item should now be unchecked."); - - executeSoon(function() { - Services.prefs.setBoolPref( - "devtools.debugger.ui.variables-searchbox-visible", gPrevPref); - - closeDebuggerAndFinish(); - }); - }); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gPrevPref = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js deleted file mode 100644 index 89663783b..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js +++ /dev/null @@ -1,93 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view filter prefs work properly. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gPrevPref = null; - -function test() -{ - gPrevPref = Services.prefs.getBoolPref( - "devtools.debugger.ui.variables-searchbox-visible"); - Services.prefs.setBoolPref( - "devtools.debugger.ui.variables-searchbox-visible", true); - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - testSearchbox(); - testPref(); - }); -} - -function testSearchbox() -{ - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should initially be a searchbox available in the variables view."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "There searchbox element should be found."); -} - -function testPref() -{ - is(gDebugger.Prefs.variablesSearchboxVisible, true, - "The debugger searchbox should be preffed as visible."); - is(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true", - "The options menu item should be checked."); - - gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "false"); - gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox(); - - executeSoon(function() { - ok(!gDebugger.DebuggerView.Variables._searchboxNode, - "There should not be a searchbox available in the variables view."); - ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "There searchbox element should not be found."); - is(gDebugger.Prefs.variablesSearchboxVisible, false, - "The debugger searchbox should now be preffed as hidden."); - isnot(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true", - "The options menu item should now be unchecked."); - - gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "true"); - gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox(); - - executeSoon(function() { - ok(gDebugger.DebuggerView.Variables._searchboxNode, - "There should be a searchbox available in the variables view."); - ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"), - "There searchbox element should be found."); - is(gDebugger.Prefs.variablesSearchboxVisible, true, - "The debugger searchbox should now be preffed as visible."); - is(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true", - "The options menu item should now be checked."); - - executeSoon(function() { - Services.prefs.setBoolPref( - "devtools.debugger.ui.variables-searchbox-visible", gPrevPref); - - closeDebuggerAndFinish(); - }); - }); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gPrevPref = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js deleted file mode 100644 index af3c4b85d..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js +++ /dev/null @@ -1,284 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly filters nodes. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gSearchBox = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.delayedSearch = false; - prepareVariables(testVariablesFiltering); - }); -} - -function testVariablesFiltering() -{ - function test1() - { - write("*one"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the load scope"); - - is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the load scope"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "one", "The only inner variable displayed should be 'one'"); - - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "button", "The only load variable displayed should be 'button'"); - - let oneItem = innerScopeItem.get("one"); - is(oneItem.expanded, false, - "The one item in the inner scope should not be expanded"); - - EventUtils.sendKey("RETURN", gDebugger); - is(oneItem.expanded, true, - "The one item in the inner scope should now be expanded"); - } - - function test2() - { - write("*two"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, - "There should be 1 variable displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be 0 variables displayed in the load scope"); - - is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the load scope"); - - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), - "two", "The only inner variable displayed should be 'two'"); - - let twoItem = innerScopeItem.get("two"); - is(twoItem.expanded, false, - "The two item in the inner scope should not be expanded"); - - EventUtils.sendKey("RETURN", gDebugger); - is(twoItem.expanded, true, - "The two item in the inner scope should now be expanded"); - } - - function test3() - { - backspace(3); - - is(gSearchBox.value, "*", - "Searchbox value is incorrect after 3 backspaces"); - - // variable count includes `__proto__` for object scopes - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 4, - "There should be 4 variables displayed in the inner scope"); - isnot(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the math scope"); - isnot(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the test scope"); - isnot(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the load scope"); - isnot(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the global scope"); - - is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - ok(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length > 1, - "There should be more than one property displayed in the load scope"); - isnot(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be some properties displayed in the global scope"); - } - - function test4() - { - backspace(1); - - is(gSearchBox.value, "", - "Searchbox value is incorrect after 1 backspace"); - - // variable count includes `__proto__` for object scopes - is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 4, - "There should be 4 variables displayed in the inner scope"); - isnot(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the math scope"); - isnot(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the test scope"); - isnot(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the load scope"); - isnot(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, - "There should be some variables displayed in the global scope"); - - is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the inner scope"); - is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the math scope"); - is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be 0 properties displayed in the test scope"); - ok(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length > 1, - "There should be more than one properties displayed in the load scope"); - isnot(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "There should be some properties displayed in the global scope"); - } - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - executeSoon(function() { - test1(); - executeSoon(function() { - test2(); - executeSoon(function() { - test3(); - executeSoon(function() { - test4(); - executeSoon(function() { - closeDebuggerAndFinish(); - }); - }); - }); - }); - }); -} - -function prepareVariables(aCallback) -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 4 Debugger:FetchedVariables events, one from the global object - // scope, two from the |with| scopes and the regular one. - if (++count < 4) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger); - - executeSoon(function() { - aCallback(); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger) - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js deleted file mode 100644 index 962f6542a..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js +++ /dev/null @@ -1,249 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly filters nodes. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gSearchBox = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = false; - gDebugger.DebuggerView.Variables.delayedSearch = false; - prepareVariables(testVariablesFiltering); - }); -} - -function testVariablesFiltering() -{ - let f = { - test1: function() - { - assertExpansion(1, [true, false, false, false, false]); - clear(); - }, - test2: function() - { - assertExpansion(2, [true, false, false, false, false]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test3: function() - { - assertExpansion(3, [true, false, false, false, false]); - gDebugger.editor.focus(); - }, - test4: function() - { - assertExpansion(4, [true, false, false, false, false]); - write("*"); - }, - test5: function() { - assertExpansion(5, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test6: function() { - assertExpansion(6, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test7: function() { - assertExpansion(7, [true, true, true, true, true]); - backspace(1); - }, - test8: function() { - assertExpansion(8, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test9: function() { - assertExpansion(9, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test10: function() { - assertExpansion(10, [true, true, true, true, true]); - innerScopeItem.collapse(); - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - }, - test11: function() { - assertExpansion(11, [false, false, false, false, false]); - clear(); - }, - test12: function() { - assertExpansion(12, [false, false, false, false, false]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test13: function() { - assertExpansion(13, [false, false, false, false, false]); - gDebugger.editor.focus(); - }, - test14: function() { - assertExpansion(14, [false, false, false, false, false]); - write("*"); - }, - test15: function() { - assertExpansion(15, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test16: function() { - assertExpansion(16, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test17: function() { - assertExpansion(17, [true, true, true, true, true]); - backspace(1); - }, - test18: function() { - assertExpansion(18, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test19: function() { - assertExpansion(19, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test20: function() { - assertExpansion(20, [true, true, true, true, true]); - } - }; - - function assertExpansion(n, array) { - is(innerScopeItem.expanded, array[0], - "The innerScope should " + (array[0] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(mathScopeItem.expanded, array[1], - "The mathScope should " + (array[1] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(testScopeItem.expanded, array[2], - "The testScope should " + (array[2] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(loadScopeItem.expanded, array[3], - "The loadScope should " + (array[3] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(globalScopeItem.expanded, array[4], - "The globalScope should " + (array[4] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - } - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - executeSoon(function() { - for (let i = 1; i <= Object.keys(f).length; i++) { - f["test" + i](); - } - closeDebuggerAndFinish(); - }); -} - -function prepareVariables(aCallback) -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 2 Debugger:FetchedVariables events, one from the inner object - // scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - executeSoon(function() { - aCallback(); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger) - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js deleted file mode 100644 index d18e0bbb2..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js +++ /dev/null @@ -1,254 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly filters nodes. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gSearchBox = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.delayedSearch = false; - prepareVariables(testVariablesFiltering); - }); -} - -function testVariablesFiltering() -{ - let f = { - test1: function() - { - assertExpansion(1, [true, false, false, false, false]); - clear(); - }, - test2: function() - { - assertExpansion(2, [true, false, false, false, false]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test3: function() - { - assertExpansion(3, [true, false, false, false, false]); - gDebugger.editor.focus(); - }, - test4: function() - { - assertExpansion(4, [true, false, false, false, false]); - write("*"); - }, - test5: function() { - assertExpansion(5, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test6: function() { - assertExpansion(6, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test7: function() { - assertExpansion(7, [true, true, true, true, true]); - backspace(1); - }, - test8: function() { - assertExpansion(8, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test9: function() { - assertExpansion(9, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test10: function() { - assertExpansion(10, [true, true, true, true, true]); - innerScopeItem.collapse(); - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - }, - test11: function() { - assertExpansion(11, [false, false, false, false, false]); - clear(); - }, - test12: function() { - assertExpansion(12, [false, false, false, false, false]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test13: function() { - assertExpansion(13, [false, false, false, false, false]); - gDebugger.editor.focus(); - }, - test14: function() { - assertExpansion(14, [false, false, false, false, false]); - write("*"); - }, - test15: function() { - assertExpansion(15, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test16: function() { - assertExpansion(16, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test17: function() { - assertExpansion(17, [true, true, true, true, true]); - backspace(1); - }, - test18: function() { - assertExpansion(18, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - }, - test19: function() { - assertExpansion(19, [true, true, true, true, true]); - gDebugger.editor.focus(); - }, - test20: function() { - assertExpansion(20, [true, true, true, true, true]); - } - }; - - function assertExpansion(n, array) { - is(innerScopeItem.expanded, array[0], - "The innerScope should " + (array[0] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(mathScopeItem.expanded, array[1], - "The mathScope should " + (array[1] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(testScopeItem.expanded, array[2], - "The testScope should " + (array[2] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(loadScopeItem.expanded, array[3], - "The loadScope should " + (array[3] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(globalScopeItem.expanded, array[4], - "The globalScope should " + (array[4] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - } - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - executeSoon(function() { - for (let i = 1; i <= Object.keys(f).length; i++) { - f["test" + i](); - } - closeDebuggerAndFinish(); - }); -} - -function prepareVariables(aCallback) -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 2 Debugger:FetchedVariables events, one from the inner object - // scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger); - - executeSoon(function() { - aCallback(); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js deleted file mode 100644 index 7668512fd..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js +++ /dev/null @@ -1,324 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly filters nodes. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; -var gSearchBox = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.delayedSearch = false; - prepareVariables(testVariablesFiltering); - }); -} - -function testVariablesFiltering() -{ - let f = { - test1: function(aCallback) - { - assertExpansion(1, [true, false, false, false, false]); - write("*arguments"); - aCallback(); - }, - test2: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, false, - "The arguments pseudoarray in the testScope should not be expanded"); - is(loadScopeItem.get("arguments").expanded, false, - "The arguments pseudoarray in the testScope should not be expanded"); - - assertExpansion(1, [true, true, true, true, true]); - EventUtils.sendKey("RETURN", gDebugger); - aCallback(); - }, - test3: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - is(loadScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - - waitForFetchedProperties(2, function() { - is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the testScope should have 4 visible properties"); - is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the loadScope should have 4 visible properties"); - - assertExpansion(2, [true, true, true, true, true]); - backspace(1); - aCallback(); - }); - }, - test4: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - is(loadScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - - waitForFetchedProperties(0, function() { - is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the testScope should have 4 visible properties"); - is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the loadScope should have 4 visible properties"); - - assertExpansion(3, [true, true, true, true, true]); - backspace(8); - aCallback(); - }); - }, - test5: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - is(loadScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - - waitForFetchedProperties(0, function() { - is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the testScope should have 4 visible properties"); - is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the loadScope should have 4 visible properties"); - - assertExpansion(4, [true, true, true, true, true]); - backspace(1); - aCallback(); - }); - }, - test6: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - is(loadScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - - waitForFetchedProperties(0, function() { - is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the testScope should have 4 visible properties"); - is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the loadScope should have 4 visible properties"); - - assertExpansion(5, [true, true, true, true, true]); - write("*"); - aCallback(); - }); - }, - test7: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - is(loadScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - - waitForFetchedProperties(0, function() { - is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the testScope should have 4 visible properties"); - is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, - "The arguments in the loadScope should have 4 visible properties"); - - assertExpansion(5, [true, true, true, true, true]); - append("arguments"); - aCallback(); - }); - }, - test8: function(aCallback) - { - is(testScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - is(loadScopeItem.get("arguments").expanded, true, - "The arguments pseudoarray in the testScope should now be expanded"); - - waitForFetchedProperties(0, function() { - is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "The arguments in the testScope should have 0 visible properties"); - is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, - "The arguments in the loadScope should have 0 visible properties"); - - assertExpansion(5, [true, true, true, true, true]); - aCallback(); - }); - }, - }; - - function assertExpansion(n, array) { - is(innerScopeItem.expanded, array[0], - "The innerScope should " + (array[0] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(mathScopeItem.expanded, array[1], - "The mathScope should " + (array[1] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(testScopeItem.expanded, array[2], - "The testScope should " + (array[2] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(loadScopeItem.expanded, array[3], - "The loadScope should " + (array[3] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - - is(globalScopeItem.expanded, array[4], - "The globalScope should " + (array[4] ? "" : "not ") + - "be expanded at this point (" + n + ")"); - } - - function waitForFetchedProperties(n, aCallback) { - if (n == 0) { - aCallback(); - return; - } - - let count = 0; - gDebugger.addEventListener("Debugger:FetchedProperties", function test() { - // We expect n Debugger:FetchedProperties events. - if (++count < n) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedProperties", test, false); - Services.tm.currentThread.dispatch({ run: function() { - executeSoon(aCallback); - }}, 0); - }, false); - } - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - executeSoon(function() { - f.test1(function() { - f.test2(function() { - f.test3(function() { - f.test4(function() { - f.test5(function() { - f.test6(function() { - f.test7(function() { - f.test8(function() { - closeDebuggerAndFinish(); - }); - }); - }); - }); - }); - }); - }); - }); - }); -} - -function prepareVariables(aCallback) -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 2 Debugger:FetchedVariables events, one from the inner object - // scope and the regular one. - if (++count < 2) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger); - - executeSoon(function() { - aCallback(); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js b/browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js deleted file mode 100644 index 7cb9e10d4..000000000 --- a/browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js +++ /dev/null @@ -1,394 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that the property view correctly re-expands nodes after pauses. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; -var gDebuggee = null; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebuggee = aDebuggee; - - gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown() { - gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown); - addBreakpoint(); - }); - }); -} - -function addBreakpoint() -{ - gDebugger.DebuggerController.Breakpoints.addBreakpoint({ - url: gDebugger.DebuggerView.Sources.selectedValue, - line: 16 - }, function(aBreakpointClient, aResponseError) { - ok(!aResponseError, "There shouldn't be an error."); - // Wait for the resume... - gDebugger.gClient.addOneTimeListener("resumed", function() { - gDebugger.DebuggerController.StackFrames.autoScopeExpand = true; - gDebugger.DebuggerView.Variables.nonEnumVisible = false; - gDebugger.DebuggerView.Variables.commitHierarchyIgnoredItems = Object.create(null); - testVariablesExpand(); - }); - }); -} - -function testVariablesExpand() -{ - let count = 0; - gDebugger.addEventListener("Debugger:FetchedVariables", function test() { - // We expect 4 Debugger:FetchedVariables events, one from the global object - // scope, two from the |with| scopes and the regular one. - if (++count < 4) { - info("Number of received Debugger:FetchedVariables events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedVariables", test, false); - Services.tm.currentThread.dispatch({ run: function() { - - var frames = gDebugger.DebuggerView.StackFrames.widget._list, - scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.querySelectorAll(".variables-view-scope")[0], - mathScope = scopes.querySelectorAll(".variables-view-scope")[1], - testScope = scopes.querySelectorAll(".variables-view-scope")[2], - loadScope = scopes.querySelectorAll(".variables-view-scope")[3], - globalScope = scopes.querySelectorAll(".variables-view-scope")[4]; - - let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - innerScope.querySelector(".name").getAttribute("value")); - let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - mathScope.querySelector(".name").getAttribute("value")); - let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - testScope.querySelector(".name").getAttribute("value")); - let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - loadScope.querySelector(".name").getAttribute("value")); - let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get( - globalScope.querySelector(".name").getAttribute("value")); - - is(innerScope.querySelector(".arrow").hasAttribute("open"), true, - "The innerScope arrow should initially be expanded"); - is(mathScope.querySelector(".arrow").hasAttribute("open"), true, - "The mathScope arrow should initially be expanded"); - is(testScope.querySelector(".arrow").hasAttribute("open"), true, - "The testScope arrow should initially be expanded"); - is(loadScope.querySelector(".arrow").hasAttribute("open"), true, - "The loadScope arrow should initially be expanded"); - is(globalScope.querySelector(".arrow").hasAttribute("open"), true, - "The globalScope arrow should initially be expanded"); - - is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The innerScope enumerables should initially be expanded"); - is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The mathScope enumerables should initially be expanded"); - is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The testScope enumerables should initially be expanded"); - is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The loadScope enumerables should initially be expanded"); - is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The globalScope enumerables should initially be expanded"); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - mathScopeItem.collapse(); - testScopeItem.collapse(); - loadScopeItem.collapse(); - globalScopeItem.collapse(); - - is(innerScope.querySelector(".arrow").hasAttribute("open"), true, - "The innerScope arrow should initially be expanded"); - is(mathScope.querySelector(".arrow").hasAttribute("open"), false, - "The mathScope arrow should initially not be expanded"); - is(testScope.querySelector(".arrow").hasAttribute("open"), false, - "The testScope arrow should initially not be expanded"); - is(loadScope.querySelector(".arrow").hasAttribute("open"), false, - "The loadScope arrow should initially not be expanded"); - is(globalScope.querySelector(".arrow").hasAttribute("open"), false, - "The globalScope arrow should initially not be expanded"); - - is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The innerScope enumerables should initially be expanded"); - is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), false, - "The mathScope enumerables should initially not be expanded"); - is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), false, - "The testScope enumerables should initially not be expanded"); - is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), false, - "The loadScope enumerables should initially not be expanded"); - is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), false, - "The globalScope enumerables should initially not be expanded"); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, false, - "The mathScope expanded getter should return false"); - is(testScopeItem.expanded, false, - "The testScope expanded getter should return false"); - is(loadScopeItem.expanded, false, - "The loadScope expanded getter should return false"); - is(globalScopeItem.expanded, false, - "The globalScope expanded getter should return false"); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger); - EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger); - - - is(innerScope.querySelector(".arrow").hasAttribute("open"), true, - "The innerScope arrow should now be expanded"); - is(mathScope.querySelector(".arrow").hasAttribute("open"), true, - "The mathScope arrow should now be expanded"); - is(testScope.querySelector(".arrow").hasAttribute("open"), true, - "The testScope arrow should now be expanded"); - is(loadScope.querySelector(".arrow").hasAttribute("open"), true, - "The loadScope arrow should now be expanded"); - is(globalScope.querySelector(".arrow").hasAttribute("open"), true, - "The globalScope arrow should now be expanded"); - - is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The innerScope enumerables should now be expanded"); - is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The mathScope enumerables should now be expanded"); - is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The testScope enumerables should now be expanded"); - is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The loadScope enumerables should now be expanded"); - is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The globalScope enumerables should now be expanded"); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - - let thisItem = innerScopeItem.get("this"); - is(thisItem.expanded, false, - "The local scope 'this' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test2() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false); - Services.tm.currentThread.dispatch({ run: function() { - - let windowItem = thisItem.get("window"); - is(windowItem.expanded, false, - "The local scope 'this.window' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test3() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false); - Services.tm.currentThread.dispatch({ run: function() { - - let documentItem = windowItem.get("document"); - is(documentItem.expanded, false, - "The local scope 'this.window.document' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test4() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false); - Services.tm.currentThread.dispatch({ run: function() { - - let locationItem = documentItem.get("location"); - is(locationItem.expanded, false, - "The local scope 'this.window.document.location' should not be expanded yet"); - - gDebugger.addEventListener("Debugger:FetchedProperties", function test5() { - gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false); - Services.tm.currentThread.dispatch({ run: function() { - - is(thisItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The thisItem arrow should still be expanded (1)"); - is(windowItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The windowItem arrow should still be expanded (1)"); - is(documentItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The documentItem arrow should still be expanded (1)"); - is(locationItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The locationItem arrow should still be expanded (1)"); - - is(thisItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The thisItem enumerables should still be expanded (1)"); - is(windowItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The windowItem enumerables should still be expanded (1)"); - is(documentItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The documentItem enumerables should still be expanded (1)"); - is(locationItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The locationItem enumerables should still be expanded (1)"); - - is(thisItem.expanded, true, - "The local scope 'this' should still be expanded (1)"); - is(windowItem.expanded, true, - "The local scope 'this.window' should still be expanded (1)"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should still be expanded (1)"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should still be expanded (1)"); - - - let count = 0; - gDebugger.addEventListener("Debugger:FetchedProperties", function test6() { - // We expect 4 Debugger:FetchedProperties events, one from the this - // reference, one for window, one for document and one for location. - if (++count < 4) { - info("Number of received Debugger:FetchedProperties events: " + count); - return; - } - gDebugger.removeEventListener("Debugger:FetchedProperties", test6, false); - Services.tm.currentThread.dispatch({ run: function() { - - is(innerScope.querySelector(".arrow").hasAttribute("open"), true, - "The innerScope arrow should still be expanded"); - is(mathScope.querySelector(".arrow").hasAttribute("open"), true, - "The mathScope arrow should still be expanded"); - is(testScope.querySelector(".arrow").hasAttribute("open"), true, - "The testScope arrow should still be expanded"); - is(loadScope.querySelector(".arrow").hasAttribute("open"), true, - "The loadScope arrow should still be expanded"); - is(globalScope.querySelector(".arrow").hasAttribute("open"), true, - "The globalScope arrow should still be expanded"); - - is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The innerScope enumerables should still be expanded"); - is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The mathScope enumerables should still be expanded"); - is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The testScope enumerables should still be expanded"); - is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The loadScope enumerables should still be expanded"); - is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The globalScope enumerables should still be expanded"); - - is(innerScopeItem.expanded, true, - "The innerScope expanded getter should return true"); - is(mathScopeItem.expanded, true, - "The mathScope expanded getter should return true"); - is(testScopeItem.expanded, true, - "The testScope expanded getter should return true"); - is(loadScopeItem.expanded, true, - "The loadScope expanded getter should return true"); - is(globalScopeItem.expanded, true, - "The globalScope expanded getter should return true"); - - is(thisItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The thisItem arrow should still be expanded (2)"); - is(windowItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The windowItem arrow should still be expanded (2)"); - is(documentItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The documentItem arrow should still be expanded (2)"); - is(locationItem.target.querySelector(".arrow").hasAttribute("open"), true, - "The locationItem arrow should still be expanded (2)"); - - is(thisItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The thisItem enumerables should still be expanded (2)"); - is(windowItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The windowItem enumerables should still be expanded (2)"); - is(documentItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The documentItem enumerables should still be expanded (2)"); - is(locationItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true, - "The locationItem enumerables should still be expanded (2)"); - - is(thisItem.expanded, true, - "The local scope 'this' should still be expanded (2)"); - is(windowItem.expanded, true, - "The local scope 'this.window' should still be expanded (2)"); - is(documentItem.expanded, true, - "The local scope 'this.window.document' should still be expanded (2)"); - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should still be expanded (2)"); - - executeSoon(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.querySelector("#step-in"), - gDebugger); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - locationItem.target.querySelector(".arrow"), - gDebugger); - - is(locationItem.expanded, true, - "The local scope 'this.window.document.location' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - documentItem.target.querySelector(".arrow"), - gDebugger); - - is(documentItem.expanded, true, - "The local scope 'this.window.document' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - windowItem.target.querySelector(".arrow"), - gDebugger); - - is(windowItem.expanded, true, - "The local scope 'this.window' should be expanded now"); - }); - }}, 0); - }, false); - - executeSoon(function() { - EventUtils.sendMouseEvent({ type: "mousedown" }, - thisItem.target.querySelector(".arrow"), - gDebugger); - - is(thisItem.expanded, true, - "The local scope 'this' should be expanded now"); - }); - }}, 0); - }, false); - - EventUtils.sendMouseEvent({ type: "click" }, - gDebuggee.document.querySelector("button"), - gDebuggee.window); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; - gDebuggee = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js deleted file mode 100644 index 47846e46b..000000000 --- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js +++ /dev/null @@ -1,79 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests if the preferred script is shown when a page is loaded. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gView = null; - -requestLongerTimeout(2); - -function test() -{ - let expectedScript = "test-script-switching-02.js"; - let expectedScriptShown = false; - let scriptShownUrl = null; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gView = gDebugger.DebuggerView; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gView.Sources.preferredSource = EXAMPLE_URL + expectedScript; - startTest(); - }); - - function onScriptShown(aEvent) - { - expectedScriptShown = aEvent.detail.url.indexOf(expectedScript) != -1; - scriptShownUrl = aEvent.detail.url; - startTest(); - } - - function startTest() - { - if (expectedScriptShown && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function performTest() - { - info("Currently preferred script: " + gView.Sources.preferredValue); - info("Currently selected script: " + gView.Sources.selectedValue); - - isnot(gView.Sources.preferredValue.indexOf(expectedScript), -1, - "The preferred script url wasn't set correctly."); - isnot(gView.Sources.selectedValue.indexOf(expectedScript), -1, - "The selected script isn't the correct one."); - is(gView.Sources.selectedValue, scriptShownUrl, - "The shown script is not the the correct one."); - - closeDebuggerAndFinish(); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gView = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js b/browser/devtools/debugger/test/browser_dbg_reload-same-script.js deleted file mode 100644 index bee00530f..000000000 --- a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js +++ /dev/null @@ -1,218 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests if the same script is shown after a page is reloaded. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gView = null; - -requestLongerTimeout(2); - -function test() -{ - let step = 0; - let expectedScript = ""; - let expectedScriptShown = false; - let scriptShownUrl = null; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gView = gDebugger.DebuggerView; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - startTest(); - }); - - function onScriptShown(aEvent) - { - expectedScriptShown = aEvent.detail.url.indexOf("-01.js") != -1; - scriptShownUrl = aEvent.detail.url; - startTest(); - } - - function onUlteriorScriptShown(aEvent) - { - ok(expectedScript, - "The expected script to show up should have been specified."); - - info("The expected script for this ScriptShown event is: " + expectedScript); - info("The current script for this ScriptShown event is: " + aEvent.detail.url); - - expectedScriptShown = aEvent.detail.url.indexOf(expectedScript) != -1; - scriptShownUrl = aEvent.detail.url; - testScriptShown(); - } - - function startTest() - { - if (expectedScriptShown && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - gDebugger.addEventListener("Debugger:SourceShown", onUlteriorScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: performTest }, 0); - } - } - - function finishTest() - { - if (expectedScriptShown && resumed && testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onUlteriorScriptShown); - closeDebuggerAndFinish(); - } - } - - function performTest() - { - testCurrentScript("-01.js", step); - expectedScript = "-01.js"; - performAction(reloadPage); - } - - function testScriptShown() - { - if (!expectedScriptShown) { - return; - } - step++; - - if (step === 1) { - testCurrentScript("-01.js", step, true); - expectedScript = "-01.js"; - performAction(reloadPage); - } - else if (step === 2) { - testCurrentScript("-01.js", step, true); - expectedScript = "-02.js"; - performAction(switchScript, 1); - } - else if (step === 3) { - testCurrentScript("-02.js", step); - expectedScript = "-02.js"; - performAction(reloadPage); - } - else if (step === 4) { - testCurrentScript("-02.js", step, true); - expectedScript = "-01.js"; - performAction(switchScript, 0); - } - else if (step === 5) { - testCurrentScript("-01.js", step); - expectedScript = "-01.js"; - performAction(reloadPage); - } - else if (step === 6) { - testCurrentScript("-01.js", step, true); - expectedScript = "-01.js"; - performAction(reloadPage); - } - else if (step === 7) { - testCurrentScript("-01.js", step, true); - expectedScript = "-01.js"; - performAction(reloadPage); - } - else if (step === 8) { - testCurrentScript("-01.js", step, true); - expectedScript = "-02.js"; - performAction(switchScript, 1); - } - else if (step === 9) { - testCurrentScript("-02.js", step); - expectedScript = "-02.js"; - performAction(reloadPage); - } - else if (step === 10) { - testCurrentScript("-02.js", step, true); - expectedScript = "-02.js"; - performAction(reloadPage); - } - else if (step === 11) { - testCurrentScript("-02.js", step, true); - expectedScript = "-02.js"; - performAction(reloadPage); - } - else if (step === 12) { - testCurrentScript("-02.js", step, true); - expectedScript = "-01.js"; - performAction(switchScript, 0); - } - else if (step === 13) { - testCurrentScript("-01.js", step); - finishTest(); - } - } - - function testCurrentScript(part, step, isAfterReload) - { - info("Currently preferred script: " + gView.Sources.preferredValue); - info("Currently selected script: " + gView.Sources.selectedValue); - - if (step < 1) { - is(gView.Sources.preferredValue, null, - "The preferred script url should be initially null"); - } - else if (isAfterReload) { - isnot(gView.Sources.preferredValue.indexOf(part), -1, - "The preferred script url wasn't set correctly. (" + step + ")"); - } - - isnot(gView.Sources.selectedValue.indexOf(part), -1, - "The selected script isn't the correct one. (" + step + ")"); - is(gView.Sources.selectedValue, scriptShownUrl, - "The shown script is not the the correct one. (" + step + ")"); - } - - function performAction(callback, data) - { - // Poll every few milliseconds until the scripts are retrieved. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the scripts."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gView.Sources.values.length !== 2) { - return; - } - info("Available scripts: " + gView.Sources.values); - - // We got all the scripts, it's safe to callback. - window.clearInterval(intervalID); - callback(data); - }, 100); - } - - function switchScript(index) - { - gView.Sources.selectedValue = gView.Sources.values[index]; - } - - function reloadPage() - { - gDebuggee.location.reload(); - } - - registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gView = null; - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_script-switching-02.html b/browser/devtools/debugger/test/browser_dbg_script-switching-02.html deleted file mode 100644 index 42d960a15..000000000 --- a/browser/devtools/debugger/test/browser_dbg_script-switching-02.html +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Script Switching Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript" src="test-script-switching-01.js"></script> - <script type="text/javascript" src="test-script-switching-02.js?foo=bar,baz|lol"></script> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_script-switching.html b/browser/devtools/debugger/test/browser_dbg_script-switching.html deleted file mode 100644 index a09789d12..000000000 --- a/browser/devtools/debugger/test/browser_dbg_script-switching.html +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Script Switching Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript" src="test-script-switching-01.js"></script> - <script type="text/javascript" src="test-script-switching-02.js"></script> - </head> - <body> - <button onclick="firstCall()">Click me!</button> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js deleted file mode 100644 index a057c5aa4..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js +++ /dev/null @@ -1,304 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests basic functionality of scripts filtering (token search and line jump). - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchBox = null; - -function test() -{ - requestLongerTimeout(2); - - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testScriptSearching(); - }); - }); -} - -function testScriptSearching() { - let noMatchingSources = gDebugger.L10N.getStr("noMatchingSourcesText"); - let token = ""; - - Services.tm.currentThread.dispatch({ run: function() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - write(":12"); - ok(gEditor.getCaretPosition().line == 11 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - - EventUtils.synthesizeKey("g", { metaKey: true }, gDebugger); - ok(gEditor.getCaretPosition().line == 12 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line after Meta+G"); - - EventUtils.synthesizeKey("n", { ctrlKey: true }, gDebugger); - ok(gEditor.getCaretPosition().line == 13 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line after Ctrl+N"); - - EventUtils.synthesizeKey("G", { metaKey: true, shiftKey: true }, gDebugger); - ok(gEditor.getCaretPosition().line == 12 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line after Meta+Shift+G"); - - EventUtils.synthesizeKey("p", { ctrlKey: true }, gDebugger); - ok(gEditor.getCaretPosition().line == 11 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line after Ctrl+P"); - - for (let i = 0; i < 100; i++) { - EventUtils.sendKey("DOWN", gDebugger); - } - ok(gEditor.getCaretPosition().line == 32 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line after multiple DOWN keys"); - - for (let i = 0; i < 100; i++) { - EventUtils.sendKey("UP", gDebugger); - } - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line after multiple UP keys"); - - - token = "debugger"; - write("#" + token); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor didn't jump to the correct token. (1)"); - - EventUtils.sendKey("DOWN", gDebugger); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (2)"); - - EventUtils.sendKey("DOWN", gDebugger); - ok(gEditor.getCaretPosition().line == 12 && - gEditor.getCaretPosition().col == 8 + token.length, - "The editor didn't jump to the correct token. (3)"); - - EventUtils.sendKey("RETURN", gDebugger); - ok(gEditor.getCaretPosition().line == 19 && - gEditor.getCaretPosition().col == 4 + token.length, - "The editor didn't jump to the correct token. (4)"); - - EventUtils.sendKey("ENTER", gDebugger); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor didn't jump to the correct token. (5)"); - - EventUtils.sendKey("UP", gDebugger); - ok(gEditor.getCaretPosition().line == 19 && - gEditor.getCaretPosition().col == 4 + token.length, - "The editor didn't jump to the correct token. (5.1)"); - - - token = "debugger;"; - write(":bogus#" + token); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (6)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write(":13#" + token); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (7)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write(":#" + token); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (8)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write("::#" + token); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (9)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write(":::#" + token); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (10)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - - write("#" + token + ":bogus"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (6)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write("#" + token + ":13"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (7)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write("#" + token + ":"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (8)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write("#" + token + "::"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (9)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write("#" + token + ":::"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (10)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - - write(":i am not a number"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't remain at the correct token. (11)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - write("#__i do not exist__"); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't remain at the correct token. (12)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - - token = "debugger"; - write("#" + token); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor didn't jump to the correct token. (12.1)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - clear(); - EventUtils.sendKey("RETURN", gDebugger); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor shouldn't jump to another token. (12.2)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - EventUtils.sendKey("ENTER", gDebugger); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor shouldn't jump to another token. (12.3)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - - write(":1:2:3:a:b:c:::12"); - ok(gEditor.getCaretPosition().line == 11 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line. (13)"); - - write("#don't#find#me#instead#find#" + token); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor didn't jump to the correct token. (14)"); - - EventUtils.sendKey("DOWN", gDebugger); - ok(gEditor.getCaretPosition().line == 8 && - gEditor.getCaretPosition().col == 2 + token.length, - "The editor didn't jump to the correct token. (15)"); - - EventUtils.sendKey("DOWN", gDebugger); - ok(gEditor.getCaretPosition().line == 12 && - gEditor.getCaretPosition().col == 8 + token.length, - "The editor didn't jump to the correct token. (16)"); - - EventUtils.sendKey("RETURN", gDebugger); - ok(gEditor.getCaretPosition().line == 19 && - gEditor.getCaretPosition().col == 4 + token.length, - "The editor didn't jump to the correct token. (17)"); - - EventUtils.sendKey("ENTER", gDebugger); - ok(gEditor.getCaretPosition().line == 2 && - gEditor.getCaretPosition().col == 44 + token.length, - "The editor didn't jump to the correct token. (18)"); - - EventUtils.sendKey("UP", gDebugger); - ok(gEditor.getCaretPosition().line == 19 && - gEditor.getCaretPosition().col == 4 + token.length, - "The editor didn't jump to the correct token. (18.1)"); - - - clear(); - ok(gEditor.getCaretPosition().line == 19 && - gEditor.getCaretPosition().col == 4 + token.length, - "The editor didn't remain at the correct token. (19)"); - is(gSources.visibleItems.length, 1, - "Not all the scripts are shown after the search. (20)"); - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice that matches are found."); - - closeDebuggerAndFinish(); - }}, 0); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js deleted file mode 100644 index c9b601334..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js +++ /dev/null @@ -1,267 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests basic functionality of scripts filtering (file search). - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchBox = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gDebugger.DebuggerController.activeThread.resume(function() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - firstSearch(); - }); -} - -function firstSearch() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 4 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line. (1)"); - is(gSources.visibleItems.length, 1, - "Not all the correct scripts are shown after the search. (1)"); - - secondSearch(); - }); - } else { - ok(false, "Get off my lawn."); - } - }); - write(".*-01\.js:5"); -} - -function secondSearch() { - let token = "deb"; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - append("#" + token); - - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length, - "The editor didn't jump to the correct line. (2)"); - is(gSources.visibleItems.length, 1, - "Not all the correct scripts are shown after the search. (2)"); - - waitForFirstScript(); - }); - } else { - ok(false, "Get off my lawn."); - } - }); - gSources.selectedIndex = 1; -} - -function waitForFirstScript() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - thirdSearch(); - }); - } - }); - gSources.selectedIndex = 0; -} - -function thirdSearch() { - let token = "deb"; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length, - "The editor didn't jump to the correct line. (3)"); - is(gSources.visibleItems.length, 1, - "Not all the correct scripts are shown after the search. (3)"); - - fourthSearch(0, "ugger;", token); - }); - } else { - ok(false, "Get off my lawn."); - } - }); - write(".*-02\.js#" + token); -} - -function fourthSearch(i, string, token) { - info("Searchbox value: " + gSearchBox.value); - - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length + i, - "The editor didn't remain at the correct token. (4)"); - - if (string[i]) { - EventUtils.sendChar(string[i], gDebugger); - fourthSearch(i + 1, string, token); - return; - } - - clear(); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length + i, - "The editor didn't remain at the correct token. (5)"); - - executeSoon(function() { - let noMatchingSources = gDebugger.L10N.getStr("noMatchingSourcesText"); - - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the searchbox was emptied."); - is(gSources.selectedIndex, 1, - "The scripts container should have retained its selected index after the searchbox was emptied."); - - write("BOGUS"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length + i, - "The editor didn't remain at the correct token. (6)"); - - is(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should display a notice that no scripts match the searched token."); - is(gSources.visibleItems.length, 0, - "No scripts should be displayed in the scripts container after a bogus search."); - is(gSources.selectedIndex, 1, - "The scripts container should retain its selected index after a bogus search."); - - clear(); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length + i, - "The editor didn't remain at the correct token. (7)"); - - isnot(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should not display a notice after the searchbox was emptied."); - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the searchbox was emptied."); - is(gSources.selectedIndex, 1, - "The scripts container should have retained its selected index after the searchbox was emptied of a bogus search."); - - noMatchingSourcesSingleCharCheck(token, i); - }); -} - -function noMatchingSourcesSingleCharCheck(token, i) { - let noMatchingSources = gDebugger.L10N.getStr("noMatchingSourcesText"); - - write("x"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 8 + token.length + i, - "The editor didn't remain at the correct token. (8)"); - - is(gSources.widget.getAttribute("label"), noMatchingSources, - "The scripts container should display a notice after no matches are found."); - is(gSources.visibleItems.length, 0, - "No scripts should be shown after no matches are found."); - is(gSources.selectedIndex, 1, - "The scripts container should have retained its selected index after no matches are found."); - - closeDebuggerAndFinish(); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js deleted file mode 100644 index 6e7380ef5..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js +++ /dev/null @@ -1,337 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests basic functionality of global search (lowercase + upper case, expected - * UI behavior, number of results found etc.) - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchView = null; -var gSearchBox = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gDebugger.DebuggerController.activeThread.resume(function() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchView = gDebugger.DebuggerView.GlobalSearch; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - firstSearch(); - }); -} - -function firstSearch() { - is(gSearchView.widget._list.childNodes.length, 0, - "The global search pane shouldn't have any child nodes yet."); - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible yet."); - is(gSearchView._splitter.hidden, true, - "The global search pane splitter shouldn't be visible yet."); - - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 0, - "The editor shouldn't have jumped to a matching line yet."); - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the global search."); - - let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results"); - is(scriptResults.length, 2, - "There should be matches found in two scripts."); - - let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]); - let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]); - is(item0.instance.expanded, true, - "The first script results should automatically be expanded.") - is(item1.instance.expanded, false, - "The second script results should not be automatically expanded.") - - let searchResult0 = scriptResults[0].querySelectorAll(".dbg-search-result"); - let searchResult1 = scriptResults[1].querySelectorAll(".dbg-search-result"); - is(searchResult0.length, 1, - "There should be one line result for the first url."); - is(searchResult1.length, 2, - "There should be two line results for the second url."); - - let firstLine0 = searchResult0[0]; - is(firstLine0.querySelector(".dbg-results-line-number").getAttribute("value"), "1", - "The first result for the first script doesn't have the correct line attached."); - - is(firstLine0.querySelectorAll(".dbg-results-line-contents").length, 1, - "The first result for the first script doesn't have the correct number of nodes for a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string").length, 3, - "The first result for the first script doesn't have the correct number of strings in a line."); - - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 1, - "The first result for the first script doesn't have the correct number of matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "de", - "The first result for the first script doesn't have the correct match in a line."); - - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2, - "The first result for the first script doesn't have the correct number of non-matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is ", - "The first result for the first script doesn't have the correct non-matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "dicated to the Public Domain.", - "The first result for the first script doesn't have the correct non-matches in a line."); - - let firstLine1 = searchResult1[0]; - is(firstLine1.querySelector(".dbg-results-line-number").getAttribute("value"), "1", - "The first result for the second script doesn't have the correct line attached."); - - is(firstLine1.querySelectorAll(".dbg-results-line-contents").length, 1, - "The first result for the second script doesn't have the correct number of nodes for a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string").length, 3, - "The first result for the second script doesn't have the correct number of strings in a line."); - - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 1, - "The first result for the second script doesn't have the correct number of matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "de", - "The first result for the second script doesn't have the correct match in a line."); - - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2, - "The first result for the second script doesn't have the correct number of non-matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is ", - "The first result for the second script doesn't have the correct non-matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "dicated to the Public Domain.", - "The first result for the second script doesn't have the correct non-matches in a line."); - - let secondLine1 = searchResult1[1]; - is(secondLine1.querySelector(".dbg-results-line-number").getAttribute("value"), "6", - "The second result for the second script doesn't have the correct line attached."); - - is(secondLine1.querySelectorAll(".dbg-results-line-contents").length, 1, - "The second result for the second script doesn't have the correct number of nodes for a line."); - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string").length, 3, - "The second result for the second script doesn't have the correct number of strings in a line."); - - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 1, - "The second result for the second script doesn't have the correct number of matches in a line."); - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "de", - "The second result for the second script doesn't have the correct match in a line."); - - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2, - "The second result for the second script doesn't have the correct number of non-matches in a line."); - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), ' eval("', - "The second result for the second script doesn't have the correct non-matches in a line."); - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), 'bugger;");', - "The second result for the second script doesn't have the correct non-matches in a line."); - - - secondSearch(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - write("!de"); - }); -} - -function secondSearch() { - isnot(gSearchView.widget._list.childNodes.length, 0, - "The global search pane should have some child nodes from the previous search."); - is(gSearchView.widget._parent.hidden, false, - "The global search pane should be visible from the previous search."); - is(gSearchView._splitter.hidden, false, - "The global search pane splitter should be visible from the previous search."); - - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 0, - "The editor shouldn't have jumped to a matching line yet."); - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the global search."); - - let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results"); - is(scriptResults.length, 2, - "There should be matches found in two scripts."); - - let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]); - let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]); - is(item0.instance.expanded, true, - "The first script results should automatically be expanded.") - is(item1.instance.expanded, false, - "The first script results should not be automatically expanded.") - - let searchResult0 = scriptResults[0].querySelectorAll(".dbg-search-result"); - let searchResult1 = scriptResults[1].querySelectorAll(".dbg-search-result"); - is(searchResult0.length, 1, - "There should be one line result for the first url."); - is(searchResult1.length, 1, - "There should be one line result for the second url."); - - let firstLine0 = searchResult0[0]; - is(firstLine0.querySelector(".dbg-results-line-number").getAttribute("value"), "1", - "The first result for the first script doesn't have the correct line attached."); - - is(firstLine0.querySelectorAll(".dbg-results-line-contents").length, 1, - "The first result for the first script doesn't have the correct number of nodes for a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string").length, 5, - "The first result for the first script doesn't have the correct number of strings in a line."); - - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 2, - "The first result for the first script doesn't have the correct number of matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "ed", - "The first result for the first script doesn't have the correct matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]")[1].getAttribute("value"), "ed", - "The first result for the first script doesn't have the correct matches in a line."); - - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 3, - "The first result for the first script doesn't have the correct number of non-matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is d", - "The first result for the first script doesn't have the correct non-matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "icat", - "The first result for the first script doesn't have the correct non-matches in a line."); - is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[2].getAttribute("value"), " to the Public Domain.", - "The first result for the first script doesn't have the correct non-matches in a line."); - - let firstLine1 = searchResult1[0]; - is(firstLine1.querySelector(".dbg-results-line-number").getAttribute("value"), "1", - "The first result for the second script doesn't have the correct line attached."); - - is(firstLine1.querySelectorAll(".dbg-results-line-contents").length, 1, - "The first result for the second script doesn't have the correct number of nodes for a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string").length, 5, - "The first result for the second script doesn't have the correct number of strings in a line."); - - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 2, - "The first result for the second script doesn't have the correct number of matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "ed", - "The first result for the second script doesn't have the correct matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[1].getAttribute("value"), "ed", - "The first result for the second script doesn't have the correct matches in a line."); - - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 3, - "The first result for the second script doesn't have the correct number of non-matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is d", - "The first result for the second script doesn't have the correct non-matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "icat", - "The first result for the second script doesn't have the correct non-matches in a line."); - is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[2].getAttribute("value"), " to the Public Domain.", - "The first result for the second script doesn't have the correct non-matches in a line."); - - - testClearView(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - backspace(2); - append("ED"); - }); -} - -function testClearView() { - gSearchView.clearView(); - - is(gSearchView.widget._list.childNodes.length, 0, - "The global search pane shouldn't have any child nodes after clearView()."); - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible after clearView()."); - is(gSearchView._splitter.hidden, true, - "The global search pane splitter shouldn't be visible after clearView()."); - - closeDebuggerAndFinish(); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchView = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js deleted file mode 100644 index 55278f437..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js +++ /dev/null @@ -1,285 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests if the global search results switch back and forth, and wrap around - * when switching between them. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchView = null; -var gSearchBox = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gDebugger.DebuggerController.activeThread.resume(function() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchView = gDebugger.DebuggerView.GlobalSearch; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - doSearch(); - }); -} - -function doSearch() { - is(gSearchView.widget._list.childNodes.length, 0, - "The global search pane shouldn't have any child nodes yet."); - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible yet."); - is(gSearchView._splitter.hidden, true, - "The global search pane splitter shouldn't be visible yet."); - - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 0, - "The editor shouldn't have jumped to a matching line yet."); - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the global search."); - - isnot(gSearchView.widget._list.childNodes.length, 0, - "The global search pane should be visible now."); - isnot(gSearchView.widget._parent.hidden, true, - "The global search pane should be visible now."); - isnot(gSearchView._splitter.hidden, true, - "The global search pane splitter should be visible now."); - - doFirstJump(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - write("!eval"); - }); -} - -function doFirstJump() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 4 && - gEditor.getCaretPosition().col == 6, - "The editor didn't jump to the correct line. (1)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (1)"); - - doSecondJump(); - }); - } else { - ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us."); - } - }); - executeSoon(function() { - EventUtils.sendKey("DOWN", gDebugger); - }); -} - -function doSecondJump() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 6, - "The editor didn't jump to the correct line. (2)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (2)"); - - doWrapAroundJump(); - }); - } else { - ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us."); - } - }); - executeSoon(function() { - EventUtils.sendKey("RETURN", gDebugger); - }); -} - -function doWrapAroundJump() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 4 && - gEditor.getCaretPosition().col == 6, - "The editor didn't jump to the correct line. (3)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (3)"); - - doBackwardsWrapAroundJump(); - }); - } else { - ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us."); - } - }); - executeSoon(function() { - EventUtils.sendKey("ENTER", gDebugger); - }); -} - -function doBackwardsWrapAroundJump() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 6, - "The editor didn't jump to the correct line. (4)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (4)"); - - testSearchTokenEmpty(); - }); - } else { - ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us."); - } - }); - executeSoon(function() { - EventUtils.sendKey("UP", gDebugger); - }); -} - -function testSearchTokenEmpty() { - gDebugger.addEventListener("Debugger:GlobalSearch:TokenEmpty", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 6, - "The editor didn't remain at the correct line. (5)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (5)"); - - is(gSearchView.widget._list.childNodes.length, 0, - "The global search pane shouldn't have any child nodes after clear()."); - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible after clear()."); - is(gSearchView._splitter.hidden, true, - "The global search pane splitter shouldn't be visible after clear()."); - - closeDebuggerAndFinish(); - }); - } else { - ok(false, "How did you get here? Go away!"); - } - }); - backspace(4); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function backspace(times) { - for (let i = 0; i < times; i++) { - EventUtils.sendKey("BACK_SPACE", gDebugger); - } -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchView = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js deleted file mode 100644 index d8c33b425..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js +++ /dev/null @@ -1,162 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests if the global search results are cleared on location changes, and - * the expected UI behaviors are triggered. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchView = null; -var gSearchBox = null; - -function test() -{ - requestLongerTimeout(3); - - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gDebugger.DebuggerController.activeThread.resume(function() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchView = gDebugger.DebuggerView.GlobalSearch; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - doSearch(); - }); -} - -function doSearch() { - is(gSearchView.widget._list.childNodes.length, 0, - "The global search pane shouldn't have any child nodes yet."); - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible yet."); - is(gSearchView._splitter.hidden, true, - "The global search pane splitter shouldn't be visible yet."); - - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 0, - "The editor shouldn't have jumped to a matching line yet."); - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the global search."); - - isnot(gSearchView.widget._list.childNodes.length, 0, - "The global search pane should be visible now."); - isnot(gSearchView.widget._parent.hidden, true, - "The global search pane should be visible now."); - isnot(gSearchView._splitter.hidden, true, - "The global search pane splitter should be visible now."); - - testLocationChange(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - write("!eval"); - }); -} - -function testLocationChange() -{ - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired after location change."); - info("Still attached to the tab."); - - executeSoon(function() { - is(gSearchView.widget._list.childNodes.length, 0, - "The global search pane shouldn't have any child nodes after a page navigation."); - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible after a page navigation."); - is(gSearchView._splitter.hidden, true, - "The global search pane splitter shouldn't be visible after a page navigation."); - - closeDebuggerAndFinish(); - }); - }); - - content.location = TAB1_URL; -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchView = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js deleted file mode 100644 index 46422d1f0..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js +++ /dev/null @@ -1,150 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests if the global search results trigger MatchFound and NoMatchFound events - * properly, and triggers the expected UI behavior. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchView = null; -var gSearchBox = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gDebugger.DebuggerController.activeThread.resume(function() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchView = gDebugger.DebuggerView.GlobalSearch; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - doSearch(); - }); -} - -function doSearch() { - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 0, - "The editor shouldn't have jumped to a matching line yet."); - is(gSources.visibleItems.length, 2, - "Not all the scripts are shown after the global search."); - - testSearchMatchNotFound(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - write("!eval"); - }); -} - -function testSearchMatchNotFound() { - gDebugger.addEventListener("Debugger:GlobalSearch:MatchNotFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 0, - "The editor didn't remain at the correct line."); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search."); - - closeDebuggerAndFinish(); - }); - } else { - ok(false, "How did you get here? Go away!"); - } - }); - append("/punch him/"); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchView = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js deleted file mode 100644 index e393db433..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js +++ /dev/null @@ -1,262 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests if the global search results are expanded on scroll or click, and - * clicking matches makes the source editor shows the correct script and - * makes a selection based on the match. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchView = null; -var gSearchBox = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchView = gDebugger.DebuggerView.GlobalSearch; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - doSearch(); -} - -function doSearch() { - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - continueTest(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - write("!a"); - }); -} - -function continueTest() { - let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results"); - is(scriptResults.length, 2, - "There should be matches found in two scripts."); - - testScrollToExpand(scriptResults); - testExpandCollapse(scriptResults); - testAdditionalScrollToExpand(scriptResults); - testClickLineToJump(scriptResults, [testClickMatchToJump, closeDebuggerAndFinish]); -} - -function testScrollToExpand(scriptResults) { - let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]); - let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]); - - is(item0.instance.expanded, true, - "The first script results should automatically be expanded."); - is(item1.instance.expanded, false, - "The first script results should not be automatically expanded."); - - gSearchView._forceExpandResults = true; - gSearchView._onScroll(); - - is(item0.instance.expanded, true, - "The first script results should be expanded after scrolling."); - is(item1.instance.expanded, true, - "The second script results should be expanded after scrolling."); -} - -function testExpandCollapse(scriptResults) { - let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]); - let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]); - let firstHeader = scriptResults[0].querySelector(".dbg-results-header"); - let secondHeader = scriptResults[1].querySelector(".dbg-results-header"); - - EventUtils.sendMouseEvent({ type: "click" }, firstHeader); - EventUtils.sendMouseEvent({ type: "click" }, secondHeader); - - is(item0.instance.expanded, false, - "The first script results should be collapsed on click.") - is(item1.instance.expanded, false, - "The second script results should be collapsed on click.") - - EventUtils.sendMouseEvent({ type: "click" }, firstHeader); - EventUtils.sendMouseEvent({ type: "click" }, secondHeader); - - is(item0.instance.expanded, true, - "The first script results should be expanded on an additional click."); - is(item1.instance.expanded, true, - "The second script results should be expanded on an additional click."); -} - -function testAdditionalScrollToExpand(scriptResults) { - let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]); - let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]); - let firstHeader = scriptResults[0].querySelector(".dbg-results-header"); - let secondHeader = scriptResults[1].querySelector(".dbg-results-header"); - - EventUtils.sendMouseEvent({ type: "click" }, firstHeader); - EventUtils.sendMouseEvent({ type: "click" }, secondHeader); - - is(item0.instance.expanded, false, - "The first script results should be recollapsed on click.") - is(item1.instance.expanded, false, - "The second script results should be recollapsed on click.") - - gSearchView._onScroll(); - - is(item0.instance.expanded, false, - "The first script results should not be automatically re-expanded on scroll after a user collapsed them.") - is(item1.instance.expanded, false, - "The second script results should not be automatically re-expanded on scroll after a user collapsed them.") -} - -function testClickLineToJump(scriptResults, callbacks) { - let targetResults = scriptResults[0]; - let firstHeader = targetResults.querySelector(".dbg-results-header"); - let firstHeaderItem = gDebugger.SourceResults.getItemForElement(firstHeader); - firstHeaderItem.instance.expand() - - is(firstHeaderItem.instance.expanded, true, - "The first script results should be expanded after direct function call."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 4, - "The editor didn't jump to the correct line. (1)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (1)"); - - callbacks[0](scriptResults, callbacks.slice(1)); - }); - } else { - ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us."); - } - }); - - let firstLine = targetResults.querySelector(".dbg-results-line-contents"); - EventUtils.sendMouseEvent({ type: "click" }, firstLine); -} - -function testClickMatchToJump(scriptResults, callbacks) { - let targetResults = scriptResults[1]; - let secondHeader = targetResults.querySelector(".dbg-results-header"); - let secondHeaderItem = gDebugger.SourceResults.getItemForElement(secondHeader); - secondHeaderItem.instance.expand() - - is(secondHeaderItem.instance.expanded, true, - "The second script results should be expanded after direct function call."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + aEvent.detail.url + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 5 && - gEditor.getCaretPosition().col == 5, - "The editor didn't jump to the correct line. (1)"); - is(gSources.visibleItems.length, 2, - "Not all the correct scripts are shown after the search. (1)"); - - callbacks[0](); - }); - } else { - ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us."); - } - }); - - let matches = targetResults.querySelectorAll(".dbg-results-line-contents-string[match=true]"); - let lastMatch = matches[matches.length - 1]; - EventUtils.sendMouseEvent({ type: "click" }, lastMatch); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchView = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js deleted file mode 100644 index 70809fa69..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js +++ /dev/null @@ -1,208 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -/** - * Tests if the global search results are hidden when they're supposed to - * (after a focus lost, or when ESCAPE is pressed). - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchView = null; -var gSearchBox = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gDebugger.SourceResults.prototype.alwaysExpand = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - } - } -} - -function testScriptSearching() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchView = gDebugger.DebuggerView.GlobalSearch; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - - doSearch(); -} - -function doSearch() { - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible yet."); - - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - testFocusLost(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global search."); - } - }); - executeSoon(function() { - write("!a"); - }); -} - -function testFocusLost() -{ - is(gSearchView.widget._parent.hidden, false, - "The global search pane should be visible after a search."); - - gDebugger.addEventListener("Debugger:GlobalSearch:ViewCleared", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - reshowSearch(); - }); - } else { - ok(false, "The current script shouldn't have changed after the global search stopped."); - } - }); - executeSoon(function() { - gDebugger.DebuggerView.editor.focus(); - }); -} - -function reshowSearch() { - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible after the search was stopped."); - - gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - testEscape(); - }); - } else { - ok(false, "The current script shouldn't have changed after a global re-search."); - } - }); - executeSoon(function() { - sendEnter(); - }); -} - -function testEscape() -{ - is(gSearchView.widget._parent.hidden, false, - "The global search pane should be visible after a re-search."); - - gDebugger.addEventListener("Debugger:GlobalSearch:ViewCleared", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("-02.js") != -1) { - executeSoon(function() { - finalCheck(); - }); - } else { - ok(false, "The current script shouldn't have changed after the global search escaped."); - } - }); - executeSoon(function() { - sendEscape(); - }); -} - -function finalCheck() -{ - is(gSearchView.widget._parent.hidden, true, - "The global search pane shouldn't be visible after the search was escaped."); - - closeDebuggerAndFinish(); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function sendEnter() { - gSearchBox.focus(); - EventUtils.sendKey("ENTER", gDebugger); -} - -function sendEscape() { - gSearchBox.focus(); - EventUtils.sendKey("ESCAPE", gDebugger); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchView = null; - gSearchBox = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js deleted file mode 100644 index d688c6c1e..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js +++ /dev/null @@ -1,693 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_update-editor-mode.html"; - -/** - * Tests basic functionality of scripts filtering (file search) helper UI. - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gEditor = null; -var gSources = null; -var gSearchBox = null; -var gFilteredSources = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0); - }); - }); -} - -function testScriptSearching() { - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - gFilteredSources = gDebugger.DebuggerView.FilteredSources; - - firstSearch(); -} - -function firstSearch() { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - for (let i = 0; i < gFilteredSources.itemCount; i++) { - is(gFilteredSources.labels[i], - gDebugger.SourceUtils.trimUrlLength(gSources.labels[i]), - "The filtered sources view should have the correct labels."); - is(gFilteredSources.values[i], - gDebugger.SourceUtils.trimUrlLength(gSources.values[i], 0, "start"), - "The filtered sources view should have the correct values."); - - is(gFilteredSources.visibleItems[i].label, - gDebugger.SourceUtils.trimUrlLength(gSources.labels[i]), - "The filtered sources view should have the correct labels."); - is(gFilteredSources.visibleItems[i].value, - gDebugger.SourceUtils.trimUrlLength(gSources.values[i], 0, "start"), - "The filtered sources view should have the correct values."); - - is(gFilteredSources.visibleItems[i].attachment.fullLabel, gSources.labels[i], - "The filtered sources view should have the correct labels."); - is(gFilteredSources.visibleItems[i].attachment.fullValue, gSources.values[i], - "The filtered sources view should have the correct values."); - } - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("update-editor-mode.html") != -1) { - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - secondSearch(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - write("."); -} - -function secondSearch() { - let sourceshown = false; - let popupshown = false; - let proceeded = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent1(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent1); - sourceshown = true; - executeSoon(proceed); - }); - gDebugger.addEventListener("popupshown", function _onEvent2(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent2); - popupshown = true; - executeSoon(proceed); - }); - - function proceed() { - if (!sourceshown || !popupshown || proceeded) { - return; - } - proceeded = true; - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 1, - "The filtered sources view should have 1 items available."); - is(gFilteredSources.visibleItems.length, 1, - "The filtered sources view should have 1 items visible."); - - for (let i = 0; i < gFilteredSources.itemCount; i++) { - is(gFilteredSources.labels[i], - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label), - "The filtered sources view should have the correct labels."); - is(gFilteredSources.values[i], - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"), - "The filtered sources view should have the correct values."); - - is(gFilteredSources.visibleItems[i].label, - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label), - "The filtered sources view should have the correct labels."); - is(gFilteredSources.visibleItems[i].value, - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"), - "The filtered sources view should have the correct values."); - - is(gFilteredSources.visibleItems[i].attachment.fullLabel, gSources.visibleItems[i].label, - "The filtered sources view should have the correct labels."); - is(gFilteredSources.visibleItems[i].attachment.fullValue, gSources.visibleItems[i].value, - "The filtered sources view should have the correct values."); - } - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("test-script-switching-01.js") != -1) { - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 1, - "Not all the correct scripts are shown after the search."); - - thirdSearch(); - }); - } else { - ok(false, "How did you get here?"); - } - } - write(".-0"); -} - -function thirdSearch() { - let sourceshown = false; - let popupshown = false; - let proceeded = false; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent1(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent1); - sourceshown = true; - executeSoon(proceed); - }); - gDebugger.addEventListener("popupshown", function _onEvent2(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent2); - popupshown = true; - executeSoon(proceed); - }); - - function proceed() { - if (!sourceshown || !popupshown || proceeded) { - return; - } - proceeded = true; - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - for (let i = 0; i < gFilteredSources.itemCount; i++) { - is(gFilteredSources.labels[i], - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label), - "The filtered sources view should have the correct labels."); - is(gFilteredSources.values[i], - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"), - "The filtered sources view should have the correct values."); - - is(gFilteredSources.visibleItems[i].label, - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label), - "The filtered sources view should have the correct labels."); - is(gFilteredSources.visibleItems[i].value, - gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"), - "The filtered sources view should have the correct values."); - - is(gFilteredSources.visibleItems[i].attachment.fullLabel, gSources.visibleItems[i].label, - "The filtered sources view should have the correct labels."); - is(gFilteredSources.visibleItems[i].attachment.fullValue, gSources.visibleItems[i].value, - "The filtered sources view should have the correct values."); - } - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("update-editor-mode.html") != -1) { - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - goDown(); - }); - } else { - ok(false, "How did you get here?"); - } - } - write(".-"); -} - -function goDown() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("test-editor-mode") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - goDownAgain(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - EventUtils.sendKey("DOWN", gDebugger); -} - -function goDownAgain() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("test-script-switching-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - goDownAndWrap(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - EventUtils.synthesizeKey("g", { metaKey: true }, gDebugger); -} - -function goDownAndWrap() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("update-editor-mode.html") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - goUpAndWrap(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - EventUtils.synthesizeKey("n", { ctrlKey: true }, gDebugger); -} - -function goUpAndWrap() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("test-script-switching-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - clickAndSwitch(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - EventUtils.sendKey("UP", gDebugger); -} - -function clickAndSwitch() { - let sourceshown = false; - let popuphidden = false; - let popupshown = false; - let reopened = false; - let proceeded = false; - - gDebugger.addEventListener("popuphidden", function _onEvent2(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent2); - info("Popup was hidden..."); - popuphidden = true; - - gDebugger.addEventListener("popupshown", function _onEvent3(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent3); - info("Popup was shown..."); - popupshown = true; - - proceed(); - }); - - reopen(); - }); - - function reopen() { - if (!sourceshown || !popuphidden || reopened) { - return; - } - info("Reopening popup..."); - reopened = true; - append(".-"); - } - - function proceed() { - if (!sourceshown || !popuphidden || !popupshown || proceeded) { - return; - } - info("Proceeding with next test..."); - proceeded = true; - executeSoon(clickAndSwitchAgain); - } - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("update-editor-mode.html") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - info("Source was shown and verified"); - sourceshown = true; - reopen(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - - ok(gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[0] - .classList.contains("results-panel-item"), - "The first visible item target isn't the correct one."); - - EventUtils.sendMouseEvent({ type: "click" }, - gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[0], - gDebugger); -} - -function clickAndSwitchAgain() { - let sourceshown = false; - let popuphidden = false; - let popupshown = false; - let reopened = false; - let proceeded = false; - - gDebugger.addEventListener("popuphidden", function _onEvent2(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent2); - info("Popup was hidden..."); - popuphidden = true; - - gDebugger.addEventListener("popupshown", function _onEvent3(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent3); - info("Popup was shown..."); - popupshown = true; - - proceed(); - }); - - reopen(); - }); - - function reopen() { - if (!sourceshown || !popuphidden || reopened) { - return; - } - info("Reopening popup..."); - reopened = true; - append(".-"); - } - - function proceed() { - if (!sourceshown || !popuphidden || !popupshown || proceeded) { - return; - } - info("Proceeding with next test..."); - proceeded = true; - executeSoon(switchFocusWithEscape); - } - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - is(gFilteredSources.itemCount, 3, - "The filtered sources view should have 3 items available."); - is(gFilteredSources.visibleItems.length, 3, - "The filtered sources view should have 3 items visible."); - - is(gFilteredSources.selectedValue, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"), - "The correct item should be selected in the filtered sources view"); - is(gFilteredSources.selectedLabel, - gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel), - "The correct item should be selected in the filtered sources view"); - - let url = gSources.selectedValue; - if (url.indexOf("test-script-switching-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - info("Source was shown and verified"); - sourceshown = true; - reopen(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - - ok(gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[2] - .classList.contains("results-panel-item"), - "The first visible item target isn't the correct one."); - - EventUtils.sendMouseEvent({ type: "click" }, - gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[2], - gDebugger); -} - -function switchFocusWithEscape() { - gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("update-editor-mode.html") != -1) { - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - focusAgainAfterEscape(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - EventUtils.sendKey("ESCAPE", gDebugger); -} - -function focusAgainAfterEscape() { - gDebugger.addEventListener("popupshown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("test-script-switching-01.js") != -1) { - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 1, - "Not all the correct scripts are shown after the search."); - - switchFocusWithReturn(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - append("0"); -} - -function switchFocusWithReturn() { - gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - - info("Current script url:\n" + gSources.selectedValue + "\n"); - info("Debugger editor text:\n" + gEditor.getText() + "\n"); - - let url = gSources.selectedValue; - if (url.indexOf("test-script-switching-01.js") != -1) { - - executeSoon(function() { - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); - ok(gEditor.getCaretPosition().line == 0 && - gEditor.getCaretPosition().col == 0, - "The editor didn't jump to the correct line."); - is(gSources.visibleItems.length, 3, - "Not all the correct scripts are shown after the search."); - - closeDebuggerAndFinish(); - }); - } else { - ok(false, "How did you get here?"); - } - }); - EventUtils.sendKey("RETURN", gDebugger); -} - -function clear() { - gSearchBox.focus(); - gSearchBox.value = ""; -} - -function write(text) { - clear(); - append(text); -} - -function append(text) { - gSearchBox.focus(); - - for (let i = 0; i < text.length; i++) { - EventUtils.sendChar(text[i], gDebugger); - } - info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n"); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gSearchBox = null; - gFilteredSources = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js deleted file mode 100644 index 0eddd95fc..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js +++ /dev/null @@ -1,57 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gSearchBox = null; -var gSearchBoxPanel = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - runTest(); - }); -} - -function runTest() { - gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; - gSearchBoxPanel = gDebugger.DebuggerView.Filtering._searchboxHelpPanel; - - focusSearchbox(); -} - -function focusSearchbox() { - is(gSearchBoxPanel.state, "closed", - "The search box panel shouldn't be visible yet."); - - gSearchBoxPanel.addEventListener("popupshown", function _onEvent(aEvent) { - gSearchBoxPanel.removeEventListener(aEvent.type, _onEvent); - - is(gSearchBoxPanel.state, "open", - "The search box panel should be visible after searching started."); - - closeDebuggerAndFinish(); - }); - - EventUtils.sendMouseEvent({ type: "click" }, gSearchBox); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSearchBox = null; - gSearchBoxPanel = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js b/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js deleted file mode 100644 index 821d285cb..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js +++ /dev/null @@ -1,124 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - resumeAndFinish(); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -function resumeAndFinish() { - gDebugger.DebuggerController.activeThread.resume(function() { - checkScriptsOrder(); - addScriptAndCheckOrder(1, function() { - addScriptAndCheckOrder(2, function() { - addScriptAndCheckOrder(3, function() { - closeDebuggerAndFinish(); - }); - }); - }); - }); -} - -function addScriptAndCheckOrder(method, callback) { - let sv = gDebugger.SourceUtils; - let vs = gDebugger.DebuggerView.Sources; - vs.empty(); - vs.widget.removeEventListener("select", vs._onScriptsChange, false); - - let urls = [ - { href: "ici://some.address.com/random/", leaf: "subrandom/" }, - { href: "ni://another.address.org/random/subrandom/", leaf: "page.html" }, - { href: "san://interesting.address.gro/random/", leaf: "script.js" }, - { href: "si://interesting.address.moc/random/", leaf: "script.js" }, - { href: "si://interesting.address.moc/random/", leaf: "x/script.js" }, - { href: "si://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" }, - { href: "si://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2" }, - { href: "si://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3" } - ]; - - urls.sort(function(a, b) { - return Math.random() - 0.5; - }); - - switch (method) { - case 1: - urls.forEach(function(url) { - let loc = url.href + url.leaf; - vs.push([sv.getSourceLabel(loc), { url: loc }], { staged: true }); - }); - vs.commit({ sorted: true }); - break; - - case 2: - urls.forEach(function(url) { - let loc = url.href + url.leaf; - vs.push([sv.getSourceLabel(loc), { url: loc }]); - }); - break; - - case 3: - let i = 0 - for (; i < urls.length / 2; i++) { - let url = urls[i]; - let loc = url.href + url.leaf; - vs.push([sv.getSourceLabel(loc), { url: loc }], { staged: true }); - } - vs.commit({ sorted: true }); - - for (; i < urls.length; i++) { - let url = urls[i]; - let loc = url.href + url.leaf; - vs.push([sv.getSourceLabel(loc), { url: loc }]); - } - break; - } - - executeSoon(function() { - checkScriptsOrder(method); - callback(); - }); -} - -function checkScriptsOrder(method) { - let labels = gDebugger.DebuggerView.Sources.labels; - let sorted = labels.reduce(function(prev, curr, index, array) { - return array[index - 1] < array[index]; - }); - - ok(sorted, - "Using method " + method + ", " + - "the scripts weren't in the correct order: " + labels.toSource()); - - return sorted; -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js b/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js deleted file mode 100644 index b444ae100..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js +++ /dev/null @@ -1,175 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that switching the displayed script in the UI works as advertised - * when urls are escaped. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching-02.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gSources = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0); - } - } -} - -function testScriptsDisplay() { - gSources = gDebugger.DebuggerView.Sources; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 2, - "Found the expected number of scripts."); - - for (let i = 0; i < gSources.itemCount; i++) { - info("label: " + i + " " + gSources.getItemAtIndex(i).target.getAttribute("label")); - } - - let label1 = "test-script-switching-01.js"; - let label2 = "test-script-switching-02.js"; - let params = "?foo=bar,baz|lol"; - - ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL + - label1), "First script url is incorrect."); - ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL + - label2 + params), "Second script url is incorrect."); - - ok(gDebugger.DebuggerView.Sources.containsLabel( - label1), "First script label is incorrect."); - ok(gDebugger.DebuggerView.Sources.containsLabel( - label2), "Second script label is incorrect."); - - ok(gDebugger.DebuggerView.Sources.selectedItem, - "There should be a selected item in the sources pane."); - is(gDebugger.DebuggerView.Sources.selectedLabel, - label2, "The selected label is the sources pane is incorrect."); - is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL + - label2 + params, "The selected value is the sources pane is incorrect."); - - ok(gDebugger.editor.getText().search(/debugger/) != -1, - "The correct script was loaded initially."); - - is(gDebugger.editor.getDebugLocation(), 5, - "Editor debugger location is correct."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testSwitch1(); - } - }); - - gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label1; -} - -function testSwitch1() { - dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n"); - - let label1 = "test-script-switching-01.js"; - let label2 = "test-script-switching-02.js"; - let params = "?foo=bar,baz|lol"; - - ok(gDebugger.DebuggerView.Sources.selectedItem, - "There should be a selected item in the sources pane."); - is(gDebugger.DebuggerView.Sources.selectedLabel, - label1, "The selected label is the sources pane is incorrect."); - is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL + - label1, "The selected value is the sources pane is incorrect."); - - ok(gDebugger.editor.getText().search(/debugger/) == -1, - "The second script is no longer displayed."); - - ok(gDebugger.editor.getText().search(/firstCall/) != -1, - "The first script is displayed."); - - is(gDebugger.editor.getDebugLocation(), -1, - "Editor debugger location has been cleared."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testSwitch2(); - } - }); - - gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label2 + params; -} - -function testSwitch2() { - dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n"); - - let label1 = "test-script-switching-01.js"; - let label2 = "test-script-switching-02.js"; - let params = "?foo=bar,baz|lol"; - - ok(gDebugger.DebuggerView.Sources.selectedItem, - "There should be a selected item in the sources pane."); - is(gDebugger.DebuggerView.Sources.selectedLabel, - label2, "The selected label is the sources pane is incorrect."); - is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL + - label2 + params, "The selected value is the sources pane is incorrect."); - - ok(gDebugger.editor.getText().search(/debugger/) != -1, - "The correct script was loaded initially."); - - is(gDebugger.editor.getDebugLocation(), 5, - "Editor debugger location is correct."); - - closeDebuggerAndFinish(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSources = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-switching.js b/browser/devtools/debugger/test/browser_dbg_scripts-switching.js deleted file mode 100644 index e291bf7c9..000000000 --- a/browser/devtools/debugger/test/browser_dbg_scripts-switching.js +++ /dev/null @@ -1,178 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that switching the displayed script in the UI works as advertised. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gSources = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) - { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0); - } - } -} - -function testScriptsDisplay() { - gSources = gDebugger.DebuggerView.Sources; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 2, - "Found the expected number of scripts."); - - for (let i = 0; i < gSources.itemCount; i++) { - info("label: " + i + " " + gSources.getItemAtIndex(i).target.getAttribute("label")); - } - - let label1 = "test-script-switching-01.js"; - let label2 = "test-script-switching-02.js"; - - ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL + - label1), "First script url is incorrect."); - ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL + - label2), "Second script url is incorrect."); - - ok(gDebugger.DebuggerView.Sources.containsLabel( - label1), "First script label is incorrect."); - ok(gDebugger.DebuggerView.Sources.containsLabel( - label2), "Second script label is incorrect."); - - ok(gDebugger.DebuggerView.Sources.selectedItem, - "There should be a selected item in the sources pane."); - is(gDebugger.DebuggerView.Sources.selectedLabel, - label2, "The selected label is the sources pane is incorrect."); - is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL + - label2, "The selected value is the sources pane is incorrect."); - - ok(gDebugger.editor.getText().search(/debugger/) != -1, - "The correct script was loaded initially."); - - is(gDebugger.editor.getDebugLocation(), 5, - "editor debugger location is correct."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testSwitchPaused(); - } - }); - - gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label1; -} - -function testSwitchPaused() -{ - dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n"); - - let label1 = "test-script-switching-01.js"; - let label2 = "test-script-switching-02.js"; - - ok(gDebugger.DebuggerView.Sources.selectedItem, - "There should be a selected item in the sources pane."); - is(gDebugger.DebuggerView.Sources.selectedLabel, - label1, "The selected label is the sources pane is incorrect."); - is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL + - label1, "The selected value is the sources pane is incorrect."); - - ok(gDebugger.editor.getText().search(/debugger/) == -1, - "The second script is no longer displayed."); - - ok(gDebugger.editor.getText().search(/firstCall/) != -1, - "The first script is displayed."); - - is(gDebugger.editor.getDebugLocation(), -1, - "Editor debugger location has been cleared."); - - gDebugger.DebuggerController.activeThread.resume(function() { - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testSwitchRunning(); - } - }); - - gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label2; - }); -} - -function testSwitchRunning() -{ - dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n"); - - let label1 = "test-script-switching-01.js"; - let label2 = "test-script-switching-02.js"; - - ok(gDebugger.DebuggerView.Sources.selectedItem, - "There should be a selected item in the sources pane."); - is(gDebugger.DebuggerView.Sources.selectedLabel, - label2, "The selected label is the sources pane is incorrect."); - is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL + - label2, "The selected value is the sources pane is incorrect."); - - ok(gDebugger.editor.getText().search(/debugger/) != -1, - "The second script is displayed again."); - - ok(gDebugger.editor.getText().search(/firstCall/) == -1, - "The first script is no longer displayed."); - - is(gDebugger.editor.getDebugLocation(), -1, - "Editor debugger location is still -1."); - - closeDebuggerAndFinish(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSources = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_select-line.js b/browser/devtools/debugger/test/browser_dbg_select-line.js deleted file mode 100644 index bb18ea651..000000000 --- a/browser/devtools/debugger/test/browser_dbg_select-line.js +++ /dev/null @@ -1,122 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that selecting a stack frame loads the right script in the editor - * pane and highlights the proper line. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gSources = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let testStarted = false; - let resumed = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gSources = gDebugger.DebuggerView.Sources; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) { - scriptShown = aEvent.detail.url.indexOf("-02.js") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: testSelectLine }, 0); - } - } -} - -function testSelectLine() { - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 2, "Found the expected number of scripts."); - - ok(gDebugger.editor.getText().search(/debugger/) != -1, - "The correct script was loaded initially."); - - // Yield control back to the event loop so that the debugger has a - // chance to highlight the proper line. - executeSoon(function() { - // getCaretPosition is 0-based. - is(gDebugger.editor.getCaretPosition().line, 5, - "The correct line is selected."); - - gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, function onChange() { - // Wait for the actual text to be shown. - if (gDebugger.editor.getText() == gDebugger.L10N.getStr("loadingText")) { - return; - } - // The requested source text has been shown, remove the event listener. - gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onChange); - - ok(gDebugger.editor.getText().search(/debugger/) == -1, - "The second script is no longer displayed."); - - ok(gDebugger.editor.getText().search(/firstCall/) != -1, - "The first script is displayed."); - - // Yield control back to the event loop so that the debugger has a - // chance to highlight the proper line. - executeSoon(function(){ - // getCaretPosition is 0-based. - is(gDebugger.editor.getCaretPosition().line, 4, - "The correct line is selected."); - - closeDebuggerAndFinish(); - }); - }); - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(frames.querySelectorAll(".dbg-stackframe").length, 4, - "Should have two frames."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - frames.querySelector("#stackframe-3"), - gDebugger); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSources = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_source_maps-01.js b/browser/devtools/debugger/test/browser_dbg_source_maps-01.js deleted file mode 100644 index c8ff8aae9..000000000 --- a/browser/devtools/debugger/test/browser_dbg_source_maps-01.js +++ /dev/null @@ -1,156 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test that we can set breakpoints and step through source mapped coffee - * script. - */ - -const TAB_URL = EXAMPLE_URL + "binary_search.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", true); - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - resumed = true; - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) { - gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown); - ok(aEvent.detail.url.indexOf(".coffee") != -1, - "The debugger should show the source mapped coffee script file."); - ok(gDebugger.editor.getText().search(/isnt/) != -1, - "The debugger's editor should have the coffee script source displayed."); - - testSetBreakpoint(); - }); - }); -} - -function testSetBreakpoint() { - let { activeThread } = gDebugger.DebuggerController; - activeThread.interrupt(function (aResponse) { - activeThread.setBreakpoint({ - url: EXAMPLE_URL + "binary_search.coffee", - line: 5 - }, function (aResponse, bpClient) { - ok(!aResponse.error, - "Should be able to set a breakpoint in a coffee script file."); - testSetBreakpointBlankLine(); - }); - }); -} - -function testSetBreakpointBlankLine() { - let { activeThread } = gDebugger.DebuggerController; - activeThread.setBreakpoint({ - url: EXAMPLE_URL + "binary_search.coffee", - line: 3 - }, function (aResponse, bpClient) { - ok(aResponse.actualLocation, - "Because 3 is empty, we should have an actualLocation"); - is(aResponse.actualLocation.url, EXAMPLE_URL + "binary_search.coffee", - "actualLocation.url should be source mapped to the coffee file"); - is(aResponse.actualLocation.line, 2, - "actualLocation.line should be source mapped back to 2"); - testHitBreakpoint(); - }); -} - -function testHitBreakpoint() { - let { activeThread } = gDebugger.DebuggerController; - activeThread.resume(function (aResponse) { - ok(!aResponse.error, "Shouldn't get an error resuming"); - is(aResponse.type, "resumed", "Type should be 'resumed'"); - - activeThread.addOneTimeListener("paused", function (aEvent, aPacket) { - is(aPacket.type, "paused", - "We should now be paused again"); - is(aPacket.why.type, "breakpoint", - "and the reason we should be paused is because we hit a breakpoint"); - - // Check that we stopped at the right place, by making sure that the - // environment is in the state that we expect. - is(aPacket.frame.environment.bindings.variables.start.value, 0, - "'start' is 0"); - is(aPacket.frame.environment.bindings.variables.stop.value.type, "undefined", - "'stop' hasn't been assigned to yet"); - is(aPacket.frame.environment.bindings.variables.pivot.value.type, "undefined", - "'pivot' hasn't been assigned to yet"); - - waitForCaretPos(4, testStepping); - }); - - // This will cause the breakpoint to be hit, and put us back in the paused - // state. - executeSoon(function() { - gDebuggee.binary_search([0, 2, 3, 5, 7, 10], 5); - }); - }); -} - -function testStepping() { - let { activeThread } = gDebugger.DebuggerController; - activeThread.stepIn(function (aResponse) { - ok(!aResponse.error, "Shouldn't get an error resuming"); - is(aResponse.type, "resumed", "Type should be 'resumed'"); - - // After stepping, we will pause again, so listen for that. - activeThread.addOneTimeListener("paused", function (aEvent, aPacket) { - - // Check that we stopped at the right place, by making sure that the - // environment is in the state that we expect. - is(aPacket.frame.environment.bindings.variables.start.value, 0, - "'start' is 0"); - is(aPacket.frame.environment.bindings.variables.stop.value, 5, - "'stop' hasn't been assigned to yet"); - is(aPacket.frame.environment.bindings.variables.pivot.value.type, "undefined", - "'pivot' hasn't been assigned to yet"); - - waitForCaretPos(5, closeDebuggerAndFinish); - }); - }); -} - -function waitForCaretPos(number, callback) -{ - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gDebugger.DebuggerView.editor.getCaretPosition().line != number) { - return; - } - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); -} - -registerCleanupFunction(function() { - Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", false); - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_source_maps-02.js b/browser/devtools/debugger/test/browser_dbg_source_maps-02.js deleted file mode 100644 index 40a5fa0bb..000000000 --- a/browser/devtools/debugger/test/browser_dbg_source_maps-02.js +++ /dev/null @@ -1,205 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test that we can toggle between the original and generated sources. - */ - -const TAB_URL = EXAMPLE_URL + "binary_search.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gPrevPref = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let resumed = false; - let testStarted = false; - - gPrevPref = Services.prefs.getBoolPref( - "devtools.debugger.source-maps-enabled"); - Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", true); - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - resumed = true; - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) { - gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown); - // Show original sources should be already enabled. - is(gPrevPref, false, - "The source maps functionality should be disabled by default."); - is(gDebugger.Prefs.sourceMapsEnabled, true, - "The source maps pref should be true from startup."); - is(gDebugger.DebuggerView.Options._showOriginalSourceItem.getAttribute("checked"), - "true", "Source maps should be enabled from startup. ") - - ok(aEvent.detail.url.indexOf(".coffee") != -1, - "The debugger should show the source mapped coffee script file."); - ok(aEvent.detail.url.indexOf(".js") == -1, - "The debugger should not show the generated js script file."); - ok(gDebugger.editor.getText().search(/isnt/) != -1, - "The debugger's editor should have the coffee script source displayed."); - ok(gDebugger.editor.getText().search(/function/) == -1, - "The debugger's editor should not have the JS source displayed."); - - testToggleGeneratedSource(); - }); - }); -} - -function testToggleGeneratedSource() { - gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) { - gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown); - - is(gDebugger.Prefs.sourceMapsEnabled, false, - "The source maps pref should have been set to false."); - is(gDebugger.DebuggerView.Options._showOriginalSourceItem.getAttribute("checked"), - "false", "Source maps should be enabled from startup. ") - - ok(aEvent.detail.url.indexOf(".coffee") == -1, - "The debugger should not show the source mapped coffee script file."); - ok(aEvent.detail.url.indexOf(".js") != -1, - "The debugger should show the generated js script file."); - ok(gDebugger.editor.getText().search(/isnt/) == -1, - "The debugger's editor should have the coffee script source displayed."); - ok(gDebugger.editor.getText().search(/function/) != -1, - "The debugger's editor should not have the JS source displayed."); - - testSetBreakpoint(); - }); - - // Disable source maps. - gDebugger.DebuggerView.Options._showOriginalSourceItem.setAttribute("checked", - "false"); - gDebugger.DebuggerView.Options._toggleShowOriginalSource(); - gDebugger.DebuggerView.Options._onPopupHidden(); -} - -function testSetBreakpoint() { - let { activeThread } = gDebugger.DebuggerController; - activeThread.setBreakpoint({ - url: EXAMPLE_URL + "binary_search.js", - line: 7 - }, function (aResponse, bpClient) { - ok(!aResponse.error, - "Should be able to set a breakpoint in a JavaScript file."); - testHitBreakpoint(); - }); -} - -function testHitBreakpoint() { - let { activeThread } = gDebugger.DebuggerController; - activeThread.resume(function (aResponse) { - ok(!aResponse.error, "Shouldn't get an error resuming"); - is(aResponse.type, "resumed", "Type should be 'resumed'"); - - activeThread.addOneTimeListener("framesadded", function (aEvent, aPacket) { - // Make sure that we have JavaScript stack frames. - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Correct number of frames."); - ok(frames.querySelector("#stackframe-0 .dbg-stackframe-details") - .getAttribute("value").search(/js/), - "First frame should be a JS frame."); - - waitForCaretPos(6, testToggleOnPause); - }); - - // This will cause the breakpoint to be hit, and put us back in the paused - // stated. - executeSoon(function() { - gDebuggee.binary_search([0, 2, 3, 5, 7, 10], 5); - }); - }); -} - -function testToggleOnPause() { - gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) { - gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown); - - is(gDebugger.Prefs.sourceMapsEnabled, true, - "The source maps pref should have been set to true."); - is(gDebugger.DebuggerView.Options._showOriginalSourceItem.getAttribute("checked"), - "true", "Source maps should be enabled. ") - - ok(aEvent.detail.url.indexOf(".coffee") != -1, - "The debugger should show the source mapped coffee script file."); - ok(aEvent.detail.url.indexOf(".js") == -1, - "The debugger should not show the generated js script file."); - ok(gDebugger.editor.getText().search(/isnt/) != -1, - "The debugger's editor should not have the coffee script source displayed."); - ok(gDebugger.editor.getText().search(/function/) == -1, - "The debugger's editor should have the JS source displayed."); - - // Make sure that we have coffee script stack frames. - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Correct number of frames."); - ok(frames.querySelector("#stackframe-0 .dbg-stackframe-details") - .getAttribute("value").search(/coffee/), - "First frame should be a coffee script frame."); - - waitForCaretPos(4, resumeAndFinish); - }); - - // Enable source maps. - gDebugger.DebuggerView.Options._showOriginalSourceItem.setAttribute("checked", - "true"); - gDebugger.DebuggerView.Options._toggleShowOriginalSource(); - gDebugger.DebuggerView.Options._onPopupHidden(); -} - -function resumeAndFinish() -{ - let { activeThread } = gDebugger.DebuggerController; - activeThread.resume(function (aResponse) { - ok(!aResponse.error, "Shouldn't get an error resuming"); - is(aResponse.type, "resumed", "Type should be 'resumed'"); - - closeDebuggerAndFinish(); - }); -} - -function waitForCaretPos(number, callback) -{ - // Poll every few milliseconds until the source editor line is active. - let count = 0; - let intervalID = window.setInterval(function() { - info("count: " + count + " "); - if (++count > 50) { - ok(false, "Timed out while polling for the line."); - window.clearInterval(intervalID); - return closeDebuggerAndFinish(); - } - if (gDebugger.DebuggerView.editor.getCaretPosition().line != number) { - return; - } - is(gDebugger.DebuggerView.editor.getCaretPosition().line, number, - "The right line is focused.") - // We got the source editor at the expected line, it's safe to callback. - window.clearInterval(intervalID); - callback(); - }, 100); -} - -registerCleanupFunction(function() { - Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", false); - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gPrevPref = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_sources-cache.js b/browser/devtools/debugger/test/browser_dbg_sources-cache.js deleted file mode 100644 index b8533c25f..000000000 --- a/browser/devtools/debugger/test/browser_dbg_sources-cache.js +++ /dev/null @@ -1,167 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_function-search-01.html"; - -/** - * Tests if the sources cache knows how to cache sources when prompted. - */ - -let gPane = null; -let gTab = null; -let gDebuggee = null; -let gDebugger = null; -let gEditor = null; -let gSources = null; -let gControllerSources = null; -let gPrevLabelsCache = null; -let gPrevGroupsCache = null; -const TOTAL_SOURCES = 3; - -requestLongerTimeout(2); - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - Services.tm.currentThread.dispatch({ run: testSourcesCache }, 0); - }); - }); -} - -function testSourcesCache() -{ - gEditor = gDebugger.DebuggerView.editor; - gSources = gDebugger.DebuggerView.Sources; - gControllerSources = gDebugger.DebuggerController.SourceScripts; - - ok(gEditor.getText().contains("First source!"), - "Editor text contents appears to be correct."); - is(gSources.selectedLabel, "test-function-search-01.js", - "The currently selected label in the sources container is correct."); - ok(gSources.selectedValue.contains("test-function-search-01.js"), - "The currently selected value in the sources container appears to be correct."); - - is(gSources.itemCount, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " sources present in the sources list."); - is(gSources.visibleItems.length, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " sources visible in the sources list."); - is(gSources.labels.length, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " labels stored in the sources container model.") - is(gSources.values.length, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " values stored in the sources container model.") - - info("Source labels: " + gSources.labels.toSource()); - info("Source values: " + gSources.values.toSource()); - - is(gSources.labels.sort()[0], "test-function-search-01.js", - "The first source label is correct."); - ok(gSources.values.sort()[0].contains("test-function-search-01.js"), - "The first source value appears to be correct."); - - is(gSources.labels.sort()[1], "test-function-search-02.js", - "The second source label is correct."); - ok(gSources.values.sort()[1].contains("test-function-search-02.js"), - "The second source value appears to be correct."); - - is(gSources.labels.sort()[2], "test-function-search-03.js", - "The third source label is correct."); - ok(gSources.values.sort()[2].contains("test-function-search-03.js"), - "The third source value appears to be correct."); - - is(gDebugger.SourceUtils._labelsCache.size, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " labels cached"); - is(gDebugger.SourceUtils._groupsCache.size, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " groups cached"); - - gPrevLabelsCache = gDebugger.SourceUtils._labelsCache; - gPrevGroupsCache = gDebugger.SourceUtils._groupsCache; - - fetchSources(function() { - performReload(function() { - closeDebuggerAndFinish(); - }); - }); -} - -function fetchSources(callback) { - gControllerSources.getTextForSources(gSources.values).then((aSources) => { - testCacheIntegrity(aSources); - callback(); - }); -} - -function performReload(callback) { - gDebugger.DebuggerController._target.once("will-navigate", testStateBeforeReload); - gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) { - ok(true, "tabNavigated event was fired."); - info("Still attached to the tab."); - - testStateAfterReload(); - callback(); - }); - - gDebuggee.location.reload(); -} - -function testStateBeforeReload() { - is(gSources.itemCount, 0, - "There should be no sources present in the sources list during reload."); - is(gControllerSources.getCache().length, 0, - "The sources cache should be empty during reload."); - is(gDebugger.SourceUtils._labelsCache, gPrevLabelsCache, - "The labels cache has been refreshed during reload and no new objects were created."); - is(gDebugger.SourceUtils._groupsCache, gPrevGroupsCache, - "The groups cache has been refreshed during reload and no new objects were created."); - is(gDebugger.SourceUtils._labelsCache.size, 0, - "There should be no labels cached during reload"); - is(gDebugger.SourceUtils._groupsCache.size, 0, - "There should be no groups cached during reload"); -} - -function testStateAfterReload() { - is(gSources.itemCount, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " sources present in the sources list."); - is(gDebugger.SourceUtils._labelsCache.size, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " labels cached after reload."); - is(gDebugger.SourceUtils._groupsCache.size, TOTAL_SOURCES, - "There should be " + TOTAL_SOURCES + " groups cached after reload."); -} - -function testCacheIntegrity(aCache) { - for (let source of aCache) { - let [url, contents] = source; - - // Sources of a debugee don't always finish fetching consecutively. D'uh. - let index = url.match(/test-function-search-0(\d)/).pop(); - - ok(index >= 1 && index <= TOTAL_SOURCES, - "Found a source url cached correctly (" + index + ")"); - ok(contents.contains( - ["First source!", "Second source!", "Third source!"][index - 1]), - "Found a source's text contents cached correctly (" + index + ")"); - - info("Cached source url at " + index + ": " + url); - info("Cached source text at " + index + ": " + contents); - } -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gEditor = null; - gSources = null; - gControllerSources = null; - gPrevLabelsCache = null; - gPrevGroupsCache = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-01.js b/browser/devtools/debugger/test/browser_dbg_stack-01.js deleted file mode 100644 index 36b6aeb03..000000000 --- a/browser/devtools/debugger/test/browser_dbg_stack-01.js +++ /dev/null @@ -1,54 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testSimpleCall(); - }); -} - -function testSimpleCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 1, - "Should have only one frame."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.simpleCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-02.js b/browser/devtools/debugger/test/browser_dbg_stack-02.js deleted file mode 100644 index 8bd6a2d0b..000000000 --- a/browser/devtools/debugger/test/browser_dbg_stack-02.js +++ /dev/null @@ -1,86 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testEvalCall(); - }); -} - -function testEvalCall() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 2, - "Should have two frames."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"), - "(eval)", "Frame name should be (eval)"); - - ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"), - "First frame should be selected by default."); - - ok(!frames.querySelector("#stackframe-1").parentNode.hasAttribute("checked"), - "Second frame should not be selected."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - frames.querySelector("#stackframe-1"), - gDebugger); - - ok(!frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"), - "First frame should not be selected after click."); - - ok(frames.querySelector("#stackframe-1").parentNode.hasAttribute("checked"), - "Second frame should be selected after click."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - frames.querySelector("#stackframe-0 .dbg-stackframe-title"), - gDebugger); - - ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"), - "First frame should be selected after click inside the first frame."); - - ok(!frames.querySelector("#stackframe-1").parentNode.hasAttribute("checked"), - "Second frame should not be selected after click inside the first frame."); - - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); - }}, 0); - }); - - gDebuggee.evalCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-03.js b/browser/devtools/debugger/test/browser_dbg_stack-03.js deleted file mode 100644 index 1ef00d3a3..000000000 --- a/browser/devtools/debugger/test/browser_dbg_stack-03.js +++ /dev/null @@ -1,71 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testRecurse(); - }); -} - -function testRecurse() { - gDebuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1; - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let pageSize = gDebugger.gCallStackPageSize; - let recurseLimit = gDebuggee.gRecurseLimit; - let childNodes = frames.childNodes; - - is(frames.querySelectorAll(".dbg-stackframe").length, pageSize, - "Should have the max limit of frames."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - is(frames.querySelectorAll(".dbg-stackframe").length, pageSize * 2, - "Should now have twice the max limit of frames."); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - is(frames.querySelectorAll(".dbg-stackframe").length, recurseLimit, - "Should have reached the recurse limit."); - - gDebugger.DebuggerController.activeThread.resume(function() { - window.clearInterval(scrollingInterval); - closeDebuggerAndFinish(); - }); - }); - }); - - let scrollingInterval = window.setInterval(function() { - frames.scrollByIndex(-1); - }, 100); - }}, 0); - }); - - gDebuggee.recurse(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-04.js b/browser/devtools/debugger/test/browser_dbg_stack-04.js deleted file mode 100644 index e68aaea8c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_stack-04.js +++ /dev/null @@ -1,65 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - testEvalCallResume(); - }); -} - -function testEvalCallResume() { - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - Services.tm.currentThread.dispatch({ run: function() { - - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(frames.querySelectorAll(".dbg-stackframe").length, 2, - "Should have two frames."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - - gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() { - gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true); - - is(frames.querySelectorAll(".dbg-stackframe").length, 0, - "Should have no frames after resume"); - - is(childNodes.length, 0, - "Should only have no children."); - - closeDebuggerAndFinish(); - }, true); - - gDebugger.DebuggerController.activeThread.resume(); - }}, 0); - }); - - gDebuggee.evalCall(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-05.js b/browser/devtools/debugger/test/browser_dbg_stack-05.js deleted file mode 100644 index 1fef044e0..000000000 --- a/browser/devtools/debugger/test/browser_dbg_stack-05.js +++ /dev/null @@ -1,114 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Test that switching between stack frames properly sets the current debugger -// location in the source editor. - -const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; - -function test() { - let scriptShown = false; - let framesAdded = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("-02.js") != -1) { - scriptShown = true; - gDebugger.removeEventListener(aEvent.type, _onEvent); - runTest(); - } - }); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - runTest(); - }); - - gDebuggee.firstCall(); - }); - - function runTest() - { - if (scriptShown && framesAdded) { - Services.tm.currentThread.dispatch({ run: testRecurse }, 0); - } - } -} - -function testRecurse() -{ - let frames = gDebugger.DebuggerView.StackFrames.widget._list; - let childNodes = frames.childNodes; - - is(frames.querySelectorAll(".dbg-stackframe").length, 4, - "Correct number of frames."); - - is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length, - "All children should be frames."); - - ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"), - "First frame should be selected by default."); - - ok(!frames.querySelector("#stackframe-2").parentNode.hasAttribute("checked"), - "Third frame should not be selected."); - - is(gDebugger.editor.getDebugLocation(), 5, - "editor debugger location is correct."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - frames.querySelector("#stackframe-2"), - gDebugger); - - ok(!frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"), - "First frame should not be selected after click."); - - ok(frames.querySelector("#stackframe-2").parentNode.hasAttribute("checked"), - "Third frame should be selected after click."); - - is(gDebugger.editor.getDebugLocation(), 4, - "editor debugger location is correct after click."); - - - EventUtils.sendMouseEvent({ type: "mousedown" }, - frames.querySelector("#stackframe-0 .dbg-stackframe-title"), - gDebugger); - - ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"), - "First frame should be selected after click inside the first frame."); - - ok(!frames.querySelector("#stackframe-2").parentNode.hasAttribute("checked"), - "Third frame should not be selected after click inside the first frame."); - - is(gDebugger.editor.getDebugLocation(), 5, - "editor debugger location is correct (frame 0 again)."); - - gDebugger.DebuggerController.activeThread.resume(function() { - is(gDebugger.editor.getDebugLocation(), -1, - "editor debugger location is correct after resume."); - - closeDebuggerAndFinish(); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_stack.html b/browser/devtools/debugger/test/browser_dbg_stack.html deleted file mode 100644 index c3d083087..000000000 --- a/browser/devtools/debugger/test/browser_dbg_stack.html +++ /dev/null @@ -1,32 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head><meta charset='utf-8'/><title>Browser Debugger Test Tab</title> -<!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> -<script type="text/javascript"> - -function simpleCall() { - debugger; -} - -function evalCall() { - eval("debugger;"); -} - -var gRecurseLimit = 100; -var gRecurseDepth = 0; -function recurse() { - if (++gRecurseDepth == gRecurseLimit) { - debugger; - gRecurseDepth = 0; - return; - } - recurse(); -} - -</script> -</head> - -<body></body> - -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_step-out.js b/browser/devtools/debugger/test/browser_dbg_step-out.js deleted file mode 100644 index 37df052b5..000000000 --- a/browser/devtools/debugger/test/browser_dbg_step-out.js +++ /dev/null @@ -1,132 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* Any copyright is dedicated to the Public Domain. - 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 + "test-step-out.html"; - -var gPane = null; -var gTab = null; -var gDebugger = null; - -function test() -{ - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gPane = aPane; - gDebugger = gPane.panelWin; - - testNormalReturn(); - }); -} - -function testNormalReturn() -{ - gPane.panelWin.gClient.addOneTimeListener("paused", function() { - gDebugger.addEventListener("Debugger:SourceShown", function dbgstmt(aEvent) { - gDebugger.removeEventListener(aEvent.type, dbgstmt); - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should be paused now."); - - let count = 0; - gPane.panelWin.gClient.addOneTimeListener("paused", function() { - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should be paused again."); - - gDebugger.addEventListener("Debugger:FetchedVariables", function stepout() { - ok(true, "Debugger:FetchedVariables event received."); - gDebugger.removeEventListener("Debugger:FetchedVariables", stepout, false); - - Services.tm.currentThread.dispatch({ run: function() { - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.firstChild, - innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes; - - is(innerNodes[0].querySelector(".name").getAttribute("value"), "<return>", - "Should have the right property name for the return value."); - - is(innerNodes[0].querySelector(".value").getAttribute("value"), 10, - "Should have the right property value for the return value."); - - testReturnWithException(); - }}, 0); - }, false); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("step-out"), - gDebugger); - }); - }); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.getElementById("return"), - content.window); -} - -function testReturnWithException() -{ - gDebugger.DebuggerController.activeThread.resume(function() { - gPane.panelWin.gClient.addOneTimeListener("paused", function() { - gDebugger.addEventListener("Debugger:FetchedVariables", function dbgstmt(aEvent) { - gDebugger.removeEventListener(aEvent.type, dbgstmt, false); - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should be paused now."); - - let count = 0; - gPane.panelWin.gClient.addOneTimeListener("paused", function() { - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should be paused again."); - - gDebugger.addEventListener("Debugger:FetchedVariables", function stepout() { - ok(true, "Debugger:FetchedVariables event received."); - gDebugger.removeEventListener("Debugger:FetchedVariables", stepout, false); - - Services.tm.currentThread.dispatch({ run: function() { - - var scopes = gDebugger.DebuggerView.Variables._list, - innerScope = scopes.firstChild, - innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes; - - is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>", - "Should have the right property name for the exception value."); - - is(innerNodes[0].querySelector(".value").getAttribute("value"), '"boom"', - "Should have the right property value for the exception value."); - - resumeAndFinish(); - - }}, 0); - }, false); - }); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.getElementById("step-out"), - gDebugger); - }, false); - }); - - EventUtils.sendMouseEvent({ type: "click" }, - content.document.getElementById("throw"), - content.window); - }); -} - -function resumeAndFinish() { - gPane.panelWin.gClient.addOneTimeListener("resumed", function() { - Services.tm.currentThread.dispatch({ run: closeDebuggerAndFinish }, 0); - }); - - gDebugger.DebuggerController.activeThread.resume(); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebugger = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_tab1.html b/browser/devtools/debugger/test/browser_dbg_tab1.html deleted file mode 100644 index 67d81f915..000000000 --- a/browser/devtools/debugger/test/browser_dbg_tab1.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Test Tab</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_tab2.html b/browser/devtools/debugger/test/browser_dbg_tab2.html deleted file mode 100644 index 30fcccf74..000000000 --- a/browser/devtools/debugger/test/browser_dbg_tab2.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Test Tab 2</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_tabactor-01.js b/browser/devtools/debugger/test/browser_dbg_tabactor-01.js deleted file mode 100644 index 8175d364c..000000000 --- a/browser/devtools/debugger/test/browser_dbg_tabactor-01.js +++ /dev/null @@ -1,47 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Check extension-added tab actor lifetimes. - */ - -var gTab1 = null; -var gTab1Actor = null; - -var gClient = null; - -function test() -{ - DebuggerServer.addActors("chrome://mochitests/content/browser/browser/devtools/debugger/test/testactors.js"); - - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function (aType, aTraits) { - is(aType, "browser", "Root actor should identify itself as a browser."); - get_tab(); - }); -} - -function get_tab() -{ - gTab1 = addTab(TAB1_URL, function() { - attach_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) { - gTab1Actor = aGrip.actor; - ok(aGrip.testTabActor1, "Found the test tab actor.") - ok(aGrip.testTabActor1.indexOf("testone") >= 0, - "testTabActor's actorPrefix should be used."); - gClient.request({ to: aGrip.testTabActor1, type: "ping" }, function(aResponse) { - is(aResponse.pong, "pong", "Actor should respond to requests."); - finish_test(); - }); - }); - }); -} - -function finish_test() -{ - gClient.close(function() { - removeTab(gTab1); - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_tabactor-02.js b/browser/devtools/debugger/test/browser_dbg_tabactor-02.js deleted file mode 100644 index 492f47395..000000000 --- a/browser/devtools/debugger/test/browser_dbg_tabactor-02.js +++ /dev/null @@ -1,61 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Check extension-added tab actor lifetimes. - */ - -var gTab1 = null; -var gTab1Actor = null; - -var gClient = null; - -function test() -{ - DebuggerServer.addActors("chrome://mochitests/content/browser/browser/devtools/debugger/test/testactors.js"); - - let transport = DebuggerServer.connectPipe(); - gClient = new DebuggerClient(transport); - gClient.connect(function (aType, aTraits) { - is(aType, "browser", "Root actor should identify itself as a browser."); - get_tab(); - }); -} - -function get_tab() -{ - gTab1 = addTab(TAB1_URL, function() { - attach_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) { - gTab1Actor = aGrip.actor; - ok(aGrip.testTabActor1, "Found the test tab actor.") - ok(aGrip.testTabActor1.indexOf("testone") >= 0, - "testTabActor's actorPrefix should be used."); - gClient.request({ to: aGrip.testTabActor1, type: "ping" }, function(aResponse) { - is(aResponse.pong, "pong", "Actor should respond to requests."); - close_tab(aResponse.actor); - }); - }); - }); -} - -function close_tab(aTestActor) -{ - removeTab(gTab1); - try { - gClient.request({ to: aTestActor, type: "ping" }, function (aResponse) { - is(aResponse, undefined, "testTabActor1 didn't go away with the tab."); - finish_test(); - }); - } catch (e) { - is(e.message, "'ping' request packet has no destination.", - "testTabActor1 should have gone away with the tab."); - finish_test(); - } -} - -function finish_test() -{ - gClient.close(function () { - finish(); - }); -} diff --git a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.html b/browser/devtools/debugger/test/browser_dbg_update-editor-mode.html deleted file mode 100644 index 2cb5d3f50..000000000 --- a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Update Editor Mode Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript" src="test-script-switching-01.js?q=a"></script> - <script type="text/javascript" src="test-editor-mode?a=b"></script> - <script type="text/javascript"> - function banana() { } - </script> - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.js b/browser/devtools/debugger/test/browser_dbg_update-editor-mode.js deleted file mode 100644 index 785994ee7..000000000 --- a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.js +++ /dev/null @@ -1,145 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that updating the editor mode sets the right highlighting engine, - * and script URIs with extra query parameters also get the right engine. - */ - -const TAB_URL = EXAMPLE_URL + "browser_dbg_update-editor-mode.html"; - -var gPane = null; -var gTab = null; -var gDebuggee = null; -var gDebugger = null; -var gSources = null; - -function test() -{ - let scriptShown = false; - let framesAdded = false; - let testStarted = false; - let resumed = false; - - debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) { - gTab = aTab; - gDebuggee = aDebuggee; - gPane = aPane; - gDebugger = gPane.panelWin; - gSources = gDebugger.DebuggerView.Sources; - resumed = true; - - gDebugger.addEventListener("Debugger:SourceShown", onScriptShown); - - gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() { - framesAdded = true; - executeSoon(startTest); - }); - - executeSoon(function() { - gDebuggee.firstCall(); - }); - }); - - function onScriptShown(aEvent) { - scriptShown = aEvent.detail.url.indexOf("test-editor-mode") != -1; - executeSoon(startTest); - } - - function startTest() - { - if (scriptShown && framesAdded && resumed && !testStarted) { - gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown); - testStarted = true; - Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0); - } - } -} - -function testScriptsDisplay() { - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 3, - "Found the expected number of scripts."); - - is(gDebugger.editor.getMode(), SourceEditor.MODES.TEXT, - "Found the expected editor mode."); - - ok(gDebugger.editor.getText().search(/debugger/) != -1, - "The correct script was loaded initially."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("switching-01.js") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testSwitchPaused1(); - } - }); - - let url = gDebuggee.document.querySelector("script").src; - gDebugger.DebuggerView.Sources.selectedValue = url; -} - -function testSwitchPaused1() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 3, - "Found the expected number of scripts."); - - ok(gDebugger.editor.getText().search(/debugger/) == -1, - "The second script is no longer displayed."); - - ok(gDebugger.editor.getText().search(/firstCall/) != -1, - "The first script is displayed."); - - is(gDebugger.editor.getMode(), SourceEditor.MODES.JAVASCRIPT, - "Found the expected editor mode."); - - gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) { - let url = aEvent.detail.url; - if (url.indexOf("update-editor-mode") != -1) { - gDebugger.removeEventListener(aEvent.type, _onEvent); - testSwitchPaused2(); - } - }); - - let label = "browser_dbg_update-editor-mode.html"; - gDebugger.DebuggerView.Sources.selectedLabel = label; -} - -function testSwitchPaused2() -{ - is(gDebugger.DebuggerController.activeThread.state, "paused", - "Should only be getting stack frames while paused."); - - is(gSources.itemCount, 3, - "Found the expected number of scripts."); - - ok(gDebugger.editor.getText().search(/firstCall/) == -1, - "The first script is no longer displayed."); - - ok(gDebugger.editor.getText().search(/debugger/) == -1, - "The second script is no longer displayed."); - - ok(gDebugger.editor.getText().search(/banana/) != -1, - "The third script is displayed."); - - is(gDebugger.editor.getMode(), SourceEditor.MODES.HTML, - "Found the expected editor mode."); - - gDebugger.DebuggerController.activeThread.resume(function() { - closeDebuggerAndFinish(); - }); -} - -registerCleanupFunction(function() { - removeTab(gTab); - gPane = null; - gTab = null; - gDebuggee = null; - gDebugger = null; - gSources = null; -}); diff --git a/browser/devtools/debugger/test/browser_dbg_watch-expressions.html b/browser/devtools/debugger/test/browser_dbg_watch-expressions.html deleted file mode 100644 index 842ac7d48..000000000 --- a/browser/devtools/debugger/test/browser_dbg_watch-expressions.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Browser Debugger Watch Expressions Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript"> - function test() { - ermahgerd.call({ canada: new String("eh") }); - } - function ermahgerd(aArg) { - var t = document.title; - debugger; - (function() { - var a = undefined; - debugger; - var a = {}; - debugger; - }("sensational")); - } - </script> - - </head> - <body> - </body> -</html> diff --git a/browser/devtools/debugger/test/browser_dbg_with-frame.html b/browser/devtools/debugger/test/browser_dbg_with-frame.html deleted file mode 100644 index 59a2397c3..000000000 --- a/browser/devtools/debugger/test/browser_dbg_with-frame.html +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Debugger Function Call Parameter Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - <script type="text/javascript"> - window.addEventListener("load", function() { - function test(aNumber) { - var a, obj = { one: 1, two: 2 }; - var r = aNumber; - with (Math) { - a = PI * r * r; - with (obj) { - var foo = two * PI; - debugger; - } - } - }; - function load() { - test(10); - } - var button = document.querySelector("button"); - button.addEventListener("click", load, false); - }); - </script> - - </head> - <body> - <button>Click me!</button> - </body> -</html> diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js deleted file mode 100644 index 3c4cf47af..000000000 --- a/browser/devtools/debugger/test/head.js +++ /dev/null @@ -1,207 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - -let tempScope = {}; -Cu.import("resource://gre/modules/Services.jsm", tempScope); -Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope); -Cu.import("resource://gre/modules/devtools/dbg-client.jsm", tempScope); -Cu.import("resource:///modules/source-editor.jsm", tempScope); -Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope); -Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope); -let Services = tempScope.Services; -let SourceEditor = tempScope.SourceEditor; -let DebuggerServer = tempScope.DebuggerServer; -let DebuggerTransport = tempScope.DebuggerTransport; -let DebuggerClient = tempScope.DebuggerClient; -let gDevTools = tempScope.gDevTools; -let devtools = tempScope.devtools; -let TargetFactory = devtools.TargetFactory; - -// Import the GCLI test helper -let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/")); -Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this); - -const EXAMPLE_URL = "http://example.com/browser/browser/devtools/debugger/test/"; -const TAB1_URL = EXAMPLE_URL + "browser_dbg_tab1.html"; -const TAB2_URL = EXAMPLE_URL + "browser_dbg_tab2.html"; -const STACK_URL = EXAMPLE_URL + "browser_dbg_stack.html"; - -// Enable logging and remote debugging for the relevant tests. -let gEnableRemote = Services.prefs.getBoolPref("devtools.debugger.remote-enabled"); -let gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log"); -Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true); -Services.prefs.setBoolPref("devtools.debugger.log", true); - -registerCleanupFunction(function() { - Services.prefs.setBoolPref("devtools.debugger.remote-enabled", gEnableRemote); - Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging); - - // Properly shut down the server to avoid memory leaks. - DebuggerServer.destroy(); -}); - -if (!DebuggerServer.initialized) { - DebuggerServer.init(function() true); - DebuggerServer.addBrowserActors(); -} - -waitForExplicitFinish(); - -function addWindow() { - let windowReference = window.open(); - let chromeWindow = windowReference - .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShellTreeItem).rootTreeItem - .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); - - return chromeWindow; -} - -function addTab(aURL, aOnload, aWindow) { - let targetWindow = aWindow || window; - let targetBrowser = targetWindow.gBrowser; - - targetWindow.focus(); - targetBrowser.selectedTab = targetBrowser.addTab(aURL); - - let tab = targetBrowser.selectedTab; - let browser = tab.linkedBrowser; - let win = browser.contentWindow; - let expectedReadyState = aURL == "about:blank" ? ["interactive", "complete"] : ["complete"]; - - if (aOnload) { - let handler = function() { - if (browser.currentURI.spec != aURL || - expectedReadyState.indexOf((win.document || {}).readyState) == -1) { - return; - } - browser.removeEventListener("load", handler, true); - executeSoon(aOnload); - } - browser.addEventListener("load", handler, true); - } - - return tab; -} - -function removeTab(aTab, aWindow) { - let targetWindow = aWindow || window; - let targetBrowser = targetWindow.gBrowser; - - targetBrowser.removeTab(aTab); -} - -function closeDebuggerAndFinish(aRemoteFlag, aCallback, aWindow) { - let debuggerClosed = false; - let debuggerDisconnected = false; - - ok(gTab, "There is a gTab to use for getting a toolbox reference"); - let target = TargetFactory.forTab(gTab); - - window.addEventListener("Debugger:Shutdown", function cleanup() { - window.removeEventListener("Debugger:Shutdown", cleanup, false); - debuggerDisconnected = true; - maybeFinish(); - }, false); - - let toolbox = gDevTools.getToolbox(target); - toolbox.destroy().then(function() { - debuggerClosed = true; - maybeFinish(); - }); - - function maybeFinish() { - if (debuggerClosed && debuggerDisconnected) { - (finish || aCallback)(); - } - } -} - -function get_tab_actor_for_url(aClient, aURL, aCallback) { - aClient.listTabs(function(aResponse) { - for each (let tab in aResponse.tabs) { - if (tab.url == aURL) { - aCallback(tab); - return; - } - } - }); -} - -function attach_tab_actor_for_url(aClient, aURL, aCallback) { - get_tab_actor_for_url(aClient, aURL, function(actor) { - aClient.attachTab(actor.actor, function(aResponse) { - aCallback(actor, aResponse); - }); - }); -} - -function attach_thread_actor_for_url(aClient, aURL, aCallback) { - attach_tab_actor_for_url(aClient, aURL, function(aTabActor, aResponse) { - aClient.attachThread(actor.threadActor, function(aResponse, aThreadClient) { - // We don't care about the pause right now (use - // get_actor_for_url() if you do), so resume it. - aThreadClient.resume(function(aResponse) { - aCallback(actor); - }); - }); - }); -} - -function wait_for_connect_and_resume(aOnDebugging, aTab) { - let target = TargetFactory.forTab(aTab); - - gDevTools.showToolbox(target, "jsdebugger").then(function(toolbox) { - let dbg = toolbox.getCurrentPanel(); - - // Wait for the initial resume... - dbg.panelWin.gClient.addOneTimeListener("resumed", function() { - aOnDebugging(); - }); - }); -} - -function debug_tab_pane(aURL, aOnDebugging, aBeforeTabAdded) { - // Make any necessary preparations (start the debugger server etc.) - if (aBeforeTabAdded) { - aBeforeTabAdded(); - } - - let tab = addTab(aURL, function() { - let debuggee = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject; - let target = TargetFactory.forTab(gBrowser.selectedTab); - - info("Opening Debugger"); - gDevTools.showToolbox(target, "jsdebugger").then(function(toolbox) { - let dbg = toolbox.getCurrentPanel(); - - // Wait for the initial resume... - dbg.panelWin.gClient.addOneTimeListener("resumed", function() { - info("Debugger has started"); - dbg._view.Variables.lazyEmpty = false; - dbg._view.Variables.lazyAppend = false; - dbg._view.Variables.lazyExpand = false; - aOnDebugging(tab, debuggee, dbg); - }); - }); - }); -} - -function debug_chrome(aURL, aOnClosing, aOnDebugging) { - let tab = addTab(aURL, function() { - let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject; - - info("Opening Browser Debugger"); - let win = BrowserDebuggerProcess.init(aOnClosing, function(process) { - - // The remote debugging process has started... - info("Browser Debugger has started"); - aOnDebugging(tab, debuggee, process); - }); - }); -} diff --git a/browser/devtools/debugger/test/moz.build b/browser/devtools/debugger/test/moz.build deleted file mode 100644 index 895d11993..000000000 --- a/browser/devtools/debugger/test/moz.build +++ /dev/null @@ -1,6 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - diff --git a/browser/devtools/debugger/test/test-editor-mode b/browser/devtools/debugger/test/test-editor-mode deleted file mode 100644 index a86191c98..000000000 --- a/browser/devtools/debugger/test/test-editor-mode +++ /dev/null @@ -1,6 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function secondCall() { - eval("debugger;"); -} diff --git a/browser/devtools/debugger/test/test-function-search-01.js b/browser/devtools/debugger/test/test-function-search-01.js deleted file mode 100644 index b5d647cfe..000000000 --- a/browser/devtools/debugger/test/test-function-search-01.js +++ /dev/null @@ -1,42 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function test() { - // Blah! First source! -} - -test.prototype = { - anonymousExpression: function() { - }, - namedExpression: function NAME() { - }, - sub: { - sub: { - sub: { - } - } - } -}; - -var foo = { - a_test: function() { - }, - n_test: function x() { - }, - sub: { - a_test: function() { - }, - n_test: function y() { - }, - sub: { - a_test: function() { - }, - n_test: function z() { - }, - sub: { - test_SAME_NAME: function test_SAME_NAME() { - } - } - } - } -}; diff --git a/browser/devtools/debugger/test/test-function-search-02.js b/browser/devtools/debugger/test/test-function-search-02.js deleted file mode 100644 index 10b48518f..000000000 --- a/browser/devtools/debugger/test/test-function-search-02.js +++ /dev/null @@ -1,21 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -var test2 = function() { - // Blah! Second source! -} - -var test3 = function test3_NAME() { -} - -var test4_SAME_NAME = function test4_SAME_NAME() { -} - -test.prototype.x = function X() { -}; -test.prototype.sub.y = function Y() { -}; -test.prototype.sub.sub.z = function Z() { -}; -test.prototype.sub.sub.sub.t = this.x = this.y = this.z = function() { -}; diff --git a/browser/devtools/debugger/test/test-function-search-03.js b/browser/devtools/debugger/test/test-function-search-03.js deleted file mode 100644 index e64292a92..000000000 --- a/browser/devtools/debugger/test/test-function-search-03.js +++ /dev/null @@ -1,32 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -window.addEventListener("bogus", function namedEventListener() { - // Blah! Third source! -}); - -try { - var bar = foo.sub.sub.test({ - a: function A() { - } - }); - - bar.alpha = foo.sub.sub.test({ - b: function B() { - } - }); - - bar.alpha.beta = new X(Y(Z(foo.sub.sub.test({ - c: function C() { - } - })))); - - this.theta = new X(new Y(new Z(new foo.sub.sub.test({ - d: function D() { - } - })))); - - var fun = foo = bar = this.t_foo = window.w_bar = function baz() {}; - -} catch (e) { -} diff --git a/browser/devtools/debugger/test/test-location-changes-bp.html b/browser/devtools/debugger/test/test-location-changes-bp.html deleted file mode 100644 index 0e1831894..000000000 --- a/browser/devtools/debugger/test/test-location-changes-bp.html +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset='utf-8'/> -<script type="text/javascript" src="test-location-changes-bp.js"></script> -<script type="text/javascript"> -function runDebuggerStatement() { - debugger; -} -</script> -</head> -<body> - -<button type="button" onclick="myFunction()">Run</button> - -</body> -</html> diff --git a/browser/devtools/debugger/test/test-location-changes-bp.js b/browser/devtools/debugger/test/test-location-changes-bp.js deleted file mode 100644 index d164b8bdf..000000000 --- a/browser/devtools/debugger/test/test-location-changes-bp.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function myFunction() { - var a = 1; - debugger; -} diff --git a/browser/devtools/debugger/test/test-script-switching-01.js b/browser/devtools/debugger/test/test-script-switching-01.js deleted file mode 100644 index a4c078032..000000000 --- a/browser/devtools/debugger/test/test-script-switching-01.js +++ /dev/null @@ -1,6 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function firstCall() { - eval("secondCall();"); -} diff --git a/browser/devtools/debugger/test/test-script-switching-02.js b/browser/devtools/debugger/test/test-script-switching-02.js deleted file mode 100644 index 6606bd366..000000000 --- a/browser/devtools/debugger/test/test-script-switching-02.js +++ /dev/null @@ -1,11 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function secondCall() { - // This comment is useful for browser_dbg_select-line.js. ☺ - eval("debugger;"); - function foo() {} - if (true) { - foo(); - } -} diff --git a/browser/devtools/debugger/test/test-step-out.html b/browser/devtools/debugger/test/test-step-out.html deleted file mode 100644 index c19236772..000000000 --- a/browser/devtools/debugger/test/test-step-out.html +++ /dev/null @@ -1,37 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset='utf-8'/> - <title>Debugger Step Out Return Value Test</title> - <!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> - </head> - <body> - <button id="return">return</button> - <button id="throw">throw</button> - </body> - <script type="text/javascript"> - window.addEventListener("load", function() { - function normal(aArg) { - debugger; - var r = 10; - return r; - } - function error(aArg) { - function inner(aArg) { - debugger; - var r = 10; - throw "boom"; - return r; - } - try { - inner(aArg); - } catch (e) {} - } - var button = document.getElementById("return"); - button.addEventListener("click", normal, false); - button = document.getElementById("throw"); - button.addEventListener("click", error, false); - }); - </script> -</html> diff --git a/browser/devtools/debugger/test/testactors.js b/browser/devtools/debugger/test/testactors.js deleted file mode 100644 index 8c97b3e91..000000000 --- a/browser/devtools/debugger/test/testactors.js +++ /dev/null @@ -1,31 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -function TestActor1(aConnection, aTab) -{ - this.conn = aConnection; - this.tab = aTab; -} - -TestActor1.prototype = { - actorPrefix: "testone", - - grip: function TA1_grip() { - return { actor: this.actorID, - test: "TestActor1" }; - }, - - onPing: function TA1_onPing() { - return { pong: "pong" }; - } -}; - -TestActor1.prototype.requestTypes = { - "ping": TestActor1.prototype.onPing -}; - -DebuggerServer.removeTabActor(TestActor1); -DebuggerServer.removeGlobalActor(TestActor1); - -DebuggerServer.addTabActor(TestActor1, "testTabActor1"); -DebuggerServer.addGlobalActor(TestActor1, "testGlobalActor1"); |