diff --git a/.eslintignore b/.eslintignore index ded817a6e777..c0b4a8fa055e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -119,7 +119,6 @@ devtools/client/storage/test/*.html !devtools/client/storage/test/storage-unsecured-iframe-usercontextid.html devtools/client/webaudioeditor/** devtools/client/webconsole/net/** -devtools/client/webconsole/new-console-output/test/mochitest/** devtools/client/webconsole/test/** devtools/client/webconsole/hudservice.js devtools/client/webconsole/webconsole-connection-proxy.js diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/.eslintrc.js b/devtools/client/webconsole/new-console-output/test/mochitest/.eslintrc.js deleted file mode 100644 index 677cbb4243df..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/.eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -module.exports = { - // Extend from the shared list of defined globals for mochitests. - "extends": "../../../../../.eslintrc.mochitests.js" -}; diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini index 02170fe506a4..3ad267e27fd7 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini +++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini @@ -10,273 +10,31 @@ support-files = source-mapped.css source-mapped.css.map source-mapped.scss - test_bug_1010953_cspro.html - test_bug_1010953_cspro.html^headers^ - test_bug_1247459_violation.html - test_bug_770099_violation.html - test_bug_770099_violation.html^headers^ - test_bug1045902_console_csp_ignore_reflected_xss_message.html - test_bug1045902_console_csp_ignore_reflected_xss_message.html^headers^ - test_bug1092055_shouldwarn.html - test_bug1092055_shouldwarn.js - test_bug1092055_shouldwarn.js^headers^ - test_hpkp-invalid-headers.sjs - test_hsts-invalid-headers.sjs - test-autocomplete-in-stackframe.html test-batching.html - test-bug_1050691_click_function_to_source.html - test-bug_1050691_click_function_to_source.js - test-bug_923281_console_log_filter.html - test-bug_923281_test1.js - test-bug_923281_test2.js - test-bug_939783_console_trace_duplicates.html - test-bug-585956-console-trace.html - test-bug-593003-iframe-wrong-hud-iframe.html - test-bug-593003-iframe-wrong-hud.html - test-bug-595934-canvas-css.html - test-bug-595934-canvas-css.js - test-bug-595934-css-loader.css - test-bug-595934-css-loader.css^headers^ - test-bug-595934-css-loader.html - test-bug-595934-css-parser.css - test-bug-595934-css-parser.html - test-bug-595934-empty-getelementbyid.html - test-bug-595934-empty-getelementbyid.js - test-bug-595934-html.html - test-bug-595934-image.html - test-bug-595934-image.jpg - test-bug-595934-imagemap.html - test-bug-595934-malformedxml-external.html - test-bug-595934-malformedxml-external.xml - test-bug-595934-malformedxml.xhtml - test-bug-595934-svg.xhtml - test-bug-595934-workers.html - test-bug-595934-workers.js - test-bug-597136-external-script-errors.html - test-bug-597136-external-script-errors.js - test-bug-597756-reopen-closed-tab.html - test-bug-599725-response-headers.sjs - test-bug-600183-charset.html - test-bug-600183-charset.html^headers^ - test-bug-601177-log-levels.html - test-bug-601177-log-levels.js - test-bug-603750-websocket.html - test-bug-603750-websocket.js - test-bug-609872-cd-iframe-child.html - test-bug-609872-cd-iframe-parent.html - test-bug-613013-console-api-iframe.html - test-bug-618078-network-exceptions.html - test-bug-621644-jsterm-dollar.html - test-bug-630733-response-redirect-headers.sjs - test-bug-632275-getters.html - test-bug-632347-iterators-generators.html - test-bug-644419-log-limits.html - test-bug-646025-console-file-location.html - test-bug-658368-time-methods.html - test-bug-737873-mixedcontent.html - test-bug-752559-ineffective-iframe-sandbox-warning-inner.html - test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html - test-bug-752559-ineffective-iframe-sandbox-warning-nested2.html - test-bug-752559-ineffective-iframe-sandbox-warning0.html - test-bug-752559-ineffective-iframe-sandbox-warning1.html - test-bug-752559-ineffective-iframe-sandbox-warning2.html - test-bug-752559-ineffective-iframe-sandbox-warning3.html - test-bug-752559-ineffective-iframe-sandbox-warning4.html - test-bug-752559-ineffective-iframe-sandbox-warning5.html - test-bug-762593-insecure-passwords-about-blank-web-console-warning.html - test-bug-762593-insecure-passwords-web-console-warning.html - test-bug-766001-console-log.js - test-bug-766001-js-console-links.html - test-bug-766001-js-errors.js - test-bug-782653-css-errors-1.css - test-bug-782653-css-errors-2.css - test-bug-782653-css-errors.html - test-bug-837351-security-errors.html - test-bug-859170-longstring-hang.html - test-bug-869003-iframe.html - test-bug-869003-top-window.html - test-bug-952277-highlight-nodes-in-vview.html - test-bug-989025-iframe-parent.html - test-certificate-messages.html - test-closure-optimized-out.html - test-closures.html - test-console-api-stackframe.html - test-console-assert.html - test-console-clear.html - test-console-column.html - test-console-count-external-file.js - test-console-count.html - test-console-extras.html + test-console.html test-console-filters.html test-console-group.html - test-console-output-02.html - test-console-output-03.html - test-console-output-04.html - test-console-output-dom-elements.html - test-console-output-events.html - test-console-replaced-api.html - test-console-server-logging-array.sjs - test-console-server-logging-backtrace.sjs - test-console-server-logging.sjs test-console-table.html - test-console-trace-async.html - test-console-workers.html - test-console.html - test-consoleiframes.html - test-cu-reporterror.js - test-data.json - test-data.json^headers^ - test-duplicate-error.html - test-encoding-ISO-8859-1.html - test-error.html - test-eval-in-stackframe.html - test-exception-stackframe.html - test-file-location.js - test-filter.html - test-for-of.html - test-iframe-762593-insecure-form-action.html - test-iframe-762593-insecure-frame.html - test-iframe1.html - test-iframe2.html - test-iframe3.html - test-image.png test-location-debugger-link-console-log.js test-location-debugger-link-errors.js test-location-debugger-link.html test-location-styleeditor-link-1.css test-location-styleeditor-link-2.css test-location-styleeditor-link.html - test-mixedcontent-securityerrors.html - test-mutation.html test-network-request.html - test-network.html - test-observe-http-ajax.html - test-own-console.html - test-property-provider.html - test-repeated-messages.html - test-result-format-as-string.html test-sourcemap-error-01.html - test-sourcemap-error-01.js test-sourcemap-error-02.html + test-sourcemap-error-01.js test-sourcemap-error-02.js test-stacktrace-location-debugger-link.html - test-trackingprotection-securityerrors.html - test-webconsole-error-observer.html - testscript.js - !/devtools/client/netmonitor/test/sjs_cors-test-server.sjs - !/image/test/mochitest/blue.png !/devtools/client/framework/test/shared-head.js -[browser_console.js] -skip-if = true # Bug 1406060 -[browser_console_addonsdk_loader_exception.js] -skip-if = true # Bug 1406060 -[browser_console_clear_method.js] -skip-if = true # Bug 1406060 -[browser_console_consolejsm_output.js] -skip-if = true # Bug 1406060 -[browser_console_dead_objects.js] -skip-if = true # Bug 1406060 -[browser_console_error_source_click.js] -skip-if = true # Bug 1406060 -[browser_console_filters.js] -skip-if = true # Bug 1406060 -[browser_console_hide_jsterm_when_devtools_chrome_enabled_false.js] -skip-if = true # Bug 1406060 -[browser_console_nsiconsolemessage.js] -skip-if = true # Bug 1406060 -[browser_console_open_or_focus.js] -skip-if = true # Bug 1406060 -[browser_console_restore.js] -skip-if = true # Bug 1406060 -[browser_console_webconsole_ctrlw_close_tab.js] -skip-if = true # Bug 1406060 -[browser_console_webconsole_iframe_messages.js] -skip-if = true # Bug 1406060 -[browser_console_webconsole_private_browsing.js] -skip-if = true # Bug 1403188 -# old console skip-if = e10s # Bug 1042253 - webconsole e10s tests -[browser_jsterm_copy_command.js] -skip-if = true -subsuite = clipboard -# old console skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts -[browser_jsterm_history_persist.js] -skip-if = true # Bug 1401881 [browser_jsterm_inspect.js] -[browser_jsterm_no_autocompletion_on_defined_variables.js] -skip-if = true # Bug 1401881 [browser_netmonitor_shows_reqs_in_webconsole.js] -[browser_webconsole.js] -skip-if = true # Bug 1404829 -[browser_webconsole_No_input_and_Tab_key_pressed.js] -skip-if = true # Bug 1403910 -[browser_webconsole_No_input_change_and_Tab_key_pressed.js] -skip-if = true # Bug 1404882 -[browser_webconsole_add_edited_input_to_history.js] -skip-if = true # Bug 1401881 -[browser_webconsole_allow_mixedcontent_securityerrors.js] -tags = mcb -skip-if = true # Bug 1403452 -# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001 -[browser_webconsole_assert.js] -skip-if = true # Bug 1403458 -[browser_webconsole_autocomplete-properties-with-non-alphanumeric-names.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_JSTerm_helpers.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_accessibility.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_and_selfxss.js] -subsuite = clipboard -skip-if = true # Bug 1404850 -# old console skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts -[browser_webconsole_autocomplete_crossdomain_iframe.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_in_debugger_stackframe.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_keys.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_popup.js] -skip-if = true # Bug 1401881 -[browser_webconsole_autocomplete_popup_close_on_tab_switch.js] -skip-if = true # Bug 1401881 [browser_webconsole_batching.js] -[browser_webconsole_block_mixedcontent_securityerrors.js] -tags = mcb -skip-if = true # Bug 1403899 -# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001 -[browser_webconsole_cached_autocomplete.js] -skip-if = true # Bug 1401881 -[browser_webconsole_cached_messages.js] -skip-if = true # Bug 1406069 -[browser_webconsole_cd_iframe.js] -skip-if = true # Bug 1406030 -[browser_webconsole_certificate_messages.js] -skip-if = true # Bug 1401881 -# old console skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s -[browser_webconsole_charset.js] -skip-if = true # Bug 1404400 -[browser_webconsole_chrome.js] -skip-if = true # Bug 1401881 -[browser_webconsole_click_function_to_source.js] -skip-if = true # Bug 1406038 [browser_webconsole_clickable_urls.js] -[browser_webconsole_closing_after_completion.js] -skip-if = true # Bug 1401881 -[browser_webconsole_closing_brackets.js] -skip-if = true # Bug 1401881 -[browser_webconsole_closure_inspection.js] -skip-if = true # Bug 1405250 -[browser_webconsole_completion.js] -skip-if = true # Bug 1401881 -[browser_webconsole_console_api_iframe.js] -skip-if = true # Bug 1401881 [browser_webconsole_console_dir.js] -[browser_webconsole_console_dir_uninspectable.js] -skip-if = true # Bug 1403449 [browser_webconsole_console_group.js] -[browser_webconsole_console_logging_workers_api.js] -skip-if = true # Bug 1405252 [browser_webconsole_console_table.js] [browser_webconsole_context_menu_copy_entire_message.js] subsuite = clipboard @@ -288,199 +46,31 @@ skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 subsuite = clipboard [browser_webconsole_context_menu_open_url.js] [browser_webconsole_context_menu_store_as_global.js] -[browser_webconsole_copy_entire_message_context_menu.js] -subsuite = clipboard -skip-if = true # Bug 1401958 -# old console skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts -[browser_webconsole_copy_link_location.js] -skip-if = true # Bug 1401944 -[browser_webconsole_csp_ignore_reflected_xss_message.js] -skip-if = true # Bug 1401881 -# old console skip-if = (e10s && debug) || (e10s && os == 'win') # Bug 1221499 enabled these on windows -[browser_webconsole_cspro.js] -skip-if = true # Bug 1401881 -# old console skip-if = e10s && (os == 'win' || os == 'mac') # Bug 1243967 -[browser_webconsole_ctrl_key_nav.js] -skip-if = true # Bug 1401881 -# old console skip-if = os != "mac" -[browser_webconsole_deactivateHUDForContext_unfocused_window.js] -skip-if = true # Bug 1401881 -[browser_webconsole_document_body_autocomplete.js] -skip-if = true # Bug 1404851 -[browser_webconsole_document_focus.js] -skip-if = true # Bug 1404368 -[browser_webconsole_duplicate_errors.js] -skip-if = true # Bug 1403907 -[browser_webconsole_errors_after_page_reload.js] -skip-if = true # Bug 1401881 -[browser_webconsole_eval_in_debugger_stackframe.js] -skip-if = true # Bug 1401881 -[browser_webconsole_eval_in_debugger_stackframe2.js] -skip-if = true # Bug 1401881 -[browser_webconsole_execution_scope.js] -skip-if = true # Bug 1405333 -[browser_webconsole_external_script_errors.js] -skip-if = true # Bug 1401881 -[browser_webconsole_file_uri.js] -skip-if = true # Bug 1404382 -[browser_webconsole_filter_scroll.js] -skip-if = true # Bug 1404392 [browser_webconsole_filters.js] [browser_webconsole_filters_persist.js] -[browser_webconsole_highlighter_console_helper.js] -skip-if = true # Bug 1404853 -# old console skip-if = true # Requires direct access to content nodes -[browser_webconsole_history.js] -skip-if = true # Bug 1401881 -[browser_webconsole_history_arrow_keys.js] -skip-if = true # Bug 1401881 -[browser_webconsole_history_nav.js] -skip-if = true # Bug 1401881 -[browser_webconsole_hpkp_invalid-headers.js] -skip-if = true # Bug 1405340 -# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001 -[browser_webconsole_hsts_invalid-headers.js] -skip-if = true # Bug 1405341 -# old console skip-if = e10s # Bug 1042253 - webconsole e10s tests -[browser_webconsole_iframe_wrong_hud.js] -skip-if = true # Bug 1404378 -[browser_webconsole_ineffective_iframe_sandbox_warning.js] -skip-if = true # Bug 1404883 -# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001 [browser_webconsole_init.js] -[browser_webconsole_input_expansion.js] -skip-if = true # Bug 1404371 -[browser_webconsole_input_field_focus_on_panel_select.js] -skip-if = true # Bug 1405343 [browser_webconsole_input_focus.js] -[browser_webconsole_insecure_passwords_about_blank_web_console_warning.js] -skip-if = true # Bug 1404884 -[browser_webconsole_insecure_passwords_web_console_warning.js] -skip-if = true # Bug 1404888 -# old console skip-if = true # Bug 1110500 - mouse event failure in test -[browser_webconsole_inspect_cross_domain_object.js] -skip-if = true # Bug 1401548 -[browser_webconsole_iterators_generators.js] -skip-if = true # Bug 1404849 -# old console skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s -[browser_webconsole_js_input_expansion.js] -skip-if = true # Bug 1405350 -[browser_webconsole_jsterm.js] -skip-if = true # Bug 1405352 -# old console skip-if = e10s # Bug 1042253 - webconsole e10s tests (Linux debug timeout) -[browser_webconsole_jsterm_copy.js] -subsuite = clipboard -skip-if = true # Bug 1404831 -# old console skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts -[browser_webconsole_jsterm_dollar.js] -skip-if = true # Bug 1404843 [browser_webconsole_keyboard_accessibility.js] [browser_webconsole_location_debugger_link.js] [browser_webconsole_location_scratchpad_link.js] [browser_webconsole_location_styleeditor_link.js] [browser_webconsole_logErrorInPage.js] -[browser_webconsole_longstring_expand.js] -skip-if = true # Bug 1403448 -[browser_webconsole_longstring_hang.js] -skip-if = true # Bug 1403448 -[browser_webconsole_message_categories.js] -skip-if = true # Bug 1404384 -# old console skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s -[browser_webconsole_mixedcontent.js] -tags = mcb -skip-if = true # Bug 1404886 -[browser_webconsole_multiline_input.js] -skip-if = true # Bug 1401881 -[browser_webconsole_multiple_windows_and_tabs.js] -skip-if = true # Bug 1401881 -[browser_webconsole_netlogging_reset_filter.js] -skip-if = true # Bug 1405636 -[browser_webconsole_network_exceptions.js] -skip-if = true # Bug 1401881 -[browser_webconsole_network_messages_expand.js] [browser_webconsole_network_messages_openinnet.js] -[browser_webconsole_network_requests_from_chrome.js] -skip-if = true # Bug 1401881 +[browser_webconsole_network_messages_expand.js] [browser_webconsole_nodes_highlight.js] [browser_webconsole_nodes_select.js] -[browser_webconsole_notifications.js] -skip-if = true # Bug 1405637 -[browser_webconsole_object_inspector.js] [browser_webconsole_object_inspector_entries.js] +[browser_webconsole_object_inspector.js] [browser_webconsole_observer_notifications.js] -[browser_webconsole_optimized_out_vars.js] -skip-if = true # Bug 1401881 -[browser_webconsole_output_copy.js] -subsuite = clipboard -skip-if = true # Bug 1404364 -# old console skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts -[browser_webconsole_output_copy_newlines.js] -subsuite = clipboard -skip-if = true # Bug 1405641 -# old console skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts -[browser_webconsole_output_order.js] -skip-if = true # Bug 1401881 [browser_webconsole_persist.js] -[browser_webconsole_property_provider.js] -skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s -[browser_webconsole_prune_scroll.js] -skip-if = true # Bug 1404832 -[browser_webconsole_reflow.js] -skip-if = true # Bug 1406022 -[browser_webconsole_reopen_closed_tab.js] -skip-if = true # Bug 1401881 -[browser_webconsole_repeat_different_objects.js] -skip-if = true # Bug 1401953 -[browser_webconsole_repeated_messages_accuracy.js] -skip-if = true # Bug 1403450 -[browser_webconsole_sandbox_update_after_navigation.js] -skip-if = true # Bug 1401942 -[browser_webconsole_script_errordoc_urls.js] -skip-if = true # Bug 1403454 -# old console skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s [browser_webconsole_scroll.js] -[browser_webconsole_select_all.js] -skip-if = true # Bug 1404359 -[browser_webconsole_show_subresource_security_errors.js] -skip-if = true # Bug 1401881 -# old console skip-if = e10s && (os == 'win' || os == 'mac') # Bug 1243987 [browser_webconsole_shows_reqs_in_netmonitor.js] [browser_webconsole_sourcemap_css.js] [browser_webconsole_sourcemap_error.js] [browser_webconsole_sourcemap_invalid.js] [browser_webconsole_sourcemap_nosource.js] -[browser_webconsole_split.js] -skip-if = true # Bug 1401881 -[browser_webconsole_split_escape_key.js] -skip-if = true # Bug 1405647 -[browser_webconsole_split_focus.js] -skip-if = true # Bug 1405648 -[browser_webconsole_split_persist.js] -skip-if = true # Bug 1405649 [browser_webconsole_stacktrace_location_debugger_link.js] [browser_webconsole_stacktrace_location_scratchpad_link.js] -[browser_webconsole_strict_mode_errors.js] -skip-if = true # Bug 1406039 [browser_webconsole_string.js] -[browser_webconsole_time_methods.js] -skip-if = true # Bug 1404877 [browser_webconsole_timestamps.js] -[browser_webconsole_trackingprotection_errors.js] -tags = trackingprotection -skip-if = true # Bug 1405650 -# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001 -[browser_webconsole_variables_view_dont_sort_non_sortable_classes_properties.js] -skip-if = true # Bug 1403196 -[browser_webconsole_variables_view_while_debugging.js] -skip-if = true # Bug 1403200 -[browser_webconsole_variables_view_while_debugging_and_inspecting.js] -skip-if = true # Bug 1403205 -[browser_webconsole_view_source.js] -skip-if = true # Bug 1405652 -# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001 -[browser_webconsole_violation.js] -skip-if = true # Bug 1405245 -# old console skip-if = e10s && (os == 'win') # Bug 1264955 [browser_webconsole_warn_about_replaced_api.js] -[browser_webconsole_websocket.js] -skip-if = true # Bug 1401881 \ No newline at end of file diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console.js deleted file mode 100644 index c70039bec41c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console.js +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test the basic features of the Browser Console, bug 587757. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html?" + Date.now(); -const TEST_FILE = "chrome://mochitests/content/browser/devtools/client/" + - "webconsole/test/test-cu-reporterror.js"; - -const TEST_XHR_ERROR_URI = `http://example.com/404.html?${Date.now()}`; - -const TEST_IMAGE = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-image.png"; - -const ObjectClient = require("devtools/shared/client/object-client"); - -add_task(function* () { - yield loadTab(TEST_URI); - - let opened = waitForBrowserConsole(); - - let hud = HUDService.getBrowserConsole(); - ok(!hud, "browser console is not open"); - info("wait for the browser console to open with ctrl-shift-j"); - EventUtils.synthesizeKey("j", { accelKey: true, shiftKey: true }, window); - - hud = yield opened; - ok(hud, "browser console opened"); - yield testMessages(hud); - yield testCPOWInspection(hud); -}); - -function testMessages(hud) { - hud.jsterm.clearOutput(true); - - expectUncaughtException(); - executeSoon(() => { - foobarExceptionBug587757(); - }); - - // Add a message from a chrome window. - hud.iframeWindow.console.log("bug587757a"); - - // Check Cu.reportError stack. - // Use another js script to not depend on the test file line numbers. - Services.scriptloader.loadSubScript(TEST_FILE, hud.iframeWindow); - - // Bug 1348885: test that error from nuked globals do not throw - let sandbox = new Cu.Sandbox(null, { - wantComponents: false, - wantGlobalProperties: ["URL", "URLSearchParams"], - }); - let error = Cu.evalInSandbox(` - new Error("1348885"); - `, sandbox); - Cu.reportError(error); - Cu.nukeSandbox(sandbox); - - // Add a message from a content window. - content.console.log("bug587757b"); - - // Test eval. - hud.jsterm.execute("document.location.href"); - - // Test eval frame script - hud.jsterm.execute(` - gBrowser.selectedBrowser.messageManager.loadFrameScript('data:application/javascript,console.log("framescript-message")', false); - "framescript-eval"; - `); - - // Check for network requests. - let xhr = new XMLHttpRequest(); - xhr.onload = () => console.log("xhr loaded, status is: " + xhr.status); - xhr.open("get", TEST_URI, true); - xhr.send(); - - // Check for xhr error. - let xhrErr = new XMLHttpRequest(); - xhrErr.onload = () => { - console.log("xhr error loaded, status is: " + xhrErr.status); - }; - xhrErr.open("get", TEST_XHR_ERROR_URI, true); - xhrErr.send(); - - // Check that Fetch requests are categorized as "XHR". - fetch(TEST_IMAGE).then(() => { console.log("fetch loaded"); }); - - return waitForMessages({ - webconsole: hud, - messages: [ - { - name: "chrome window console.log() is displayed", - text: "bug587757a", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - name: "Cu.reportError is displayed", - text: "bug1141222", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - stacktrace: [{ - file: TEST_FILE, - line: 2, - }, { - file: TEST_FILE, - line: 4, - }, - // Ignore the rest of the stack, - // just assert Cu.reportError call site - // and consoleOpened call - ] - }, - { - name: "Error from nuked global works", - text: "1348885", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - { - name: "content window console.log() is displayed", - text: "bug587757b", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - name: "jsterm eval result", - text: "browser.xul", - category: CATEGORY_OUTPUT, - severity: SEVERITY_LOG, - }, - { - name: "jsterm eval result 2", - text: "framescript-eval", - category: CATEGORY_OUTPUT, - severity: SEVERITY_LOG, - }, - { - name: "frame script message", - text: "framescript-message", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - name: "exception message", - text: "foobarExceptionBug587757", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - { - name: "network message", - text: "test-console.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_INFO, - isXhr: true, - }, - { - name: "xhr error message", - text: "404.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_ERROR, - isXhr: true, - }, - { - name: "network message", - text: "test-image.png", - category: CATEGORY_NETWORK, - severity: SEVERITY_INFO, - isXhr: true, - }, - ], - }); -} - -function* testCPOWInspection(hud) { - // Directly request evaluation to get an actor for the selected browser. - // Note that this doesn't actually render a message, and instead allows us - // us to assert that inspecting an object doesn't throw in the server. - // This would be done in a mochitest-chrome suite, but that doesn't run in - // e10s, so it's harder to get ahold of a CPOW. - let cpowEval = yield hud.jsterm.requestEvaluation("gBrowser.selectedBrowser"); - info("Creating an ObjectClient with: " + cpowEval.result.actor); - - let objectClient = new ObjectClient(hud.jsterm.hud.proxy.client, { - actor: cpowEval.result.actor, - }); - - // Before the fix for Bug 1382833, this wouldn't resolve due to a CPOW error - // in the ObjectActor. - let prototypeAndProperties = yield objectClient.getPrototypeAndProperties(); - - // Just a sanity check to make sure a valid packet came back - is(prototypeAndProperties.prototype.class, "XBL prototype JSClass", - "Looks like a valid response"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_addonsdk_loader_exception.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_addonsdk_loader_exception.js deleted file mode 100644 index 5214d9849e07..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_addonsdk_loader_exception.js +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that exceptions from scripts loaded with the addon-sdk loader are -// opened correctly in View Source from the Browser Console. -// See bug 866950. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
hello world from bug 866950"; - -function test() { - requestLongerTimeout(2); - - let webconsole, browserconsole; - - Task.spawn(runner).then(finishTest); - - function* runner() { - let {tab} = yield loadTab(TEST_URI); - webconsole = yield openConsole(tab); - ok(webconsole, "web console opened"); - - browserconsole = yield HUDService.toggleBrowserConsole(); - ok(browserconsole, "browser console opened"); - - // Cause an exception in a script loaded with the addon-sdk loader. - let toolbox = gDevTools.getToolbox(webconsole.target); - let oldPanels = toolbox._toolPanels; - // non-iterable - toolbox._toolPanels = {}; - - function fixToolbox() { - toolbox._toolPanels = oldPanels; - } - - info("generate exception and wait for message"); - - executeSoon(() => { - executeSoon(fixToolbox); - expectUncaughtException(); - toolbox.getToolPanels(); - }); - - let [result] = yield waitForMessages({ - webconsole: browserconsole, - messages: [{ - text: "TypeError: this._toolPanels is not iterable", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }], - }); - - fixToolbox(); - - let msg = [...result.matched][0]; - ok(msg, "message element found"); - let locationNode = msg - .querySelector(".message .message-location > .frame-link"); - ok(locationNode, "message location element found"); - - let url = locationNode.getAttribute("data-url"); - info("location node url: " + url); - ok(url.indexOf("resource://") === 0, "error comes from a subscript"); - - let viewSource = browserconsole.viewSource; - let URL = null; - let clickPromise = defer(); - browserconsole.viewSourceInDebugger = (sourceURL) => { - info("browserconsole.viewSourceInDebugger() was invoked: " + sourceURL); - URL = sourceURL; - clickPromise.resolve(null); - }; - - msg.scrollIntoView(); - EventUtils.synthesizeMouse(locationNode, 2, 2, {}, - browserconsole.iframeWindow); - - info("wait for click on locationNode"); - yield clickPromise.promise; - - info("view-source url: " + URL); - ok(URL, "we have some source URL after the click"); - isnot(URL.indexOf("toolbox.js"), -1, - "we have the expected view source URL"); - is(URL.indexOf("->"), -1, "no -> in the URL given to view-source"); - - browserconsole.viewSourceInDebugger = viewSource; - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_clear_method.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_clear_method.js deleted file mode 100644 index 33b43850e4df..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_clear_method.js +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that console.clear() does not clear the output of the browser console. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
Bug 1296870"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield HUDService.toggleBrowserConsole(); - - info("Log a new message from the content page"); - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.wrappedJSObject.console.log("msg"); - }); - yield waitForMessage("msg", hud); - - info("Send a console.clear() from the content page"); - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.wrappedJSObject.console.clear(); - }); - yield waitForMessage("Console was cleared", hud); - - info("Check that the messages logged after the first clear are still displayed"); - isnot(hud.outputNode.textContent.indexOf("msg"), -1, "msg is in the output"); -}); - -function waitForMessage(message, webconsole) { - return waitForMessages({ - webconsole, - messages: [{ - text: message, - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_consolejsm_output.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_consolejsm_output.js deleted file mode 100644 index 646fa0647d2c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_consolejsm_output.js +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that Console.jsm outputs messages to the Browser Console, bug 851231. - -"use strict"; - -function onNewMessage(aEvent, aNewMessages) { - for (let msg of aNewMessages) { - // Messages that shouldn't be output contain the substring FAIL_TEST - if (msg.node.textContent.includes("FAIL_TEST")) { - ok(false, "Message shouldn't have been output: " + msg.node.textContent); - } - } -} - -add_task(function* () { - let consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"]; - let storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage); - storage.clearEvents(); - - let {console} = Cu.import("resource://gre/modules/Console.jsm", {}); - console.log("bug861338-log-cached"); - - let hud = yield HUDService.toggleBrowserConsole(); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "cached console.log message", - text: "bug861338-log-cached", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - - hud.jsterm.clearOutput(true); - - function testTrace() { - console.trace(); - } - - console.time("foobarTimer"); - let foobar = { bug851231prop: "bug851231value" }; - - console.log("bug851231-log"); - console.info("bug851231-info"); - console.warn("bug851231-warn"); - console.error("bug851231-error", foobar); - console.debug("bug851231-debug"); - console.dir(document); - testTrace(); - console.timeEnd("foobarTimer"); - - info("wait for the Console.jsm messages"); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "console.log output", - text: "bug851231-log", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - name: "console.info output", - text: "bug851231-info", - category: CATEGORY_WEBDEV, - severity: SEVERITY_INFO, - }, - { - name: "console.warn output", - text: "bug851231-warn", - category: CATEGORY_WEBDEV, - severity: SEVERITY_WARNING, - }, - { - name: "console.error output", - text: /\bbug851231-error\b.+\{\s*bug851231prop:\s"bug851231value"\s*\}/, - category: CATEGORY_WEBDEV, - severity: SEVERITY_ERROR, - objects: true, - }, - { - name: "console.debug output", - text: "bug851231-debug", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - name: "console.trace output", - consoleTrace: { - file: "browser_console_consolejsm_output.js", - fn: "testTrace", - }, - }, - { - name: "console.dir output", - consoleDir: /XULDocument\s+.+\s+chrome:\/\/.+\/browser\.xul/, - }, - { - name: "console.time output", - consoleTime: "foobarTimer", - }, - { - name: "console.timeEnd output", - consoleTimeEnd: "foobarTimer", - }, - ], - }); - - let consoleErrorMsg = results[3]; - ok(consoleErrorMsg, "console.error message element found"); - let clickable = consoleErrorMsg.clickableElements[0]; - ok(clickable, "clickable object found for console.error"); - - let deferred = defer(); - - let onFetch = (aEvent, aVar) => { - // Skip the notification from console.dir variablesview-fetched. - if (aVar._variablesView != hud.jsterm._variablesView) { - return; - } - hud.jsterm.off("variablesview-fetched", onFetch); - - deferred.resolve(aVar); - }; - - hud.jsterm.on("variablesview-fetched", onFetch); - - clickable.scrollIntoView(false); - - info("wait for variablesview-fetched"); - executeSoon(() => - EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow)); - - let varView = yield deferred.promise; - ok(varView, "object inspector opened on click"); - - yield findVariableViewProperties(varView, [{ - name: "bug851231prop", - value: "bug851231value", - }], { webconsole: hud }); - - yield HUDService.toggleBrowserConsole(); -}); - -add_task(function* testPrefix() { - let consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"]; - let storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage); - storage.clearEvents(); - - let {ConsoleAPI} = Cu.import("resource://gre/modules/Console.jsm", {}); - let consoleOptions = { - maxLogLevel: "error", - prefix: "Log Prefix", - }; - let console2 = new ConsoleAPI(consoleOptions); - console2.error("Testing a prefix"); - console2.log("FAIL_TEST: Below the maxLogLevel"); - - let hud = yield HUDService.toggleBrowserConsole(); - hud.ui.on("new-messages", onNewMessage); - yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "cached console.error message", - prefix: "Log Prefix:", - severity: SEVERITY_ERROR, - text: "Testing a prefix", - }], - }); - - hud.jsterm.clearOutput(true); - hud.ui.off("new-messages", onNewMessage); - yield HUDService.toggleBrowserConsole(); -}); - -add_task(function* testMaxLogLevelPrefMissing() { - let consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"]; - let storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage); - storage.clearEvents(); - - let {ConsoleAPI} = Cu.import("resource://gre/modules/Console.jsm", {}); - let consoleOptions = { - maxLogLevel: "error", - maxLogLevelPref: "testing.maxLogLevel", - }; - let console = new ConsoleAPI(consoleOptions); - - is(Services.prefs.getPrefType(consoleOptions.maxLogLevelPref), - Services.prefs.PREF_INVALID, - "Check log level pref is missing"); - - // Since the maxLogLevelPref doesn't exist, we should fallback to the passed - // maxLogLevel of "error". - console.warn("FAIL_TEST: Below the maxLogLevel"); - console.error("Error should be shown"); - - let hud = yield HUDService.toggleBrowserConsole(); - - hud.ui.on("new-messages", onNewMessage); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "defaulting to error level", - severity: SEVERITY_ERROR, - text: "Error should be shown", - }], - }); - - hud.jsterm.clearOutput(true); - hud.ui.off("new-messages", onNewMessage); - yield HUDService.toggleBrowserConsole(); -}); - -add_task(function* testMaxLogLevelPref() { - let consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"]; - let storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage); - storage.clearEvents(); - - let {ConsoleAPI} = Cu.import("resource://gre/modules/Console.jsm", {}); - let consoleOptions = { - maxLogLevel: "error", - maxLogLevelPref: "testing.maxLogLevel", - }; - - info("Setting the pref to warn"); - Services.prefs.setCharPref(consoleOptions.maxLogLevelPref, "Warn"); - - let console = new ConsoleAPI(consoleOptions); - - is(console.maxLogLevel, "warn", "Check pref was read at initialization"); - - console.info("FAIL_TEST: info is below the maxLogLevel"); - console.error("Error should be shown"); - console.warn("Warn should be shown due to the initial pref value"); - - info("Setting the pref to info"); - Services.prefs.setCharPref(consoleOptions.maxLogLevelPref, "INFO"); - is(console.maxLogLevel, "info", "Check pref was lowercased"); - - console.info("info should be shown due to the pref change being observed"); - - info("Clearing the pref"); - Services.prefs.clearUserPref(consoleOptions.maxLogLevelPref); - - console.warn("FAIL_TEST: Shouldn't be shown due to defaulting to error"); - console.error("Should be shown due to defaulting to error"); - - let hud = yield HUDService.toggleBrowserConsole(); - hud.ui.on("new-messages", onNewMessage); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "error > warn", - severity: SEVERITY_ERROR, - text: "Error should be shown", - }, - { - name: "warn is the inital pref value", - severity: SEVERITY_WARNING, - text: "Warn should be shown due to the initial pref value", - }, - { - name: "pref changed to info", - severity: SEVERITY_INFO, - text: "info should be shown due to the pref change being observed", - }, - { - name: "default to intial maxLogLevel if pref is removed", - severity: SEVERITY_ERROR, - text: "Should be shown due to defaulting to error", - }], - }); - - hud.jsterm.clearOutput(true); - hud.ui.off("new-messages", onNewMessage); - yield HUDService.toggleBrowserConsole(); -}); - -// Test that console.profile/profileEnd trigger the right events -add_task(function* testProfile() { - let consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"]; - let storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage); - let { console } = Cu.import("resource://gre/modules/Console.jsm", {}); - - storage.clearEvents(); - - let profilerEvents = []; - - function observer(subject, topic) { - is(topic, "console-api-profiler", "The topic is 'console-api-profiler'"); - const subjectObj = subject.wrappedJSObject; - const event = { action: subjectObj.action, name: subjectObj.arguments[0] }; - info(`Profiler event: action=${event.action}, name=${event.name}`); - profilerEvents.push(event); - } - - Services.obs.addObserver(observer, "console-api-profiler"); - - console.profile("test"); - console.profileEnd("test"); - - Services.obs.removeObserver(observer, "console-api-profiler"); - - // Test that no messages were logged to the storage - let consoleEvents = storage.getEvents(); - is(consoleEvents.length, 0, "There are zero logged messages"); - - // Test that two profiler events were fired - is(profilerEvents.length, 2, "Got two profiler events"); - is(profilerEvents[0].action, "profile", "First event has the right action"); - is(profilerEvents[0].name, "test", "First event has the right name"); - is(profilerEvents[1].action, "profileEnd", "Second event has the right action"); - is(profilerEvents[1].name, "test", "Second event has the right name"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_dead_objects.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_dead_objects.js deleted file mode 100644 index fb8d0e2f54c8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_dead_objects.js +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that Dead Objects do not break the Web/Browser Consoles. -// See bug 883649. -// This test does: -// - opens a new tab, -// - opens the Browser Console, -// - stores a reference to the content document of the tab on the chrome -// window object, -// - closes the tab, -// - tries to use the object that was pointing to the now-defunct content -// document. This is the dead object. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
dead objects!"; - -function test() { - let hud = null; - - registerCleanupFunction(() => { - Services.prefs.clearUserPref("devtools.chrome.enabled"); - }); - - Task.spawn(runner).then(finishTest); - - function* runner() { - Services.prefs.setBoolPref("devtools.chrome.enabled", true); - yield loadTab(TEST_URI); - let browser = gBrowser.selectedBrowser; - let winID = browser.outerWindowID; - - info("open the browser console"); - - hud = yield HUDService.toggleBrowserConsole(); - ok(hud, "browser console opened"); - - let jsterm = hud.jsterm; - - jsterm.clearOutput(); - - // Add the reference to the content document. - yield jsterm.execute("Cu = Components.utils;" + - "Cu.import('resource://gre/modules/Services.jsm');" + - "chromeWindow = Services.wm.getMostRecentWindow('" + - "navigator:browser');" + - "foobarzTezt = chromeWindow.content.document;" + - "delete chromeWindow"); - - gBrowser.removeCurrentTab(); - - yield TestUtils.topicObserved("outer-window-nuked", (subject, data) => { - let id = subject.QueryInterface(Components.interfaces.nsISupportsPRUint64).data; - return id == winID; - }); - - let msg = yield jsterm.execute("foobarzTezt"); - - isnot(hud.outputNode.textContent.indexOf("[object DeadObject]"), -1, - "dead object found"); - - jsterm.setInputValue("foobarzTezt"); - - for (let c of ".hello") { - EventUtils.synthesizeKey(c, {}, hud.iframeWindow); - } - - yield jsterm.execute(); - - isnot(hud.outputNode.textContent.indexOf("can't access dead object"), -1, - "'cannot access dead object' message found"); - - // Click the second execute output. - let clickable = msg.querySelector("a"); - ok(clickable, "clickable object found"); - isnot(clickable.textContent.indexOf("[object DeadObject]"), -1, - "message text check"); - - msg.scrollIntoView(); - - executeSoon(() => { - EventUtils.synthesizeMouseAtCenter(clickable, {}, hud.iframeWindow); - }); - - yield jsterm.once("variablesview-fetched"); - ok(true, "variables view fetched"); - - msg = yield jsterm.execute("delete window.foobarzTezt; 2013-26"); - - isnot(msg.textContent.indexOf("1987"), -1, "result message found"); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_error_source_click.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_error_source_click.js deleted file mode 100644 index 5839f20d515a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_error_source_click.js +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that JS errors and CSS warnings open view source when their source link -// is clicked in the Browser Console. See bug 877778. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
hello world from bug 877778 " + - ""; - -add_task(function* () { - yield new Promise(resolve => { - SpecialPowers.pushPrefEnv({"set": [ - ["devtools.browserconsole.filter.cssparser", true] - ]}, resolve); - }); - - yield loadTab(TEST_URI); - let hud = yield HUDService.toggleBrowserConsole(); - ok(hud, "browser console opened"); - - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - info("generate exception and wait for the message"); - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - let button = content.document.querySelector("button"); - button.click(); - }); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: "ReferenceError: foobar is not defined", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - { - text: "Unknown property \u2018test-color\u2019", - category: CATEGORY_CSS, - severity: SEVERITY_WARNING, - }, - ], - }); - - let viewSourceCalled = false; - - let viewSource = hud.viewSource; - hud.viewSource = () => { - viewSourceCalled = true; - }; - - for (let result of results) { - viewSourceCalled = false; - - let msg = [...result.matched][0]; - ok(msg, "message element found for: " + result.text); - ok(!msg.classList.contains("filtered-by-type"), "message element is not filtered"); - let selector = ".message .message-location .frame-link-source"; - let locationNode = msg.querySelector(selector); - ok(locationNode, "message location element found"); - - locationNode.click(); - - ok(viewSourceCalled, "view source opened"); - } - - hud.viewSource = viewSource; - - yield finishTest(); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_filters.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_filters.js deleted file mode 100644 index 802fa8963841..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_filters.js +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that the Browser Console does not use the same filter prefs as the Web -// Console. See bug 878186. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
browser console filters"; -const WEB_CONSOLE_PREFIX = "devtools.webconsole.filter."; -const BROWSER_CONSOLE_PREFIX = "devtools.browserconsole.filter."; - -add_task(function* () { - yield loadTab(TEST_URI); - - info("open the web console"); - let hud = yield openConsole(); - ok(hud, "web console opened"); - - is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), true, - "'exception' filter is enabled (browser console)"); - is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), true, - "'exception' filter is enabled (web console)"); - - info("toggle 'exception' filter"); - hud.setFilterState("exception", false); - - is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), true, - "'exception' filter is enabled (browser console)"); - is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), false, - "'exception' filter is disabled (web console)"); - - hud.setFilterState("exception", true); - - // We need to let the console opening event loop to finish. - let deferred = defer(); - executeSoon(() => closeConsole().then(() => deferred.resolve(null))); - yield deferred.promise; - - info("web console closed"); - hud = yield HUDService.toggleBrowserConsole(); - ok(hud, "browser console opened"); - - is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), true, - "'exception' filter is enabled (browser console)"); - is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), true, - "'exception' filter is enabled (web console)"); - - info("toggle 'exception' filter"); - hud.setFilterState("exception", false); - - is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), false, - "'exception' filter is disabled (browser console)"); - is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), true, - "'exception' filter is enabled (web console)"); - - hud.setFilterState("exception", true); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_hide_jsterm_when_devtools_chrome_enabled_false.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_hide_jsterm_when_devtools_chrome_enabled_false.js deleted file mode 100644 index 2bf28e39de84..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_hide_jsterm_when_devtools_chrome_enabled_false.js +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/* - * Bug 922161 - Hide Browser Console JS input field if devtools.chrome.enabled - * is false. - * when devtools.chrome.enabled then - * -browser console jsterm should be enabled - * -browser console object inspector properties should be set. - * -webconsole jsterm should be enabled - * -webconsole object inspector properties should be set. - * - * when devtools.chrome.enabled == false then - * -browser console jsterm should be disabled - * -browser console object inspector properties should not be set. - * -webconsole jsterm should be enabled - * -webconsole object inspector properties should be set. - */ - -"use strict"; - -function testObjectInspectorPropertiesAreNotSet(variablesView) { - is(variablesView.eval, null, "vview.eval is null"); - is(variablesView.switch, null, "vview.switch is null"); - is(variablesView.delete, null, "vview.delete is null"); -} - -function* getVariablesView(hud) { - function openVariablesView(event, vview) { - deferred.resolve(vview._variablesView); - } - - let deferred = defer(); - - // Filter out other messages to ensure ours stays visible. - hud.ui.filterBox.value = "browser_console_hide_jsterm_test"; - - hud.jsterm.clearOutput(); - hud.jsterm.execute("new Object({ browser_console_hide_jsterm_test: true })"); - - let [message] = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "Object { browser_console_hide_jsterm_test: true }", - category: CATEGORY_OUTPUT, - }], - }); - - hud.jsterm.once("variablesview-fetched", openVariablesView); - - let anchor = [...message.matched][0].querySelector("a"); - - executeSoon(() => - EventUtils.synthesizeMouse(anchor, 2, 2, {}, hud.iframeWindow) - ); - - return deferred.promise; -} - -function testJSTermIsVisible(hud) { - let inputContainer = hud.ui.window.document - .querySelector(".jsterm-input-container"); - isnot(inputContainer.style.display, "none", "input is visible"); -} - -function testObjectInspectorPropertiesAreSet(variablesView) { - isnot(variablesView.eval, null, "vview.eval is set"); - isnot(variablesView.switch, null, "vview.switch is set"); - isnot(variablesView.delete, null, "vview.delete is set"); -} - -function testJSTermIsNotVisible(hud) { - let inputContainer = hud.ui.window.document - .querySelector(".jsterm-input-container"); - is(inputContainer.style.display, "none", "input is not visible"); -} - -function* testRunner() { - let browserConsole, webConsole, variablesView; - - Services.prefs.setBoolPref("devtools.chrome.enabled", true); - - browserConsole = yield HUDService.toggleBrowserConsole(); - variablesView = yield getVariablesView(browserConsole); - testJSTermIsVisible(browserConsole); - testObjectInspectorPropertiesAreSet(variablesView); - - let {tab: browserTab} = yield loadTab("data:text/html;charset=utf8,hello world"); - webConsole = yield openConsole(browserTab); - variablesView = yield getVariablesView(webConsole); - testJSTermIsVisible(webConsole); - testObjectInspectorPropertiesAreSet(variablesView); - yield closeConsole(browserTab); - - yield HUDService.toggleBrowserConsole(); - Services.prefs.setBoolPref("devtools.chrome.enabled", false); - - browserConsole = yield HUDService.toggleBrowserConsole(); - variablesView = yield getVariablesView(browserConsole); - testJSTermIsNotVisible(browserConsole); - testObjectInspectorPropertiesAreNotSet(variablesView); - - webConsole = yield openConsole(browserTab); - variablesView = yield getVariablesView(webConsole); - testJSTermIsVisible(webConsole); - testObjectInspectorPropertiesAreSet(variablesView); - yield closeConsole(browserTab); -} - -function test() { - Task.spawn(testRunner).then(finishTest); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_nsiconsolemessage.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_nsiconsolemessage.js deleted file mode 100644 index fedd0c71c3d7..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_nsiconsolemessage.js +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that nsIConsoleMessages are displayed in the Browser Console. -// See bug 859756. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
hello world\n
nsIConsoleMessages ftw!"; - -function test() { - const FILTER_PREF = "devtools.browserconsole.filter.jslog"; - Services.prefs.setBoolPref(FILTER_PREF, true); - - registerCleanupFunction(() => { - Services.prefs.clearUserPref(FILTER_PREF); - }); - - Task.spawn(function* () { - const {tab} = yield loadTab(TEST_URI); - - // Test for cached nsIConsoleMessages. - Services.console.logStringMessage("test1 for bug859756"); - - info("open web console"); - let hud = yield openConsole(tab); - - ok(hud, "web console opened"); - Services.console.logStringMessage("do-not-show-me"); - - ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { - content.console.log("foobarz"); - }); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "foobarz", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - - let text = hud.outputNode.textContent; - is(text.indexOf("do-not-show-me"), -1, - "nsIConsoleMessages are not displayed"); - is(text.indexOf("test1 for bug859756"), -1, - "nsIConsoleMessages are not displayed (confirmed)"); - - yield closeConsole(tab); - - info("web console closed"); - hud = yield HUDService.toggleBrowserConsole(); - ok(hud, "browser console opened"); - - Services.console.logStringMessage("test2 for bug859756"); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "test1 for bug859756", - category: CATEGORY_JS, - }, { - text: "test2 for bug859756", - category: CATEGORY_JS, - }, { - text: "do-not-show-me", - category: CATEGORY_JS, - }], - }); - - let msg = [...results[2].matched][0]; - ok(msg, "message element for do-not-show-me (nsIConsoleMessage)"); - isnot(msg.textContent.indexOf("do-not-show"), -1, - "element content is correct"); - ok(!msg.classList.contains("filtered-by-type"), "element is not filtered"); - - hud.setFilterState("jslog", false); - - ok(msg.classList.contains("filtered-by-type"), "element is filtered"); - }).then(finishTest); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_open_or_focus.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_open_or_focus.js deleted file mode 100644 index b9a1b85a9ba7..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_open_or_focus.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that the "browser console" menu item opens or focuses (if already open) -// the console window instead of toggling it open/close. - -"use strict"; - -var {Tools} = require("devtools/client/definitions"); - -add_task(function* () { - let currWindow, hud, mainWindow; - - mainWindow = Services.wm.getMostRecentWindow(null); - - yield HUDService.openBrowserConsoleOrFocus(); - - hud = HUDService.getBrowserConsole(); - - console.log("testmessage"); - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "testmessage" - }], - }); - currWindow = Services.wm.getMostRecentWindow(null); - is(currWindow.document.documentURI, Tools.webConsole.oldWebConsoleURL, - "The Browser Console is open and has focus"); - mainWindow.focus(); - yield HUDService.openBrowserConsoleOrFocus(); - currWindow = Services.wm.getMostRecentWindow(null); - is(currWindow.document.documentURI, Tools.webConsole.oldWebConsoleURL, - "The Browser Console is open and has focus"); - yield HUDService.toggleBrowserConsole(); - hud = HUDService.getBrowserConsole(); - ok(!hud, "Browser Console has been closed"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js deleted file mode 100644 index 161fb786a476..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_restore.js +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that the browser console gets session state is set correctly, and that -// it re-opens when restore is requested. - -"use strict"; - -add_task(async function() { - is(HUDService.getBrowserConsoleSessionState(), false, "Session state false by default"); - HUDService.storeBrowserConsoleSessionState(); - is(HUDService.getBrowserConsoleSessionState(), false, - "Session state still not true even after setting (since Browser Console is closed)"); - - await HUDService.toggleBrowserConsole(); - HUDService.storeBrowserConsoleSessionState(); - is(HUDService.getBrowserConsoleSessionState(), true, - "Session state true (since Browser Console is opened)"); - - info("Closing the browser console and waiting for the session restore to reopen it") - await HUDService.toggleBrowserConsole(); - - let opened = waitForBrowserConsole(); - gDevTools.restoreDevToolsSession({ - browserConsole: true - }); - - info("Waiting for the console to open after session restore") - await opened; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_ctrlw_close_tab.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_ctrlw_close_tab.js deleted file mode 100644 index 65cfb3be69dc..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_ctrlw_close_tab.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that Ctrl-W closes the Browser Console and that Ctrl-W closes the -// current tab when using the Web Console - bug 871156. - -"use strict"; - -add_task(function* () { - const TEST_URI = "data:text/html;charset=utf8,
hello world"; - let firstTab = gBrowser.selectedTab; - - Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false); - registerCleanupFunction(() => { - Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled"); - }); - - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - ok(hud, "Web Console opened"); - - let tabClosed = defer(); - let toolboxDestroyed = defer(); - let tabSelected = defer(); - - let target = TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = gDevTools.getToolbox(target); - - gBrowser.tabContainer.addEventListener("TabClose", function () { - info("tab closed"); - tabClosed.resolve(null); - }, {once: true}); - - gBrowser.tabContainer.addEventListener("TabSelect", function () { - if (gBrowser.selectedTab == firstTab) { - info("tab selected"); - tabSelected.resolve(null); - } - }, {once: true}); - - toolbox.once("destroyed", () => { - info("toolbox destroyed"); - toolboxDestroyed.resolve(null); - }); - - // Get out of the web console initialization. - executeSoon(() => { - EventUtils.synthesizeKey("w", { accelKey: true }); - }); - - yield promise.all([tabClosed.promise, toolboxDestroyed.promise, - tabSelected.promise]); - info("promise.all resolved. start testing the Browser Console"); - - hud = yield HUDService.toggleBrowserConsole(); - ok(hud, "Browser Console opened"); - - let deferred = defer(); - - Services.obs.addObserver(function onDestroy() { - Services.obs.removeObserver(onDestroy, "web-console-destroyed"); - ok(true, "the Browser Console closed"); - - deferred.resolve(null); - }, "web-console-destroyed"); - - waitForFocus(() => { - EventUtils.synthesizeKey("w", { accelKey: true }, hud.iframeWindow); - }, hud.iframeWindow); - - yield deferred.promise; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_iframe_messages.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_iframe_messages.js deleted file mode 100644 index 9bf3fe2b7cca..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_iframe_messages.js +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that cached messages from nested iframes are displayed in the -// Web/Browser Console. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-consoleiframes.html"; - -const expectedMessages = [ - { - text: "main file", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - text: "blah", - category: CATEGORY_JS, - severity: SEVERITY_ERROR - }, - { - text: "iframe 2", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG - }, - { - text: "iframe 3", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG - } -]; - -// "iframe 1" console messages can be coalesced into one if they follow each -// other in the sequence of messages (depending on timing). If they do not, then -// they will be displayed in the console output independently, as separate -// messages. This is why we need to match any of the following two rules. -const expectedMessagesAny = [ - { - name: "iframe 1 (count: 2)", - text: "iframe 1", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - count: 2 - }, - { - name: "iframe 1 (repeats: 2)", - text: "iframe 1", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 2 - }, -]; - -add_task(function* () { - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - yield loadTab(TEST_URI); - let hud = yield openConsole(); - ok(hud, "web console opened"); - - yield testWebConsole(hud); - yield closeConsole(); - info("web console closed"); - - hud = yield HUDService.toggleBrowserConsole(); - yield testBrowserConsole(hud); - yield closeConsole(); -}); - -function* testWebConsole(hud) { - yield waitForMessages({ - webconsole: hud, - messages: expectedMessages, - }); - - info("first messages matched"); - - yield waitForMessages({ - webconsole: hud, - messages: expectedMessagesAny, - matchCondition: "any", - }); -} - -function* testBrowserConsole(hud) { - ok(hud, "browser console opened"); - - // TODO: The browser console doesn't show page's console.log statements - // in e10s windows. See Bug 1241289. - if (Services.appinfo.browserTabsRemoteAutostart) { - todo(false, "Bug 1241289"); - return; - } - - yield waitForMessages({ - webconsole: hud, - messages: expectedMessages, - }); - - info("first messages matched"); - yield waitForMessages({ - webconsole: hud, - messages: expectedMessagesAny, - matchCondition: "any", - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_private_browsing.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_private_browsing.js deleted file mode 100644 index 382066b8952f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console_webconsole_private_browsing.js +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Bug 874061: test for how the browser and web consoles display messages coming -// from private windows. See bug for description of expected behavior. - -"use strict"; - -function test() { - const TEST_URI = "data:text/html;charset=utf8,
hello world! bug 874061" + - ""; - let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"] - .getService(Ci.nsIConsoleAPIStorage); - let privateWindow, privateBrowser, privateTab, privateContent; - let hud, expectedMessages, nonPrivateMessage; - - // This test is slightly more involved: it opens the web console twice, - // a new private window once, and the browser console twice. We can get - // a timeout with debug builds on slower machines. - requestLongerTimeout(2); - start(); - - function start() { - gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "data:text/html;charset=utf8," + - "
hello world! I am not private!"); - gBrowser.selectedBrowser.addEventListener("load", onLoadTab, true); - } - - function onLoadTab() { - gBrowser.selectedBrowser.removeEventListener("load", onLoadTab, true); - info("onLoadTab()"); - - // Make sure we have a clean state to start with. - Services.console.reset(); - ConsoleAPIStorage.clearEvents(); - - // Add a non-private message to the browser console. - ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { - content.console.log("bug874061-not-private"); - }); - - nonPrivateMessage = { - name: "console message from a non-private window", - text: "bug874061-not-private", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }; - - privateWindow = OpenBrowserWindow({ private: true }); - ok(privateWindow, "new private window"); - ok(PrivateBrowsingUtils.isWindowPrivate(privateWindow), "window's private"); - - whenDelayedStartupFinished(privateWindow, onPrivateWindowReady); - } - - function onPrivateWindowReady() { - info("private browser window opened"); - privateBrowser = privateWindow.gBrowser; - - privateTab = privateBrowser.selectedTab = privateBrowser.addTab(TEST_URI); - privateBrowser.selectedBrowser.addEventListener("load", function onLoad() { - info("private tab opened"); - privateBrowser.selectedBrowser.removeEventListener("load", onLoad, true); - privateContent = privateBrowser.selectedBrowser.contentWindow; - ok(PrivateBrowsingUtils.isBrowserPrivate(privateBrowser.selectedBrowser), - "tab window is private"); - openConsole(privateTab).then(consoleOpened); - }, true); - } - - function addMessages() { - let button = privateContent.document.querySelector("button"); - ok(button, "button in page"); - EventUtils.synthesizeMouse(button, 2, 2, {}, privateContent); - } - - function consoleOpened(injectedHud) { - hud = injectedHud; - ok(hud, "web console opened"); - - addMessages(); - expectedMessages = [ - { - name: "script error", - text: "fooBazBaz is not defined", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - { - name: "console message", - text: "foobar bug 874061", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - ]; - - // Make sure messages are displayed in the web console as they happen, even - // if this is a private tab. - waitForMessages({ - webconsole: hud, - messages: expectedMessages, - }).then(testCachedMessages); - } - - function testCachedMessages() { - info("testCachedMessages()"); - closeConsole(privateTab).then(() => { - info("web console closed"); - openConsole(privateTab).then(consoleReopened); - }); - } - - function consoleReopened(injectedHud) { - hud = injectedHud; - ok(hud, "web console reopened"); - - // Make sure that cached messages are displayed in the web console, even - // if this is a private tab. - waitForMessages({ - webconsole: hud, - messages: expectedMessages, - }).then(testBrowserConsole); - } - - function testBrowserConsole() { - info("testBrowserConsole()"); - closeConsole(privateTab).then(() => { - info("web console closed"); - HUDService.toggleBrowserConsole().then(onBrowserConsoleOpen); - }); - } - - // Make sure that the cached messages from private tabs are not displayed in - // the browser console. - function checkNoPrivateMessages() { - let text = hud.outputNode.textContent; - is(text.indexOf("fooBazBaz"), -1, "no exception displayed"); - is(text.indexOf("bug 874061"), -1, "no console message displayed"); - } - - function onBrowserConsoleOpen(injectedHud) { - hud = injectedHud; - ok(hud, "browser console opened"); - - checkNoPrivateMessages(); - addMessages(); - expectedMessages.push(nonPrivateMessage); - - // Make sure that live messages are displayed in the browser console, even - // from private tabs. - waitForMessages({ - webconsole: hud, - messages: expectedMessages, - }).then(testPrivateWindowClose); - } - - function testPrivateWindowClose() { - info("close the private window and check if private messages are removed"); - hud.jsterm.once("private-messages-cleared", () => { - isnot(hud.outputNode.textContent.indexOf("bug874061-not-private"), -1, - "non-private messages are still shown after private window closed"); - checkNoPrivateMessages(); - - info("close the browser console"); - HUDService.toggleBrowserConsole().then(() => { - info("reopen the browser console"); - executeSoon(() => - HUDService.toggleBrowserConsole().then(onBrowserConsoleReopen)); - }); - }); - privateWindow.BrowserTryToCloseWindow(); - } - - function onBrowserConsoleReopen(injectedHud) { - hud = injectedHud; - ok(hud, "browser console reopened"); - - // Make sure that the non-private message is still shown after reopen. - waitForMessages({ - webconsole: hud, - messages: [nonPrivateMessage], - }).then(() => { - // Make sure that no private message is displayed after closing the - // private window and reopening the Browser Console. - checkNoPrivateMessages(); - executeSoon(finishTest); - }); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_copy_command.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_copy_command.js deleted file mode 100644 index 4f434127df31..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_copy_command.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the `copy` console helper works as intended. - -"use strict"; - -var gWebConsole, gJSTerm; - -var TEXT = "Lorem ipsum dolor sit amet, consectetur adipisicing " + - "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " + - "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " + - "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " + - "dolor in reprehenderit in voluptate velit esse cillum dolore eu " + - "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " + - "proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + - new Date(); - -var ID = "select-me"; - -add_task(function* init() { - yield loadTab("data:text/html;charset=utf-8," + - "
" + - "This is some example text
" + - "" + TEXT + "
" + - "' + - "hi
"; -var hud; - -/** - * Unit test for bug 611795: - * Repeated CSS messages get collapsed into one. - */ - -add_task(function* () { - yield loadTab(TEST_URI); - - hud = yield openConsole(); - hud.jsterm.clearOutput(true); - - BrowserReload(); - yield loadBrowser(gBrowser.selectedBrowser); - - yield onContentLoaded(); - yield testConsoleLogRepeats(); - - hud = null; -}); - -function onContentLoaded() { - let cssWarning = "Unknown property \u2018-moz-opacity\u2019. Declaration dropped."; - - return waitForMessages({ - webconsole: hud, - messages: [{ - text: cssWarning, - category: CATEGORY_CSS, - severity: SEVERITY_WARNING, - repeats: 2, - }], - }); -} - -function testConsoleLogRepeats() { - let jsterm = hud.jsterm; - - jsterm.clearOutput(); - - jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a " + - "line of reasonably long text that I will use to " + - "verify that the repeated text node is of an " + - "appropriate size.');"); - jsterm.execute(); - - return waitForMessages({ - webconsole: hud, - messages: [{ - text: "this is a line of reasonably long text", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 10, - }], - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_No_input_and_Tab_key_pressed.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_No_input_and_Tab_key_pressed.js deleted file mode 100644 index 2143017e08a5..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_No_input_and_Tab_key_pressed.js +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 583816. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/browser/test-console.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - testCompletion(hud); -}); - -function testCompletion(hud) { - let jsterm = hud.jsterm; - let input = jsterm.inputNode; - - jsterm.setInputValue(""); - EventUtils.synthesizeKey("VK_TAB", {}); - is(jsterm.completeNode.value, "<- no result", "<- no result - matched"); - is(input.value, "", "inputnode is empty - matched"); - is(input.getAttribute("focused"), "true", "input is still focused"); - - // Any thing which is not in property autocompleter - jsterm.setInputValue("window.Bug583816"); - EventUtils.synthesizeKey("VK_TAB", {}); - is(jsterm.completeNode.value, " <- no result", - "completenode content - matched"); - is(input.value, "window.Bug583816", "inputnode content - matched"); - is(input.getAttribute("focused"), "true", "input is still focused"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_No_input_change_and_Tab_key_pressed.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_No_input_change_and_Tab_key_pressed.js deleted file mode 100644 index fd4e802fb670..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_No_input_change_and_Tab_key_pressed.js +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 734061. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/browser/test-console.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - let jsterm = hud.jsterm; - let input = jsterm.inputNode; - - is(input.getAttribute("focused"), "true", "input has focus"); - EventUtils.synthesizeKey("VK_TAB", {}); - is(input.getAttribute("focused"), "", "focus moved away"); - - // Test user changed something - input.focus(); - EventUtils.synthesizeKey("A", {}); - EventUtils.synthesizeKey("VK_TAB", {}); - is(input.getAttribute("focused"), "true", "input is still focused"); - - // Test non empty input but not changed since last focus - input.blur(); - input.focus(); - EventUtils.synthesizeKey("VK_RIGHT", {}); - EventUtils.synthesizeKey("VK_TAB", {}); - is(input.getAttribute("focused"), "", "input moved away"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_add_edited_input_to_history.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_add_edited_input_to_history.js deleted file mode 100644 index ccbcb3bf3031..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_add_edited_input_to_history.js +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that user input that is not submitted in the command line input is not -// lost after navigating in history. -// See https://bugzilla.mozilla.org/show_bug.cgi?id=817834 - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 817834"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - testEditedInputHistory(hud); -}); - -function testEditedInputHistory(HUD) { - let jsterm = HUD.jsterm; - let inputNode = jsterm.inputNode; - ok(!jsterm.getInputValue(), "jsterm.getInputValue() is empty"); - is(inputNode.selectionStart, 0); - is(inputNode.selectionEnd, 0); - - jsterm.setInputValue('"first item"'); - EventUtils.synthesizeKey("VK_UP", {}); - is(jsterm.getInputValue(), '"first item"', "null test history up"); - EventUtils.synthesizeKey("VK_DOWN", {}); - is(jsterm.getInputValue(), '"first item"', "null test history down"); - - jsterm.execute(); - is(jsterm.getInputValue(), "", "cleared input line after submit"); - - jsterm.setInputValue('"editing input 1"'); - EventUtils.synthesizeKey("VK_UP", {}); - is(jsterm.getInputValue(), '"first item"', "test history up"); - EventUtils.synthesizeKey("VK_DOWN", {}); - is(jsterm.getInputValue(), '"editing input 1"', - "test history down restores in-progress input"); - - jsterm.setInputValue('"second item"'); - jsterm.execute(); - jsterm.setInputValue('"editing input 2"'); - EventUtils.synthesizeKey("VK_UP", {}); - is(jsterm.getInputValue(), '"second item"', "test history up"); - EventUtils.synthesizeKey("VK_UP", {}); - is(jsterm.getInputValue(), '"first item"', "test history up"); - EventUtils.synthesizeKey("VK_DOWN", {}); - is(jsterm.getInputValue(), '"second item"', "test history down"); - EventUtils.synthesizeKey("VK_DOWN", {}); - is(jsterm.getInputValue(), '"editing input 2"', - "test history down restores new in-progress input again"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_allow_mixedcontent_securityerrors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_allow_mixedcontent_securityerrors.js deleted file mode 100644 index 30be80b5d1f3..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_allow_mixedcontent_securityerrors.js +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// The test loads a web page with mixed active and display content -// on it while the "block mixed content" settings are _off_. -// It then checks that the loading mixed content warning messages -// are logged to the console and have the correct "Learn More" -// url appended to them. -// Bug 875456 - Log mixed content messages from the Mixed Content -// Blocker to the Security Pane in the Web Console - -"use strict"; - -const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" + - "test/test-mixedcontent-securityerrors.html"; -const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" + - "Mixed_content" + DOCS_GA_PARAMS; - -add_task(function* () { - yield pushPrefEnv(); - - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Logged mixed active content", - text: "Loading mixed (insecure) active content " + - "\u201chttp://example.com/\u201d on a secure page", - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - { - name: "Logged mixed passive content - image", - text: "Loading mixed (insecure) display content " + - "\u201chttp://example.com/tests/image/test/mochitest/blue.png\u201d " + - "on a secure page", - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - ], - }); - - yield testClickOpenNewTab(hud, results); -}); - -function pushPrefEnv() { - let deferred = defer(); - let options = {"set": - [["security.mixed_content.block_active_content", false], - ["security.mixed_content.block_display_content", false] - ]}; - SpecialPowers.pushPrefEnv(options, deferred.resolve); - return deferred.promise; -} - -function testClickOpenNewTab(hud, results) { - let warningNode = results[0].clickableElements[0]; - ok(warningNode, "link element"); - ok(warningNode.classList.contains("learn-more-link"), "link class name"); - return simulateMessageLinkClick(warningNode, LEARN_MORE_URI); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_assert.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_assert.js deleted file mode 100644 index 7fc9693f134f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_assert.js +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that console.assert() works as expected (i.e. outputs only on falsy -// asserts). See bug 760193. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console-assert.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - yield consoleOpened(hud); -}); - -function consoleOpened(hud) { - hud.jsterm.execute("test()"); - - return waitForMessages({ - webconsole: hud, - messages: [{ - text: "undefined", - category: CATEGORY_OUTPUT, - severity: SEVERITY_LOG, - }, - { - text: "start", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - text: "false assert", - category: CATEGORY_WEBDEV, - severity: SEVERITY_ERROR, - }, - { - text: "falsy assert", - category: CATEGORY_WEBDEV, - severity: SEVERITY_ERROR, - }, - { - text: "end", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }).then(() => { - let nodes = hud.outputNode.querySelectorAll(".message"); - is(nodes.length, 6, - "only six messages are displayed, no output from the true assert"); - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete-properties-with-non-alphanumeric-names.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete-properties-with-non-alphanumeric-names.js deleted file mode 100644 index 79ca21391773..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete-properties-with-non-alphanumeric-names.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// Test that properties starting with underscores or dollars can be -// autocompleted (bug 967468). - -add_task(function* () { - const TEST_URI = "data:text/html;charset=utf8,test autocompletion with " + - "$ or _"; - yield loadTab(TEST_URI); - - function* autocomplete(term) { - let deferred = defer(); - - jsterm.setInputValue(term); - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, deferred.resolve); - - yield deferred.promise; - - ok(popup.itemCount > 0, - "There's " + popup.itemCount + " suggestions for '" + term + "'"); - } - - let { jsterm } = yield openConsole(); - let popup = jsterm.autocompletePopup; - - yield jsterm.execute("var testObject = {$$aaab: '', $$aaac: ''}"); - - // Should work with bug 967468. - yield autocomplete("Object.__d"); - yield autocomplete("testObject.$$a"); - - // Here's when things go wrong in bug 967468. - yield autocomplete("Object.__de"); - yield autocomplete("testObject.$$aa"); - - // Should work with bug 1207868. - yield jsterm.execute("let foobar = {a: ''}; const blargh = {a: 1};"); - yield autocomplete("foobar"); - yield autocomplete("blargh"); - yield autocomplete("foobar.a"); - yield autocomplete("blargh.a"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_JSTerm_helpers.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_JSTerm_helpers.js deleted file mode 100644 index abc043d26e2e..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_JSTerm_helpers.js +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the autocompletion results contain the names of JSTerm helpers. - -"use strict"; - -// See Bug 686937. - -const TEST_URI = "data:text/html;charset=utf8,test JSTerm Helpers " + - "autocomplete"; - -var jsterm; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - jsterm = hud.jsterm; - let input = jsterm.inputNode; - let popup = jsterm.autocompletePopup; - - // Test if 'i' gives 'inspect' - input.value = "i"; - input.setSelectionRange(1, 1); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - let newItems = popup.getItems().map(function (e) { - return e.label; - }); - ok(newItems.indexOf("inspect") > -1, - "autocomplete results contain helper 'inspect'"); - - // Test if 'window.' does not give 'inspect'. - input.value = "window."; - input.setSelectionRange(7, 7); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - newItems = popup.getItems().map(function (e) { - return e.label; - }); - is(newItems.indexOf("inspect"), -1, - "autocomplete results do not contain helper 'inspect'"); - - // Test if 'dump(i' gives 'inspect' - input.value = "dump(i"; - input.setSelectionRange(6, 6); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - newItems = popup.getItems().map(function (e) { - return e.label; - }); - ok(newItems.indexOf("inspect") > -1, - "autocomplete results contain helper 'inspect'"); - - // Test if 'window.dump(i' gives 'inspect' - input.value = "window.dump(i"; - input.setSelectionRange(13, 13); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - newItems = popup.getItems().map(function (e) { - return e.label; - }); - ok(newItems.indexOf("inspect") > -1, - "autocomplete results contain helper 'inspect'"); - - jsterm = null; -}); - -function complete(type) { - let updated = jsterm.once("autocomplete-updated"); - jsterm.complete(type); - return updated; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_accessibility.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_accessibility.js deleted file mode 100644 index bcd2e22d0fb8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_accessibility.js +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the autocomplete input is being blurred and focused when selecting a value. -// This will help screen-readers notify users of the value that was set in the input. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
test code completion"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - let jsterm = hud.jsterm; - let input = jsterm.inputNode; - - info("Type 'd' to open the autocomplete popup"); - yield autocomplete(jsterm, "d"); - - // Add listeners for focus and blur events. - let wasBlurred = false; - input.addEventListener("blur", () => { - wasBlurred = true; - }, { - once: true - }); - - let wasFocused = false; - input.addEventListener("blur", () => { - ok(wasBlurred, "jsterm input received a blur event before received back the focus"); - wasFocused = true; - }, { - once: true - }); - - info("Close the autocomplete popup by simulating a TAB key event"); - let onPopupClosed = jsterm.autocompletePopup.once("popup-closed"); - EventUtils.synthesizeKey("VK_TAB", {}); - - info("Wait for the autocomplete popup to be closed"); - yield onPopupClosed; - - ok(wasFocused, "jsterm input received a focus event"); -}); - -function* autocomplete(jsterm, value) { - let popup = jsterm.autocompletePopup; - - yield new Promise(resolve => { - jsterm.setInputValue(value); - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - ok(popup.isOpen && popup.itemCount > 0, - "Autocomplete popup is open and contains suggestions"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_and_selfxss.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_and_selfxss.js deleted file mode 100644 index 37c86ef16345..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_and_selfxss.js +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,
test for bug 642615"; - -XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper", - "@mozilla.org/widget/clipboardhelper;1", - "nsIClipboardHelper"); -var WebConsoleUtils = require("devtools/client/webconsole/utils").Utils; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield consoleOpened(hud); -}); - -function consoleOpened(HUD) { - let deferred = defer(); - - let jsterm = HUD.jsterm; - let stringToCopy = "foobazbarBug642615"; - - jsterm.clearOutput(); - - ok(!jsterm.completeNode.value, "no completeNode.value"); - - jsterm.setInputValue("doc"); - - let completionValue; - - // wait for key "u" - function onCompletionValue() { - completionValue = jsterm.completeNode.value; - - // Arguments: expected, setup, success, failure. - waitForClipboard( - stringToCopy, - function () { - clipboardHelper.copyString(stringToCopy); - }, - onClipboardCopy, - finishTest); - } - - function onClipboardCopy() { - testSelfXss(); - - jsterm.setInputValue("docu"); - info("wait for completion update after clipboard paste"); - updateEditUIVisibility(); - jsterm.once("autocomplete-updated", onClipboardPaste); - goDoCommand("cmd_paste"); - } - - // Self xss prevention tests (bug 994134) - function testSelfXss() { - info("Self-xss paste tests"); - WebConsoleUtils.usageCount = 0; - is(WebConsoleUtils.usageCount, 0, "Test for usage count getter"); - // Input some commands to check if usage counting is working - for (let i = 0; i <= 3; i++) { - jsterm.setInputValue(i); - jsterm.execute(); - } - is(WebConsoleUtils.usageCount, 4, "Usage count incremented"); - WebConsoleUtils.usageCount = 0; - updateEditUIVisibility(); - - let oldVal = jsterm.getInputValue(); - goDoCommand("cmd_paste"); - let notificationbox = jsterm.hud.document.getElementById("webconsole-notificationbox"); - let notification = notificationbox.getNotificationWithValue("selfxss-notification"); - ok(notification, "Self-xss notification shown"); - is(oldVal, jsterm.getInputValue(), "Paste blocked by self-xss prevention"); - - // Allow pasting - jsterm.setInputValue("allow pasting"); - let evt = document.createEvent("KeyboardEvent"); - evt.initKeyEvent("keyup", true, true, window, - 0, 0, 0, 0, - 0, " ".charCodeAt(0)); - jsterm.inputNode.dispatchEvent(evt); - jsterm.setInputValue(""); - goDoCommand("cmd_paste"); - isnot("", jsterm.getInputValue(), "Paste works"); - } - function onClipboardPaste() { - ok(!jsterm.completeNode.value, "no completion value after paste"); - - info("wait for completion update after undo"); - jsterm.once("autocomplete-updated", onCompletionValueAfterUndo); - - // Get out of the webconsole event loop. - executeSoon(() => { - goDoCommand("cmd_undo"); - }); - } - - function onCompletionValueAfterUndo() { - is(jsterm.completeNode.value, completionValue, - "same completeNode.value after undo"); - - info("wait for completion update after clipboard paste (ctrl-v)"); - jsterm.once("autocomplete-updated", () => { - ok(!jsterm.completeNode.value, - "no completion value after paste (ctrl-v)"); - - // using executeSoon() to get out of the webconsole event loop. - executeSoon(deferred.resolve); - }); - - // Get out of the webconsole event loop. - executeSoon(() => { - EventUtils.synthesizeKey("v", {accelKey: true}); - }); - } - - info("wait for completion value after typing 'docu'"); - jsterm.once("autocomplete-updated", onCompletionValue); - - EventUtils.synthesizeKey("u", {}); - - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_crossdomain_iframe.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_crossdomain_iframe.js deleted file mode 100644 index b4471bd6bc1f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_crossdomain_iframe.js +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that autocomplete doesn't break when trying to reach into objects from -// a different domain, bug 989025. - -"use strict"; - -function test() { - let hud; - - const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-989025-iframe-parent.html"; - - Task.spawn(function* () { - const {tab} = yield loadTab(TEST_URI); - hud = yield openConsole(tab); - - hud.jsterm.execute("document.title"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "989025 - iframe parent", - category: CATEGORY_OUTPUT, - }], - }); - - let autocompleteUpdated = hud.jsterm.once("autocomplete-updated"); - - hud.jsterm.setInputValue("window[0].document"); - executeSoon(() => { - EventUtils.synthesizeKey(".", {}); - }); - - yield autocompleteUpdated; - - hud.jsterm.setInputValue("window[0].document.title"); - EventUtils.synthesizeKey("VK_RETURN", {}); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "Permission denied", - category: CATEGORY_OUTPUT, - severity: SEVERITY_ERROR, - }], - }); - - hud.jsterm.execute("window.location"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "test-bug-989025-iframe-parent.html", - category: CATEGORY_OUTPUT, - }], - }); - - yield closeConsole(tab); - }).then(finishTest); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_in_debugger_stackframe.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_in_debugger_stackframe.js deleted file mode 100644 index 60ba5ff0ebba..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_in_debugger_stackframe.js +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that makes sure web console autocomplete happens in the user-selected -// stackframe from the js debugger. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-autocomplete-in-stackframe.html"; - -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -var gStackframes; -registerCleanupFunction(function () { - gStackframes = null; -}); - -requestLongerTimeout(2); -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - yield testCompletion(hud); -}); - -function* testCompletion(hud) { - let jsterm = hud.jsterm; - let input = jsterm.inputNode; - let popup = jsterm.autocompletePopup; - - // Test that document.title gives string methods. Native getters must execute. - input.value = "document.title."; - input.setSelectionRange(input.value.length, input.value.length); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - let newItems = popup.getItems(); - ok(newItems.length > 0, "'document.title.' gave a list of suggestions"); - ok(newItems.some(function (item) { - return item.label == "substr"; - }), "autocomplete results do contain substr"); - ok(newItems.some(function (item) { - return item.label == "toLowerCase"; - }), "autocomplete results do contain toLowerCase"); - ok(newItems.some(function (item) { - return item.label == "strike"; - }), "autocomplete results do contain strike"); - - // Test if 'f' gives 'foo1' but not 'foo2' or 'foo3' - input.value = "f"; - input.setSelectionRange(1, 1); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(newItems.length > 0, "'f' gave a list of suggestions"); - ok(!newItems.every(function (item) { - return item.label != "foo1"; - }), "autocomplete results do contain foo1"); - ok(!newItems.every(function (item) { - return item.label != "foo1Obj"; - }), "autocomplete results do contain foo1Obj"); - ok(newItems.every(function (item) { - return item.label != "foo2"; - }), "autocomplete results do not contain foo2"); - ok(newItems.every(function (item) { - return item.label != "foo2Obj"; - }), "autocomplete results do not contain foo2Obj"); - ok(newItems.every(function (item) { - return item.label != "foo3"; - }), "autocomplete results do not contain foo3"); - ok(newItems.every(function (item) { - return item.label != "foo3Obj"; - }), "autocomplete results do not contain foo3Obj"); - - // Test if 'foo1Obj.' gives 'prop1' and 'prop2' - input.value = "foo1Obj."; - input.setSelectionRange(8, 8); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(!newItems.every(function (item) { - return item.label != "prop1"; - }), "autocomplete results do contain prop1"); - ok(!newItems.every(function (item) { - return item.label != "prop2"; - }), "autocomplete results do contain prop2"); - - // Test if 'foo1Obj.prop2.' gives 'prop21' - input.value = "foo1Obj.prop2."; - input.setSelectionRange(14, 14); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(!newItems.every(function (item) { - return item.label != "prop21"; - }), "autocomplete results do contain prop21"); - - info("Opening Debugger"); - let dbg = yield openDebugger(); - - info("Waiting for pause"); - yield pauseDebugger(dbg); - - info("Opening Console again"); - yield openConsole(); - - // From this point on the - // Test if 'f' gives 'foo3' and 'foo1' but not 'foo2' - input.value = "f"; - input.setSelectionRange(1, 1); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(newItems.length > 0, "'f' gave a list of suggestions"); - ok(!newItems.every(function (item) { - return item.label != "foo3"; - }), "autocomplete results do contain foo3"); - ok(!newItems.every(function (item) { - return item.label != "foo3Obj"; - }), "autocomplete results do contain foo3Obj"); - ok(!newItems.every(function (item) { - return item.label != "foo1"; - }), "autocomplete results do contain foo1"); - ok(!newItems.every(function (item) { - return item.label != "foo1Obj"; - }), "autocomplete results do contain foo1Obj"); - ok(newItems.every(function (item) { - return item.label != "foo2"; - }), "autocomplete results do not contain foo2"); - ok(newItems.every(function (item) { - return item.label != "foo2Obj"; - }), "autocomplete results do not contain foo2Obj"); - - yield openDebugger(); - - gStackframes.selectFrame(1); - - info("openConsole"); - yield openConsole(); - - // Test if 'f' gives 'foo2' and 'foo1' but not 'foo3' - input.value = "f"; - input.setSelectionRange(1, 1); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(newItems.length > 0, "'f' gave a list of suggestions"); - ok(!newItems.every(function (item) { - return item.label != "foo2"; - }), "autocomplete results do contain foo2"); - ok(!newItems.every(function (item) { - return item.label != "foo2Obj"; - }), "autocomplete results do contain foo2Obj"); - ok(!newItems.every(function (item) { - return item.label != "foo1"; - }), "autocomplete results do contain foo1"); - ok(!newItems.every(function (item) { - return item.label != "foo1Obj"; - }), "autocomplete results do contain foo1Obj"); - ok(newItems.every(function (item) { - return item.label != "foo3"; - }), "autocomplete results do not contain foo3"); - ok(newItems.every(function (item) { - return item.label != "foo3Obj"; - }), "autocomplete results do not contain foo3Obj"); - - // Test if 'foo2Obj.' gives 'prop1' - input.value = "foo2Obj."; - input.setSelectionRange(8, 8); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(!newItems.every(function (item) { - return item.label != "prop1"; - }), "autocomplete results do contain prop1"); - - // Test if 'foo2Obj.prop1.' gives 'prop11' - input.value = "foo2Obj.prop1."; - input.setSelectionRange(14, 14); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(!newItems.every(function (item) { - return item.label != "prop11"; - }), "autocomplete results do contain prop11"); - - // Test if 'foo2Obj.prop1.prop11.' gives suggestions for a string - // i.e. 'length' - input.value = "foo2Obj.prop1.prop11."; - input.setSelectionRange(21, 21); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - ok(!newItems.every(function (item) { - return item.label != "length"; - }), "autocomplete results do contain length"); - - // Test if 'foo1Obj[0].' throws no errors. - input.value = "foo2Obj[0]."; - input.setSelectionRange(11, 11); - yield new Promise(resolve => { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve); - }); - - newItems = popup.getItems(); - is(newItems.length, 0, "no items for foo2Obj[0]"); -} - -function pauseDebugger(aResult) { - let debuggerWin = aResult.panelWin; - let debuggerController = debuggerWin.DebuggerController; - let thread = debuggerController.activeThread; - gStackframes = debuggerController.StackFrames; - return new Promise(resolve => { - thread.addOneTimeListener("framesadded", resolve); - - info("firstCall()"); - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.wrappedJSObject.firstCall(); - }); - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_keys.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_keys.js deleted file mode 100644 index 2f3997a0d7e8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_keys.js +++ /dev/null @@ -1,369 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 585991. - -const TEST_URI = "data:text/html;charset=utf-8,
bug 585991 - autocomplete " + - "popup keyboard usage test"; - -// We should turn off auto-multiline editing during these tests -const PREF_AUTO_MULTILINE = "devtools.webconsole.autoMultiline"; -var HUD, popup, jsterm, inputNode, completeNode; - -add_task(function* () { - Services.prefs.setBoolPref(PREF_AUTO_MULTILINE, false); - yield loadTab(TEST_URI); - let hud = yield openConsole(); - - yield consoleOpened(hud); - yield popupHideAfterTab(); - yield testReturnKey(); - yield dontShowArrayNumbers(); - yield testReturnWithNoSelection(); - yield popupHideAfterReturnWithNoSelection(); - yield testCompletionInText(); - yield popupHideAfterCompletionInText(); - - HUD = popup = jsterm = inputNode = completeNode = null; - Services.prefs.setBoolPref(PREF_AUTO_MULTILINE, true); -}); - -var consoleOpened = Task.async(function* (hud) { - let deferred = defer(); - HUD = hud; - info("web console opened"); - - jsterm = HUD.jsterm; - - yield jsterm.execute("window.foobarBug585991={" + - "'item0': 'value0'," + - "'item1': 'value1'," + - "'item2': 'value2'," + - "'item3': 'value3'" + - "}"); - yield jsterm.execute("window.testBug873250a = 'hello world';" - + "window.testBug873250b = 'hello world 2';"); - popup = jsterm.autocompletePopup; - completeNode = jsterm.completeNode; - inputNode = jsterm.inputNode; - - ok(!popup.isOpen, "popup is not open"); - - popup.once("popup-opened", () => { - ok(popup.isOpen, "popup is open"); - - // 4 values, and the following properties: - // __defineGetter__ __defineSetter__ __lookupGetter__ __lookupSetter__ - // __proto__ hasOwnProperty isPrototypeOf propertyIsEnumerable - // toLocaleString toString toSource unwatch valueOf watch constructor. - is(popup.itemCount, 19, "popup.itemCount is correct"); - - let sameItems = popup.getItems().reverse().map(function (e) { - return e.label; - }); - - ok(sameItems.every(function (prop, index) { - return [ - "__defineGetter__", - "__defineSetter__", - "__lookupGetter__", - "__lookupSetter__", - "__proto__", - "constructor", - "hasOwnProperty", - "isPrototypeOf", - "item0", - "item1", - "item2", - "item3", - "propertyIsEnumerable", - "toLocaleString", - "toSource", - "toString", - "unwatch", - "valueOf", - "watch", - ][index] === prop; - }), "getItems returns the items we expect"); - - is(popup.selectedIndex, 18, - "Index of the first item from bottom is selected."); - EventUtils.synthesizeKey("VK_DOWN", {}); - - let prefix = jsterm.getInputValue().replace(/[\S]/g, " "); - - is(popup.selectedIndex, 0, "index 0 is selected"); - is(popup.selectedItem.label, "watch", "watch is selected"); - is(completeNode.value, prefix + "watch", - "completeNode.value holds watch"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(popup.selectedIndex, 1, "index 1 is selected"); - is(popup.selectedItem.label, "valueOf", "valueOf is selected"); - is(completeNode.value, prefix + "valueOf", - "completeNode.value holds valueOf"); - - EventUtils.synthesizeKey("VK_UP", {}); - - is(popup.selectedIndex, 0, "index 0 is selected"); - is(popup.selectedItem.label, "watch", "watch is selected"); - is(completeNode.value, prefix + "watch", - "completeNode.value holds watch"); - - let currentSelectionIndex = popup.selectedIndex; - - EventUtils.synthesizeKey("VK_PAGE_DOWN", {}); - - ok(popup.selectedIndex > currentSelectionIndex, - "Index is greater after PGDN"); - - currentSelectionIndex = popup.selectedIndex; - EventUtils.synthesizeKey("VK_PAGE_UP", {}); - - ok(popup.selectedIndex < currentSelectionIndex, - "Index is less after Page UP"); - - EventUtils.synthesizeKey("VK_END", {}); - is(popup.selectedIndex, 18, "index is last after End"); - - EventUtils.synthesizeKey("VK_HOME", {}); - is(popup.selectedIndex, 0, "index is first after Home"); - - info("press Tab and wait for popup to hide"); - popup.once("popup-closed", () => { - deferred.resolve(); - }); - EventUtils.synthesizeKey("VK_TAB", {}); - }); - - jsterm.setInputValue("window.foobarBug585991"); - EventUtils.synthesizeKey(".", {}); - - return deferred.promise; -}); - -function popupHideAfterTab() { - let deferred = defer(); - - // At this point the completion suggestion should be accepted. - ok(!popup.isOpen, "popup is not open"); - - is(jsterm.getInputValue(), "window.foobarBug585991.watch", - "completion was successful after VK_TAB"); - - ok(!completeNode.value, "completeNode is empty"); - - popup.once("popup-opened", function onShown() { - ok(popup.isOpen, "popup is open"); - - is(popup.itemCount, 19, "popup.itemCount is correct"); - - is(popup.selectedIndex, 18, "First index from bottom is selected"); - EventUtils.synthesizeKey("VK_DOWN", {}); - - let prefix = jsterm.getInputValue().replace(/[\S]/g, " "); - - is(popup.selectedIndex, 0, "index 0 is selected"); - is(popup.selectedItem.label, "watch", "watch is selected"); - is(completeNode.value, prefix + "watch", - "completeNode.value holds watch"); - - popup.once("popup-closed", function onHidden() { - ok(!popup.isOpen, "popup is not open after VK_ESCAPE"); - - is(jsterm.getInputValue(), "window.foobarBug585991.", - "completion was cancelled"); - - ok(!completeNode.value, "completeNode is empty"); - - deferred.resolve(); - }, false); - - info("press Escape to close the popup"); - executeSoon(function () { - EventUtils.synthesizeKey("VK_ESCAPE", {}); - }); - }, false); - - info("wait for completion: window.foobarBug585991."); - executeSoon(function () { - jsterm.setInputValue("window.foobarBug585991"); - EventUtils.synthesizeKey(".", {}); - }); - - return deferred.promise; -} - -function testReturnKey() { - let deferred = defer(); - - popup.once("popup-opened", function onShown() { - ok(popup.isOpen, "popup is open"); - - is(popup.itemCount, 19, "popup.itemCount is correct"); - - is(popup.selectedIndex, 18, "First index from bottom is selected"); - EventUtils.synthesizeKey("VK_DOWN", {}); - - let prefix = jsterm.getInputValue().replace(/[\S]/g, " "); - - is(popup.selectedIndex, 0, "index 0 is selected"); - is(popup.selectedItem.label, "watch", "watch is selected"); - is(completeNode.value, prefix + "watch", - "completeNode.value holds watch"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(popup.selectedIndex, 1, "index 1 is selected"); - is(popup.selectedItem.label, "valueOf", "valueOf is selected"); - is(completeNode.value, prefix + "valueOf", - "completeNode.value holds valueOf"); - - popup.once("popup-closed", function onHidden() { - ok(!popup.isOpen, "popup is not open after VK_RETURN"); - - is(jsterm.getInputValue(), "window.foobarBug585991.valueOf", - "completion was successful after VK_RETURN"); - - ok(!completeNode.value, "completeNode is empty"); - - deferred.resolve(); - }, false); - - info("press Return to accept suggestion. wait for popup to hide"); - - executeSoon(() => EventUtils.synthesizeKey("VK_RETURN", {})); - }, false); - - info("wait for completion suggestions: window.foobarBug585991."); - - executeSoon(function () { - jsterm.setInputValue("window.foobarBug58599"); - EventUtils.synthesizeKey("1", {}); - EventUtils.synthesizeKey(".", {}); - }); - - return deferred.promise; -} - -function* dontShowArrayNumbers() { - let deferred = defer(); - - info("dontShowArrayNumbers"); - yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.wrappedJSObject.foobarBug585991 = ["Sherlock Holmes"]; - }); - - jsterm = HUD.jsterm; - popup = jsterm.autocompletePopup; - - popup.once("popup-opened", function onShown() { - let sameItems = popup.getItems().map(function (e) { - return e.label; - }); - ok(!sameItems.some(function (prop) { - prop === "0"; - }), "Completing on an array doesn't show numbers."); - - popup.once("popup-closed", function popupHidden() { - deferred.resolve(); - }, false); - - info("wait for popup to hide"); - executeSoon(() => EventUtils.synthesizeKey("VK_ESCAPE", {})); - }, false); - - info("wait for popup to show"); - executeSoon(() => { - jsterm.setInputValue("window.foobarBug585991"); - EventUtils.synthesizeKey(".", {}); - }); - - return deferred.promise; -} - -function testReturnWithNoSelection() { - let deferred = defer(); - - info("test pressing return with open popup, but no selection, see bug 873250"); - - popup.once("popup-opened", function onShown() { - ok(popup.isOpen, "popup is open"); - is(popup.itemCount, 2, "popup.itemCount is correct"); - isnot(popup.selectedIndex, -1, "popup.selectedIndex is correct"); - - info("press Return and wait for popup to hide"); - popup.once("popup-closed", function popupHidden() { - deferred.resolve(); - }); - executeSoon(() => EventUtils.synthesizeKey("VK_RETURN", {})); - }); - - executeSoon(() => { - info("wait for popup to show"); - jsterm.setInputValue("window.testBu"); - EventUtils.synthesizeKey("g", {}); - }); - - return deferred.promise; -} - -function popupHideAfterReturnWithNoSelection() { - ok(!popup.isOpen, "popup is not open after VK_RETURN"); - - is(jsterm.getInputValue(), "", "inputNode is empty after VK_RETURN"); - is(completeNode.value, "", "completeNode is empty"); - is(jsterm.history[jsterm.history.length - 1], "window.testBug", - "jsterm history is correct"); - - return promise.resolve(); -} - -function testCompletionInText() { - info("test that completion works inside text, see bug 812618"); - - let deferred = defer(); - - popup.once("popup-opened", function onShown() { - ok(popup.isOpen, "popup is open"); - is(popup.itemCount, 2, "popup.itemCount is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - is(popup.selectedIndex, 0, "popup.selectedIndex is correct"); - ok(!completeNode.value, "completeNode.value is empty"); - - let items = popup.getItems().reverse().map(e => e.label); - let sameItems = items.every((prop, index) => - ["testBug873250a", "testBug873250b"][index] === prop); - ok(sameItems, "getItems returns the items we expect"); - - info("press Tab and wait for popup to hide"); - popup.once("popup-closed", function popupHidden() { - deferred.resolve(); - }); - EventUtils.synthesizeKey("VK_TAB", {}); - }); - - jsterm.setInputValue("dump(window.testBu)"); - inputNode.selectionStart = inputNode.selectionEnd = 18; - EventUtils.synthesizeKey("g", {}); - return deferred.promise; -} - -function popupHideAfterCompletionInText() { - // At this point the completion suggestion should be accepted. - ok(!popup.isOpen, "popup is not open"); - is(jsterm.getInputValue(), "dump(window.testBug873250b)", - "completion was successful after VK_TAB"); - is(inputNode.selectionStart, 26, "cursor location is correct"); - is(inputNode.selectionStart, inputNode.selectionEnd, - "cursor location (confirmed)"); - ok(!completeNode.value, "completeNode is empty"); - - return promise.resolve(); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_popup.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_popup.js deleted file mode 100644 index a3885716f03c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_popup.js +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 585991. - -const TEST_URI = "data:text/html;charset=utf-8,
bug 585991 - autocomplete " + - "popup test"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - - yield consoleOpened(hud); -}); - -function consoleOpened(HUD) { - let deferred = defer(); - - let items = [ - {label: "item0", value: "value0"}, - {label: "item1", value: "value1"}, - {label: "item2", value: "value2"}, - ]; - - let popup = HUD.jsterm.autocompletePopup; - let input = HUD.jsterm.inputNode; - - ok(!popup.isOpen, "popup is not open"); - ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant"); - - popup.once("popup-opened", () => { - ok(popup.isOpen, "popup is open"); - - is(popup.itemCount, 0, "no items"); - ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant"); - - popup.setItems(items); - - is(popup.itemCount, items.length, "items added"); - - let sameItems = popup.getItems(); - is(sameItems.every(function (item, index) { - return item === items[index]; - }), true, "getItems returns back the same items"); - - is(popup.selectedIndex, 2, "Index of the first item from bottom is selected."); - is(popup.selectedItem, items[2], "First item from bottom is selected"); - checkActiveDescendant(popup, input); - - popup.selectedIndex = 1; - - is(popup.selectedIndex, 1, "index 1 is selected"); - is(popup.selectedItem, items[1], "item1 is selected"); - checkActiveDescendant(popup, input); - - popup.selectedItem = items[2]; - - is(popup.selectedIndex, 2, "index 2 is selected"); - is(popup.selectedItem, items[2], "item2 is selected"); - checkActiveDescendant(popup, input); - - is(popup.selectPreviousItem(), items[1], "selectPreviousItem() works"); - - is(popup.selectedIndex, 1, "index 1 is selected"); - is(popup.selectedItem, items[1], "item1 is selected"); - checkActiveDescendant(popup, input); - - is(popup.selectNextItem(), items[2], "selectNextItem() works"); - - is(popup.selectedIndex, 2, "index 2 is selected"); - is(popup.selectedItem, items[2], "item2 is selected"); - checkActiveDescendant(popup, input); - - ok(popup.selectNextItem(), "selectNextItem() works"); - - is(popup.selectedIndex, 0, "index 0 is selected"); - is(popup.selectedItem, items[0], "item0 is selected"); - checkActiveDescendant(popup, input); - - items.push({label: "label3", value: "value3"}); - popup.appendItem(items[3]); - - is(popup.itemCount, items.length, "item3 appended"); - - popup.selectedIndex = 3; - is(popup.selectedItem, items[3], "item3 is selected"); - checkActiveDescendant(popup, input); - - popup.removeItem(items[2]); - - is(popup.selectedIndex, 2, "index2 is selected"); - is(popup.selectedItem, items[3], "item3 is still selected"); - checkActiveDescendant(popup, input); - is(popup.itemCount, items.length - 1, "item2 removed"); - - popup.clearItems(); - is(popup.itemCount, 0, "items cleared"); - ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant"); - - popup.once("popup-closed", () => { - deferred.resolve(); - }); - popup.hidePopup(); - }); - - popup.openPopup(input); - - return deferred.promise; -} - -function checkActiveDescendant(popup, input) { - let activeElement = input.ownerDocument.activeElement; - let descendantId = activeElement.getAttribute("aria-activedescendant"); - let popupItem = popup._tooltip.panel.querySelector("#" + descendantId); - let cloneItem = input.ownerDocument.querySelector("#" + descendantId); - - ok(popupItem, "Active descendant is found in the popup list"); - ok(cloneItem, "Active descendant is found in the list clone"); - is(popupItem.innerHTML, cloneItem.innerHTML, - "Cloned item has the same HTML as the original element"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_popup_close_on_tab_switch.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_popup_close_on_tab_switch.js deleted file mode 100644 index afa3dd55d1be..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_popup_close_on_tab_switch.js +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that the autocomplete popup closes on switching tabs. See bug 900448. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,
bug 900448 - autocomplete " + - "popup closes on tab switch"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - let popup = hud.jsterm.autocompletePopup; - let popupShown = once(popup, "popup-opened"); - - hud.jsterm.setInputValue("sc"); - EventUtils.synthesizeKey("r", {}); - - yield popupShown; - - yield loadTab("data:text/html;charset=utf-8,
testing autocomplete closes"); - - ok(!popup.isOpen, "Popup closes on tab switch"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_block_mixedcontent_securityerrors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_block_mixedcontent_securityerrors.js deleted file mode 100644 index 22340a6d8ec0..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_block_mixedcontent_securityerrors.js +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// The test loads a web page with mixed active and display content -// on it while the "block mixed content" settings are _on_. -// It then checks that the blocked mixed content warning messages -// are logged to the console and have the correct "Learn More" -// url appended to them. After the first test finishes, it invokes -// a second test that overrides the mixed content blocker settings -// by clicking on the doorhanger shield and validates that the -// appropriate messages are logged to console. -// Bug 875456 - Log mixed content messages from the Mixed Content -// Blocker to the Security Pane in the Web Console - -"use strict"; - -const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" + - "test/test-mixedcontent-securityerrors.html"; -const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" + - "Mixed_content" + DOCS_GA_PARAMS; - -add_task(function* () { - yield pushPrefEnv(); - - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Logged blocking mixed active content", - text: "Blocked loading mixed active content \u201chttp://example.com/\u201d", - category: CATEGORY_SECURITY, - severity: SEVERITY_ERROR, - objects: true, - }, - { - name: "Logged blocking mixed passive content - image", - text: "Blocked loading mixed active content \u201chttp://example.com/\u201d", - category: CATEGORY_SECURITY, - severity: SEVERITY_ERROR, - objects: true, - }, - ], - }); - - yield testClickOpenNewTab(hud, results[0]); - - let results2 = yield mixedContentOverrideTest2(hud, browser); - - yield testClickOpenNewTab(hud, results2[0]); -}); - -function pushPrefEnv() { - let deferred = defer(); - let options = { - "set": [ - ["security.mixed_content.block_active_content", true], - ["security.mixed_content.block_display_content", true], - ["security.mixed_content.use_hsts", false], - ["security.mixed_content.send_hsts_priming", false], - ] - }; - SpecialPowers.pushPrefEnv(options, deferred.resolve); - return deferred.promise; -} - -function mixedContentOverrideTest2(hud, browser) { - let deferred = defer(); - let {gIdentityHandler} = browser.ownerGlobal; - ok(gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"), - "Mixed Active Content state appeared on identity box"); - gIdentityHandler.disableMixedContentProtection(); - - waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Logged blocking mixed active content", - text: "Loading mixed (insecure) active content " + - "\u201chttp://example.com/\u201d on a secure page", - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - { - name: "Logged blocking mixed passive content - image", - text: "Loading mixed (insecure) display content" + - " \u201chttp://example.com/tests/image/test/mochitest/blue.png\u201d" + - " on a secure page", - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - ], - }).then(msgs => deferred.resolve(msgs), console.error); - - return deferred.promise; -} - -function testClickOpenNewTab(hud, match) { - let warningNode = match.clickableElements[0]; - ok(warningNode, "link element"); - ok(warningNode.classList.contains("learn-more-link"), "link class name"); - return simulateMessageLinkClick(warningNode, LEARN_MORE_URI); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cached_autocomplete.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cached_autocomplete.js deleted file mode 100644 index fd5c4d29ac9c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cached_autocomplete.js +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the cached autocomplete results are used when the new -// user input is a subset of the existing completion results. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
test cached autocompletion " + - "results"; - -var jsterm; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - jsterm = hud.jsterm; - let input = jsterm.inputNode; - let popup = jsterm.autocompletePopup; - - // Test if 'doc' gives 'document' - input.value = "doc"; - input.setSelectionRange(3, 3); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - is(input.value, "doc", "'docu' completion (input.value)"); - is(jsterm.completeNode.value, " ument", "'docu' completion (completeNode)"); - - // Test typing 'window.'. - input.value = "window."; - input.setSelectionRange(7, 7); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - ok(popup.getItems().length > 0, "'window.' gave a list of suggestions"); - - yield jsterm.execute("window.docfoobar = true"); - - // Test typing 'window.doc'. - input.value = "window.doc"; - input.setSelectionRange(10, 10); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - let newItems = popup.getItems(); - ok(newItems.every(function (item) { - return item.label != "docfoobar"; - }), "autocomplete cached results do not contain docfoobar. list has not " + - "been updated"); - - // Test that backspace does not cause a request to the server - input.value = "window.do"; - input.setSelectionRange(9, 9); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - newItems = popup.getItems(); - ok(newItems.every(function (item) { - return item.label != "docfoobar"; - }), "autocomplete cached results do not contain docfoobar. list has not " + - "been updated"); - - yield jsterm.execute("delete window.docfoobar"); - - // Test if 'window.getC' gives 'getComputedStyle' - input.value = "window."; - input.setSelectionRange(7, 7); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - input.value = "window.getC"; - input.setSelectionRange(11, 11); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - newItems = popup.getItems(); - ok(!newItems.every(function (item) { - return item.label != "getComputedStyle"; - }), "autocomplete results do contain getComputedStyle"); - - // Test if 'dump(d' gives non-zero results - input.value = "dump(d"; - input.setSelectionRange(6, 6); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - ok(popup.getItems().length > 0, "'dump(d' gives non-zero results"); - - // Test that 'dump(window.)' works. - input.value = "dump(window.)"; - input.setSelectionRange(12, 12); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - yield jsterm.execute("window.docfoobar = true"); - - // Make sure 'dump(window.doc)' does not contain 'docfoobar'. - input.value = "dump(window.doc)"; - input.setSelectionRange(15, 15); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - newItems = popup.getItems(); - ok(newItems.every(function (item) { - return item.label != "docfoobar"; - }), "autocomplete cached results do not contain docfoobar. list has not " + - "been updated"); - - yield jsterm.execute("delete window.docfoobar"); - - jsterm = null; -}); - -function complete(type) { - let updated = jsterm.once("autocomplete-updated"); - jsterm.complete(type); - return updated; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cached_messages.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cached_messages.js deleted file mode 100644 index bf69deee3fc2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cached_messages.js +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test to see if the cached messages are displayed when the console UI is -// opened. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-webconsole-error-observer.html"; - -// On e10s, the exception is triggered in child process -// and is ignored by test harness -if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); -} - -function test() { - waitForExplicitFinish(); - - loadTab(TEST_URI).then(testOpenUI); -} - -function testOpenUI(aTestReopen) { - openConsole().then((hud) => { - waitForMessages({ - webconsole: hud, - messages: [ - { - text: "log Bazzle", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - text: "error Bazzle", - category: CATEGORY_WEBDEV, - severity: SEVERITY_ERROR, - }, - { - text: "bazBug611032", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - { - text: "cssColorBug611032", - category: CATEGORY_CSS, - severity: SEVERITY_WARNING, - }, - ], - }).then(() => { - closeConsole(gBrowser.selectedTab).then(() => { - aTestReopen && info("will reopen the Web Console"); - executeSoon(aTestReopen ? testOpenUI : finishTest); - }); - }); - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cd_iframe.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cd_iframe.js deleted file mode 100644 index 480c60940800..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cd_iframe.js +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that the cd() jsterm helper function works as expected. See bug 609872. - -"use strict"; - -function test() { - let hud; - - const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-609872-cd-iframe-parent.html"; - - const parentMessages = [{ - name: "document.title in parent iframe", - text: "bug 609872 - iframe parent", - category: CATEGORY_OUTPUT, - }, { - name: "paragraph content", - text: "p: test for bug 609872 - iframe parent", - category: CATEGORY_OUTPUT, - }, { - name: "object content", - text: "obj: parent!", - category: CATEGORY_OUTPUT, - }]; - - const childMessages = [{ - name: "document.title in child iframe", - text: "bug 609872 - iframe child", - category: CATEGORY_OUTPUT, - }, { - name: "paragraph content", - text: "p: test for bug 609872 - iframe child", - category: CATEGORY_OUTPUT, - }, { - name: "object content", - text: "obj: child!", - category: CATEGORY_OUTPUT, - }]; - - Task.spawn(runner).then(finishTest); - - function* runner() { - const {tab} = yield loadTab(TEST_URI); - hud = yield openConsole(tab); - - yield executeWindowTest(); - - yield waitForMessages({ webconsole: hud, messages: parentMessages }); - - info("cd() into the iframe using a selector"); - hud.jsterm.clearOutput(); - yield hud.jsterm.execute("cd('iframe')"); - yield executeWindowTest(); - - yield waitForMessages({ webconsole: hud, messages: childMessages }); - - info("cd() out of the iframe, reset to default window"); - hud.jsterm.clearOutput(); - yield hud.jsterm.execute("cd()"); - yield executeWindowTest(); - - yield waitForMessages({ webconsole: hud, messages: parentMessages }); - - info("call cd() with unexpected arguments"); - hud.jsterm.clearOutput(); - yield hud.jsterm.execute("cd(document)"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "Cannot cd()", - category: CATEGORY_OUTPUT, - severity: SEVERITY_ERROR, - }], - }); - - hud.jsterm.clearOutput(); - yield hud.jsterm.execute("cd('p')"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "Cannot cd()", - category: CATEGORY_OUTPUT, - severity: SEVERITY_ERROR, - }], - }); - - info("cd() into the iframe using an iframe DOM element"); - hud.jsterm.clearOutput(); - yield hud.jsterm.execute("cd($('iframe'))"); - yield executeWindowTest(); - - yield waitForMessages({ webconsole: hud, messages: childMessages }); - - info("cd(window.parent)"); - hud.jsterm.clearOutput(); - yield hud.jsterm.execute("cd(window.parent)"); - yield executeWindowTest(); - - yield waitForMessages({ webconsole: hud, messages: parentMessages }); - - yield closeConsole(tab); - } - - function* executeWindowTest() { - yield hud.jsterm.execute("document.title"); - yield hud.jsterm.execute("'p: ' + document.querySelector('p').textContent"); - yield hud.jsterm.execute("'obj: ' + window.foobarBug609872"); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_certificate_messages.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_certificate_messages.js deleted file mode 100644 index ca08d1a0f062..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_certificate_messages.js +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the Web Console shows weak crypto warnings (SHA-1 Certificate) - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,Web Console weak crypto " + - "warnings test"; -const TEST_URI_PATH = "/browser/devtools/client/webconsole/test/" + - "test-certificate-messages.html"; - -var gWebconsoleTests = [ - {url: "https://sha1ee.example.com" + TEST_URI_PATH, - name: "SHA1 warning displayed successfully", - warning: ["SHA-1"], nowarning: ["SSL 3.0", "RC4"]}, - {url: "https://sha256ee.example.com" + TEST_URI_PATH, - name: "SSL warnings appropriately not present", - warning: [], nowarning: ["SHA-1", "SSL 3.0", "RC4"]}, -]; -const TRIGGER_MSG = "If you haven't seen ssl warnings yet, you won't"; - -var gHud = undefined, gContentBrowser; -var gCurrentTest; - -function test() { - registerCleanupFunction(function () { - gHud = gContentBrowser = null; - }); - - loadTab(TEST_URI).then(({browser}) => { - gContentBrowser = browser; - openConsole().then(runTestLoop); - }); -} - -function runTestLoop(theHud) { - gCurrentTest = gWebconsoleTests.shift(); - if (!gCurrentTest) { - finishTest(); - return; - } - if (!gHud) { - gHud = theHud; - } - gHud.jsterm.clearOutput(); - gContentBrowser.addEventListener("load", onLoad, true); - if (gCurrentTest.pref) { - SpecialPowers.pushPrefEnv({"set": gCurrentTest.pref}, - function () { - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.url); - }); - } else { - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.url); - } -} - -function onLoad() { - gContentBrowser.removeEventListener("load", onLoad, true); - - waitForSuccess({ - name: gCurrentTest.name, - validator: function () { - if (gHud.outputNode.textContent.indexOf(TRIGGER_MSG) >= 0) { - for (let warning of gCurrentTest.warning) { - if (gHud.outputNode.textContent.indexOf(warning) < 0) { - return false; - } - } - for (let nowarning of gCurrentTest.nowarning) { - if (gHud.outputNode.textContent.indexOf(nowarning) >= 0) { - return false; - } - } - return true; - } - } - }).then(runTestLoop); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_charset.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_charset.js deleted file mode 100644 index da68618be005..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_charset.js +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 600183. - -const INIT_URI = "data:text/html;charset=utf-8,Web Console - bug 600183 test"; -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-600183-charset.html"; - -function performTest(lastFinishedRequest, console) { - let deferred = defer(); - - ok(lastFinishedRequest, "charset test page was loaded and logged"); - HUDService.lastFinishedRequest.callback = null; - - executeSoon(() => { - console.webConsoleClient.getResponseContent(lastFinishedRequest.actor, - (response) => { - ok(!response.contentDiscarded, "response body was not discarded"); - - let body = response.content.text; - ok(body, "we have the response body"); - - // 的问候! - let chars = "\u7684\u95ee\u5019!"; - isnot(body.indexOf("
" + chars + "
"), -1, - "found the chinese simplified string"); - - HUDService.lastFinishedRequest.callback = null; - executeSoon(deferred.resolve); - }); - }); - - return deferred.promise; -} - -function waitForRequest() { - let deferred = defer(); - HUDService.lastFinishedRequest.callback = (req, console) => { - performTest(req, console).then(deferred.resolve); - }; - return deferred.promise; -} - -add_task(function* () { - let { browser } = yield loadTab(INIT_URI); - - yield openConsole(); - - let gotLastRequest = waitForRequest(); - - let loaded = loadBrowser(browser); - BrowserTestUtils.loadURI(browser, TEST_URI); - yield loaded; - - yield gotLastRequest; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_chrome.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_chrome.js deleted file mode 100644 index 1b32d7e2313a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_chrome.js +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that code completion works properly in chrome tabs, like about:credits. - -"use strict"; - -function test() { - Task.spawn(function* () { - const {tab} = yield loadTab("about:config"); - ok(tab, "tab loaded"); - - const hud = yield openConsole(tab); - ok(hud, "we have a console"); - ok(hud.iframeWindow, "we have the console UI window"); - - let jsterm = hud.jsterm; - ok(jsterm, "we have a jsterm"); - - let input = jsterm.inputNode; - ok(hud.outputNode, "we have an output node"); - - // Test typing 'docu'. - input.value = "docu"; - input.setSelectionRange(4, 4); - - let deferred = defer(); - - jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function () { - is(jsterm.completeNode.value, " ment", "'docu' completion"); - deferred.resolve(null); - }); - - yield deferred.promise; - }).then(finishTest); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_click_function_to_source.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_click_function_to_source.js deleted file mode 100644 index f0fe69436f37..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_click_function_to_source.js +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that clicking on a function displays its source in the debugger. See Bug 1050691. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug_1050691_click_function_to_source.html"; - -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - - // Open the Debugger panel. - let debuggerPanel = yield openDebugger(); - // And right after come back to the Console panel. - yield openConsole(); - yield testWithDebuggerOpen(hud, debuggerPanel); -}); - -function* testWithDebuggerOpen(hud, debuggerPanel) { - let clickable = yield printFunction(hud); - let panelWin = debuggerPanel.panelWin; - let onEditorLocationSet = panelWin.once(panelWin.EVENTS.EDITOR_LOCATION_SET); - synthesizeClick(clickable, hud); - yield onEditorLocationSet; - ok(isDebuggerCaretPos(debuggerPanel, 7), - "Clicking on a function should go to its source in the debugger view"); -} - -function synthesizeClick(clickable, hud) { - EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); -} - -var printFunction = Task.async(function* (hud) { - hud.jsterm.clearOutput(); - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.wrappedJSObject.foo(); - }); - let [result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - let msg = [...result.matched][0]; - let clickable = msg.querySelector("a"); - ok(clickable, "clickable item for object should exist"); - return clickable; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closing_after_completion.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closing_after_completion.js deleted file mode 100644 index 60753add75f2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closing_after_completion.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests to ensure that errors don't appear when the console is closed while a -// completion is being performed. See Bug 580001. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -add_task(function* () { - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - yield testClosingAfterCompletion(hud, browser); -}); - -function testClosingAfterCompletion(hud, browser) { - let deferred = defer(); - - let errorWhileClosing = false; - function errorListener() { - errorWhileClosing = true; - } - - browser.addEventListener("error", errorListener); - - // Focus the jsterm and perform the keycombo to close the WebConsole. - hud.jsterm.focus(); - - gDevTools.once("toolbox-destroyed", function () { - browser.removeEventListener("error", errorListener); - is(errorWhileClosing, false, "no error while closing the WebConsole"); - deferred.resolve(); - }); - - if (Services.appinfo.OS == "Darwin") { - EventUtils.synthesizeKey("i", { accelKey: true, altKey: true }); - } else { - EventUtils.synthesizeKey("i", { accelKey: true, shiftKey: true }); - } - - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closing_brackets.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closing_brackets.js deleted file mode 100644 index dd3c7217d7e4..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closing_brackets.js +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that, when the user types an extraneous closing bracket, no error -// appears. See Bug 592442. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,test for bug 592442"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - hud.jsterm.clearOutput(); - let jsterm = hud.jsterm; - - jsterm.setInputValue("document.getElementById)"); - - let error = false; - try { - jsterm.complete(jsterm.COMPLETE_HINT_ONLY); - } catch (ex) { - error = true; - } - - ok(!error, "no error was thrown when an extraneous bracket was inserted"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closure_inspection.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closure_inspection.js deleted file mode 100644 index 7dc506554644..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_closure_inspection.js +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that inspecting a closure in the variables view sidebar works when -// execution is paused. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-closures.html"; - -var gWebConsole, gJSTerm, gVariablesView; - -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -function test() { - registerCleanupFunction(() => { - gWebConsole = gJSTerm = gVariablesView = null; - }); - - function fetchScopes(hud, toolbox, panelWin, deferred) { - panelWin.once(panelWin.EVENTS.FETCHED_SCOPES, () => { - ok(true, "Scopes were fetched"); - toolbox.selectTool("webconsole").then(() => consoleOpened(hud)); - deferred.resolve(); - }); - } - - loadTab(TEST_URI).then(() => { - openConsole().then((hud) => { - openDebugger().then(({ toolbox, panelWin }) => { - let deferred = defer(); - fetchScopes(hud, toolbox, panelWin, deferred); - - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - let button = content.document.querySelector("button"); - ok(button, "button element found"); - button.click(); - }); - - return deferred.promise; - }); - }); - }); -} - -function consoleOpened(hud) { - gWebConsole = hud; - gJSTerm = hud.jsterm; - gJSTerm.execute("window.george.getName"); - - waitForMessages({ - webconsole: gWebConsole, - messages: [{ - text: "getName()", - category: CATEGORY_OUTPUT, - objects: true, - }], - }).then(onExecuteGetName); -} - -function onExecuteGetName(results) { - let clickable = results[0].clickableElements[0]; - ok(clickable, "clickable object found"); - - gJSTerm.once("variablesview-fetched", onGetNameFetch); - let contextMenu = - gWebConsole.iframeWindow.document.getElementById("output-contextmenu"); - waitForContextMenu(contextMenu, clickable, () => { - let openInVarView = contextMenu.querySelector("#menu_openInVarView"); - ok(openInVarView.disabled === false, - "the \"Open In Variables View\" context menu item should be clickable"); - // EventUtils.synthesizeMouseAtCenter seems to fail here in Mac OSX - openInVarView.click(); - }); -} - -function onGetNameFetch(evt, view) { - gVariablesView = view._variablesView; - ok(gVariablesView, "variables view object"); - - findVariableViewProperties(view, [ - { name: /_pfactory/, value: "" }, - ], { webconsole: gWebConsole }).then(onExpandClosure); -} - -function onExpandClosure(results) { - let prop = results[0].matchedProp; - ok(prop, "matched the name property in the variables view"); - - gVariablesView.window.focus(); - gJSTerm.once("sidebar-closed", finishTest); - EventUtils.synthesizeKey("VK_ESCAPE", {}, gVariablesView.window); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_completion.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_completion.js deleted file mode 100644 index ee0c6809efe9..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_completion.js +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that code completion works properly. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,test code completion"; - -var jsterm; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - jsterm = hud.jsterm; - let input = jsterm.inputNode; - - // Test typing 'docu'. - input.value = "docu"; - input.setSelectionRange(4, 4); - yield complete(jsterm.COMPLETE_HINT_ONLY); - - is(input.value, "docu", "'docu' completion (input.value)"); - is(jsterm.completeNode.value, " ment", "'docu' completion (completeNode)"); - - // Test typing 'docu' and press tab. - input.value = "docu"; - input.setSelectionRange(4, 4); - yield complete(jsterm.COMPLETE_FORWARD); - - is(input.value, "document", "'docu' tab completion"); - is(input.selectionStart, 8, "start selection is alright"); - is(input.selectionEnd, 8, "end selection is alright"); - is(jsterm.completeNode.value.replace(/ /g, ""), "", "'docu' completed"); - - // Test typing 'window.Ob' and press tab. Just 'window.O' is - // ambiguous: could be window.Object, window.Option, etc. - input.value = "window.Ob"; - input.setSelectionRange(9, 9); - yield complete(jsterm.COMPLETE_FORWARD); - - is(input.value, "window.Object", "'window.Ob' tab completion"); - - // Test typing 'document.getElem'. - input.value = "document.getElem"; - input.setSelectionRange(16, 16); - yield complete(jsterm.COMPLETE_FORWARD); - - is(input.value, "document.getElem", "'document.getElem' completion"); - is(jsterm.completeNode.value, " entsByTagNameNS", - "'document.getElem' completion"); - - // Test pressing tab another time. - yield jsterm.complete(jsterm.COMPLETE_FORWARD); - - is(input.value, "document.getElem", "'document.getElem' completion"); - is(jsterm.completeNode.value, " entsByTagName", - "'document.getElem' another tab completion"); - - // Test pressing shift_tab. - complete(jsterm.COMPLETE_BACKWARD); - - is(input.value, "document.getElem", "'document.getElem' untab completion"); - is(jsterm.completeNode.value, " entsByTagNameNS", - "'document.getElem' completion"); - - jsterm.clearOutput(); - - input.value = "docu"; - yield complete(jsterm.COMPLETE_HINT_ONLY); - - is(jsterm.completeNode.value, " ment", "'docu' completion"); - yield jsterm.execute(); - is(jsterm.completeNode.value, "", "clear completion on execute()"); - - // Test multi-line completion works - input.value = "console.log('one');\nconsol"; - yield complete(jsterm.COMPLETE_HINT_ONLY); - - is(jsterm.completeNode.value, " \n e", - "multi-line completion"); - - // Test non-object autocompletion. - input.value = "Object.name.sl"; - yield complete(jsterm.COMPLETE_HINT_ONLY); - - is(jsterm.completeNode.value, " ice", "non-object completion"); - - // Test string literal autocompletion. - input.value = "'Asimov'.sl"; - yield complete(jsterm.COMPLETE_HINT_ONLY); - - is(jsterm.completeNode.value, " ice", "string literal completion"); - - jsterm = null; -}); - -function complete(type) { - let updated = jsterm.once("autocomplete-updated"); - jsterm.complete(type); - return updated; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_api_iframe.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_api_iframe.js deleted file mode 100644 index 2ed5f5a3d5f3..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_api_iframe.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 613013. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-613013-console-api-iframe.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - BrowserReload(); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "foobarBug613013", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_dir_uninspectable.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_dir_uninspectable.js deleted file mode 100644 index 38a5b54198ec..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_dir_uninspectable.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Make sure that the Web Console output does not break after we try to call -// console.dir() for objects that are not inspectable. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,test for bug 773466"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - hud.jsterm.clearOutput(true); - - hud.jsterm.execute("console.log('fooBug773466a')"); - hud.jsterm.execute("myObj = Object.create(null)"); - hud.jsterm.execute("console.dir(myObj)"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "fooBug773466a", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - name: "console.dir output", - consoleDir: "[object Object]", - }], - }); - - content.console.log("fooBug773466b"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "fooBug773466b", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_logging_workers_api.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_logging_workers_api.js deleted file mode 100644 index 9575721c30bb..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_console_logging_workers_api.js +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the basic console.log()-style APIs and filtering work for -// sharedWorkers - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console-workers.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "foo-bar-shared-worker" - }], - }); - - hud.setFilterState("sharedworkers", false); - - is(hud.outputNode.querySelectorAll(".filtered-by-type").length, 1, - "1 message hidden for sharedworkers (logging turned off)"); - - hud.setFilterState("sharedworkers", true); - - is(hud.outputNode.querySelectorAll(".filtered-by-type").length, 0, - "1 message shown for sharedworkers (logging turned on)"); - - hud.setFilterState("sharedworkers", false); - - hud.jsterm.clearOutput(true); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_copy_entire_message_context_menu.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_copy_entire_message_context_menu.js deleted file mode 100644 index bdd4f71793f2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_copy_entire_message_context_menu.js +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/* globals goDoCommand */ - -"use strict"; - -// Test copying of the entire console message when right-clicked -// with no other text selected. See Bug 1100562. - -add_task(function* () { - let hud; - let outputNode; - let contextMenu; - - const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test/test-console.html"; - - const { tab, browser } = yield loadTab(TEST_URI); - hud = yield openConsole(tab); - outputNode = hud.outputNode; - contextMenu = hud.iframeWindow.document.getElementById("output-contextmenu"); - - registerCleanupFunction(() => { - hud = outputNode = contextMenu = null; - }); - - hud.jsterm.clearOutput(); - - yield ContentTask.spawn(browser, {}, function* () { - let button = content.document.getElementById("testTrace"); - button.click(); - }); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: "bug 1100562", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - lines: 1, - }, - { - name: "console.trace output", - consoleTrace: true, - lines: 3, - }, - ] - }); - - outputNode.focus(); - - for (let result of results) { - let message = [...result.matched][0]; - - yield waitForContextMenu(contextMenu, message, () => { - let copyItem = contextMenu.querySelector("#cMenu_copy"); - copyItem.doCommand(); - - let controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled"); - }); - - let clipboardText; - - yield waitForClipboardPromise( - () => goDoCommand("cmd_copy"), - (str) => { - clipboardText = str; - return message.textContent == clipboardText; - } - ); - - ok(clipboardText, "Clipboard text was found and saved"); - - let lines = clipboardText.split("\n"); - ok(lines.length > 0, "There is at least one newline in the message"); - is(lines.pop(), "", "There is a newline at the end"); - is(lines.length, result.lines, `There are ${result.lines} lines in the message`); - - // Test the first line for "timestamp message repeat file:line" - let firstLine = lines.shift(); - ok(/^[\d:.]+ .+ \d+ .+:\d+$/.test(firstLine), - "The message's first line has the right format"); - - // Test the remaining lines (stack trace) for "TABfunctionName sourceURL:line:col" - for (let line of lines) { - ok(/^\t.+ .+:\d+:\d+$/.test(line), "The stack trace line has the right format"); - } - } - - yield closeConsole(tab); - yield finishTest(); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_copy_link_location.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_copy_link_location.js deleted file mode 100644 index e309b36e7b82..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_copy_link_location.js +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test for the "Copy link location" context menu item shown when you right -// click network requests in the output. See Bug 638949. - -"use strict"; - -add_task(function* () { - const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html?_date=" + Date.now(); - const COMMAND_NAME = "consoleCmd_copyURL"; - const CONTEXT_MENU_ID = "#menu_copyURL"; - - registerCleanupFunction(() => { - Services.prefs.clearUserPref("devtools.webconsole.filter.networkinfo"); - }); - - Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", true); - - yield loadTab(TEST_URI); - let hud = yield openConsole(); - let output = hud.outputNode; - let menu = hud.iframeWindow.document.getElementById("output-contextmenu"); - - hud.jsterm.clearOutput(); - content.console.log("bug 638949"); - - // Test that the "Copy Link Location" command is disabled for non-network - // messages. - let [result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "bug 638949", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - - output.focus(); - let message = [...result.matched][0]; - - goUpdateCommand(COMMAND_NAME); - ok(!isEnabled(), COMMAND_NAME + " is disabled"); - - // Test that the "Copy Link Location" menu item is hidden for non-network - // messages. - yield waitForContextMenu(menu, message, () => { - let isHidden = menu.querySelector(CONTEXT_MENU_ID).hidden; - ok(isHidden, CONTEXT_MENU_ID + " is hidden"); - }); - - hud.jsterm.clearOutput(); - // Reloading will produce network logging - content.location.reload(); - - // Test that the "Copy Link Location" command is enabled and works - // as expected for any network-related message. - // This command should copy only the URL. - [result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "test-console.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }], - }); - - output.focus(); - message = [...result.matched][0]; - hud.ui.output.selectMessage(message); - - goUpdateCommand(COMMAND_NAME); - ok(isEnabled(), COMMAND_NAME + " is enabled"); - - info("expected clipboard value: " + message.url); - - let deferred = defer(); - - waitForClipboard((aData) => { - return aData.trim() == message.url; - }, () => { - goDoCommand(COMMAND_NAME); - }, () => { - deferred.resolve(null); - }, () => { - deferred.reject(null); - }); - - yield deferred.promise; - - // Test that the "Copy Link Location" menu item is visible for network-related - // messages. - yield waitForContextMenu(menu, message, () => { - let isVisible = !menu.querySelector(CONTEXT_MENU_ID).hidden; - ok(isVisible, CONTEXT_MENU_ID + " is visible"); - }); - - // Return whether "Copy Link Location" command is enabled or not. - function isEnabled() { - let controller = top.document.commandDispatcher - .getControllerForCommand(COMMAND_NAME); - return controller && controller.isCommandEnabled(COMMAND_NAME); - } -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_csp_ignore_reflected_xss_message.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_csp_ignore_reflected_xss_message.js deleted file mode 100644 index cfbf617959b5..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_csp_ignore_reflected_xss_message.js +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that a file with an unsupported CSP directive ('reflected-xss filter') -// displays the appropriate message to the console. - -"use strict"; - -const EXPECTED_RESULT = "Not supporting directive \u2018reflected-xss\u2019. " + - "Directive and values will be ignored."; -const TEST_FILE = "http://example.com/browser/devtools/client/webconsole/" + - "test/test_bug1045902_console_csp_ignore_reflected_xss_" + - "message.html"; - -var hud = undefined; - -var TEST_URI = "data:text/html;charset=utf8,Web Console CSP ignoring " + - "reflected XSS (bug 1045902)"; - -add_task(function* () { - let { browser } = yield loadTab(TEST_URI); - - hud = yield openConsole(); - - yield loadDocument(browser); - yield testViolationMessage(); - - hud = null; -}); - -function loadDocument(browser) { - hud.jsterm.clearOutput(); - browser.loadURI(TEST_FILE); - return BrowserTestUtils.browserLoaded(browser); -} - -function testViolationMessage() { - let aOutputNode = hud.outputNode; - - return waitForSuccess({ - name: "Confirming that CSP logs messages to the console when " + - "\u2018reflected-xss\u2019 directive is used!", - validator: function () { - console.log(aOutputNode.textContent); - let success = false; - success = aOutputNode.textContent.indexOf(EXPECTED_RESULT) > -1; - return success; - } - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cspro.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cspro.js deleted file mode 100644 index e0d23dbe31eb..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_cspro.js +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/* We are loading: -a script that is allowed by the CSP header but not by the CSPRO header -an image which is allowed by the CSPRO header but not by the CSP header. - -So we expect a warning (image has been blocked) and a report - (script should not load and was reported) - -The expected console messages in the constants CSP_VIOLATION_MSG and -CSP_REPORT_MSG are confirmed to be found in the console messages. - -See Bug 1010953. -*/ - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only " + - "test (bug 1010953)"; -const TEST_VIOLATION = "http://example.com/browser/devtools/client/" + - "webconsole/test/test_bug_1010953_cspro.html"; -const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " + - "blocked the loading of a resource at " + - "http://some.example.com/test.png " + - "(\u201cimg-src http://example.com\u201d)."; -const CSP_REPORT_MSG = "Content Security Policy: The page\u2019s settings " + - "observed the loading of a resource at " + - "http://some.example.com/test_bug_1010953_cspro.js " + - "(\u201cscript-src http://example.com\u201d). A CSP report is " + - "being sent."; - -add_task(function* () { - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - hud.jsterm.clearOutput(); - - let loaded = loadBrowser(browser); - BrowserTestUtils.loadURI(browser, TEST_VIOLATION); - yield loaded; - - yield waitForSuccess({ - name: "Confirmed that CSP and CSP-Report-Only log different messages to " + - "the console.", - validator: function () { - console.log(hud.outputNode.textContent); - let success = false; - success = hud.outputNode.textContent.indexOf(CSP_VIOLATION_MSG) > -1 && - hud.outputNode.textContent.indexOf(CSP_REPORT_MSG) > -1; - return success; - } - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ctrl_key_nav.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ctrl_key_nav.js deleted file mode 100644 index b040e63144e8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ctrl_key_nav.js +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test navigation of webconsole contents via ctrl-a, ctrl-e, ctrl-p, ctrl-n -// see https://bugzilla.mozilla.org/show_bug.cgi?id=804845 -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "bug 804845 and bug 619598"; - -var jsterm, inputNode; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - doTests(hud); - - jsterm = inputNode = null; -}); - -function doTests(HUD) { - jsterm = HUD.jsterm; - inputNode = jsterm.inputNode; - ok(!jsterm.getInputValue(), "jsterm.getInputValue() is empty"); - is(jsterm.inputNode.selectionStart, 0); - is(jsterm.inputNode.selectionEnd, 0); - - testSingleLineInputNavNoHistory(); - testMultiLineInputNavNoHistory(); - testNavWithHistory(); -} - -function testSingleLineInputNavNoHistory() { - // Single char input - EventUtils.synthesizeKey("1", {}); - is(inputNode.selectionStart, 1, "caret location after single char input"); - - // nav to start/end with ctrl-a and ctrl-e; - EventUtils.synthesizeKey("a", { ctrlKey: true }); - is(inputNode.selectionStart, 0, - "caret location after single char input and ctrl-a"); - - EventUtils.synthesizeKey("e", { ctrlKey: true }); - is(inputNode.selectionStart, 1, - "caret location after single char input and ctrl-e"); - - // Second char input - EventUtils.synthesizeKey("2", {}); - // nav to start/end with up/down keys; verify behaviour using ctrl-p/ctrl-n - EventUtils.synthesizeKey("VK_UP", {}); - is(inputNode.selectionStart, 0, - "caret location after two char input and VK_UP"); - EventUtils.synthesizeKey("VK_DOWN", {}); - is(inputNode.selectionStart, 2, - "caret location after two char input and VK_DOWN"); - - EventUtils.synthesizeKey("a", { ctrlKey: true }); - is(inputNode.selectionStart, 0, - "move caret to beginning of 2 char input with ctrl-a"); - EventUtils.synthesizeKey("a", { ctrlKey: true }); - is(inputNode.selectionStart, 0, - "no change of caret location on repeat ctrl-a"); - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(inputNode.selectionStart, 0, - "no change of caret location on ctrl-p from beginning of line"); - - EventUtils.synthesizeKey("e", { ctrlKey: true }); - is(inputNode.selectionStart, 2, - "move caret to end of 2 char input with ctrl-e"); - EventUtils.synthesizeKey("e", { ctrlKey: true }); - is(inputNode.selectionStart, 2, - "no change of caret location on repeat ctrl-e"); - EventUtils.synthesizeKey("n", { ctrlKey: true }); - is(inputNode.selectionStart, 2, - "no change of caret location on ctrl-n from end of line"); - - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(inputNode.selectionStart, 0, "ctrl-p moves to start of line"); - - EventUtils.synthesizeKey("n", { ctrlKey: true }); - is(inputNode.selectionStart, 2, "ctrl-n moves to end of line"); -} - -function testMultiLineInputNavNoHistory() { - let lineValues = ["one", "2", "something longer", "", "", "three!"]; - jsterm.setInputValue(""); - // simulate shift-return - for (let i = 0; i < lineValues.length; i++) { - jsterm.setInputValue(jsterm.getInputValue() + lineValues[i]); - EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true }); - } - let inputValue = jsterm.getInputValue(); - is(inputNode.selectionStart, inputNode.selectionEnd); - is(inputNode.selectionStart, inputValue.length, - "caret at end of multiline input"); - - // possibility newline is represented by one ('\r', '\n') or two - // ('\r\n') chars - let newlineString = inputValue.match(/(\r\n?|\n\r?)$/)[0]; - - // Ok, test navigating within the multi-line string! - EventUtils.synthesizeKey("VK_UP", {}); - let expectedStringAfterCarat = lineValues[5] + newlineString; - is(jsterm.getInputValue().slice(inputNode.selectionStart), expectedStringAfterCarat, - "up arrow from end of multiline"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - is(jsterm.getInputValue().slice(inputNode.selectionStart), "", - "down arrow from within multiline"); - - // navigate up through input lines - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(jsterm.getInputValue().slice(inputNode.selectionStart), expectedStringAfterCarat, - "ctrl-p from end of multiline"); - - for (let i = 4; i >= 0; i--) { - EventUtils.synthesizeKey("p", { ctrlKey: true }); - expectedStringAfterCarat = lineValues[i] + newlineString + - expectedStringAfterCarat; - is(jsterm.getInputValue().slice(inputNode.selectionStart), - expectedStringAfterCarat, "ctrl-p from within line " + i + - " of multiline input"); - } - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(inputNode.selectionStart, 0, "reached start of input"); - is(jsterm.getInputValue(), inputValue, - "no change to multiline input on ctrl-p from beginning of multiline"); - - // navigate to end of first line - EventUtils.synthesizeKey("e", { ctrlKey: true }); - let caretPos = inputNode.selectionStart; - let expectedStringBeforeCarat = lineValues[0]; - is(jsterm.getInputValue().slice(0, caretPos), expectedStringBeforeCarat, - "ctrl-e into multiline input"); - EventUtils.synthesizeKey("e", { ctrlKey: true }); - is(inputNode.selectionStart, caretPos, - "repeat ctrl-e doesn't change caret position in multiline input"); - - // navigate down one line; ctrl-a to the beginning; ctrl-e to end - for (let i = 1; i < lineValues.length; i++) { - EventUtils.synthesizeKey("n", { ctrlKey: true }); - EventUtils.synthesizeKey("a", { ctrlKey: true }); - caretPos = inputNode.selectionStart; - expectedStringBeforeCarat += newlineString; - is(jsterm.getInputValue().slice(0, caretPos), expectedStringBeforeCarat, - "ctrl-a to beginning of line " + (i + 1) + " in multiline input"); - - EventUtils.synthesizeKey("e", { ctrlKey: true }); - caretPos = inputNode.selectionStart; - expectedStringBeforeCarat += lineValues[i]; - is(jsterm.getInputValue().slice(0, caretPos), expectedStringBeforeCarat, - "ctrl-e to end of line " + (i + 1) + "in multiline input"); - } -} - -function testNavWithHistory() { - // NOTE: Tests does NOT currently define behaviour for ctrl-p/ctrl-n with - // caret placed _within_ single line input - let values = ['"single line input"', - '"a longer single-line input to check caret repositioning"', - ['"multi-line"', '"input"', '"here!"'].join("\n"), - ]; - // submit to history - for (let i = 0; i < values.length; i++) { - jsterm.setInputValue(values[i]); - jsterm.execute(); - } - is(inputNode.selectionStart, 0, "caret location at start of empty line"); - - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(inputNode.selectionStart, values[values.length - 1].length, - "caret location correct at end of last history input"); - - // Navigate backwards history with ctrl-p - for (let i = values.length - 1; i > 0; i--) { - let match = values[i].match(/(\n)/g); - if (match) { - // multi-line inputs won't update from history unless caret at beginning - EventUtils.synthesizeKey("a", { ctrlKey: true }); - for (let j = 0; j < match.length; j++) { - EventUtils.synthesizeKey("p", { ctrlKey: true }); - } - EventUtils.synthesizeKey("p", { ctrlKey: true }); - } else { - // single-line inputs will update from history from end of line - EventUtils.synthesizeKey("p", { ctrlKey: true }); - } - is(jsterm.getInputValue(), values[i - 1], - "ctrl-p updates inputNode from backwards history values[" + i - 1 + "]"); - } - let inputValue = jsterm.getInputValue(); - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(inputNode.selectionStart, 0, - "ctrl-p at beginning of history moves caret location to beginning " + - "of line"); - is(jsterm.getInputValue(), inputValue, - "no change to input value on ctrl-p from beginning of line"); - - // Navigate forwards history with ctrl-n - for (let i = 1; i < values.length; i++) { - EventUtils.synthesizeKey("n", { ctrlKey: true }); - is(jsterm.getInputValue(), values[i], - "ctrl-n updates inputNode from forwards history values[" + i + "]"); - is(inputNode.selectionStart, values[i].length, - "caret location correct at end of history input for values[" + i + "]"); - } - EventUtils.synthesizeKey("n", { ctrlKey: true }); - ok(!jsterm.getInputValue(), "ctrl-n at end of history updates to empty input"); - - // Simulate editing multi-line - inputValue = "one\nlinebreak"; - jsterm.setInputValue(inputValue); - - // Attempt nav within input - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(jsterm.getInputValue(), inputValue, - "ctrl-p from end of multi-line does not trigger history"); - - EventUtils.synthesizeKey("a", { ctrlKey: true }); - EventUtils.synthesizeKey("p", { ctrlKey: true }); - is(jsterm.getInputValue(), values[values.length - 1], - "ctrl-p from start of multi-line triggers history"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_deactivateHUDForContext_unfocused_window.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_deactivateHUDForContext_unfocused_window.js deleted file mode 100644 index 400b96607087..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_deactivateHUDForContext_unfocused_window.js +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 597103. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -var tab1, tab2, win1, win2; -var noErrors = true; - -function tab1Loaded() { - win2 = OpenBrowserWindow(); - whenDelayedStartupFinished(win2, win2Loaded); -} - -function win2Loaded() { - tab2 = win2.gBrowser.addTab(TEST_URI); - win2.gBrowser.selectedTab = tab2; - tab2.linkedBrowser.addEventListener("load", tab2Loaded, true); -} - -function tab2Loaded(aEvent) { - tab2.linkedBrowser.removeEventListener(aEvent.type, tab2Loaded, true); - - let consolesOpened = 0; - function onWebConsoleOpen() { - consolesOpened++; - if (consolesOpened == 2) { - executeSoon(closeConsoles); - } - } - - function openConsoles() { - try { - let target1 = TargetFactory.forTab(tab1); - gDevTools.showToolbox(target1, "webconsole").then(onWebConsoleOpen); - } catch (ex) { - ok(false, "gDevTools.showToolbox(target1) exception: " + ex); - noErrors = false; - } - - try { - let target2 = TargetFactory.forTab(tab2); - gDevTools.showToolbox(target2, "webconsole").then(onWebConsoleOpen); - } catch (ex) { - ok(false, "gDevTools.showToolbox(target2) exception: " + ex); - noErrors = false; - } - } - - function closeConsoles() { - try { - let target1 = TargetFactory.forTab(tab1); - gDevTools.closeToolbox(target1).then(function () { - try { - let target2 = TargetFactory.forTab(tab2); - gDevTools.closeToolbox(target2).then(testEnd); - } catch (ex) { - ok(false, "gDevTools.closeToolbox(target2) exception: " + ex); - noErrors = false; - } - }); - } catch (ex) { - ok(false, "gDevTools.closeToolbox(target1) exception: " + ex); - noErrors = false; - } - } - - function testEnd() { - ok(noErrors, "there were no errors"); - - win1.gBrowser.removeTab(tab1); - - Array.forEach(win2.gBrowser.tabs, function (aTab) { - win2.gBrowser.removeTab(aTab); - }); - - executeSoon(function () { - win2.close(); - tab1 = tab2 = win1 = win2 = null; - finishTest(); - }); - } - - openConsoles(); -} - -function test() { - loadTab(TEST_URI).then(() => { - tab1 = gBrowser.selectedTab; - win1 = window; - tab1Loaded(); - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_document_body_autocomplete.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_document_body_autocomplete.js deleted file mode 100644 index d7f6011b127a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_document_body_autocomplete.js +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that document.body autocompletes in the web console. See Bug 651501. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console autocompletion " + - "bug in document.body"; - -var gHUD; - -add_task(function* () { - yield loadTab(TEST_URI); - - gHUD = yield openConsole(); - - yield consoleOpened(); - yield autocompletePopupHidden(); - let view = yield testPropertyPanel(); - yield onVariablesViewReady(view); - - gHUD = null; -}); - -function consoleOpened() { - let deferred = defer(); - - let jsterm = gHUD.jsterm; - let popup = jsterm.autocompletePopup; - - ok(!popup.isOpen, "popup is not open"); - - popup.once("popup-opened", () => { - ok(popup.isOpen, "popup is open"); - - is(popup.itemCount, jsterm._autocompleteCache.length, - "popup.itemCount is correct"); - isnot(jsterm._autocompleteCache.indexOf("addEventListener"), -1, - "addEventListener is in the list of suggestions"); - isnot(jsterm._autocompleteCache.indexOf("bgColor"), -1, - "bgColor is in the list of suggestions"); - isnot(jsterm._autocompleteCache.indexOf("ATTRIBUTE_NODE"), -1, - "ATTRIBUTE_NODE is in the list of suggestions"); - - popup.once("popup-closed", () => { - deferred.resolve(); - }); - EventUtils.synthesizeKey("VK_ESCAPE", {}); - }); - - jsterm.setInputValue("document.body"); - EventUtils.synthesizeKey(".", {}); - - return deferred.promise; -} - -function autocompletePopupHidden() { - let deferred = defer(); - - let jsterm = gHUD.jsterm; - let popup = jsterm.autocompletePopup; - let completeNode = jsterm.completeNode; - - ok(!popup.isOpen, "popup is not open"); - - jsterm.once("autocomplete-updated", function () { - is(completeNode.value, testStr + "dy", "autocomplete shows document.body"); - deferred.resolve(); - }); - - let inputStr = "document.b"; - jsterm.setInputValue(inputStr); - EventUtils.synthesizeKey("o", {}); - let testStr = inputStr.replace(/./g, " ") + " "; - - return deferred.promise; -} - -function testPropertyPanel() { - let deferred = defer(); - - let jsterm = gHUD.jsterm; - jsterm.clearOutput(); - jsterm.execute("document", (msg) => { - jsterm.once("variablesview-fetched", (evt, view) => { - deferred.resolve(view); - }); - let anchor = msg.querySelector(".message-body a"); - EventUtils.synthesizeMouse(anchor, 2, 2, {}, gHUD.iframeWindow); - }); - - return deferred.promise; -} - -function onVariablesViewReady(view) { - return findVariableViewProperties(view, [ - { name: "body", value: "
" }, - ], { webconsole: gHUD }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_document_focus.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_document_focus.js deleted file mode 100644 index 58f1ae52b348..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_document_focus.js +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 588342. - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342"; - -add_task(function* () { - let { browser } = yield loadTab(TEST_URI); - let hud = yield openConsole(); - - yield checkConsoleFocus(hud); - - let isFocused = yield ContentTask.spawn(browser, { }, function* () { - var fm = Components.classes["@mozilla.org/focus-manager;1"]. - getService(Components.interfaces.nsIFocusManager); - return fm.focusedWindow == content; - }); - - ok(isFocused, "content document has focus"); -}); - -function* checkConsoleFocus(hud) { - let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager); - - yield new Promise(resolve => { - waitForFocus(resolve); - }); - - is(hud.jsterm.inputNode.getAttribute("focused"), "true", - "jsterm input is focused on web console open"); - is(fm.focusedWindow, hud.iframeWindow, "hud window is focused"); - yield closeConsole(null); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_duplicate_errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_duplicate_errors.js deleted file mode 100644 index be7704f651a8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_duplicate_errors.js +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that exceptions thrown by content don't show up twice in the Web -// Console. See Bug 582201. - -"use strict"; - -const INIT_URI = "data:text/html;charset=utf8,hello world"; -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-duplicate-error.html"; - -add_task(function* () { - yield loadTab(INIT_URI); - - let hud = yield openConsole(); - - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "fooDuplicateError1", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - { - text: "test-duplicate-error.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }], - }); - - let text = hud.outputNode.textContent; - let error1pos = text.indexOf("fooDuplicateError1"); - ok(error1pos > -1, "found fooDuplicateError1"); - if (error1pos > -1) { - ok(text.indexOf("fooDuplicateError1", error1pos + 1) == -1, - "no duplicate for fooDuplicateError1"); - } -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_errors_after_page_reload.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_errors_after_page_reload.js deleted file mode 100644 index af00bf913a38..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_errors_after_page_reload.js +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that errors still show up in the Web Console after a page reload. -// See bug 580030: the error handler fails silently after page reload. -// https://bugzilla.mozilla.org/show_bug.cgi?id=580030 - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-error.html"; - -function test() { - Task.spawn(function* () { - const {tab} = yield loadTab(TEST_URI); - const hud = yield openConsole(tab); - info("console opened"); - - executeSoon(() => { - hud.jsterm.clearOutput(); - info("wait for reload"); - content.location.reload(); - }); - - yield hud.target.once("navigate"); - info("target navigated"); - - let button = content.document.querySelector("button"); - ok(button, "button found"); - - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - EventUtils.sendMouseEvent({type: "click"}, button, content); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "fooBazBaz is not defined", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }], - }); - }).then(finishTest); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_eval_in_debugger_stackframe.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_eval_in_debugger_stackframe.js deleted file mode 100644 index bc923ff4495b..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_eval_in_debugger_stackframe.js +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that makes sure web console eval happens in the user-selected stackframe -// from the js debugger. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-eval-in-stackframe.html"; - -var gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController; -var gStackframes; - -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -function test() { - loadTab(TEST_URI).then(() => { - openConsole().then(consoleOpened); - }); -} - -function consoleOpened(hud) { - gWebConsole = hud; - gJSTerm = hud.jsterm; - gJSTerm.execute("foo").then(onExecuteFoo); -} - -function onExecuteFoo() { - isnot(gWebConsole.outputNode.textContent.indexOf("globalFooBug783499"), -1, - "|foo| value is correct"); - - gJSTerm.clearOutput(); - - // Test for Bug 690529 - Web Console and Scratchpad should evaluate - // expressions in the scope of the content window, not in a sandbox. - executeSoon(() => { - gJSTerm.execute("foo2 = 'newFoo'; window.foo2").then(onNewFoo2); - }); -} - -function onNewFoo2(msg) { - is(gWebConsole.outputNode.textContent.indexOf("undefined"), -1, - "|undefined| is not displayed after adding |foo2|"); - - ok(msg, "output result found"); - - isnot(msg.textContent.indexOf("newFoo"), -1, - "'newFoo' is displayed after adding |foo2|"); - - gJSTerm.clearOutput(); - - info("openDebugger"); - executeSoon(() => openDebugger().then(debuggerOpened)); -} - -function debuggerOpened(aResult) { - gDebuggerWin = aResult.panelWin; - gDebuggerController = gDebuggerWin.DebuggerController; - gThread = gDebuggerController.activeThread; - gStackframes = gDebuggerController.StackFrames; - - info("openConsole"); - executeSoon(() => - openConsole().then(() => - gJSTerm.execute("foo + foo2").then(onExecuteFooAndFoo2) - ) - ); -} - -function onExecuteFooAndFoo2() { - let expected = "globalFooBug783499newFoo"; - isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1, - "|foo + foo2| is displayed after starting the debugger"); - - executeSoon(() => { - gJSTerm.clearOutput(); - - info("openDebugger"); - openDebugger().then(() => { - gThread.addOneTimeListener("framesadded", onFramesAdded); - - info("firstCall()"); - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.wrappedJSObject.firstCall(); - }); - }); - }); -} - -function onFramesAdded() { - info("onFramesAdded, openConsole() now"); - executeSoon(() => - openConsole().then(() => - gJSTerm.execute("foo + foo2").then(onExecuteFooAndFoo2InSecondCall) - ) - ); -} - -function onExecuteFooAndFoo2InSecondCall() { - let expected = "globalFooBug783499foo2SecondCall"; - isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1, - "|foo + foo2| from |secondCall()|"); - - function runOpenConsole() { - openConsole().then(() => { - gJSTerm.execute("foo + foo2 + foo3").then(onExecuteFoo23InFirstCall); - }); - } - - executeSoon(() => { - gJSTerm.clearOutput(); - - info("openDebugger and selectFrame(1)"); - - openDebugger().then(() => { - gStackframes.selectFrame(1); - - info("openConsole"); - executeSoon(() => runOpenConsole()); - }); - }); -} - -function onExecuteFoo23InFirstCall() { - let expected = "fooFirstCallnewFoofoo3FirstCall"; - isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1, - "|foo + foo2 + foo3| from |firstCall()|"); - - executeSoon(() => - gJSTerm.execute("foo = 'abba'; foo3 = 'bug783499'; foo + foo3").then( - onExecuteFooAndFoo3ChangesInFirstCall)); -} - -var onExecuteFooAndFoo3ChangesInFirstCall = Task.async(function*() { - let expected = "abbabug783499"; - isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1, - "|foo + foo3| updated in |firstCall()|"); - - yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() { - is(content.wrappedJSObject.foo, "globalFooBug783499", - "|foo| in content window"); - is(content.wrappedJSObject.foo2, "newFoo", "|foo2| in content window"); - ok(!content.wrappedJSObject.foo3, - "|foo3| was not added to the content window"); - }); - - gWebConsole = gJSTerm = gDebuggerWin = gThread = gDebuggerController = - gStackframes = null; - executeSoon(finishTest); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_eval_in_debugger_stackframe2.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_eval_in_debugger_stackframe2.js deleted file mode 100644 index 1cccfd3c7496..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_eval_in_debugger_stackframe2.js +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test to make sure that web console commands can fire while paused at a -// breakpoint that was triggered from a JS call. Relies on asynchronous js -// evaluation over the protocol - see Bug 1088861. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-eval-in-stackframe.html"; - -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -add_task(function* () { - yield loadTab(TEST_URI); - - info("open the web console"); - let hud = yield openConsole(); - let {jsterm} = hud; - - info("open the debugger"); - let {panelWin} = yield openDebugger(); - let {DebuggerController} = panelWin; - let {activeThread} = DebuggerController; - - let firstCall = defer(); - let frameAdded = defer(); - executeSoon(() => { - info("Executing firstCall"); - activeThread.addOneTimeListener("framesadded", () => { - executeSoon(frameAdded.resolve); - }); - jsterm.execute("firstCall()").then(firstCall.resolve); - }); - - info("Waiting for a frame to be added"); - yield frameAdded.promise; - - info("Executing basic command while paused"); - yield executeAndConfirm(jsterm, "1 + 2", "3"); - - info("Executing command using scoped variables while paused"); - yield executeAndConfirm(jsterm, "foo + foo2", - '"globalFooBug783499foo2SecondCall"'); - - info("Resuming the thread"); - activeThread.resume(); - - info("Checking the first command, which is the last to resolve since it " + - "paused"); - let node = yield firstCall.promise; - is(node.querySelector(".message-body").textContent, - "undefined", - "firstCall() returned correct value"); -}); - -function* executeAndConfirm(jsterm, input, output) { - info("Executing command `" + input + "`"); - - let node = yield jsterm.execute(input); - - is(node.querySelector(".message-body").textContent, output, - "Expected result from call to " + input); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_execution_scope.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_execution_scope.js deleted file mode 100644 index 78865c9b25a9..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_execution_scope.js +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that commands run by the user are executed in content space. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - hud.jsterm.clearOutput(); - hud.jsterm.execute("window.location.href;"); - - let [input, output] = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "window.location.href;", - category: CATEGORY_INPUT, - }, - { - text: TEST_URI, - category: CATEGORY_OUTPUT, - }], - }); - - let inputNode = [...input.matched][0]; - let outputNode = [...output.matched][0]; - is(inputNode.getAttribute("category"), "input", - "input node category is correct"); - is(outputNode.getAttribute("category"), "output", - "output node category is correct"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_external_script_errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_external_script_errors.js deleted file mode 100644 index 9e413e41615d..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_external_script_errors.js +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 597136. - -const TEST_URI = "http://example.com/browser/devtools/client/" + - "webconsole/test/test-bug-597136-external-script-" + - "errors.html"; - -function test() { - Task.spawn(function* () { - const {tab} = yield loadTab(TEST_URI); - const hud = yield openConsole(tab); - - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - BrowserTestUtils.synthesizeMouseAtCenter("button", {}, gBrowser.selectedBrowser); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "bogus is not defined", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }], - }); - }).then(finishTest); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_file_uri.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_file_uri.js deleted file mode 100644 index 285aac64c780..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_file_uri.js +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 595223. - -const PREF = "devtools.webconsole.persistlog"; -const TEST_FILE = "test-network.html"; - -var hud; - -add_task(function* () { - Services.prefs.setBoolPref(PREF, true); - - let jar = getJar(getRootDirectory(gTestPath)); - let dir = jar ? - extractJarToTmp(jar) : - getChromeDir(getResolvedURI(gTestPath)); - - dir.append(TEST_FILE); - let uri = Services.io.newFileURI(dir); - - // Open tab with correct remote type so we don't switch processes when we load - // the file:// URI, otherwise we won't get the same web console. - let remoteType = E10SUtils.getRemoteTypeForURI(uri.spec, - gMultiProcessBrowser); - let { browser } = yield loadTab("about:blank", remoteType); - - hud = yield openConsole(); - hud.jsterm.clearOutput(); - - let loaded = loadBrowser(browser); - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, uri.spec); - yield loaded; - - yield testMessages(); - - Services.prefs.clearUserPref(PREF); - hud = null; -}); - -function testMessages() { - return waitForMessages({ - webconsole: hud, - messages: [{ - text: "running network console logging tests", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - text: "test-network.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }, - { - text: "test-image.png", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }, - { - text: "testscript.js", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }], - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_filter_scroll.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_filter_scroll.js deleted file mode 100644 index 5abe08b5a9e2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_filter_scroll.js +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 597460. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-network.html"; -const PREF = "devtools.webconsole.persistlog"; - -add_task(function* () { - Services.prefs.setBoolPref(PREF, true); - - yield loadTab(TEST_URI); - let hud = yield openConsole(); - - let results = yield consoleOpened(hud); - - testScroll(results, hud); - - Services.prefs.clearUserPref(PREF); -}); - -function consoleOpened(hud) { - let deferred = defer(); - - for (let i = 0; i < 200; i++) { - content.console.log("test message " + i); - } - - hud.setFilterState("network", false); - hud.setFilterState("networkinfo", false); - - hud.ui.filterBox.value = "test message"; - hud.ui.adjustVisibilityOnSearchStringChange(); - - waitForMessages({ - webconsole: hud, - messages: [{ - name: "console messages displayed", - text: "test message 199", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }).then(() => { - waitForMessages({ - webconsole: hud, - messages: [{ - text: "test-network.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }], - }).then(deferred.resolve); - - content.location.reload(); - }); - - return deferred.promise; -} - -function testScroll([result], hud) { - let scrollNode = hud.ui.outputWrapper; - let msgNode = [...result.matched][0]; - ok(msgNode.classList.contains("filtered-by-type"), - "network message is filtered by type"); - ok(msgNode.classList.contains("filtered-by-string"), - "network message is filtered by string"); - - ok(scrollNode.scrollTop > 0, "scroll location is not at the top"); - - // Make sure the Web Console output is scrolled as near as possible to the - // bottom. - let nodeHeight = msgNode.clientHeight; - ok(scrollNode.scrollTop >= scrollNode.scrollHeight - scrollNode.clientHeight - - nodeHeight * 2, "scroll location is correct"); - - hud.setFilterState("network", true); - hud.setFilterState("networkinfo", true); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_highlighter_console_helper.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_highlighter_console_helper.js deleted file mode 100644 index 3efadd0ffe9a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_highlighter_console_helper.js +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the $0 console helper works as intended. See Bug 653531. - -"use strict"; - -var inspector, h1, outputNode; - -function createDocument() { - let doc = content.document; - let div = doc.createElement("div"); - h1 = doc.createElement("h1"); - let p1 = doc.createElement("p"); - let p2 = doc.createElement("p"); - let div2 = doc.createElement("div"); - let p3 = doc.createElement("p"); - doc.title = "Inspector Tree Selection Test"; - h1.textContent = "Inspector Tree Selection Test"; - p1.textContent = "This is some example text"; - p2.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " + - "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " + - "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " + - "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " + - "dolor in reprehenderit in voluptate velit esse cillum dolore eu " + - "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " + - "proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - p3.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " + - "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " + - "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " + - "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " + - "dolor in reprehenderit in voluptate velit esse cillum dolore eu " + - "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " + - "proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - div.appendChild(h1); - div.appendChild(p1); - div.appendChild(p2); - div2.appendChild(p3); - doc.body.appendChild(div); - doc.body.appendChild(div2); - setupHighlighterTests(); -} - -function setupHighlighterTests() { - ok(h1, "we have the header node"); - openInspector().then(runSelectionTests); -} - -var runSelectionTests = Task.async(function* (aInspector) { - inspector = aInspector; - - let onPickerStarted = inspector.toolbox.once("picker-started"); - inspector.toolbox.highlighterUtils.startPicker(); - yield onPickerStarted; - - info("Picker mode started, now clicking on H1 to select that node"); - h1.scrollIntoView(); - let onPickerStopped = inspector.toolbox.once("picker-stopped"); - let onInspectorUpdated = inspector.once("inspector-updated"); - EventUtils.synthesizeMouseAtCenter(h1, {}, content); - yield onPickerStopped; - yield onInspectorUpdated; - - info("Picker mode stopped, H1 selected, now switching to the console"); - let hud = yield openConsole(gBrowser.selectedTab); - - performWebConsoleTests(hud); -}); - -function performWebConsoleTests(hud) { - let jsterm = hud.jsterm; - outputNode = hud.outputNode; - - jsterm.clearOutput(); - jsterm.execute("$0", onNodeOutput); - - function onNodeOutput(node) { - isnot(node.textContent.indexOf("bug 660806 - history " + - "navigation must not show the autocomplete popup"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield consoleOpened(hud); -}); - -function consoleOpened(HUD) { - let deferred = defer(); - - let jsterm = HUD.jsterm; - let popup = jsterm.autocompletePopup; - let onShown = function () { - ok(false, "popup shown"); - }; - - jsterm.execute(`window.foobarBug660806 = { - 'location': 'value0', - 'locationbar': 'value1' - }`); - - popup.on("popup-opened", onShown); - - ok(!popup.isOpen, "popup is not open"); - - ok(!jsterm.lastInputValue, "no lastInputValue"); - jsterm.setInputValue("window.foobarBug660806.location"); - is(jsterm.lastInputValue, "window.foobarBug660806.location", - "lastInputValue is correct"); - - EventUtils.synthesizeKey("VK_RETURN", {}); - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.lastInputValue, "window.foobarBug660806.location", - "lastInputValue is correct, again"); - - executeSoon(function () { - ok(!popup.isOpen, "popup is not open"); - popup.off("popup-opened", onShown); - executeSoon(deferred.resolve); - }); - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_hpkp_invalid-headers.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_hpkp_invalid-headers.js deleted file mode 100644 index 4633ca5c4d58..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_hpkp_invalid-headers.js +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that errors about invalid HPKP security headers are logged to the web -// console. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console HPKP invalid " + - "header test"; -const SJS_URL = "https://example.com/browser/devtools/client/webconsole/" + - "test/test_hpkp-invalid-headers.sjs"; -const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/HTTP/" + - "Public_Key_Pinning" + DOCS_GA_PARAMS; -const NON_BUILTIN_ROOT_PREF = "security.cert_pinning.process_headers_from_" + - "non_builtin_roots"; - -add_task(function* () { - registerCleanupFunction(() => { - Services.prefs.clearUserPref(NON_BUILTIN_ROOT_PREF); - }); - - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield* checkForMessage({ - url: SJS_URL + "?badSyntax", - name: "Could not parse header error displayed successfully", - text: "Public-Key-Pins: The site specified a header that could not be " + - "parsed successfully." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?noMaxAge", - name: "No max-age error displayed successfully", - text: "Public-Key-Pins: The site specified a header that did not include " + - "a \u2018max-age\u2019 directive." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?invalidIncludeSubDomains", - name: "Invalid includeSubDomains error displayed successfully", - text: "Public-Key-Pins: The site specified a header that included an " + - "invalid \u2018includeSubDomains\u2019 directive." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?invalidMaxAge", - name: "Invalid max-age error displayed successfully", - text: "Public-Key-Pins: The site specified a header that included an " + - "invalid \u2018max-age\u2019 directive." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?multipleIncludeSubDomains", - name: "Multiple includeSubDomains error displayed successfully", - text: "Public-Key-Pins: The site specified a header that included " + - "multiple \u2018includeSubDomains\u2019 directives." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?multipleMaxAge", - name: "Multiple max-age error displayed successfully", - text: "Public-Key-Pins: The site specified a header that included " + - "multiple \u2018max-age\u2019 directives." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?multipleReportURIs", - name: "Multiple report-uri error displayed successfully", - text: "Public-Key-Pins: The site specified a header that included " + - "multiple \u2018report-uri\u2019 directives." - }, hud); - - // The root used for mochitests is not built-in, so set the relevant pref to - // true to have the PKP implementation return more specific errors. - Services.prefs.setBoolPref(NON_BUILTIN_ROOT_PREF, true); - - yield* checkForMessage({ - url: SJS_URL + "?pinsetDoesNotMatch", - name: "Non-matching pinset error displayed successfully", - text: "Public-Key-Pins: The site specified a header that did not include " + - "a matching pin." - }, hud); - - Services.prefs.setBoolPref(NON_BUILTIN_ROOT_PREF, false); - - yield* checkForMessage({ - url: SJS_URL + "?pinsetDoesNotMatch", - name: "Non-built-in root error displayed successfully", - text: "Public-Key-Pins: The certificate used by the site was not issued " + - "by a certificate in the default root certificate store. To " + - "prevent accidental breakage, the specified header was ignored." - }, hud); -}); - -function* checkForMessage(curTest, hud) { - hud.jsterm.clearOutput(); - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, curTest.url); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: curTest.name, - text: curTest.text, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - ], - }); - - yield testClickOpenNewTab(hud, results); -} - -function testClickOpenNewTab(hud, results) { - let warningNode = results[0].clickableElements[0]; - ok(warningNode, "link element"); - ok(warningNode.classList.contains("learn-more-link"), "link class name"); - return simulateMessageLinkClick(warningNode, LEARN_MORE_URI); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_hsts_invalid-headers.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_hsts_invalid-headers.js deleted file mode 100644 index 1feebd14e8c2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_hsts_invalid-headers.js +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that errors about invalid HSTS security headers are logged -// to the web console. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console HSTS invalid " + - "header test"; -const SJS_URL = "https://example.com/browser/devtools/client/webconsole/" + - "test/test_hsts-invalid-headers.sjs"; -const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/HTTP/Headers/" + - "Strict-Transport-Security" + DOCS_GA_PARAMS; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield* checkForMessage({ - url: SJS_URL + "?badSyntax", - name: "Could not parse header error displayed successfully", - text: "Strict-Transport-Security: The site specified a header that could " + - "not be parsed successfully." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?noMaxAge", - name: "No max-age error displayed successfully", - text: "Strict-Transport-Security: The site specified a header that did " + - "not include a \u2018max-age\u2019 directive." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?invalidIncludeSubDomains", - name: "Invalid includeSubDomains error displayed successfully", - text: "Strict-Transport-Security: The site specified a header that " + - "included an invalid \u2018includeSubDomains\u2019 directive." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?invalidMaxAge", - name: "Invalid max-age error displayed successfully", - text: "Strict-Transport-Security: The site specified a header that " + - "included an invalid \u2018max-age\u2019 directive." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?multipleIncludeSubDomains", - name: "Multiple includeSubDomains error displayed successfully", - text: "Strict-Transport-Security: The site specified a header that " + - "included multiple \u2018includeSubDomains\u2019 directives." - }, hud); - - yield* checkForMessage({ - url: SJS_URL + "?multipleMaxAge", - name: "Multiple max-age error displayed successfully", - text: "Strict-Transport-Security: The site specified a header that " + - "included multiple \u2018max-age\u2019 directives." - }, hud); -}); - -function* checkForMessage(curTest, hud) { - hud.jsterm.clearOutput(); - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, curTest.url); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: curTest.name, - text: curTest.text, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - ], - }); - - yield testClickOpenNewTab(hud, results); -} - -function testClickOpenNewTab(hud, results) { - let warningNode = results[0].clickableElements[0]; - ok(warningNode, "link element"); - ok(warningNode.classList.contains("learn-more-link"), "link class name"); - return simulateMessageLinkClick(warningNode, LEARN_MORE_URI); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_iframe_wrong_hud.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_iframe_wrong_hud.js deleted file mode 100644 index 7ac32b4b5f9e..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_iframe_wrong_hud.js +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 593003. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-593003-iframe-wrong-hud.html"; - -const TEST_IFRAME_URI = "http://example.com/browser/devtools/client/" + - "webconsole/test/test-bug-593003-iframe-wrong-" + - "hud-iframe.html"; - -const TEST_DUMMY_URI = "http://example.com/browser/devtools/client/" + - "webconsole/test/test-console.html"; - -add_task(function* () { - - let tab1 = (yield loadTab(TEST_URI)).tab; - yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.console.log("FOO"); - }); - yield openConsole(); - - let tab2 = (yield loadTab(TEST_DUMMY_URI)).tab; - yield openConsole(gBrowser.selectedTab); - - info("Reloading tab 1"); - yield reloadTab(tab1); - - info("Checking for messages"); - yield checkMessages(tab1, tab2); - - info("Cleaning up"); - yield closeConsole(tab1); - yield closeConsole(tab2); -}); - -function* reloadTab(tab) { - let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser); - tab.linkedBrowser.reload(); - yield loaded; -} - -function* checkMessages(tab1, tab2) { - let hud1 = yield openConsole(tab1); - let outputNode1 = hud1.outputNode; - - info("Waiting for messages"); - yield waitForMessages({ - webconsole: hud1, - messages: [{ - text: TEST_IFRAME_URI, - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }] - }); - - let hud2 = yield openConsole(tab2); - let outputNode2 = hud2.outputNode; - - isnot(outputNode1, outputNode2, - "the two HUD outputNodes must be different"); - - let msg = "Didn't find the iframe network request in tab2"; - testLogEntry(outputNode2, TEST_IFRAME_URI, msg, true, true); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ineffective_iframe_sandbox_warning.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ineffective_iframe_sandbox_warning.js deleted file mode 100644 index 221d08212aea..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ineffective_iframe_sandbox_warning.js +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that warnings about ineffective iframe sandboxing are logged to the -// web console when necessary (and not otherwise). See Bug 752559. - -"use strict"; - -requestLongerTimeout(2); - -const TEST_URI_WARNING = "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning0.html"; -const TEST_URI_NOWARNING = [ - "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning1.html", - "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning2.html", - "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning3.html", - "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning4.html", - "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning5.html" -]; - -const INEFFECTIVE_IFRAME_SANDBOXING_MSG = "An iframe which has both " + - "allow-scripts and allow-same-origin for its sandbox attribute can remove " + - "its sandboxing."; -const SENTINEL_MSG = "testing ineffective sandboxing message"; - -add_task(function* () { - yield testYesWarning(); - - for (let id = 0; id < TEST_URI_NOWARNING.length; id++) { - yield testNoWarning(id); - } -}); - -function* testYesWarning() { - yield loadTab(TEST_URI_WARNING); - let hud = yield openConsole(); - - ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function* (msg) { - content.console.log(msg); - }); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Ineffective iframe sandboxing warning displayed successfully", - text: INEFFECTIVE_IFRAME_SANDBOXING_MSG, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING - }, - { - text: SENTINEL_MSG, - severity: SEVERITY_LOG - } - ] - }); - - let msgs = hud.outputNode.querySelectorAll(".message[category=security]"); - is(msgs.length, 1, "one security message"); -} - -function* testNoWarning(id) { - yield loadTab(TEST_URI_NOWARNING[id]); - let hud = yield openConsole(); - - ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function* (msg) { - content.console.log(msg); - }); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: SENTINEL_MSG, - severity: SEVERITY_LOG - } - ] - }); - - let msgs = hud.outputNode.querySelectorAll(".message[category=security]"); - is(msgs.length, 0, "no security messages (case " + id + ")"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_expansion.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_expansion.js deleted file mode 100644 index 7d85b4e9ca79..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_expansion.js +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 588967. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - testInputExpansion(hud); -}); - -function testInputExpansion(hud) { - let input = hud.jsterm.inputNode; - - input.focus(); - - is(input.getAttribute("multiline"), "true", "multiline is enabled"); - - let ordinaryHeight = input.clientHeight; - - // Tests if the inputNode expands. - input.value = "hello\nworld\n"; - let length = input.value.length; - input.selectionEnd = length; - input.selectionStart = length; - // Performs an "d". This will trigger/test for the input event that should - // change the height of the inputNode. - EventUtils.synthesizeKey("d", {}); - ok(input.clientHeight > ordinaryHeight, "the input expanded"); - - // Test if the inputNode shrinks again. - input.value = ""; - EventUtils.synthesizeKey("d", {}); - is(input.clientHeight, ordinaryHeight, "the input's height is normal again"); - - input = length = null; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_field_focus_on_panel_select.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_field_focus_on_panel_select.js deleted file mode 100644 index 2d7fda7f5ff5..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_field_focus_on_panel_select.js +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that the JS input field is focused when the user switches back to the -// web console from other tools, see bug 891581. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
hello"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - hud.jsterm.clearOutput(); - - is(hud.jsterm.inputNode.hasAttribute("focused"), true, - "inputNode should be focused"); - - hud.ui.filterBox.focus(); - - is(hud.ui.filterBox.hasAttribute("focused"), true, - "filterBox should be focused"); - - is(hud.jsterm.inputNode.hasAttribute("focused"), false, - "inputNode shouldn't be focused"); - - yield openInspector(); - hud = yield openConsole(); - - is(hud.jsterm.inputNode.hasAttribute("focused"), true, - "inputNode should be focused"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_insecure_passwords_about_blank_web_console_warning.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_insecure_passwords_about_blank_web_console_warning.js deleted file mode 100644 index 9ac3182dfb08..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_insecure_passwords_about_blank_web_console_warning.js +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that errors about insecure passwords are logged to the web console. See Bug 762593. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-762593-insecure-passwords-about-blank-web-console-warning.html"; -const INSECURE_PASSWORD_MSG = "Password fields present on an insecure " + - "(http://) iframe. This is a security risk that allows user login " + - "credentials to be stolen."; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Insecure password error displayed successfully", - text: INSECURE_PASSWORD_MSG, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING - }, - ], - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_insecure_passwords_web_console_warning.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_insecure_passwords_web_console_warning.js deleted file mode 100644 index 4bbb0de90123..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_insecure_passwords_web_console_warning.js +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - - // Tests that errors about insecure passwords are logged to the web console. - // See Bug 762593. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-762593-insecure-passwords-web-" + - "console-warning.html"; -const INSECURE_PASSWORD_MSG = "Password fields present on an insecure " + - "(http://) page. This is a security risk that allows user " + - "login credentials to be stolen."; -const INSECURE_FORM_ACTION_MSG = "Password fields present in a form with an " + - "insecure (http://) form action. This is a security risk " + - "that allows user login credentials to be stolen."; -const INSECURE_IFRAME_MSG = "Password fields present on an insecure " + - "(http://) iframe. This is a security risk that allows " + - "user login credentials to be stolen."; -const INSECURE_PASSWORDS_URI = "https://developer.mozilla.org/docs/Web/" + - "Security/Insecure_passwords" + DOCS_GA_PARAMS; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - let result = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Insecure password error displayed successfully", - text: INSECURE_PASSWORD_MSG, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING - }, - { - name: "Insecure iframe error displayed successfully", - text: INSECURE_IFRAME_MSG, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING - }, - { - name: "Insecure form action error displayed successfully", - text: INSECURE_FORM_ACTION_MSG, - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING - }, - ], - }); - - yield testClickOpenNewTab(hud, result); -}); - -function testClickOpenNewTab(hud, [result]) { - let msg = [...result.matched][0]; - let warningNode = msg.querySelector(".learn-more-link"); - ok(warningNode, "learn more link"); - return simulateMessageLinkClick(warningNode, INSECURE_PASSWORDS_URI); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_inspect_cross_domain_object.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_inspect_cross_domain_object.js deleted file mode 100644 index 685148fc7155..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_inspect_cross_domain_object.js +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that users can inspect objects logged from cross-domain iframes - -// bug 869003. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-869003-top-window.html"; - -add_task(function* () { - // This test is slightly more involved: it opens the web console, then the - // variables view for a given object, it updates a property in the view and - // checks the result. We can get a timeout with debug builds on slower - // machines. - requestLongerTimeout(2); - - yield loadTab("data:text/html;charset=utf8,
hello"); - let hud = yield openConsole(); - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI); - - let [result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "console.log message", - text: "foobar", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - objects: true, - }], - }); - - let msg = [...result.matched][0]; - ok(msg, "message element"); - - let body = msg.querySelector(".message-body"); - ok(body, "message body"); - - let clickable = result.clickableElements[0]; - ok(clickable, "clickable object found"); - ok(body.textContent.includes('{ hello: "world!",'), "message text check"); - - executeSoon(() => { - EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); - }); - - let aVar = yield hud.jsterm.once("variablesview-fetched"); - ok(aVar, "variables view fetched"); - ok(aVar._variablesView, "variables view object"); - - [result] = yield findVariableViewProperties(aVar, [ - { name: "hello", value: "world!" }, - { name: "bug", value: 869003 }, - ], { webconsole: hud }); - - let prop = result.matchedProp; - ok(prop, "matched the |hello| property in the variables view"); - - // Check that property value updates work. - aVar = yield updateVariablesViewProperty({ - property: prop, - field: "value", - string: "'omgtest'", - webconsole: hud, - }); - - info("onFetchAfterUpdate"); - - yield findVariableViewProperties(aVar, [ - { name: "hello", value: "omgtest" }, - { name: "bug", value: 869003 }, - ], { webconsole: hud }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_iterators_generators.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_iterators_generators.js deleted file mode 100644 index 43db5d670f36..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_iterators_generators.js +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 632347. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-632347-iterators-generators.html"; - -function test() { - requestLongerTimeout(6); - - loadTab(TEST_URI).then(() => { - openConsole().then(consoleOpened); - }); -} - -function consoleOpened(HUD) { - let {JSPropertyProvider} = require("devtools/shared/webconsole/js-property-provider"); - - let tmp = Cu.import("resource://gre/modules/jsdebugger.jsm", {}); - tmp.addDebuggerToGlobal(tmp); - let dbg = new tmp.Debugger(); - - let jsterm = HUD.jsterm; - let win = content.wrappedJSObject; - let dbgWindow = dbg.addDebuggee(content); - let container = win._container; - - // Make sure autocomplete does not walk through generators. - let result = container.gen1.next(); - let completion = JSPropertyProvider(dbgWindow, null, "_container.gen1."); - isnot(completion.matches.length, 0, "Got matches for gen1"); - - is(result + 1, container.gen1.next(), "gen1.next() did not execute"); - - result = container.gen2.next().value; - - completion = JSPropertyProvider(dbgWindow, null, "_container.gen2."); - isnot(completion.matches.length, 0, "Got matches for gen2"); - - is((result / 2 + 1) * 2, container.gen2.next().value, - "gen2.next() did not execute"); - - completion = JSPropertyProvider(dbgWindow, null, "window._container."); - ok(completion, "matches available for window._container"); - ok(completion.matches.length, "matches available for window (length)"); - - dbg.removeDebuggee(content); - jsterm.clearOutput(); - - jsterm.execute("window._container", (msg) => { - jsterm.once("variablesview-fetched", testVariablesView.bind(null, HUD)); - let anchor = msg.querySelector(".message-body a"); - EventUtils.synthesizeMouse(anchor, 2, 2, {}, HUD.iframeWindow); - }); -} - -function testVariablesView(aWebconsole, aEvent, aView) { - findVariableViewProperties(aView, [ - { name: "gen1", isGenerator: true }, - { name: "gen2", isGenerator: true }, - ], { webconsole: aWebconsole }).then(function () { - executeSoon(finishTest); - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_js_input_expansion.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_js_input_expansion.js deleted file mode 100644 index 7d45059fc740..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_js_input_expansion.js +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the input box expands as the user types long lines. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - hud.jsterm.clearOutput(); - - let input = hud.jsterm.inputNode; - input.focus(); - - is(input.getAttribute("multiline"), "true", "multiline is enabled"); - // Tests if the inputNode expands. - input.value = "hello\nworld\n"; - let length = input.value.length; - input.selectionEnd = length; - input.selectionStart = length; - function getHeight() { - return input.clientHeight; - } - let initialHeight = getHeight(); - // Performs an "d". This will trigger/test for the input event that should - // change the "row" attribute of the inputNode. - EventUtils.synthesizeKey("d", {}); - let newHeight = getHeight(); - ok(initialHeight < newHeight, "Height changed: " + newHeight); - - // Add some more rows. Tests for the 8 row limit. - input.value = "row1\nrow2\nrow3\nrow4\nrow5\nrow6\nrow7\nrow8\nrow9\nrow10\n"; - length = input.value.length; - input.selectionEnd = length; - input.selectionStart = length; - EventUtils.synthesizeKey("d", {}); - let newerHeight = getHeight(); - - ok(newerHeight > newHeight, "height changed: " + newerHeight); - - // Test if the inputNode shrinks again. - input.value = ""; - EventUtils.synthesizeKey("d", {}); - let height = getHeight(); - info("height: " + height); - info("initialHeight: " + initialHeight); - let finalHeightDifference = Math.abs(initialHeight - height); - ok(finalHeightDifference <= 1, "height shrank to original size within 1px"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm.js deleted file mode 100644 index b5e386670505..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm.js +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -var jsterm; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - jsterm = hud.jsterm; - yield testJSTerm(hud); - jsterm = null; -}); - -function checkResult(msg, desc) { - let def = defer(); - waitForMessages({ - webconsole: jsterm.hud.owner, - messages: [{ - name: desc, - category: CATEGORY_OUTPUT, - }], - }).then(([result]) => { - let node = [...result.matched][0].querySelector(".message-body"); - if (typeof msg == "string") { - is(node.textContent.trim(), msg, - "correct message shown for " + desc); - } else if (typeof msg == "function") { - ok(msg(node), "correct message shown for " + desc); - } - - def.resolve(); - }); - return def.promise; -} - -function* testJSTerm(hud) { - const HELP_URL = "https://developer.mozilla.org/docs/Tools/" + - "Web_Console/Helpers"; - - jsterm.clearOutput(); - yield jsterm.execute("$('#header').getAttribute('id')"); - yield checkResult('"header"', "$() worked"); - - jsterm.clearOutput(); - yield jsterm.execute("$$('h1').length"); - yield checkResult("1", "$$() worked"); - - jsterm.clearOutput(); - yield jsterm.execute("$x('.//*', document.body)[0] == $$('h1')[0]"); - yield checkResult("true", "$x() worked"); - - // no jsterm.clearOutput() here as we clear the output using the clear() fn. - yield jsterm.execute("clear()"); - - yield waitForSuccess({ - name: "clear() worked", - validator: function () { - return jsterm.outputNode.childNodes.length == 0; - } - }); - - jsterm.clearOutput(); - yield jsterm.execute("keys({b:1})[0] == 'b'"); - yield checkResult("true", "keys() worked", 1); - - jsterm.clearOutput(); - yield jsterm.execute("values({b:1})[0] == 1"); - yield checkResult("true", "values() worked", 1); - - jsterm.clearOutput(); - - let openedLinks = 0; - let oldOpenLink = hud.openLink; - hud.openLink = (url) => { - if (url == HELP_URL) { - openedLinks++; - } - }; - - yield jsterm.execute("help()"); - yield jsterm.execute("help"); - yield jsterm.execute("?"); - - let output = jsterm.outputNode.querySelector(".message[category='output']"); - ok(!output, "no output for help() calls"); - is(openedLinks, 3, "correct number of pages opened by the help calls"); - hud.openLink = oldOpenLink; - - jsterm.clearOutput(); - yield jsterm.execute("pprint({b:2, a:1})"); - yield checkResult("\" b: 2\n a: 1\"", "pprint()"); - - // check instanceof correctness, bug 599940 - jsterm.clearOutput(); - yield jsterm.execute("[] instanceof Array"); - yield checkResult("true", "[] instanceof Array == true"); - - jsterm.clearOutput(); - yield jsterm.execute("({}) instanceof Object"); - yield checkResult("true", "({}) instanceof Object == true"); - - // check for occurrences of Object XRayWrapper, bug 604430 - jsterm.clearOutput(); - yield jsterm.execute("document"); - yield checkResult(function (node) { - return node.textContent.search(/\[object xraywrapper/i) == -1; - }, "document - no XrayWrapper"); - - // check that pprint(window) and keys(window) don't throw, bug 608358 - jsterm.clearOutput(); - yield jsterm.execute("pprint(window)"); - yield checkResult(null, "pprint(window)"); - - jsterm.clearOutput(); - yield jsterm.execute("keys(window)"); - yield checkResult(null, "keys(window)"); - - // bug 614561 - jsterm.clearOutput(); - yield jsterm.execute("pprint('hi')"); - yield checkResult("\" 0: \"h\"\n 1: \"i\"\"", "pprint('hi')"); - - // check that pprint(function) shows function source, bug 618344 - jsterm.clearOutput(); - yield jsterm.execute("pprint(function() { var someCanaryValue = 42; })"); - yield checkResult(function (node) { - return node.textContent.indexOf("someCanaryValue") > -1; - }, "pprint(function) shows source"); - - // check that an evaluated null produces "null", bug 650780 - jsterm.clearOutput(); - yield jsterm.execute("null"); - yield checkResult("null", "null is null"); - - jsterm.clearOutput(); - yield jsterm.execute("undefined"); - yield checkResult("undefined", "undefined is printed"); - - // check that thrown strings produce error messages, - // and the message text matches that of a stringified error object - // bug 1099071 - jsterm.clearOutput(); - yield jsterm.execute("throw '';"); - yield checkResult((node) => { - return node.closest(".message").getAttribute("severity") === "error" && - node.textContent === new Error("").toString(); - }, "thrown empty string generates error message"); - - jsterm.clearOutput(); - yield jsterm.execute("throw 'tomatoes';"); - yield checkResult((node) => { - return node.closest(".message").getAttribute("severity") === "error" && - node.textContent === new Error("tomatoes").toString(); - }, "thrown non-empty string generates error message"); - - jsterm.clearOutput(); - yield jsterm.execute("throw { foo: 'bar' };"); - yield checkResult((node) => { - return node.closest(".message").getAttribute("severity") === "error" && - node.textContent === Object.prototype.toString(); - }, "thrown object generates error message"); - - // check that errors with entires in errordocs.js display links - // alongside their messages. - const ErrorDocs = require("devtools/server/actors/errordocs"); - - const ErrorDocStatements = { - "JSMSG_BAD_RADIX": "(42).toString(0);", - "JSMSG_BAD_ARRAY_LENGTH": "([]).length = -1", - "JSMSG_NEGATIVE_REPETITION_COUNT": "'abc'.repeat(-1);", - "JSMSG_PRECISION_RANGE": "77.1234.toExponential(-1);", - }; - - for (let errorMessageName of Object.keys(ErrorDocStatements)) { - let title = ErrorDocs.GetURL({ errorMessageName }).split("?")[0]; - - jsterm.clearOutput(); - yield jsterm.execute(ErrorDocStatements[errorMessageName]); - yield checkResult((node) => { - return node.parentNode.getElementsByTagName("a")[0].title == title; - }, `error links to ${title}`); - } - - // Ensure that dom errors, with error numbers outside of the range - // of valid js.msg errors, don't cause crashes (bug 1270721). - yield jsterm.execute("new Request('',{redirect:'foo'})"); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm_copy.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm_copy.js deleted file mode 100644 index 53dbc38bd851..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm_copy.js +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 613280. - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 613280"; - -function test() { - loadTab(TEST_URI).then(() => { - openConsole().then((HUD) => { - ContentTask.spawn(gBrowser.selectedBrowser, null, function*(){ - content.console.log("foobarBazBug613280"); - }); - waitForMessages({ - webconsole: HUD, - messages: [{ - text: "foobarBazBug613280", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }).then(performTest.bind(null, HUD)); - }); - }); -} - -function performTest(HUD, [result]) { - let msg = [...result.matched][0]; - let input = HUD.jsterm.inputNode; - - let clipboardSetup = function () { - goDoCommand("cmd_copy"); - }; - - let clipboardCopyDone = function () { - finishTest(); - }; - - let controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled"); - - HUD.ui.output.selectMessage(msg); - HUD.outputNode.focus(); - - goUpdateCommand("cmd_copy"); - - controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled"); - - // Remove new lines and whitespace since getSelection() includes - // a new line between message and line number, but the clipboard doesn't - // @see bug 1119503 - let selectionText = (HUD.iframeWindow.getSelection() + "") - .replace(/\r?\n|\r| /g, ""); - isnot(selectionText.indexOf("foobarBazBug613280"), -1, - "selection text includes 'foobarBazBug613280'"); - - waitForClipboard((str) => { - return selectionText.trim() === str.trim().replace(/ /g, ""); - }, clipboardSetup, clipboardCopyDone, clipboardCopyDone); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm_dollar.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm_dollar.js deleted file mode 100644 index 12a90cf680fe..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_jsterm_dollar.js +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 621644. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-621644-jsterm-dollar.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield test$(hud); - yield test$$(hud); -}); - -function* test$(HUD) { - let deferred = defer(); - - HUD.jsterm.clearOutput(); - - HUD.jsterm.execute("$(document.body)", (msg) => { - ok(msg.textContent.indexOf("
") > -1, - "jsterm output is correct for $()"); - deferred.resolve(); - }); - - return deferred.promise; -} - -function test$$(HUD) { - let deferred = defer(); - - HUD.jsterm.clearOutput(); - - HUD.jsterm.setInputValue(); - HUD.jsterm.execute("$$(document)", (msg) => { - ok(msg.textContent.indexOf("621644") > -1, - "jsterm output is correct for $$()"); - deferred.resolve(); - }); - - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_longstring_expand.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_longstring_expand.js deleted file mode 100644 index bbf99c7757f9..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_longstring_expand.js +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that long strings can be expanded in the console output. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,test for bug 787981 - check " + - "that long strings can be expanded in the output."; - -add_task(function* () { - let { DebuggerServer } = require("devtools/server/main"); - - let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)) - .join("a") + "foobar"; - let initialString = - longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH); - - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - hud.jsterm.clearOutput(true); - hud.jsterm.execute("console.log('bazbaz', '" + longString + "', 'boom')"); - - let [result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "console.log output", - text: ["bazbaz", "boom", initialString], - noText: "foobar", - longString: true, - }], - }); - - let clickable = result.longStrings[0]; - ok(clickable, "long string ellipsis is shown"); - - clickable.scrollIntoView(false); - - EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "full string", - text: ["bazbaz", "boom", longString], - category: CATEGORY_WEBDEV, - longString: false, - }], - }); - - hud.jsterm.clearOutput(true); - let msg = yield execute(hud, "'" + longString + "'"); - - isnot(msg.textContent.indexOf(initialString), -1, - "initial string is shown"); - is(msg.textContent.indexOf(longString), -1, - "full string is not shown"); - - clickable = msg.querySelector(".longStringEllipsis"); - ok(clickable, "long string ellipsis is shown"); - - clickable.scrollIntoView(false); - - EventUtils.synthesizeMouse(clickable, 3, 4, {}, hud.iframeWindow); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "full string", - text: longString, - category: CATEGORY_OUTPUT, - longString: false, - }], - }); -}); - -function execute(hud, str) { - let deferred = defer(); - hud.jsterm.execute(str, deferred.resolve); - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_longstring_hang.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_longstring_hang.js deleted file mode 100644 index 036ad6e88170..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_longstring_hang.js +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that very long strings do not hang the browser. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-859170-longstring-hang.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - info("wait for the initial long string"); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "find 'foobar', no 'foobaz', in long string output", - text: "foobar", - noText: "foobaz", - category: CATEGORY_WEBDEV, - longString: true, - }, - ], - }); - - let clickable = results[0].longStrings[0]; - ok(clickable, "long string ellipsis is shown"); - clickable.scrollIntoView(false); - - EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); - - info("wait for long string expansion"); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "find 'foobaz' after expand, but no 'boom!' at the end", - text: "foobaz", - noText: "boom!", - category: CATEGORY_WEBDEV, - longString: false, - }, - { - text: "too long to be displayed", - longString: false, - }, - ], - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_message_categories.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_message_categories.js deleted file mode 100644 index c997e186b436..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_message_categories.js +++ /dev/null @@ -1,212 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 595934. - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "bug 595934 - message categories coverage."; -const TESTS_PATH = "http://example.com/browser/devtools/client/webconsole/" + - "test/"; -const TESTS = [ - { - // #0 - file: "test-bug-595934-css-loader.html", - category: "CSS Loader", - matchString: "text/css", - }, - { - // #1 - file: "test-bug-595934-imagemap.html", - category: "Layout: ImageMap", - matchString: "shape=\"rect\"", - }, - { - // #2 - file: "test-bug-595934-html.html", - category: "HTML", - matchString: "multipart/form-data", - onload: function () { - let form = content.document.querySelector("form"); - form.submit(); - }, - }, - { - // #3 - file: "test-bug-595934-workers.html", - category: "Web Worker", - matchString: "fooBarWorker", - }, - { - // #4 - file: "test-bug-595934-malformedxml.xhtml", - category: "malformed-xml", - matchString: "no root element found", - }, - { - // #5 - file: "test-bug-595934-svg.xhtml", - category: "SVG", - matchString: "fooBarSVG", - }, - { - // #6 - file: "test-bug-595934-css-parser.html", - category: "CSS Parser", - matchString: "foobarCssParser", - }, - { - // #7 - file: "test-bug-595934-malformedxml-external.html", - category: "malformed-xml", - matchString: "", - }, - { - // #8 - file: "test-bug-595934-empty-getelementbyid.html", - category: "DOM", - matchString: "getElementById", - }, - { - // #9 - file: "test-bug-595934-canvas-css.html", - category: "CSS Parser", - matchString: "foobarCanvasCssParser", - }, - { - // #10 - file: "test-bug-595934-image.html", - category: "Image", - matchString: "corrupt", - }, -]; - -var pos = -1; - -var foundCategory = false; -var foundText = false; -var pageLoaded = false; -var pageError = false; -var output = null; -var jsterm = null; -var hud = null; -var testEnded = false; - -var TestObserver = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), - - observe: function testObserve(subject) { - if (testEnded || !(subject instanceof Ci.nsIScriptError)) { - return; - } - - let expectedCategory = TESTS[pos].category; - - info("test #" + pos + " console observer got " + subject.category + - ", is expecting " + expectedCategory); - - if (subject.category == expectedCategory) { - foundCategory = true; - startNextTest(); - } else { - info("unexpected message was: " + subject.sourceName + ":" + - subject.lineNumber + "; " + subject.errorMessage); - } - } -}; - -function consoleOpened(hudConsole) { - hud = hudConsole; - output = hud.outputNode; - jsterm = hud.jsterm; - - Services.console.registerListener(TestObserver); - - registerCleanupFunction(testEnd); - - testNext(); -} - -function testNext() { - jsterm.clearOutput(); - foundCategory = false; - foundText = false; - pageLoaded = false; - pageError = false; - - pos++; - info("testNext: #" + pos); - if (pos < TESTS.length) { - test = TESTS[pos]; - - waitForMessages({ - webconsole: hud, - messages: [{ - name: "message for test #" + pos + ": '" + test.matchString + "'", - text: test.matchString, - }], - }).then(() => { - foundText = true; - startNextTest(); - }); - - let testLocation = TESTS_PATH + test.file; - gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) { - if (content.location.href != testLocation) { - return; - } - gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true); - - pageLoaded = true; - test.onload && test.onload(evt); - - if (test.expectError) { - content.addEventListener("error", function () { - pageError = true; - startNextTest(); - }, {once: true}); - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - } else { - pageError = true; - } - - startNextTest(); - }, true); - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testLocation); - } else { - testEnded = true; - finishTest(); - } -} - -function testEnd() { - if (!testEnded) { - info("foundCategory " + foundCategory + " foundText " + foundText + - " pageLoaded " + pageLoaded + " pageError " + pageError); - } - - Services.console.unregisterListener(TestObserver); - hud = TestObserver = output = jsterm = null; -} - -function startNextTest() { - if (!testEnded && foundCategory && foundText && pageLoaded && pageError) { - testNext(); - } -} - -function test() { - requestLongerTimeout(2); - - loadTab(TEST_URI).then(() => { - openConsole().then(consoleOpened); - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_mixedcontent.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_mixedcontent.js deleted file mode 100644 index 844399931f21..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_mixedcontent.js +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the Web Console Mixed Content messages are displayed. See Bug 737873. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,Web Console mixed content test"; -const TEST_HTTPS_URI = "https://example.com/browser/devtools/client/" + - "webconsole/test/test-bug-737873-mixedcontent.html"; -const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" + - "Mixed_content"; - -registerCleanupFunction(function*() { - Services.prefs.clearUserPref("security.mixed_content.block_display_content"); - Services.prefs.clearUserPref("security.mixed_content.block_active_content"); -}); - -add_task(function* () { - Services.prefs.setBoolPref("security.mixed_content.block_display_content", - false); - Services.prefs.setBoolPref("security.mixed_content.block_active_content", - false); - - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield testMixedContent(hud); -}); - -var testMixedContent = Task.async(function* (hud) { - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_HTTPS_URI); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "example.com", - category: CATEGORY_NETWORK, - severity: SEVERITY_WARNING, - }], - }); - - let msg = [...results[0].matched][0]; - ok(msg, "page load logged"); - ok(msg.classList.contains("mixed-content"), ".mixed-content element"); - - let link = msg.querySelector(".learn-more-link"); - ok(link, "mixed content link element"); - is(link.textContent, "[Mixed Content]", "link text is accurate"); - - yield simulateMessageLinkClick(link, LEARN_MORE_URI); - - ok(!msg.classList.contains("filtered-by-type"), "message is not filtered"); - - hud.setFilterState("netwarn", false); - - ok(msg.classList.contains("filtered-by-type"), "message is filtered"); - - hud.setFilterState("netwarn", true); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_multiline_input.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_multiline_input.js deleted file mode 100644 index 7285c21279c3..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_multiline_input.js +++ /dev/null @@ -1,70 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/* 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/. */ - -// Tests that the console waits for more input instead of evaluating -// when valid, but incomplete, statements are present upon pressing enter -// -or- when the user ends a line with shift + enter. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -let SHOULD_ENTER_MULTILINE = [ - {input: "function foo() {" }, - {input: "var a = 1," }, - {input: "var a = 1;", shiftKey: true }, - {input: "function foo() { }", shiftKey: true }, - {input: "function" }, - {input: "(x) =>" }, - {input: "let b = {" }, - {input: "let a = [" }, - {input: "{" }, - {input: "{ bob: 3343," }, - {input: "function x(y=" }, - {input: "Array.from(" }, - // shift + enter creates a new line despite parse errors - {input: "{2,}", shiftKey: true }, -]; -let SHOULD_EXECUTE = [ - {input: "function foo() { }" }, - {input: "var a = 1;" }, - {input: "function foo() { var a = 1; }" }, - {input: '"asdf"' }, - {input: "99 + 3" }, - {input: "1, 2, 3" }, - // errors - {input: "function f(x) { let y = 1, }" }, - {input: "function f(x=,) {" }, - {input: "{2,}" }, -]; - -add_task(function* () { - let { tab, browser } = yield loadTab(TEST_URI); - let hud = yield openConsole(); - let inputNode = hud.jsterm.inputNode; - - for (let test of SHOULD_ENTER_MULTILINE) { - hud.jsterm.setInputValue(test.input); - EventUtils.synthesizeKey("VK_RETURN", { shiftKey: test.shiftKey }); - let inputValue = hud.jsterm.getInputValue(); - is(inputNode.selectionStart, inputNode.selectionEnd, - "selection is collapsed"); - is(inputNode.selectionStart, inputValue.length, - "caret at end of multiline input"); - let inputWithNewline = test.input + "\n"; - is(inputValue, inputWithNewline, "Input value is correct"); - } - - for (let test of SHOULD_EXECUTE) { - hud.jsterm.setInputValue(test.input); - EventUtils.synthesizeKey("VK_RETURN", { shiftKey: test.shiftKey }); - let inputValue = hud.jsterm.getInputValue(); - is(inputNode.selectionStart, 0, "selection starts/ends at 0"); - is(inputNode.selectionEnd, 0, "selection starts/ends at 0"); - is(inputValue, "", "Input value is cleared"); - } - -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_multiple_windows_and_tabs.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_multiple_windows_and_tabs.js deleted file mode 100644 index cec965b4eb20..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_multiple_windows_and_tabs.js +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the Web Console doesn't leak when multiple tabs and windows are -// opened and then closed. See Bug 595350. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 595350"; - -var win1 = window, win2; -var openTabs = []; -var loadedTabCount = 0; - -function test() { - requestLongerTimeout(3); - - // Add two tabs in the main window. - addTabs(win1); - - // Open a new window. - win2 = OpenBrowserWindow(); - win2.addEventListener("load", onWindowLoad, true); -} - -function onWindowLoad(aEvent) { - win2.removeEventListener(aEvent.type, onWindowLoad, true); - - // Add two tabs in the new window. - addTabs(win2); -} - -function addTabs(aWindow) { - for (let i = 0; i < 2; i++) { - let tab = aWindow.gBrowser.addTab(TEST_URI); - openTabs.push(tab); - - tab.linkedBrowser.addEventListener("load", function onLoad(aEvent) { - tab.linkedBrowser.removeEventListener(aEvent.type, onLoad, true); - - loadedTabCount++; - info("tabs loaded: " + loadedTabCount); - if (loadedTabCount >= 4) { - executeSoon(openConsoles); - } - }, true); - } -} - -function openConsoles() { - function open(i) { - let tab = openTabs[i]; - openConsole(tab).then(function (hud) { - ok(hud, "HUD is open for tab " + i); - let window = hud.target.tab.linkedBrowser.contentWindow; - window.console.log("message for tab " + i); - - if (i >= openTabs.length - 1) { - // Use executeSoon() to allow the promise to resolve. - executeSoon(closeConsoles); - } - else { - executeSoon(() => open(i + 1)); - } - }); - } - - // open the Web Console for each of the four tabs and log a message. - open(0); -} - -function closeConsoles() { - let consolesClosed = 0; - - function onWebConsoleClose(aSubject, aTopic) { - if (aTopic == "web-console-destroyed") { - consolesClosed++; - info("consoles destroyed: " + consolesClosed); - if (consolesClosed == 4) { - // Use executeSoon() to allow all the observers to execute. - executeSoon(finishTest); - } - } - } - - Services.obs.addObserver(onWebConsoleClose, "web-console-destroyed"); - - registerCleanupFunction(() => { - Services.obs.removeObserver(onWebConsoleClose, "web-console-destroyed"); - }); - - win2.close(); - - win1.gBrowser.removeTab(openTabs[0]); - win1.gBrowser.removeTab(openTabs[1]); - - openTabs = win1 = win2 = null; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_netlogging_reset_filter.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_netlogging_reset_filter.js deleted file mode 100644 index 51b723f5fcdd..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_netlogging_reset_filter.js +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that network log messages bring up the network panel and select the -// right request even if it was previously filtered off. - -"use strict"; - -const TEST_FILE_URI = - "http://example.com/browser/devtools/client/webconsole/test/" + - "test-network.html"; -const TEST_URI = "data:text/html;charset=utf8,
test file URI"; - -var hud; - -add_task(function* () { - let requests = []; - let { browser } = yield loadTab(TEST_URI); - - yield pushPrefEnv(); - hud = yield openConsole(); - hud.jsterm.clearOutput(); - - HUDService.lastFinishedRequest.callback = request => requests.push(request); - - let loaded = loadBrowser(browser); - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_FILE_URI); - yield loaded; - - yield testMessages(); - let htmlRequest = requests.find(e => e.request.url.endsWith("html")); - ok(htmlRequest, "htmlRequest was a html"); - - yield hud.ui.openNetworkPanel(htmlRequest.actor); - let toolbox = gDevTools.getToolbox(hud.target); - is(toolbox.currentToolId, "netmonitor", "Network panel was opened"); - - let panel = toolbox.getCurrentPanel(); - let { store, windowRequire } = panel.panelWin; - let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); - let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/src/selectors/index"); - - let selected = getSelectedRequest(store.getState()); - is(selected.method, htmlRequest.request.method, - "The correct request is selected"); - is(selected.url, htmlRequest.request.url, - "The correct request is definitely selected"); - - // Filter out the HTML request. - store.dispatch(Actions.toggleRequestFilterType("js")); - - yield toolbox.selectTool("webconsole"); - is(toolbox.currentToolId, "webconsole", "Web console was selected"); - yield hud.ui.openNetworkPanel(htmlRequest.actor); - - selected = getSelectedRequest(store.getState()); - is(selected.method, htmlRequest.request.method, - "The correct request is selected"); - is(selected.url, htmlRequest.request.url, - "The correct request is definitely selected"); - - // All tests are done. Shutdown. - HUDService.lastFinishedRequest.callback = null; - htmlRequest = browser = requests = hud = null; -}); - -function testMessages() { - return waitForMessages({ - webconsole: hud, - messages: [{ - text: "running network console logging tests", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - text: "test-network.html", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }, - { - text: "testscript.js", - category: CATEGORY_NETWORK, - severity: SEVERITY_LOG, - }], - }); -} - -function pushPrefEnv() { - let deferred = defer(); - let options = { - set: [["devtools.webconsole.filter.networkinfo", true]] - }; - SpecialPowers.pushPrefEnv(options, deferred.resolve); - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_exceptions.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_exceptions.js deleted file mode 100644 index 439793b22308..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_exceptions.js +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that we report JS exceptions in event handlers coming from -// network requests, like onreadystate for XHR. See bug 618078. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 618078"; -const TEST_URI2 = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-618078-network-exceptions.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI2); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "bug618078exception", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }], - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_requests_from_chrome.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_requests_from_chrome.js deleted file mode 100644 index 1f8e88366f12..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_requests_from_chrome.js +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that network requests from chrome don't cause the Web Console to -// throw exceptions. See Bug 597136. - -"use strict"; - -const TEST_URI = "http://example.com/"; - -var good = true; -var listener = { - QueryInterface: XPCOMUtils.generateQI([ Ci.nsIObserver ]), - observe: function (subject) { - if (subject instanceof Ci.nsIScriptError && - subject.category === "XPConnect JavaScript" && - subject.sourceName.includes("webconsole")) { - good = false; - } - } -}; - -var xhr; - -function test() { - Services.console.registerListener(listener); - - // trigger a lazy-load of the HUD Service - HUDService; - - xhr = new XMLHttpRequest(); - xhr.addEventListener("load", xhrComplete); - xhr.open("GET", TEST_URI, true); - xhr.send(null); -} - -function xhrComplete() { - xhr.removeEventListener("load", xhrComplete); - window.setTimeout(checkForException, 0); -} - -function checkForException() { - ok(good, "no exception was thrown when sending a network request from a " + - "chrome window"); - - Services.console.unregisterListener(listener); - listener = xhr = null; - - finishTest(); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_notifications.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_notifications.js deleted file mode 100644 index 1cac2dcdcae2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_notifications.js +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,
Web Console test for " + - "notifications"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let consoleOpened = defer(); - let gotEvents = waitForEvents(consoleOpened.promise); - yield openConsole().then(() => { - consoleOpened.resolve(); - }); - - yield gotEvents; -}); - -function waitForEvents(onConsoleOpened) { - let deferred = defer(); - - function webConsoleCreated(id) { - Services.obs.removeObserver(observer, "web-console-created"); - ok(HUDService.getHudReferenceById(id), "We have a hud reference"); - content.wrappedJSObject.console.log("adding a log message"); - } - - function webConsoleDestroyed(id) { - Services.obs.removeObserver(observer, "web-console-destroyed"); - ok(!HUDService.getHudReferenceById(id), "We do not have a hud reference"); - executeSoon(deferred.resolve); - } - - function webConsoleMessage(id, nodeID) { - Services.obs.removeObserver(observer, "web-console-message-created"); - ok(id, "we have a console ID"); - is(typeof nodeID, "string", "message node id is a string"); - onConsoleOpened.then(closeConsole); - } - - let observer = { - - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), - - observe: function observe(subject, topic, data) { - subject = subject.QueryInterface(Ci.nsISupportsString); - - switch (topic) { - case "web-console-created": - webConsoleCreated(subject.data); - break; - case "web-console-destroyed": - webConsoleDestroyed(subject.data); - break; - case "web-console-message-created": - webConsoleMessage(subject, data); - break; - default: - break; - } - }, - - init: function init() { - Services.obs.addObserver(this, "web-console-created"); - Services.obs.addObserver(this, "web-console-destroyed"); - Services.obs.addObserver(this, "web-console-message-created"); - } - }; - - observer.init(); - - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_optimized_out_vars.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_optimized_out_vars.js deleted file mode 100644 index 3bbb0231d7ad..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_optimized_out_vars.js +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that inspecting an optimized out variable works when execution is -// paused. - -"use strict"; - -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -function test() { - Task.spawn(function* () { - const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-closure-optimized-out.html"; - let {tab} = yield loadTab(TEST_URI); - let hud = yield openConsole(tab); - let { toolbox, panel, panelWin } = yield openDebugger(); - - let sources = panelWin.DebuggerView.Sources; - yield panel.addBreakpoint({ actor: sources.values[0], line: 18 }); - yield ensureThreadClientState(panel, "resumed"); - - let fetchedScopes = panelWin.once(panelWin.EVENTS.FETCHED_SCOPES); - - // Cause the debuggee to pause - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - let button = content.document.querySelector("button"); - button.click(); - }); - - yield fetchedScopes; - ok(true, "Scopes were fetched"); - - yield toolbox.selectTool("webconsole"); - - // This is the meat of the test: evaluate the optimized out variable. - hud.jsterm.execute("upvar"); - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "optimized out", - category: CATEGORY_OUTPUT, - }] - }); - - finishTest(); - }).catch(aError => { - ok(false, "Got an error: " + aError.message + "\n" + aError.stack); - }); -} - -// Debugger helper functions stolen from devtools/client/debugger/test/head.js. - -function ensureThreadClientState(aPanel, aState) { - let thread = aPanel.panelWin.gThreadClient; - let state = thread.state; - - info("Thread is: '" + state + "'."); - - if (state == aState) { - return promise.resolve(null); - } - return waitForThreadEvents(aPanel, aState); -} - -function waitForThreadEvents(aPanel, aEventName, aEventRepeat = 1) { - info("Waiting for thread event: '" + aEventName + "' to fire: " + - aEventRepeat + " time(s)."); - - let deferred = defer(); - let thread = aPanel.panelWin.gThreadClient; - let count = 0; - - thread.addListener(aEventName, function onEvent(eventName, ...args) { - info("Thread event '" + eventName + "' fired: " + (++count) + " time(s)."); - - if (count == aEventRepeat) { - ok(true, "Enough '" + eventName + "' thread events have been fired."); - thread.removeListener(eventName, onEvent); - deferred.resolve.apply(deferred, args); - } - }); - - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_copy.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_copy.js deleted file mode 100644 index 5d515c348bda..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_copy.js +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* globals goUpdateCommand goDoCommand */ - -"use strict"; - -// See Bug 587617. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -var HUD, outputNode; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - yield consoleOpened(hud); - yield testContextMenuCopy(); - - HUD = outputNode = null; -}); - -function consoleOpened(hud) { - HUD = hud; - - let deferred = defer(); - - // See bugs 574036, 586386 and 587617. - outputNode = HUD.outputNode; - - HUD.jsterm.clearOutput(); - - let controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled"); - - ContentTask.spawn(gBrowser.selectedBrowser, null, - "() => content.console.log('Hello world! bug587617')"); - - waitForMessages({ - webconsole: HUD, - messages: [{ - text: "bug587617", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }).then(([result]) => { - let msg = [...result.matched][0]; - HUD.ui.output.selectMessage(msg); - - outputNode.focus(); - - goUpdateCommand("cmd_copy"); - controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled"); - - // Remove new lines and whitespace since getSelection() includes - // a new line between message and line number, but the clipboard doesn't - // @see bug 1119503 - let selection = (HUD.iframeWindow.getSelection() + "") - .replace(/\r?\n|\r| /g, ""); - isnot(selection.indexOf("bug587617"), -1, - "selection text includes 'bug587617'"); - - waitForClipboard((str) => { - // Strip out spaces for comparison ease - return selection.trim() == str.trim().replace(/ /g, ""); - }, () => { - goDoCommand("cmd_copy"); - }, deferred.resolve, deferred.resolve); - }); - return deferred.promise; -} - -// Test that the context menu "Copy" (which has a different code path) works -// properly as well. -function testContextMenuCopy() { - let deferred = defer(); - - let contextMenuId = HUD.ui.outputWrapper.getAttribute("context"); - let contextMenu = HUD.ui.document.getElementById(contextMenuId); - ok(contextMenu, "the output node has a context menu"); - - let copyItem = contextMenu.querySelector("*[command='cmd_copy']"); - ok(copyItem, "the context menu on the output node has a \"Copy\" item"); - - // Remove new lines and whitespace since getSelection() includes - // a new line between message and line number, but the clipboard doesn't - // @see bug 1119503 - let selection = (HUD.iframeWindow.getSelection() + "") - .replace(/\r?\n|\r| /g, ""); - - copyItem.doCommand(); - - waitForClipboard((str) => { - // Strip out spaces for comparison ease - return selection.trim() == str.trim().replace(/ /g, ""); - }, () => { - goDoCommand("cmd_copy"); - }, deferred.resolve, deferred.resolve); - HUD = outputNode = null; - - return deferred.promise; -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_copy_newlines.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_copy_newlines.js deleted file mode 100644 index 22de843f955c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_copy_newlines.js +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that multiple messages are copied into the clipboard and that they are -// separated by new lines. See bug 916997. - -"use strict"; - -add_task(function* () { - const TEST_URI = "data:text/html;charset=utf8,
hello world, bug 916997"; - let clipboardValue = ""; - - yield loadTab(TEST_URI); - let hud = yield openConsole(); - hud.jsterm.clearOutput(); - - let controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled"); - - content.console.log("Hello world! bug916997a"); - content.console.log("Hello world 2! bug916997b"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "Hello world! bug916997a", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, { - text: "Hello world 2! bug916997b", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - - hud.ui.output.selectAllMessages(); - hud.outputNode.focus(); - - goUpdateCommand("cmd_copy"); - controller = top.document.commandDispatcher - .getControllerForCommand("cmd_copy"); - is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled"); - - let selection = hud.iframeWindow.getSelection() + ""; - info("selection '" + selection + "'"); - - waitForClipboard((str) => { - clipboardValue = str; - return str.indexOf("bug916997a") > -1 && str.indexOf("bug916997b") > -1; - }, - () => { - goDoCommand("cmd_copy"); - }, - () => { - info("clipboard value '" + clipboardValue + "'"); - let lines = clipboardValue.trim().split("\n"); - is(hud.outputNode.children.length, 2, "number of messages"); - is(lines.length, hud.outputNode.children.length, "number of lines"); - isnot(lines[0].indexOf("bug916997a"), -1, - "first message text includes 'bug916997a'"); - isnot(lines[1].indexOf("bug916997b"), -1, - "second message text includes 'bug916997b'"); - is(lines[0].indexOf("bug916997b"), -1, - "first message text does not include 'bug916997b'"); - }, - () => { - info("last clipboard value: '" + clipboardValue + "'"); - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_order.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_order.js deleted file mode 100644 index 66fa74cb0a56..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_output_order.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that any output created from calls to the console API comes before the -// echoed JavaScript. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - - let jsterm = hud.jsterm; - - jsterm.clearOutput(); - jsterm.execute("console.log('foo', 'bar');"); - - let [functionCall, consoleMessage, result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "console.log('foo', 'bar');", - category: CATEGORY_INPUT, - }, - { - text: "foo bar", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }, - { - text: "undefined", - category: CATEGORY_OUTPUT, - }] - }); - - let fncallNode = [...functionCall.matched][0]; - let consoleMessageNode = [...consoleMessage.matched][0]; - let resultNode = [...result.matched][0]; - is(fncallNode.nextElementSibling, consoleMessageNode, - "console.log() is followed by 'foo' 'bar'"); - is(consoleMessageNode.nextElementSibling, resultNode, - "'foo' 'bar' is followed by undefined"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_property_provider.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_property_provider.js deleted file mode 100644 index 0c9b4c4e34c1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_property_provider.js +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests the property provider, which is part of the code completion -// infrastructure. - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf8,
test the JS property provider"; - -function test() { - loadTab(TEST_URI).then(testPropertyProvider); -} - -function testPropertyProvider({browser}) { - browser.removeEventListener("load", testPropertyProvider, true); - let {JSPropertyProvider} = require("devtools/shared/webconsole/js-property-provider"); - - let tmp = Cu.import("resource://gre/modules/jsdebugger.jsm", {}); - tmp.addDebuggerToGlobal(tmp); - let dbg = new tmp.Debugger(); - let dbgWindow = dbg.addDebuggee(content); - - let completion = JSPropertyProvider(dbgWindow, null, "thisIsNotDefined"); - is(completion.matches.length, 0, "no match for 'thisIsNotDefined"); - - // This is a case the PropertyProvider can't handle. Should return null. - completion = JSPropertyProvider(dbgWindow, null, "window[1].acb"); - is(completion, null, "no match for 'window[1].acb"); - - // A very advanced completion case. - let strComplete = - "function a() { }document;document.getElementById(window.locatio"; - completion = JSPropertyProvider(dbgWindow, null, strComplete); - ok(completion.matches.length == 2, "two matches found"); - ok(completion.matchProp == "locatio", "matching part is 'test'"); - let matches = completion.matches; - matches.sort(); - ok(matches[0] == "location", "the first match is 'location'"); - ok(matches[1] == "locationbar", "the second match is 'locationbar'"); - - dbg.removeDebuggee(content); - finishTest(); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_prune_scroll.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_prune_scroll.js deleted file mode 100644 index 54d4ff518671..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_prune_scroll.js +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 613642. - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "bug 613642: maintain scroll with pruning of old messages"; - -var hud; - -add_task(function* () { - yield loadTab(TEST_URI); - - hud = yield openConsole(); - - hud.jsterm.clearOutput(); - - let outputNode = hud.outputNode; - - Services.prefs.setIntPref("devtools.hud.loglimit.console", 140); - let scrollBoxElement = hud.ui.outputWrapper; - - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - for (let i = 0; i < 150; i++) { - content.console.log("test message " + i); - } - }); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "test message 149", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - - let oldScrollTop = scrollBoxElement.scrollTop; - isnot(oldScrollTop, 0, "scroll location is not at the top"); - - let firstNode = outputNode.firstChild; - ok(firstNode, "found the first message"); - - let msgNode = outputNode.children[80]; - ok(msgNode, "found the 80th message"); - - // scroll to the middle message node - msgNode.scrollIntoView(false); - - isnot(scrollBoxElement.scrollTop, oldScrollTop, - "scroll location updated (scrolled to message)"); - - oldScrollTop = scrollBoxElement.scrollTop; - - // add a message - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.console.log("hello world"); - }); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "hello world", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - }], - }); - - // Scroll location needs to change, because one message is also removed, and - // we need to scroll a bit towards the top, to keep the current view in sync. - isnot(scrollBoxElement.scrollTop, oldScrollTop, - "scroll location updated (added a message)"); - - isnot(outputNode.firstChild, firstNode, - "first message removed"); - - Services.prefs.clearUserPref("devtools.hud.loglimit.console"); - - hud = null; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_reflow.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_reflow.js deleted file mode 100644 index 86caa10e050f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_reflow.js +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "reflow activity"; - -add_task(function* () { - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - function onReflowListenersReady() { - browser.contentDocument.body.style.display = "none"; - browser.contentDocument.body.clientTop; - } - - Services.prefs.setBoolPref("devtools.webconsole.filter.csslog", true); - hud.ui._updateReflowActivityListener(onReflowListenersReady); - Services.prefs.clearUserPref("devtools.webconsole.filter.csslog"); - - yield waitForMessages({ - webconsole: hud, - messages: [{ - text: /reflow: /, - category: CATEGORY_CSS, - severity: SEVERITY_LOG, - }], - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_reopen_closed_tab.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_reopen_closed_tab.js deleted file mode 100644 index f2713d7e83f8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_reopen_closed_tab.js +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 597756. - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-597756-reopen-closed-tab.html"; - -var HUD; - -add_task(function* () { - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - let { browser } = yield loadTab(TEST_URI); - HUD = yield openConsole(); - - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - yield reload(browser); - - yield testMessages(); - - yield closeConsole(); - - // Close and reopen - gBrowser.removeCurrentTab(); - - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - let tab = yield loadTab(TEST_URI); - HUD = yield openConsole(); - - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - - yield reload(tab.browser); - - yield testMessages(); - - HUD = null; -}); - -function reload(browser) { - let loaded = loadBrowser(browser); - browser.reload(); - return loaded; -} - -function testMessages() { - return waitForMessages({ - webconsole: HUD, - messages: [{ - name: "error message displayed", - text: "fooBug597756_error", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }], - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_repeat_different_objects.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_repeat_different_objects.js deleted file mode 100644 index 86ab5bd39203..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_repeat_different_objects.js +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that makes sure messages are not considered repeated when console.log() -// is invoked with different objects, see bug 865288. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-repeated-messages.html"; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - - info("waiting for 3 console.log objects"); - - hud.jsterm.clearOutput(true); - hud.jsterm.execute("window.testConsoleObjects()"); - - let [result] = yield waitForMessages({ - webconsole: hud, - messages: [{ - name: "3 console.log messages", - text: "abba", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - count: 3, - repeats: 1, - objects: true, - }], - }); - - let msgs = [...result.matched]; - is(msgs.length, 3, "3 message elements"); - - for (let i = 0; i < msgs.length; i++) { - info("test message element #" + i); - - let msg = msgs[i]; - let clickable = msg.querySelector(".message-body a"); - ok(clickable, "clickable object #" + i); - - msg.scrollIntoView(false); - yield clickObject(clickable, i); - } - - function* clickObject(obj, i) { - executeSoon(() => { - EventUtils.synthesizeMouse(obj, 2, 2, {}, hud.iframeWindow); - }); - - let varView = yield hud.jsterm.once("variablesview-fetched"); - ok(varView, "variables view fetched #" + i); - - yield findVariableViewProperties(varView, [ - { name: "id", value: "abba" + i }, - ], { webconsole: hud }); - } -}); - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_repeated_messages_accuracy.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_repeated_messages_accuracy.js deleted file mode 100644 index 36b13ce02f43..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_repeated_messages_accuracy.js +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that makes sure messages are not considered repeated when coming from -// different lines of code, or from different severities, etc. -// See bugs 720180 and 800510. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-repeated-messages.html"; -const PREF = "devtools.webconsole.persistlog"; - -add_task(function* () { - Services.prefs.setBoolPref(PREF, true); - - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - yield consoleOpened(hud); - - let loaded = loadBrowser(browser); - BrowserReload(); - yield loaded; - - yield testCSSRepeats(hud); - yield testCSSRepeatsAfterReload(hud); - yield testConsoleRepeats(hud); - yield testConsoleFalsyValues(hud); - - Services.prefs.clearUserPref(PREF); -}); - -function consoleOpened(hud) { - // Check that css warnings are not coalesced if they come from different - // lines. - info("waiting for 2 css warnings"); - - return waitForMessages({ - webconsole: hud, - messages: [{ - name: "two css warnings", - category: CATEGORY_CSS, - count: 2, - repeats: 1, - }], - }); -} - -function testCSSRepeats(hud) { - info("wait for repeats after page reload"); - - return waitForMessages({ - webconsole: hud, - messages: [{ - name: "two css warnings, repeated twice", - category: CATEGORY_CSS, - repeats: 2, - count: 2, - }], - }); -} - -function testCSSRepeatsAfterReload(hud) { - hud.jsterm.clearOutput(true); - hud.jsterm.execute("testConsole()"); - - info("wait for repeats with the console API"); - - return waitForMessages({ - webconsole: hud, - messages: [ - { - name: "console.log 'foo repeat' repeated twice", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 2, - }, - { - name: "console.log 'foo repeat' repeated once", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 1, - }, - { - name: "console.error 'foo repeat' repeated once", - category: CATEGORY_WEBDEV, - severity: SEVERITY_ERROR, - repeats: 1, - }, - ], - }); -} - -function testConsoleRepeats(hud) { - hud.jsterm.clearOutput(true); - hud.jsterm.execute("undefined"); - - ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { - content.console.log("undefined"); - }); - - info("make sure console API messages are not coalesced with jsterm output"); - - return waitForMessages({ - webconsole: hud, - messages: [ - { - name: "'undefined' jsterm input message", - text: "undefined", - category: CATEGORY_INPUT, - }, - { - name: "'undefined' jsterm output message", - text: "undefined", - category: CATEGORY_OUTPUT, - }, - { - name: "'undefined' console.log message", - text: "undefined", - category: CATEGORY_WEBDEV, - repeats: 1, - }, - ], - }); -} - -function testConsoleFalsyValues(hud) { - hud.jsterm.clearOutput(true); - hud.jsterm.execute("testConsoleFalsyValues()"); - - info("wait for repeats of falsy values with the console API"); - - return waitForMessages({ - webconsole: hud, - messages: [ - { - name: "console.log 'NaN' repeated once", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 1, - }, - { - name: "console.log 'undefined' repeated once", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 1, - }, - { - name: "console.log 'null' repeated once", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 1, - }, - { - name: "console.log 'NaN' repeated twice", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 2, - }, - { - name: "console.log 'undefined' repeated twice", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 2, - }, - { - name: "console.log 'null' repeated twice", - category: CATEGORY_WEBDEV, - severity: SEVERITY_LOG, - repeats: 2, - }, - ], - }); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_sandbox_update_after_navigation.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_sandbox_update_after_navigation.js deleted file mode 100644 index 163b6cbf3d6a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_sandbox_update_after_navigation.js +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests if the JSTerm sandbox is updated when the user navigates from one -// domain to another, in order to avoid permission denied errors with a sandbox -// created for a different origin. See Bug 664688. - -"use strict"; - -add_task(function* () { - const TEST_URI1 = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - const TEST_URI2 = "http://example.org/browser/devtools/client/webconsole/" + - "test/test-console.html"; - - yield loadTab(TEST_URI1); - let hud = yield openConsole(); - - hud.jsterm.clearOutput(); - hud.jsterm.execute("window.location.href"); - - info("wait for window.location.href"); - - let msgForLocation1 = { - webconsole: hud, - messages: [ - { - name: "window.location.href jsterm input", - text: "window.location.href", - category: CATEGORY_INPUT, - }, - { - name: "window.location.href result is displayed", - text: TEST_URI1, - category: CATEGORY_OUTPUT, - }, - ], - }; - - yield waitForMessages(msgForLocation1); - - // load second url - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI2); - yield loadBrowser(gBrowser.selectedBrowser); - - is(hud.outputNode.textContent.indexOf("Permission denied"), -1, - "no permission denied errors"); - - hud.jsterm.clearOutput(); - hud.jsterm.execute("window.location.href"); - - info("wait for window.location.href after page navigation"); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "window.location.href jsterm input", - text: "window.location.href", - category: CATEGORY_INPUT, - }, - { - name: "window.location.href result is displayed", - text: TEST_URI2, - category: CATEGORY_OUTPUT, - }, - ], - }); - - is(hud.outputNode.textContent.indexOf("Permission denied"), -1, - "no permission denied errors"); - - // Navigation clears messages. Wait for that clear to happen before - // continuing the test or it might destroy messages we wait later on (Bug - // 1270234). - let cleared = hud.jsterm.once("messages-cleared"); - - gBrowser.goBack(); - - info("Waiting for messages to be cleared due to navigation"); - yield cleared; - - info("Messages cleared after navigation; checking location"); - hud.jsterm.execute("window.location.href"); - - info("wait for window.location.href after goBack()"); - yield waitForMessages(msgForLocation1); - is(hud.outputNode.textContent.indexOf("Permission denied"), -1, - "no permission denied errors"); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_script_errordoc_urls.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_script_errordoc_urls.js deleted file mode 100644 index 779d80376b5d..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_script_errordoc_urls.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Ensure that [Learn More] links appear alongside any errors listed -// in "errordocs.js". Note: this only tests script execution. - -"use strict"; - -const ErrorDocs = require("devtools/server/actors/errordocs"); - -function makeURIData(script) { - return `data:text/html;charset=utf8,`; -} - -const TestData = [ - { - jsmsg: "JSMSG_READ_ONLY", - script: "'use strict'; (Object.freeze({name: 'Elsa', score: 157})).score = 0;", - isException: true, - }, - { - jsmsg: "JSMSG_STMT_AFTER_RETURN", - script: "function a() { return; 1 + 1; };", - isException: false, - } -]; - -add_task(function* () { - yield loadTab("data:text/html;charset=utf8,errordoc tests"); - - let hud = yield openConsole(); - - for (let i = 0; i < TestData.length; i++) { - yield testScriptError(hud, TestData[i]); - } -}); - -function* testScriptError(hud, testData) { - if (testData.isException === true) { - expectUncaughtException(); - } - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, makeURIData(testData.script)); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - category: CATEGORY_JS - } - ] - }); - - // grab the most current error doc URL - let url = ErrorDocs.GetURL({ errorMessageName: testData.jsmsg }); - - let hrefs = {}; - for (let link of hud.jsterm.outputNode.querySelectorAll("a")) { - hrefs[link.href] = true; - } - - ok(url in hrefs, `Expected a link to ${url}.`); - - hud.jsterm.clearOutput(); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_select_all.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_select_all.js deleted file mode 100644 index 459e7054d4e2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_select_all.js +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// See Bug 586388. - -const TEST_URI = "http://example.com/"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - yield testSelectionWhenMovingBetweenBoxes(hud); - performTestsAfterOutput(hud); -}); - -var testSelectionWhenMovingBetweenBoxes = Task.async(function* (hud) { - let jsterm = hud.jsterm; - - // Fill the console with some output. - jsterm.clearOutput(); - yield jsterm.execute("1 + 2"); - yield jsterm.execute("3 + 4"); - yield jsterm.execute("5 + 6"); - - return waitForMessages({ - webconsole: hud, - messages: [{ - text: "3", - category: CATEGORY_OUTPUT, - }, - { - text: "7", - category: CATEGORY_OUTPUT, - }, - { - text: "11", - category: CATEGORY_OUTPUT, - }], - }); -}); - -function performTestsAfterOutput(hud) { - let outputNode = hud.outputNode; - - ok(outputNode.childNodes.length >= 3, "the output node has children after " + - "executing some JavaScript"); - - // Test that the global Firefox "Select All" functionality (e.g. Edit > - // Select All) works properly in the Web Console. - let commandController = hud.ui._commandController; - ok(commandController != null, "the window has a command controller object"); - - commandController.selectAll(); - - let selectedCount = hud.ui.output.getSelectedMessages().length; - is(selectedCount, outputNode.childNodes.length, - "all console messages are selected after performing a regular browser " + - "select-all operation"); - - hud.iframeWindow.getSelection().removeAllRanges(); - - // Test the context menu "Select All" (which has a different code path) works - // properly as well. - let contextMenuId = hud.ui.outputWrapper.getAttribute("context"); - let contextMenu = hud.ui.document.getElementById(contextMenuId); - ok(contextMenu != null, "the output node has a context menu"); - - let selectAllItem = contextMenu.querySelector("*[command='cmd_selectAll']"); - ok(selectAllItem != null, - "the context menu on the output node has a \"Select All\" item"); - - outputNode.focus(); - - selectAllItem.doCommand(); - - selectedCount = hud.ui.output.getSelectedMessages().length; - is(selectedCount, outputNode.childNodes.length, - "all console messages are selected after performing a select-all " + - "operation from the context menu"); - - hud.iframeWindow.getSelection().removeAllRanges(); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_show_subresource_security_errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_show_subresource_security_errors.js deleted file mode 100644 index 2f2238d1fbbb..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_show_subresource_security_errors.js +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Ensure non-toplevel security errors are displayed - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console subresource STS " + - "warning test"; -const TEST_DOC = "https://example.com/browser/devtools/client/webconsole/" + - "test/test_bug1092055_shouldwarn.html"; -const SAMPLE_MSG = "specified a header that could not be parsed successfully."; - -add_task(function* () { - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - hud.jsterm.clearOutput(); - - let loaded = loadBrowser(browser); - BrowserTestUtils.loadURI(browser, TEST_DOC); - yield loaded; - - yield waitForSuccess({ - name: "Subresource STS warning displayed successfully", - validator: function () { - return hud.outputNode.textContent.indexOf(SAMPLE_MSG) > -1; - } - }); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split.js deleted file mode 100644 index a981a0c94e02..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split.js +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for splitting"; - -function test() { - waitForExplicitFinish(); - // Test is slow on Linux EC2 instances - Bug 962931 - requestLongerTimeout(2); - - let {Toolbox} = require("devtools/client/framework/toolbox"); - let toolbox; - - loadTab(TEST_URI).then(testConsoleLoadOnDifferentPanel); - - function testConsoleLoadOnDifferentPanel() { - info("About to check console loads even when non-webconsole panel is open"); - - openPanel("inspector").then(() => { - toolbox.on("webconsole-ready", () => { - ok(true, "Webconsole has been triggered as loaded while another tool " + - "is active"); - testKeyboardShortcuts(); - }); - - // Opens split console. - toolbox.toggleSplitConsole(); - }); - } - - function testKeyboardShortcuts() { - info("About to check that panel responds to ESCAPE keyboard shortcut"); - - toolbox.once("split-console", () => { - ok(true, "Split console has been triggered via ESCAPE keypress"); - checkAllTools(); - }); - - // Closes split console. - EventUtils.sendKey("ESCAPE", toolbox.win); - } - - function checkAllTools() { - info("About to check split console with each panel individually."); - - Task.spawn(function* () { - yield openAndCheckPanel("jsdebugger"); - yield openAndCheckPanel("inspector"); - yield openAndCheckPanel("styleeditor"); - yield openAndCheckPanel("performance"); - yield openAndCheckPanel("netmonitor"); - - yield checkWebconsolePanelOpened(); - testBottomHost(); - }); - } - - function getCurrentUIState() { - let win = toolbox.win; - let deck = toolbox.doc.querySelector("#toolbox-deck"); - let webconsolePanel = toolbox.webconsolePanel; - let splitter = toolbox.doc.querySelector("#toolbox-console-splitter"); - - let containerHeight = parseFloat(win.getComputedStyle(deck.parentNode) - .getPropertyValue("height")); - let deckHeight = parseFloat(win.getComputedStyle(deck) - .getPropertyValue("height")); - let webconsoleHeight = parseFloat(win.getComputedStyle(webconsolePanel) - .getPropertyValue("height")); - let splitterVisibility = !splitter.getAttribute("hidden"); - let openedConsolePanel = toolbox.currentToolId === "webconsole"; - let cmdButton = toolbox.doc.querySelector("#command-button-splitconsole"); - - return { - deckHeight: deckHeight, - containerHeight: containerHeight, - webconsoleHeight: webconsoleHeight, - splitterVisibility: splitterVisibility, - openedConsolePanel: openedConsolePanel, - buttonSelected: cmdButton.classList.contains("checked") - }; - } - - const checkWebconsolePanelOpened = Task.async(function* () { - info("About to check special cases when webconsole panel is open."); - - // Start with console split, so we can test for transition to main panel. - yield toolbox.toggleSplitConsole(); - - let currentUIState = getCurrentUIState(); - - ok(currentUIState.splitterVisibility, - "Splitter is visible when console is split"); - ok(currentUIState.deckHeight > 0, - "Deck has a height > 0 when console is split"); - ok(currentUIState.webconsoleHeight > 0, - "Web console has a height > 0 when console is split"); - ok(!currentUIState.openedConsolePanel, - "The console panel is not the current tool"); - ok(currentUIState.buttonSelected, "The command button is selected"); - - yield openPanel("webconsole"); - currentUIState = getCurrentUIState(); - - ok(!currentUIState.splitterVisibility, - "Splitter is hidden when console is opened."); - is(currentUIState.deckHeight, 0, - "Deck has a height == 0 when console is opened."); - is(currentUIState.webconsoleHeight, currentUIState.containerHeight, - "Web console is full height."); - ok(currentUIState.openedConsolePanel, - "The console panel is the current tool"); - ok(currentUIState.buttonSelected, - "The command button is still selected."); - - // Make sure splitting console does nothing while webconsole is opened - yield toolbox.toggleSplitConsole(); - - currentUIState = getCurrentUIState(); - - ok(!currentUIState.splitterVisibility, - "Splitter is hidden when console is opened."); - is(currentUIState.deckHeight, 0, - "Deck has a height == 0 when console is opened."); - is(currentUIState.webconsoleHeight, currentUIState.containerHeight, - "Web console is full height."); - ok(currentUIState.openedConsolePanel, - "The console panel is the current tool"); - ok(currentUIState.buttonSelected, - "The command button is still selected."); - - // Make sure that split state is saved after opening another panel - yield openPanel("inspector"); - currentUIState = getCurrentUIState(); - ok(currentUIState.splitterVisibility, - "Splitter is visible when console is split"); - ok(currentUIState.deckHeight > 0, - "Deck has a height > 0 when console is split"); - ok(currentUIState.webconsoleHeight > 0, - "Web console has a height > 0 when console is split"); - ok(!currentUIState.openedConsolePanel, - "The console panel is not the current tool"); - ok(currentUIState.buttonSelected, - "The command button is still selected."); - - yield toolbox.toggleSplitConsole(); - }); - - const checkToolboxUI = Task.async(function* () { - let currentUIState = getCurrentUIState(); - - ok(!currentUIState.splitterVisibility, "Splitter is hidden by default"); - is(currentUIState.deckHeight, currentUIState.containerHeight, - "Deck has a height > 0 by default"); - is(currentUIState.webconsoleHeight, 0, - "Web console is collapsed by default"); - ok(!currentUIState.openedConsolePanel, - "The console panel is not the current tool"); - ok(!currentUIState.buttonSelected, "The command button is not selected."); - - yield toolbox.toggleSplitConsole(); - - currentUIState = getCurrentUIState(); - - ok(currentUIState.splitterVisibility, - "Splitter is visible when console is split"); - ok(currentUIState.deckHeight > 0, - "Deck has a height > 0 when console is split"); - ok(currentUIState.webconsoleHeight > 0, - "Web console has a height > 0 when console is split"); - is(Math.round(currentUIState.deckHeight + currentUIState.webconsoleHeight), - currentUIState.containerHeight, - "Everything adds up to container height"); - ok(!currentUIState.openedConsolePanel, - "The console panel is not the current tool"); - ok(currentUIState.buttonSelected, "The command button is selected."); - - yield toolbox.toggleSplitConsole(); - - currentUIState = getCurrentUIState(); - - ok(!currentUIState.splitterVisibility, "Splitter is hidden after toggling"); - is(currentUIState.deckHeight, currentUIState.containerHeight, - "Deck has a height > 0 after toggling"); - is(currentUIState.webconsoleHeight, 0, - "Web console is collapsed after toggling"); - ok(!currentUIState.openedConsolePanel, - "The console panel is not the current tool"); - ok(!currentUIState.buttonSelected, "The command button is not selected."); - }); - - function openPanel(toolId) { - let deferred = defer(); - let target = TargetFactory.forTab(gBrowser.selectedTab); - gDevTools.showToolbox(target, toolId).then(function (box) { - toolbox = box; - deferred.resolve(); - }).catch(console.error); - return deferred.promise; - } - - function openAndCheckPanel(toolId) { - return openPanel(toolId).then(() => { - info("Checking toolbox for " + toolId); - return checkToolboxUI(toolbox.getCurrentPanel()); - }); - } - - function testBottomHost() { - checkHostType(Toolbox.HostType.BOTTOM); - - checkToolboxUI(); - - toolbox.switchHost(Toolbox.HostType.SIDE).then(testSidebarHost); - } - - function testSidebarHost() { - checkHostType(Toolbox.HostType.SIDE); - - checkToolboxUI(); - - toolbox.switchHost(Toolbox.HostType.WINDOW).then(testWindowHost); - } - - function testWindowHost() { - checkHostType(Toolbox.HostType.WINDOW); - - checkToolboxUI(); - - toolbox.switchHost(Toolbox.HostType.BOTTOM).then(testDestroy); - } - - function checkHostType(hostType) { - is(toolbox.hostType, hostType, "host type is " + hostType); - - let pref = Services.prefs.getCharPref("devtools.toolbox.host"); - is(pref, hostType, "host pref is " + hostType); - } - - function testDestroy() { - toolbox.destroy().then(function () { - let target = TargetFactory.forTab(gBrowser.selectedTab); - gDevTools.showToolbox(target).then(finish); - }); - } - - function finish() { - toolbox = null; - finishTest(); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_escape_key.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_escape_key.js deleted file mode 100644 index 08a14069dd3c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_escape_key.js +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - - "use strict"; - - function test() { - info("Test various cases where the escape key should hide the split console."); - - let toolbox; - let hud; - let jsterm; - let hudMessages; - let variablesView; - - Task.spawn(runner).then(finish); - - function* runner() { - let {tab} = yield loadTab("data:text/html;charset=utf-8,
Web Console " + - "test for splitting"); - let target = TargetFactory.forTab(tab); - toolbox = yield gDevTools.showToolbox(target, "inspector"); - - yield testCreateSplitConsoleAfterEscape(); - - yield showAutoCompletePopoup(); - - yield testHideAutoCompletePopupAfterEscape(); - - yield executeJS(); - yield clickMessageAndShowVariablesView(); - jsterm.focus(); - - yield testHideVariablesViewAfterEscape(); - - yield clickMessageAndShowVariablesView(); - yield startPropertyEditor(); - - yield testCancelPropertyEditorAfterEscape(); - yield testHideVariablesViewAfterEscape(); - yield testHideSplitConsoleAfterEscape(); - } - - function testCreateSplitConsoleAfterEscape() { - let result = toolbox.once("webconsole-ready", () => { - hud = toolbox.getPanel("webconsole").hud; - jsterm = hud.jsterm; - ok(toolbox.splitConsole, "Split console is created."); - }); - - let contentWindow = toolbox.win; - contentWindow.focus(); - EventUtils.sendKey("ESCAPE", contentWindow); - - return result; - } - - function testHideSplitConsoleAfterEscape() { - let result = toolbox.once("split-console", () => { - ok(!toolbox.splitConsole, "Split console is hidden."); - }); - EventUtils.sendKey("ESCAPE", toolbox.win); - - return result; - } - - function testHideVariablesViewAfterEscape() { - let result = jsterm.once("sidebar-closed", () => { - ok(!hud.ui.jsterm.sidebar, - "Variables view is hidden."); - ok(toolbox.splitConsole, - "Split console is open after hiding the variables view."); - }); - EventUtils.sendKey("ESCAPE", toolbox.win); - - return result; - } - - function testHideAutoCompletePopupAfterEscape() { - let deferred = defer(); - let popup = jsterm.autocompletePopup; - - popup.once("popup-closed", () => { - ok(!popup.isOpen, - "Auto complete popup is hidden."); - ok(toolbox.splitConsole, - "Split console is open after hiding the autocomplete popup."); - - deferred.resolve(); - }); - - EventUtils.sendKey("ESCAPE", toolbox.win); - - return deferred.promise; - } - - function testCancelPropertyEditorAfterEscape() { - EventUtils.sendKey("ESCAPE", variablesView.window); - ok(hud.ui.jsterm.sidebar, - "Variables view is open after canceling property editor."); - ok(toolbox.splitConsole, - "Split console is open after editing."); - } - - function* executeJS() { - jsterm.execute("var foo = { bar: \"baz\" }; foo;"); - hudMessages = yield waitForMessages({ - webconsole: hud, - messages: [{ - text: "Object { bar: \"baz\" }", - category: CATEGORY_OUTPUT, - objects: true - }], - }); - } - - function clickMessageAndShowVariablesView() { - let result = jsterm.once("variablesview-fetched", (event, vview) => { - variablesView = vview; - }); - - let clickable = hudMessages[0].clickableElements[0]; - EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow); - - return result; - } - - function* startPropertyEditor() { - let results = yield findVariableViewProperties(variablesView, [ - {name: "bar", value: "baz"} - ], {webconsole: hud}); - results[0].matchedProp.focus(); - EventUtils.synthesizeKey("VK_RETURN", variablesView.window); - } - - function showAutoCompletePopoup() { - let onPopupShown = jsterm.autocompletePopup.once("popup-opened"); - - jsterm.focus(); - jsterm.setInputValue("document.location."); - EventUtils.sendKey("TAB", hud.iframeWindow); - - return onPopupShown; - } - - function finish() { - toolbox.destroy().then(() => { - toolbox = null; - hud = null; - jsterm = null; - hudMessages = null; - variablesView = null; - - finishTest(); - }); - } - } diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_focus.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_focus.js deleted file mode 100644 index ff65229c9003..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_focus.js +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - - "use strict"; - - function test() { - info("Test that the split console state is persisted"); - - let toolbox; - let TEST_URI = "data:text/html;charset=utf-8,
Web Console test for " + - "splitting
"; - - Task.spawn(runner).then(finish); - - function* runner() { - info("Opening a tab while there is no user setting on split console pref"); - let {tab} = yield loadTab(TEST_URI); - let target = TargetFactory.forTab(tab); - toolbox = yield gDevTools.showToolbox(target, "inspector"); - - ok(!toolbox.splitConsole, "Split console is hidden by default"); - - info("Focusing the search box before opening the split console"); - let inspector = toolbox.getPanel("inspector"); - inspector.searchBox.focus(); - - let activeElement = getActiveElement(inspector.panelDoc); - is(activeElement, inspector.searchBox, "Search box is focused"); - - yield toolbox.openSplitConsole(); - - ok(toolbox.splitConsole, "Split console is now visible"); - - // Use the binding element since jsterm.inputNode is a XUL textarea element. - activeElement = getActiveElement(toolbox.doc); - activeElement = activeElement.ownerDocument.getBindingParent(activeElement); - let inputNode = toolbox.getPanel("webconsole").hud.jsterm.inputNode; - is(activeElement, inputNode, "Split console input is focused by default"); - - yield toolbox.closeSplitConsole(); - - info("Making sure that the search box is refocused after closing the " + - "split console"); - activeElement = getActiveElement(inspector.panelDoc); - is(activeElement, inspector.searchBox, "Search box is focused"); - - yield toolbox.destroy(); - } - - function getActiveElement(doc) { - let activeElement = doc.activeElement; - while (activeElement && activeElement.contentDocument) { - activeElement = activeElement.contentDocument.activeElement; - } - return activeElement; - } - - function finish() { - toolbox = TEST_URI = null; - Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled"); - Services.prefs.clearUserPref("devtools.toolbox.splitconsoleHeight"); - finishTest(); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_persist.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_persist.js deleted file mode 100644 index ea28e6843939..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_split_persist.js +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - - "use strict"; - - function test() { - info("Test that the split console state is persisted"); - - let toolbox; - let TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "splitting
"; - - Task.spawn(runner).then(finish); - - function* runner() { - info("Opening a tab while there is no user setting on split console pref"); - let {tab} = yield loadTab(TEST_URI); - let target = TargetFactory.forTab(tab); - toolbox = yield gDevTools.showToolbox(target, "inspector"); - - ok(!toolbox.splitConsole, "Split console is hidden by default."); - ok(!isCommandButtonChecked(), "Split console button is unchecked by " + - "default."); - yield toggleSplitConsoleWithEscape(); - ok(toolbox.splitConsole, "Split console is now visible."); - ok(isCommandButtonChecked(), "Split console button is now checked."); - ok(getVisiblePrefValue(), "Visibility pref is true"); - - is(getHeightPrefValue(), toolbox.webconsolePanel.height, - "Panel height matches the pref"); - toolbox.webconsolePanel.height = 200; - - yield toolbox.destroy(); - - info("Opening a tab while there is a true user setting on split console " + - "pref"); - ({tab} = yield loadTab(TEST_URI)); - target = TargetFactory.forTab(tab); - toolbox = yield gDevTools.showToolbox(target, "inspector"); - - ok(toolbox.splitConsole, "Split console is visible by default."); - ok(isCommandButtonChecked(), "Split console button is checked by default."); - is(getHeightPrefValue(), 200, "Height is set based on panel height after " + - "closing"); - - // Use the binding element since jsterm.inputNode is a XUL textarea element. - let activeElement = getActiveElement(toolbox.doc); - activeElement = activeElement.ownerDocument.getBindingParent(activeElement); - let inputNode = toolbox.getPanel("webconsole").hud.jsterm.inputNode; - is(activeElement, inputNode, "Split console input is focused by default"); - - toolbox.webconsolePanel.height = 1; - ok(toolbox.webconsolePanel.clientHeight > 1, - "The actual height of the console is bound with a min height"); - - toolbox.webconsolePanel.height = 10000; - ok(toolbox.webconsolePanel.clientHeight < 10000, - "The actual height of the console is bound with a max height"); - - yield toggleSplitConsoleWithEscape(); - ok(!toolbox.splitConsole, "Split console is now hidden."); - ok(!isCommandButtonChecked(), "Split console button is now unchecked."); - ok(!getVisiblePrefValue(), "Visibility pref is false"); - - yield toolbox.destroy(); - - is(getHeightPrefValue(), 10000, - "Height is set based on panel height after closing"); - - info("Opening a tab while there is a false user setting on split " + - "console pref"); - ({tab} = yield loadTab(TEST_URI)); - target = TargetFactory.forTab(tab); - toolbox = yield gDevTools.showToolbox(target, "inspector"); - - ok(!toolbox.splitConsole, "Split console is hidden by default."); - ok(!getVisiblePrefValue(), "Visibility pref is false"); - - yield toolbox.destroy(); - } - - function getActiveElement(doc) { - let activeElement = doc.activeElement; - while (activeElement && activeElement.contentDocument) { - activeElement = activeElement.contentDocument.activeElement; - } - return activeElement; - } - - function getVisiblePrefValue() { - return Services.prefs.getBoolPref("devtools.toolbox.splitconsoleEnabled"); - } - - function getHeightPrefValue() { - return Services.prefs.getIntPref("devtools.toolbox.splitconsoleHeight"); - } - - function isCommandButtonChecked() { - return toolbox.doc.querySelector("#command-button-splitconsole") - .classList.contains("checked"); - } - - function toggleSplitConsoleWithEscape() { - let onceSplitConsole = toolbox.once("split-console"); - let contentWindow = toolbox.win; - contentWindow.focus(); - EventUtils.sendKey("ESCAPE", contentWindow); - return onceSplitConsole; - } - - function finish() { - toolbox = TEST_URI = null; - Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled"); - Services.prefs.clearUserPref("devtools.toolbox.splitconsoleHeight"); - finishTest(); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_strict_mode_errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_strict_mode_errors.js deleted file mode 100644 index cdaf2764e754..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_strict_mode_errors.js +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Check that "use strict" JS errors generate errors, not warnings. - -"use strict"; - -add_task(function* () { - // On e10s, the exception is triggered in child process - // and is ignored by test harness - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - yield loadTab("data:text/html;charset=utf8,"); - - let hud = yield openConsole(); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: "SyntaxError: 'arguments' can't be defined or assigned to in strict mode code", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - ], - }); - - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "data:text/html;charset=" - + "utf8,"); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: "SyntaxError: duplicate formal argument a", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - ], - }); - - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "data:text/html;charset=" - + "utf8,"); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: 'TypeError: setting getter-only property "p"', - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - ], - }); - - if (!Services.appinfo.browserTabsRemoteAutostart) { - expectUncaughtException(); - } - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, - "data:text/html;charset=utf8,"); - - yield waitForMessages({ - webconsole: hud, - messages: [ - { - text: "ReferenceError: assignment to undeclared variable v", - category: CATEGORY_JS, - severity: SEVERITY_ERROR, - }, - ], - }); - - hud = null; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_time_methods.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_time_methods.js deleted file mode 100644 index 2cd36181930f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_time_methods.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the Console API implements the time() and timeEnd() methods. See Bug 658368. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-bug-658368-time-methods.html"; - -const TEST_URI2 = "data:text/html;charset=utf-8,"; - -const TEST_URI3 = "data:text/html;charset=utf-8,"; - -const TEST_URI4 = "data:text/html;charset=utf-8," + - ""; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud1 = yield openConsole(); - - yield waitForMessages({ - webconsole: hud1, - messages: [{ - name: "aTimer started", - consoleTime: "aTimer", - }, { - name: "aTimer end", - consoleTimeEnd: "aTimer", - }], - }); - - // The next test makes sure that timers with the same name but in separate - // tabs, do not contain the same value. - let { browser } = yield loadTab(TEST_URI2); - let hud2 = yield openConsole(); - - testLogEntry(hud2.outputNode, "bTimer: timer started", - "bTimer was not started", false, true); - - // The next test makes sure that timers with the same name but in separate - // pages, do not contain the same value. - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI3); - - yield waitForMessages({ - webconsole: hud2, - messages: [{ - name: "bTimer started", - consoleTime: "bTimer", - }], - }); - - hud2.jsterm.clearOutput(); - - // Now the following console.timeEnd() call shouldn't display anything, - // if the timers in different pages are not related. - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI4); - yield loadBrowser(browser); - - testLogEntry(hud2.outputNode, "bTimer: timer started", - "bTimer was not started", false, true); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_trackingprotection_errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_trackingprotection_errors.js deleted file mode 100644 index eafeee18e3d1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_trackingprotection_errors.js +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Load a page with tracking elements that get blocked and make sure that a -// 'learn more' link shows up in the webconsole. - -"use strict"; - -const TEST_URI = "http://tracking.example.org/browser/devtools/client/" + - "webconsole/test/test-trackingprotection-securityerrors.html"; -const LEARN_MORE_URI = "https://developer.mozilla.org/Firefox/Privacy/" + - "Tracking_Protection" + DOCS_GA_PARAMS; -const PREF = "privacy.trackingprotection.enabled"; - -const {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {}); - -registerCleanupFunction(function () { - Services.prefs.clearUserPref(PREF); - UrlClassifierTestUtils.cleanupTestTrackers(); -}); - -add_task(function* testMessagesAppear() { - yield UrlClassifierTestUtils.addTestTrackers(); - Services.prefs.setBoolPref(PREF, true); - - let { browser } = yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - let results = yield waitForMessages({ - webconsole: hud, - messages: [ - { - name: "Was blocked because tracking protection is enabled", - text: "The resource at \u201chttp://tracking.example.com/\u201d was " + - "blocked because tracking protection is enabled", - category: CATEGORY_SECURITY, - severity: SEVERITY_WARNING, - objects: true, - }, - ], - }); - - yield testClickOpenNewTab(hud, results[0]); -}); - -function testClickOpenNewTab(hud, match) { - let warningNode = match.clickableElements[0]; - ok(warningNode, "link element"); - ok(warningNode.classList.contains("learn-more-link"), "link class name"); - return simulateMessageLinkClick(warningNode, LEARN_MORE_URI); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_variables_view_dont_sort_non_sortable_classes_properties.js b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_variables_view_dont_sort_non_sortable_classes_properties.js deleted file mode 100644 index a1e6cb54dc2a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_variables_view_dont_sort_non_sortable_classes_properties.js +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -/* Test case that ensures Array and other list types are not sorted in variables - * view. - * - * The tested types are: - * - Array - * - Int8Array - * - Int16Array - * - Int32Array - * - Uint8Array - * - Uint16Array - * - Uint32Array - * - Uint8ClampedArray - * - Float32Array - * - Float64Array - * - NodeList - */ - -function test() { - const TEST_URI = "data:text/html;charset=utf-8, \ - \ - \ -Hello world!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-585956-console-trace.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-585956-console-trace.html deleted file mode 100644 index e658ba633d8c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-585956-console-trace.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -Web Console test for bug 585956 - console.trace().
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-593003-iframe-wrong-hud-iframe.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-593003-iframe-wrong-hud-iframe.html deleted file mode 100644 index ebf9c515fe89..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-593003-iframe-wrong-hud-iframe.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -WebConsole test: iframe associated to the wrong HUD.
-This is the iframe!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-593003-iframe-wrong-hud.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-593003-iframe-wrong-hud.html deleted file mode 100644 index 8e47cf20f974..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-593003-iframe-wrong-hud.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -WebConsole test: iframe associated to the wrong HUD.
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-canvas-css.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-canvas-css.html deleted file mode 100644 index 3c9cf03a528a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-canvas-css.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - -Web Console test for bug 595934 - category "CSS Parser" (with - Canvas).
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-canvas-css.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-canvas-css.js deleted file mode 100644 index fcaf14597a0e..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-canvas-css.js +++ /dev/null @@ -1,10 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -window.addEventListener("DOMContentLoaded", function () { - var canvas = document.querySelector("canvas"); - var context = canvas.getContext("2d"); - context.strokeStyle = "foobarCanvasCssParser"; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.css b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.css deleted file mode 100644 index b4224430f694..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.css +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -body { - color: #0f0; - font-weight: bold; -} - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.css^headers^ b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.css^headers^ deleted file mode 100644 index e7be84a714be..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.css^headers^ +++ /dev/null @@ -1 +0,0 @@ -Content-Type: image/png diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.html deleted file mode 100644 index 6bb0d54c5eda..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-loader.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -Web Console test for bug 595934 - category "CSS Loader".
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-parser.css b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-parser.css deleted file mode 100644 index f6db823987e1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-parser.css +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -p { - color: #0f0; - foobarCssParser: failure; -} - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-parser.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-parser.html deleted file mode 100644 index a4ea74ba38f8..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-css-parser.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -Web Console test for bug 595934 - category "CSS Parser".
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-empty-getelementbyid.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-empty-getelementbyid.html deleted file mode 100644 index a70f9011b371..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-empty-getelementbyid.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - -Web Console test for bug 595934 - category "DOM" - (empty getElementById()).
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-empty-getelementbyid.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-empty-getelementbyid.js deleted file mode 100644 index bf48995ee440..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-empty-getelementbyid.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -window.addEventListener("load", function () { - document.getElementById(""); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-html.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-html.html deleted file mode 100644 index fe35afef6655..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-html.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - -Web Console test for bug 595934 - category "HTML".
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-image.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-image.html deleted file mode 100644 index 312ecd49fbb1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-image.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -Web Console test for bug 595934 - category Image.
-
Web Console test for bug 595934 - category "ImageMap".
-
Web Console test for bug 595934 - category "malformed-xml" - (external file).
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-malformedxml-external.xml b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-malformedxml-external.xml deleted file mode 100644 index 4812786f10a0..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-malformedxml-external.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -Web Console test for bug 595934 - category "malformed-xml".
- diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-malformedxml.xhtml b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-malformedxml.xhtml deleted file mode 100644 index 62689c567cc6..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-malformedxml.xhtml +++ /dev/null @@ -1,10 +0,0 @@ - - - -Web Console test for bug 595934 - category "malformed-xml".
- diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-svg.xhtml b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-svg.xhtml deleted file mode 100644 index 572382c64d79..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-svg.xhtml +++ /dev/null @@ -1,17 +0,0 @@ - - - -Web Console test for bug 595934 - category "SVG".
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-workers.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-workers.html deleted file mode 100644 index baf5a621571b..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-workers.html +++ /dev/null @@ -1,18 +0,0 @@ - - - -Web Console test for bug 595934 - category "DOM Worker - javascript".
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-workers.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-workers.js deleted file mode 100644 index d23f080af2aa..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-595934-workers.js +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/* global fooBarWorker*/ -/* eslint-disable no-unused-vars*/ - -"use strict"; - -var onmessage = function () { - fooBarWorker(); -}; - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597136-external-script-errors.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597136-external-script-errors.html deleted file mode 100644 index 25bdeecc5237..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597136-external-script-errors.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - -- - - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597136-external-script-errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597136-external-script-errors.js deleted file mode 100644 index 00821e38e238..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597136-external-script-errors.js +++ /dev/null @@ -1,9 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -function f() { - bogus.g(); -} - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597756-reopen-closed-tab.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597756-reopen-closed-tab.html deleted file mode 100644 index 68e19e677503..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-597756-reopen-closed-tab.html +++ /dev/null @@ -1,18 +0,0 @@ - - -
- -hello world!
"; - - response.setHeader("Etag", Etag, false); - - if (IfNoneMatch == Etag) { - response.setStatusLine(request.httpVersion, "304", "Not Modified"); - } - else { - response.setHeader("Content-Type", "text/html", false); - response.setHeader("Content-Length", page.length + "", false); - response.write(page); - } -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-600183-charset.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-600183-charset.html deleted file mode 100644 index 040490a6b0f1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-600183-charset.html +++ /dev/null @@ -1,9 +0,0 @@ - - - -µÄÎʺò!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-600183-charset.html^headers^ b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-600183-charset.html^headers^ deleted file mode 100644 index 9f3e2302f5d1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-600183-charset.html^headers^ +++ /dev/null @@ -1 +0,0 @@ -Content-Type: text/html; charset=gb2312 diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-601177-log-levels.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-601177-log-levels.html deleted file mode 100644 index a592139077d5..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-601177-log-levels.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - -
-
-
-
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-601177-log-levels.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-601177-log-levels.js
deleted file mode 100644
index afeb13ff625b..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-601177-log-levels.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-foobarBug601177strictError = "strict error";
-
-window.foobarBug601177exception();
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-603750-websocket.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-603750-websocket.html
deleted file mode 100644
index 1ebf3375fb6e..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-603750-websocket.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- Web Console test for bug 595934 - Web Socket errors.
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-603750-websocket.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-603750-websocket.js deleted file mode 100644 index e9b122e27043..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-603750-websocket.js +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -window.addEventListener("load", function () { - let ws1 = new WebSocket("ws://0.0.0.0:81"); - ws1.onopen = function () { - ws1.send("test 1"); - ws1.close(); - }; - - let ws2 = new window.frames[0].WebSocket("ws://0.0.0.0:82"); - ws2.onopen = function () { - ws2.send("test 2"); - ws2.close(); - }; -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-609872-cd-iframe-child.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-609872-cd-iframe-child.html deleted file mode 100644 index 451eba21e61c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-609872-cd-iframe-child.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -test for bug 609872 - iframe child
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-609872-cd-iframe-parent.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-609872-cd-iframe-parent.html deleted file mode 100644 index fdb636b974e0..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-609872-cd-iframe-parent.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -test for bug 609872 - iframe parent
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-613013-console-api-iframe.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-613013-console-api-iframe.html deleted file mode 100644 index edf40e80ed1f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-613013-console-api-iframe.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -test for bug 613013
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-618078-network-exceptions.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-618078-network-exceptions.html deleted file mode 100644 index ac755e1b97a2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-618078-network-exceptions.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - -Web Console test for bug 618078 - exception in async network request - callback.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-621644-jsterm-dollar.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-621644-jsterm-dollar.html deleted file mode 100644 index 09c98670386c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-621644-jsterm-dollar.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -hello world!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-630733-response-redirect-headers.sjs b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-630733-response-redirect-headers.sjs deleted file mode 100644 index f92e0fe658e6..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-630733-response-redirect-headers.sjs +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function handleRequest(request, response) -{ - var page = "hello world! bug 630733
"; - - response.setStatusLine(request.httpVersion, "301", "Moved Permanently"); - response.setHeader("Content-Type", "text/html", false); - response.setHeader("Content-Length", page.length + "", false); - response.setHeader("x-foobar-bug630733", "bazbaz", false); - response.setHeader("Location", "/redirect-from-bug-630733", false); - response.write(page); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-632275-getters.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-632275-getters.html deleted file mode 100644 index 41333b9d235a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-632275-getters.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - -Web Console test for bug 632275 - getters.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-632347-iterators-generators.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-632347-iterators-generators.html deleted file mode 100644 index 2209e519dffe..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-632347-iterators-generators.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - -Web Console test for bug 632347 - generators.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-644419-log-limits.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-644419-log-limits.html deleted file mode 100644 index 21d99ba148a6..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-644419-log-limits.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -I am sandboxed and want to escape.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html deleted file mode 100644 index b9939fe83c0f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -This insecure page is served with an about:blank iframe. A script then adds a - password field to it.
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-762593-insecure-passwords-web-console-warning.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-762593-insecure-passwords-web-console-warning.html deleted file mode 100644 index f473303f446b..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-762593-insecure-passwords-web-console-warning.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - -This page is served with an iframe with insecure password field.
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-console-log.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-console-log.js deleted file mode 100644 index f56c1e8c8061..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-console-log.js +++ /dev/null @@ -1,10 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -function onLoad123() { - console.log("Blah Blah"); -} - -window.addEventListener("load", onLoad123); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-js-console-links.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-js-console-links.html deleted file mode 100644 index 6a6ac6008991..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-js-console-links.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -Web Console test for bug 766001 : Open JS/Console call Links in Debugger.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-js-errors.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-js-errors.js deleted file mode 100644 index 5ff6b5dec073..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-766001-js-errors.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -window.addEventListener("load", function () { - document.bar(); -}); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors-1.css b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors-1.css deleted file mode 100644 index ad7fd1999542..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors-1.css +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -body { - color: #0f0; - font-weight: green; -} - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors-2.css b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors-2.css deleted file mode 100644 index 91b14137a273..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors-2.css +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -body { - color: #0fl; - font-weight: bold; -} - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors.html deleted file mode 100644 index 7ca11fc34078..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-782653-css-errors.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -Web Console test for bug 782653 : Open CSS Links in Style Editor.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-837351-security-errors.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-837351-security-errors.html deleted file mode 100644 index db83274f0968..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-837351-security-errors.html +++ /dev/null @@ -1,15 +0,0 @@ - - - -Web Console test for bug 859170 - very long strings hang the browser.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-869003-iframe.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-869003-iframe.html deleted file mode 100644 index 5a29728e574d..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-869003-iframe.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - -Make sure users can inspect objects from cross-domain iframes.
-Iframe window.
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-869003-top-window.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-869003-top-window.html deleted file mode 100644 index a2da438f6d71..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-869003-top-window.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -Make sure users can inspect objects from cross-domain iframes.
-Top window.
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-952277-highlight-nodes-in-vview.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-952277-highlight-nodes-in-vview.html deleted file mode 100644 index de297d9b573c..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-952277-highlight-nodes-in-vview.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -Web Console test for bug 952277 - Highlighting and selecting nodes from the variablesview
-Web Console test for bug 952277 - Highlighting and selecting nodes from the variablesview
-Web Console test for bug 952277 - Highlighting and selecting nodes from the variablesview
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-989025-iframe-parent.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-989025-iframe-parent.html deleted file mode 100644 index 54a4e90383bd..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-989025-iframe-parent.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -test for bug 989025 - iframe parent
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug_1050691_click_function_to_source.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-bug_1050691_click_function_to_source.html deleted file mode 100644 index 912e301f02ea..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug_1050691_click_function_to_source.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -Web Console test for bug 939783 - different console.trace() calls - wrongly filtered as duplicates
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-certificate-messages.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-certificate-messages.html deleted file mode 100644 index b0419a6fc379..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-certificate-messages.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -Hello world!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-assert.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-assert.html deleted file mode 100644 index b104d72d4350..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-assert.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -test console.assert()
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-clear.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-clear.html deleted file mode 100644 index 8009db858d7f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-clear.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -test console.count()
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-extras.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-extras.html deleted file mode 100644 index 8685b1a800c9..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-extras.html +++ /dev/null @@ -1,18 +0,0 @@ - - - -hello world!
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-03.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-03.html deleted file mode 100644 index 9dcf051a63f3..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-03.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - -hello world!
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-04.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-04.html deleted file mode 100644 index bb43452772f0..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-04.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - -hello world!
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-dom-elements.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-dom-elements.html deleted file mode 100644 index 81ea252ebe27..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-dom-elements.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - -hello world!
- - - - - - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-events.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-events.html deleted file mode 100644 index 908a86fabde1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-output-events.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - -hello world!
- - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-replaced-api.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-replaced-api.html deleted file mode 100644 index 2b05d023acd2..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-replaced-api.html +++ /dev/null @@ -1,12 +0,0 @@ - - - -hello world!
" + - ""; - - var data = { - "version": "4.1.0", - "columns": ["log", "backtrace", "type"], - "rows":[[ - [{ "best": "Firefox", "reckless": "Chrome", "new_ie": "Safari", "new_new_ie": "Edge"}], - "C:\\src\\www\\serverlogging\\test7.php:4:1", - "" - ]], - }; - - // Put log into headers. - var value = b64EncodeUnicode(JSON.stringify(data)); - response.setHeader("X-ChromeLogger-Data", value, false); - - response.write(page); -} - -function b64EncodeUnicode(str) { - return btoa(unescape(encodeURIComponent(str))); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-server-logging-backtrace.sjs b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-server-logging-backtrace.sjs deleted file mode 100644 index 517257cee2b4..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-server-logging-backtrace.sjs +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function handleRequest(request, response) -{ - var page = "" + - "" + - "hello world!
" + - ""; - - var data = { - "version": "4.1.0", - "columns": ["log", "backtrace", "type"], - "rows":[[ - ["correct 1"], - "/some/path/to/file.py : 33", - "error" - ], [ - ["correct 2"], - "/some/path/to/file.py:33", - "error" - ], [ - ["wrong 1"], - "/some/path/to/file.py:33wrong", - "error" - ], [ - ["wrong 2"], - "/some/path/to/file.py", - "error" - ]], - }; - - // Put log into headers. - var value = b64EncodeUnicode(JSON.stringify(data)); - response.setHeader("X-ChromeLogger-Data", value, false); - - response.write(page); -} - -function b64EncodeUnicode(str) { - return btoa(unescape(encodeURIComponent(str))); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-server-logging.sjs b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-server-logging.sjs deleted file mode 100644 index 7177e71852a1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-server-logging.sjs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function handleRequest(request, response) -{ - var page = "" + - "" + - "hello world!
" + - ""; - - var data = { - "version": "4.1.0", - "columns": ["log", "backtrace", "type"], - "rows": [[ - ["values: %s %o %i %f %s","string",{"a":10,"___class_name":"Object"},123,1.12, "\u2713"], - "C:\\src\\www\\serverlogging\\test7.php:4:1", - "" - ]] - }; - - // Put log into headers. - var value = b64EncodeUnicode(JSON.stringify(data)); - response.setHeader("X-ChromeLogger-Data", value, false); - - response.write(page); -} - -function b64EncodeUnicode(str) { - return btoa(unescape(encodeURIComponent(str))); -} diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-trace-async.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-trace-async.html deleted file mode 100644 index c7b895455e66..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-trace-async.html +++ /dev/null @@ -1,24 +0,0 @@ - - - -Web Console test for bug 1200832 - console.trace() async stacks
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-workers.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-console-workers.html deleted file mode 100644 index f4b286ae5767..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-console-workers.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -Hello world!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-exception-stackframe.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-exception-stackframe.html deleted file mode 100644 index 0a6dea4cadfb..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-exception-stackframe.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -Hello world!
- - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-file-location.js b/devtools/client/webconsole/new-console-output/test/mochitest/test-file-location.js deleted file mode 100644 index d9879a356574..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-file-location.js +++ /dev/null @@ -1,12 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -console.log("message for level log"); -console.info("message for level info"); -console.warn("message for level warn"); -console.error("message for level error"); -console.debug("message for level debug"); diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-filter.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-filter.html deleted file mode 100644 index 219177bb293d..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-filter.html +++ /dev/null @@ -1,11 +0,0 @@ - - - -b
d
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe-762593-insecure-form-action.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe-762593-insecure-form-action.html deleted file mode 100644 index d14b5cdd7c2a..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe-762593-insecure-form-action.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -This frame contains a password field inside a form with insecure action.
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe-762593-insecure-frame.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe-762593-insecure-frame.html deleted file mode 100644 index dde47a78e33f..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe-762593-insecure-frame.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -This frame is served with an insecure password field.
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe1.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe1.html deleted file mode 100644 index 4dd4eddfedc1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-iframe1.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -
-
-
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-mutation.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-mutation.html
deleted file mode 100644
index e80933b06d0c..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-mutation.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-observe-http-ajax.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-observe-http-ajax.html
deleted file mode 100644
index 5abcefdad050..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-observe-http-ajax.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- Hello world!
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-result-format-as-string.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-result-format-as-string.html deleted file mode 100644 index c3ab78ee7f1d..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-result-format-as-string.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Make sure js eval results are formatted as strings.
- - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-trackingprotection-securityerrors.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-trackingprotection-securityerrors.html deleted file mode 100644 index 17f0e459e3d1..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-trackingprotection-securityerrors.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test-webconsole-error-observer.html b/devtools/client/webconsole/new-console-output/test/mochitest/test-webconsole-error-observer.html deleted file mode 100644 index 8466bc6f2f59..000000000000 --- a/devtools/client/webconsole/new-console-output/test/mochitest/test-webconsole-error-observer.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -
-
-
\ No newline at end of file
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_1010953_cspro.html^headers^ b/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_1010953_cspro.html^headers^
deleted file mode 100644
index 03056e2cb322..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_1010953_cspro.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Security-Policy: default-src 'self'; img-src 'self'; script-src some.example.com;
-Content-Security-Policy-Report-Only: default-src 'self'; img-src some.example.com; script-src 'self'; report-uri https://example.com/ignored/;
\ No newline at end of file
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_1247459_violation.html b/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_1247459_violation.html
deleted file mode 100644
index fdda4eb262b4..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_1247459_violation.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_770099_violation.html b/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_770099_violation.html
deleted file mode 100644
index ccbded87a3ef..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_770099_violation.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_770099_violation.html^headers^ b/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_770099_violation.html^headers^
deleted file mode 100644
index 4c6fa3c26a77..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test_bug_770099_violation.html^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Security-Policy: default-src 'self'
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test_hpkp-invalid-headers.sjs b/devtools/client/webconsole/new-console-output/test/mochitest/test_hpkp-invalid-headers.sjs
deleted file mode 100644
index cd0e18523b37..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test_hpkp-invalid-headers.sjs
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function handleRequest(request, response)
-{
- response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
-
- let issue;
- switch (request.queryString) {
- case "badSyntax":
- response.setHeader("Public-Key-Pins", "\"");
- issue = "is not syntactically correct.";
- break;
- case "noMaxAge":
- response.setHeader("Public-Key-Pins", "max-age444");
- issue = "does not include a max-age directive.";
- break;
- case "invalidIncludeSubDomains":
- response.setHeader("Public-Key-Pins", "includeSubDomains=abc");
- issue = "includes an invalid includeSubDomains directive.";
- break;
- case "invalidMaxAge":
- response.setHeader("Public-Key-Pins", "max-age=abc");
- issue = "includes an invalid max-age directive.";
- break;
- case "multipleIncludeSubDomains":
- response.setHeader("Public-Key-Pins",
- "includeSubDomains; includeSubDomains");
- issue = "includes multiple includeSubDomains directives.";
- break;
- case "multipleMaxAge":
- response.setHeader("Public-Key-Pins",
- "max-age=444; max-age=999");
- issue = "includes multiple max-age directives.";
- break;
- case "multipleReportURIs":
- response.setHeader("Public-Key-Pins",
- 'report-uri="http://example.com"; ' +
- 'report-uri="http://example.com"');
- issue = "includes multiple report-uri directives.";
- break;
- case "pinsetDoesNotMatch":
- response.setHeader(
- "Public-Key-Pins",
- 'max-age=999; ' +
- 'pin-sha256="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; ' +
- 'pin-sha256="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB="');
- issue = "does not include a matching pin.";
- break;
- }
-
- response.write("This page is served with a PKP header that " + issue);
-}
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/test_hsts-invalid-headers.sjs b/devtools/client/webconsole/new-console-output/test/mochitest/test_hsts-invalid-headers.sjs
deleted file mode 100644
index 9e3ea7624055..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test_hsts-invalid-headers.sjs
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function handleRequest(request, response)
-{
- response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
-
- let issue;
- switch (request.queryString) {
- case "badSyntax":
- response.setHeader("Strict-Transport-Security", "\"");
- issue = "is not syntactically correct.";
- break;
- case "noMaxAge":
- response.setHeader("Strict-Transport-Security", "max-age444");
- issue = "does not include a max-age directive.";
- break;
- case "invalidIncludeSubDomains":
- response.setHeader("Strict-Transport-Security", "includeSubDomains=abc");
- issue = "includes an invalid includeSubDomains directive.";
- break;
- case "invalidMaxAge":
- response.setHeader("Strict-Transport-Security", "max-age=abc");
- issue = "includes an invalid max-age directive.";
- break;
- case "multipleIncludeSubDomains":
- response.setHeader("Strict-Transport-Security",
- "includeSubDomains; includeSubDomains");
- issue = "includes multiple includeSubDomains directives.";
- break;
- case "multipleMaxAge":
- response.setHeader("Strict-Transport-Security",
- "max-age=444; max-age=999");
- issue = "includes multiple max-age directives.";
- break;
- }
-
- response.write("This page is served with a STS header that " + issue);
-}
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/testscript.js b/devtools/client/webconsole/new-console-output/test/mochitest/testscript.js
deleted file mode 100644
index 849b03d86edb..000000000000
--- a/devtools/client/webconsole/new-console-output/test/mochitest/testscript.js
+++ /dev/null
@@ -1,2 +0,0 @@
-"use strict";
-console.log("running network console logging tests");