author | Sebastian Hengst <archaeopteryx@coole-files.de> |
Sat, 07 Oct 2017 16:40:12 +0200 | |
changeset 385013 | e27e466cec06d42e12328206bc5026bd68d5f7fa |
parent 385012 | 7abbc56b3bb78983e83d86a563799b9f4d538d53 |
child 385014 | 38ae97c33bb72164b48f4e8e8c32989176983e31 |
push id | 52854 |
push user | archaeopteryx@coole-files.de |
push date | Sat, 07 Oct 2017 14:48:34 +0000 |
treeherder | autoland@e27e466cec06 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | backout |
bugs | 1406042 |
milestone | 58.0a1 |
backs out | 8149514f04738b632122746c6b03d8ec420197f9 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/.eslintignore +++ b/.eslintignore @@ -114,17 +114,16 @@ devtools/client/shared/widgets/*.jsm devtools/client/storage/test/*.html !devtools/client/storage/test/storage-cookies.html !devtools/client/storage/test/storage-overflow.html !devtools/client/storage/test/storage-search.html !devtools/client/storage/test/storage-unsecured-iframe.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 devtools/client/webconsole/webconsole.js devtools/client/webide/** !devtools/client/webide/components/webideCli.js devtools/server/tests/browser/storage-*.html !devtools/server/tests/browser/storage-unsecured-iframe.html
deleted file mode 100644 --- 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" -};
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini +++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini @@ -5,482 +5,72 @@ support-files = code_bundle_invalidmap.js code_bundle_invalidmap.js.map code_bundle_nosource.js code_bundle_nosource.js.map head.js 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-02.html test-sourcemap-error-01.js - test-sourcemap-error-02.html 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 skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts [browser_webconsole_context_menu_copy_link_location.js] subsuite = clipboard skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts [browser_webconsole_context_menu_copy_object.js] 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_openinnet.js] [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_nodes_highlight.js] [browser_webconsole_nodes_select.js] -[browser_webconsole_notifications.js] -skip-if = true # Bug 1405637 +[browser_webconsole_object_inspector_entries.js] [browser_webconsole_object_inspector.js] -[browser_webconsole_object_inspector_entries.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
deleted file mode 100644 --- 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"); -}
deleted file mode 100644 --- 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,<p>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; - } -}
deleted file mode 100644 --- 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,<p>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, - }], - }); -}
deleted file mode 100644 --- 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"); -});
deleted file mode 100644 --- 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,<p>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"); - } -}
deleted file mode 100644 --- 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,<p>hello world from bug 877778 " + - "<button onclick='foobar.explode()' " + - "style='test-color: green-please'>click!</button>"; - -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(); -});
deleted file mode 100644 --- 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,<p>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); -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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,<title>bug859756</title>\n" + - "<p>hello world\n<p>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); -}
deleted file mode 100644 --- 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"); -});
deleted file mode 100644 --- 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; -});
deleted file mode 100644 --- 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,<title>bug871156</title>\n" + - "<p>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; -});
deleted file mode 100644 --- 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", - }); -}
deleted file mode 100644 --- 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,<p>hello world! bug 874061" + - "<button onclick='console.log(\"foobar bug 874061\");" + - "fooBazBaz.yummy()'>click</button>"; - 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," + - "<p>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); - }); - } -}
deleted file mode 100644 --- 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," + - "<body>" + - " <div>" + - " <h1>Testing copy command</h1>" + - " <p>This is some example text</p>" + - " <p id='select-me'>" + TEXT + "</p>" + - " </div>" + - " <div><p></p></div>" + - "</body>"); - - gWebConsole = yield openConsole(); - gJSTerm = gWebConsole.jsterm; -}); - -add_task(function* testCopy() { - let RANDOM = Math.random(); - let string = "Text: " + RANDOM; - let obj = {a: 1, b: "foo", c: RANDOM}; - - let samples = [ - [RANDOM, RANDOM], - [JSON.stringify(string), string], - [obj.toSource(), JSON.stringify(obj, null, " ")], - [ - "$('#" + ID + "')", - content.document.getElementById(ID).outerHTML - ] - ]; - for (let [source, reference] of samples) { - let deferredResult = defer(); - - SimpleTest.waitForClipboard( - "" + reference, - () => { - let command = "copy(" + source + ")"; - info("Attempting to copy: " + source); - info("Executing command: " + command); - gJSTerm.execute(command, msg => { - is(msg, undefined, "Command success: " + command); - }); - }, - deferredResult.resolve, - deferredResult.reject); - - yield deferredResult.promise; - } -}); - -add_task(function* cleanup() { - gWebConsole = gJSTerm = null; - gBrowser.removeTab(gBrowser.selectedTab); - finishTest(); -});
deleted file mode 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_history_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/ */ - -// Test that console command input is persisted across toolbox loads. -// See Bug 943306. - -"use strict"; - -requestLongerTimeout(2); - -const TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "persisting history - bug 943306"; -const INPUT_HISTORY_COUNT = 10; - -add_task(function* () { - info("Setting custom input history pref to " + INPUT_HISTORY_COUNT); - Services.prefs.setIntPref("devtools.webconsole.inputHistoryCount", - INPUT_HISTORY_COUNT); - - // First tab: run a bunch of commands and then make sure that you can - // navigate through their history. - yield loadTab(TEST_URI); - let hud1 = yield openConsole(); - is(JSON.stringify(hud1.jsterm.history), "[]", - "No history on first tab initially"); - yield populateInputHistory(hud1); - is(JSON.stringify(hud1.jsterm.history), - '["0","1","2","3","4","5","6","7","8","9"]', - "First tab has populated history"); - - // Second tab: Just make sure that you can navigate through the history - // generated by the first tab. - yield loadTab(TEST_URI); - let hud2 = yield openConsole(); - is(JSON.stringify(hud2.jsterm.history), - '["0","1","2","3","4","5","6","7","8","9"]', - "Second tab has populated history"); - yield testNaviatingHistoryInUI(hud2); - is(JSON.stringify(hud2.jsterm.history), - '["0","1","2","3","4","5","6","7","8","9",""]', - "An empty entry has been added in the second tab due to history perusal"); - - // Third tab: Should have the same history as first tab, but if we run a - // command, then the history of the first and second shouldn't be affected - yield loadTab(TEST_URI); - let hud3 = yield openConsole(); - is(JSON.stringify(hud3.jsterm.history), - '["0","1","2","3","4","5","6","7","8","9"]', - "Third tab has populated history"); - - // Set input value separately from execute so UP arrow accurately navigates - // history. - hud3.jsterm.setInputValue('"hello from third tab"'); - hud3.jsterm.execute(); - - is(JSON.stringify(hud1.jsterm.history), - '["0","1","2","3","4","5","6","7","8","9"]', - "First tab history hasn't changed due to command in third tab"); - is(JSON.stringify(hud2.jsterm.history), - '["0","1","2","3","4","5","6","7","8","9",""]', - "Second tab history hasn't changed due to command in third tab"); - is(JSON.stringify(hud3.jsterm.history), - '["1","2","3","4","5","6","7","8","9","\\"hello from third tab\\""]', - "Third tab has updated history (and purged the first result) after " + - "running a command"); - - // Fourth tab: Should have the latest command from the third tab, followed - // by the rest of the history from the first tab. - yield loadTab(TEST_URI); - let hud4 = yield openConsole(); - is(JSON.stringify(hud4.jsterm.history), - '["1","2","3","4","5","6","7","8","9","\\"hello from third tab\\""]', - "Fourth tab has most recent history"); - - yield hud4.jsterm.clearHistory(); - is(JSON.stringify(hud4.jsterm.history), "[]", - "Clearing history for a tab works"); - - yield loadTab(TEST_URI); - let hud5 = yield openConsole(); - is(JSON.stringify(hud5.jsterm.history), "[]", - "Clearing history carries over to a new tab"); - - info("Clearing custom input history pref"); - Services.prefs.clearUserPref("devtools.webconsole.inputHistoryCount"); -}); - -/** - * Populate the history by running the following commands: - * [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - */ -function* populateInputHistory(hud) { - let jsterm = hud.jsterm; - - for (let i = 0; i < INPUT_HISTORY_COUNT; i++) { - // Set input value separately from execute so UP arrow accurately navigates - // history. - jsterm.setInputValue(i); - jsterm.execute(); - } -} - -/** - * Check pressing up results in history traversal like: - * [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] - */ -function* testNaviatingHistoryInUI(hud) { - let jsterm = hud.jsterm; - jsterm.focus(); - - // Count backwards from original input and make sure that pressing up - // restores this. - for (let i = INPUT_HISTORY_COUNT - 1; i >= 0; i--) { - EventUtils.synthesizeKey("VK_UP", {}); - is(jsterm.getInputValue(), i, "Pressing up restores last input"); - } -}
deleted file mode 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_no_autocompletion_on_defined_variables.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/ */ - -// Tests for bug 704295 - -"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(); - - testCompletion(hud); -}); - -function testCompletion(hud) { - let jsterm = hud.jsterm; - let input = jsterm.inputNode; - - // Test typing 'var d = 5;' and press RETURN - jsterm.setInputValue("var d = "); - EventUtils.synthesizeKey("5", {}); - EventUtils.synthesizeKey(";", {}); - is(input.value, "var d = 5;", "var d = 5;"); - is(jsterm.completeNode.value, "", "no completion"); - EventUtils.synthesizeKey("VK_RETURN", {}); - is(jsterm.completeNode.value, "", "clear completion on execute()"); - - // Test typing 'var a = d' and press RETURN - jsterm.setInputValue("var a = "); - EventUtils.synthesizeKey("d", {}); - is(input.value, "var a = d", "var a = d"); - is(jsterm.completeNode.value, "", "no completion"); - EventUtils.synthesizeKey("VK_RETURN", {}); - is(jsterm.completeNode.value, "", "clear completion on execute()"); -}
deleted file mode 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole.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 611795. - -const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">' + - 'test repeated css warnings</div><p style="-moz-opacity:0">' + - "hi</p>"; -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, - }], - }); -}
deleted file mode 100644 --- 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"); -}
deleted file mode 100644 --- 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"); -});
deleted file mode 100644 --- 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"); -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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"); - }); -}
deleted file mode 100644 --- 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"); -});
deleted file mode 100644 --- 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,<p>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; -}
deleted file mode 100644 --- 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,<p>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"); -}
deleted file mode 100644 --- 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,<p>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; -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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(); - }); - }); -}
deleted file mode 100644 --- 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,<p>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(); -}
deleted file mode 100644 --- 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,<p>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"); -}
deleted file mode 100644 --- 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,<p>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,<p>testing autocomplete closes"); - - ok(!popup.isOpen, "Popup closes on tab switch"); -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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,<p>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; -}
deleted file mode 100644 --- 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); - }); - }); - }); -}
deleted file mode 100644 --- 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"); - } -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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("<p>" + chars + "</p>"), -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; -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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; -});
deleted file mode 100644 --- 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; -}
deleted file mode 100644 --- 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"); -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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,<p>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; -}
deleted file mode 100644 --- 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, - }], - }); -});
deleted file mode 100644 --- 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, - }], - }); -});
deleted file mode 100644 --- 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); -});
deleted file mode 100644 --- 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(); -});
deleted file mode 100644 --- 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); - } -});
deleted file mode 100644 --- 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; - } - }); -}
deleted file mode 100644 --- 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; - } - }); -});
deleted file mode 100644 --- 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"); -}
deleted file mode 100644 --- 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(); - }); -}
deleted file mode 100644 --- 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: "<body>" }, - ], { webconsole: gHUD }); -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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"); - } -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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); -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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"); -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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, - }], - }); -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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("<h1>"), -1, "correct output for $0"); - - jsterm.clearOutput(); - jsterm.execute("$0.textContent = 'bug653531'", onNodeUpdate); - } - - function onNodeUpdate(node) { - isnot(node.textContent.indexOf("bug653531"), -1, - "correct output for $0.textContent"); - is(inspector.selection.node.textContent, "bug653531", - "node successfully updated"); - - inspector = h1 = outputNode = null; - gBrowser.removeCurrentTab(); - finishTest(); - } -} - -function test() { - waitForExplicitFinish(); - - gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); - gBrowser.selectedBrowser.addEventListener("load", function () { - waitForFocus(createDocument, content); - }, {capture: true, once: true}); - - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, - "data:text/html;charset=utf-8,test for highlighter helper in web console"); -}
deleted file mode 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_history.js +++ /dev/null @@ -1,62 +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 console history feature accessed via the up and down arrow keys. - -"use strict"; - -const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + - "test/test-console.html"; - -// Constants used for defining the direction of JSTerm input history navigation. -const HISTORY_BACK = -1; -const HISTORY_FORWARD = 1; - -add_task(function* () { - yield loadTab(TEST_URI); - let hud = yield openConsole(); - hud.jsterm.clearOutput(); - - let jsterm = hud.jsterm; - let input = jsterm.inputNode; - - let executeList = ["document", "window", "window.location"]; - - for (let item of executeList) { - input.value = item; - yield jsterm.execute(); - } - - for (let x = executeList.length - 1; x != -1; x--) { - jsterm.historyPeruse(HISTORY_BACK); - is(input.value, executeList[x], "check history previous idx:" + x); - } - - jsterm.historyPeruse(HISTORY_BACK); - is(input.value, executeList[0], "test that item is still index 0"); - - jsterm.historyPeruse(HISTORY_BACK); - is(input.value, executeList[0], "test that item is still still index 0"); - - for (let i = 1; i < executeList.length; i++) { - jsterm.historyPeruse(HISTORY_FORWARD); - is(input.value, executeList[i], "check history next idx:" + i); - } - - jsterm.historyPeruse(HISTORY_FORWARD); - is(input.value, "", "check input is empty again"); - - // Simulate pressing Arrow_Down a few times and then if Arrow_Up shows - // the previous item from history again. - jsterm.historyPeruse(HISTORY_FORWARD); - jsterm.historyPeruse(HISTORY_FORWARD); - jsterm.historyPeruse(HISTORY_FORWARD); - - is(input.value, "", "check input is still empty"); - - let idxLast = executeList.length - 1; - jsterm.historyPeruse(HISTORY_BACK); - is(input.value, executeList[idxLast], "check history next idx:" + idxLast); -});
deleted file mode 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_history_arrow_keys.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/ */ - -"use strict"; - -// See Bugs 594497 and 619598. - -var jsterm, inputNode, values; - -var TEST_URI = "data:text/html;charset=utf-8,Web Console test for " + - "bug 594497 and bug 619598"; - -add_task(function* () { - yield loadTab(TEST_URI); - - let hud = yield openConsole(); - - setup(hud); - performTests(); - - jsterm = inputNode = values = null; -}); - -function setup(HUD) { - jsterm = HUD.jsterm; - inputNode = jsterm.inputNode; - - jsterm.focus(); - - ok(!jsterm.getInputValue(), "jsterm.getInputValue() is empty"); - - values = ["document", "window", "document.body"]; - values.push(values.join(";\n"), "document.location"); - - // Execute each of the values; - for (let i = 0; i < values.length; i++) { - jsterm.setInputValue(values[i]); - jsterm.execute(); - } -} - -function performTests() { - EventUtils.synthesizeKey("VK_UP", {}); - - - is(jsterm.getInputValue(), values[4], - "VK_UP: jsterm.getInputValue() #4 is correct"); - - ok(inputNode.selectionStart == values[4].length && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.getInputValue(), values[3], - "VK_UP: jsterm.getInputValue() #3 is correct"); - - ok(inputNode.selectionStart == values[3].length && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - inputNode.setSelectionRange(values[3].length - 2, values[3].length - 2); - - EventUtils.synthesizeKey("VK_UP", {}); - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.getInputValue(), values[3], - "VK_UP two times: jsterm.getInputValue() #3 is correct"); - - ok(inputNode.selectionStart == jsterm.getInputValue().indexOf("\n") && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.getInputValue(), values[3], - "VK_UP again: jsterm.getInputValue() #3 is correct"); - - ok(inputNode.selectionStart == 0 && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.getInputValue(), values[2], - "VK_UP: jsterm.getInputValue() #2 is correct"); - - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.getInputValue(), values[1], - "VK_UP: jsterm.getInputValue() #1 is correct"); - - EventUtils.synthesizeKey("VK_UP", {}); - - is(jsterm.getInputValue(), values[0], - "VK_UP: jsterm.getInputValue() #0 is correct"); - - ok(inputNode.selectionStart == values[0].length && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(jsterm.getInputValue(), values[1], - "VK_DOWN: jsterm.getInputValue() #1 is correct"); - - ok(inputNode.selectionStart == values[1].length && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(jsterm.getInputValue(), values[2], - "VK_DOWN: jsterm.getInputValue() #2 is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(jsterm.getInputValue(), values[3], - "VK_DOWN: jsterm.getInputValue() #3 is correct"); - - ok(inputNode.selectionStart == values[3].length && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - inputNode.setSelectionRange(2, 2); - - EventUtils.synthesizeKey("VK_DOWN", {}); - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(jsterm.getInputValue(), values[3], - "VK_DOWN two times: jsterm.getInputValue() #3 is correct"); - - ok(inputNode.selectionStart > jsterm.getInputValue().lastIndexOf("\n") && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(jsterm.getInputValue(), values[3], - "VK_DOWN again: jsterm.getInputValue() #3 is correct"); - - ok(inputNode.selectionStart == values[3].length && - inputNode.selectionStart == inputNode.selectionEnd, - "caret location is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - is(jsterm.getInputValue(), values[4], - "VK_DOWN: jsterm.getInputValue() #4 is correct"); - - EventUtils.synthesizeKey("VK_DOWN", {}); - - ok(!jsterm.getInputValue(), - "VK_DOWN: jsterm.getInputValue() is empty"); -}
deleted file mode 100644 --- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_history_nav.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/ */ - -"use strict"; - -// See Bug 660806. - -const TEST_URI = "data:text/html;charset=utf-8,<p>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; -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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 + ")"); -}
deleted file mode 100644 --- 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; -}
deleted file mode 100644 --- 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,<p>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"); -});
deleted file mode 100644 --- 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 - }, - ], - }); -});
deleted file mode 100644 --- 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); -}
deleted file mode 100644 --- 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,<p>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 }); -});
deleted file mode 100644 --- 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); - }); -}
deleted file mode 100644 --- 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/" + - &quo