From f6db0ee55782a171ce893389645b7ec1473bc6a6 Mon Sep 17 00:00:00 2001 From: Victor Porof Date: Fri, 5 Jul 2019 11:24:38 +0200 Subject: [PATCH] Bug 1561435 - Format devtools/client/, a=automatic-formatting # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35884 --HG-- extra : source : 60e4496cf9699dc59f2f4738cb60f87cbdb01e67 --- .eslintrc.js | 8 - .prettierignore | 25 - .../aboutdebugging-new/aboutdebugging.js | 65 +- .../client/aboutdebugging-new/initializer.js | 5 +- .../src/actions/debug-targets.js | 67 +- .../src/actions/runtimes.js | 139 +- .../src/actions/telemetry.js | 4 +- .../aboutdebugging-new/src/components/App.js | 53 +- .../src/components/CompatibilityWarning.js | 26 +- .../src/components/ConnectionPromptSetting.js | 11 +- .../src/components/ProfilerDialog.js | 17 +- .../src/components/RuntimeActions.js | 47 +- .../src/components/RuntimeInfo.js | 58 +- .../src/components/RuntimePage.js | 213 ++- .../src/components/ServiceWorkersWarning.js | 12 +- .../src/components/connect/ConnectPage.js | 118 +- .../src/components/connect/ConnectSection.js | 28 +- .../src/components/connect/ConnectSteps.js | 7 +- .../connect/NetworkLocationsForm.js | 22 +- .../connect/NetworkLocationsList.js | 12 +- .../components/debugtarget/DebugTargetItem.js | 8 +- .../components/debugtarget/DebugTargetList.js | 34 +- .../components/debugtarget/DebugTargetPane.js | 55 +- .../components/debugtarget/ExtensionDetail.js | 53 +- .../src/components/debugtarget/FieldPair.js | 18 +- .../components/debugtarget/InspectAction.js | 5 +- .../components/debugtarget/ProcessDetail.js | 5 +- .../debugtarget/ServiceWorkerAction.js | 25 +- .../ServiceWorkerAdditionalActions.js | 26 +- .../src/components/debugtarget/TabDetail.js | 6 +- .../TemporaryExtensionAdditionalActions.js | 23 +- .../debugtarget/TemporaryExtensionDetail.js | 9 +- .../TemporaryExtensionInstallSection.js | 19 +- .../TemporaryExtensionInstaller.js | 8 +- .../components/debugtarget/WorkerDetail.js | 71 +- .../src/components/shared/DetailsLog.js | 15 +- .../src/components/shared/IconLabel.js | 12 +- .../src/components/shared/Message.js | 45 +- .../sidebar/RefreshDevicesButton.js | 5 +- .../src/components/sidebar/Sidebar.js | 68 +- .../components/sidebar/SidebarFixedItem.js | 22 +- .../src/components/sidebar/SidebarItem.js | 49 +- .../components/sidebar/SidebarRuntimeItem.js | 53 +- .../aboutdebugging-new/src/constants.js | 45 +- .../aboutdebugging-new/src/create-store.js | 39 +- .../src/middleware/error-logging.js | 4 +- .../src/middleware/event-recording.js | 105 +- .../middleware/extension-component-data.js | 27 +- .../src/middleware/process-component-data.js | 13 +- .../src/middleware/tab-component-data.js | 9 +- .../src/middleware/worker-component-data.js | 13 +- .../src/modules/client-wrapper.js | 25 +- .../src/modules/debug-target-support.js | 23 +- .../src/modules/extensions-helper.js | 35 +- .../aboutdebugging-new/src/modules/l10n.js | 4 +- .../src/modules/network-locations.js | 12 +- .../src/modules/runtime-client-factory.js | 5 +- .../src/modules/usb-runtimes.js | 7 +- .../src/reducers/debug-targets-state.js | 21 +- .../src/reducers/runtimes-state.js | 19 +- .../src/reducers/ui-state.js | 11 +- .../aboutdebugging-new/src/types/index.js | 13 +- .../aboutdebugging-new/src/types/runtime.js | 4 +- .../client/aboutdebugging-new/src/types/ui.js | 20 +- ...ser_aboutdebugging_addons_debug_console.js | 43 +- ...er_aboutdebugging_addons_debug_debugger.js | 47 +- ...r_aboutdebugging_addons_debug_inspector.js | 36 +- ...rowser_aboutdebugging_addons_debug_nobg.js | 81 +- ...owser_aboutdebugging_addons_debug_popup.js | 147 +- ...wser_aboutdebugging_addons_manifest_url.js | 22 +- ...er_aboutdebugging_addons_remote_runtime.js | 51 +- ...ebugging_addons_temporary_addon_buttons.js | 88 +- ...utdebugging_addons_temporary_id_message.js | 30 +- ...ebugging_addons_temporary_install_error.js | 43 +- ...debugging_addons_temporary_install_path.js | 6 +- ...debugging_addons_temporary_reload_error.js | 43 +- .../browser_aboutdebugging_addons_warnings.js | 27 +- ...aboutdebugging_connect_networklocations.js | 60 +- ...outdebugging_connect_toggle_usb_devices.js | 43 +- ...boutdebugging_connection_prompt_setting.js | 32 +- ...arget-pane_collapsibilities_interaction.js | 15 +- ...target-pane_collapsibilities_preference.js | 11 +- ..._aboutdebugging_debug-target-pane_empty.js | 56 +- ...debugging_debug-target-pane_usb_runtime.js | 15 +- .../browser_aboutdebugging_devtools.js | 5 +- ...utdebugging_devtoolstoolbox_contextmenu.js | 57 +- ..._devtoolstoolbox_contextmenu_markupview.js | 20 +- ...er_aboutdebugging_devtoolstoolbox_focus.js | 67 +- ..._aboutdebugging_devtoolstoolbox_menubar.js | 27 +- ...utdebugging_devtoolstoolbox_performance.js | 22 +- ...r_aboutdebugging_devtoolstoolbox_reload.js | 18 +- ...boutdebugging_devtoolstoolbox_shortcuts.js | 53 +- ...ugging_devtoolstoolbox_splitconsole_key.js | 12 +- ...ugging_devtoolstoolbox_target_destroyed.js | 21 +- ...ging_devtoolstoolbox_tooltip_markupview.js | 66 +- ...er_aboutdebugging_fenix_runtime_display.js | 48 +- .../browser_aboutdebugging_hidden_addons.js | 48 +- .../browser_aboutdebugging_message_close.js | 30 +- .../browser_aboutdebugging_navigate.js | 44 +- ...owser_aboutdebugging_persist_connection.js | 17 +- ...browser_aboutdebugging_process_category.js | 12 +- .../browser_aboutdebugging_process_main.js | 22 +- .../browser_aboutdebugging_profiler_dialog.js | 5 +- ...ging_real_usb_runtime_page_runtime_info.js | 37 +- ...browser_aboutdebugging_real_usb_sidebar.js | 13 +- .../browser/browser_aboutdebugging_routes.js | 36 +- ...debugging_runtime_compatibility_warning.js | 64 +- ...gging_runtime_disconnect_remote_runtime.js | 15 +- ...ebugging_runtime_remote_runtime_buttons.js | 36 +- ...aboutdebugging_runtime_usbclient_closed.js | 21 +- ...r_aboutdebugging_select_network_runtime.js | 17 +- ...ebugging_select_page_with_serviceworker.js | 35 +- ...aboutdebugging_serviceworker_fetch_flag.js | 30 +- ..._aboutdebugging_serviceworker_multie10s.js | 22 +- ...tdebugging_serviceworker_not_compatible.js | 56 +- ...owser_aboutdebugging_serviceworker_push.js | 19 +- ...debugging_serviceworker_pushservice_url.js | 35 +- ...outdebugging_serviceworker_runtime-page.js | 30 +- ...wser_aboutdebugging_serviceworker_start.js | 18 +- ...ser_aboutdebugging_serviceworker_status.js | 67 +- ...er_aboutdebugging_serviceworker_timeout.js | 18 +- ...aboutdebugging_serviceworker_unregister.js | 14 +- ...aboutdebugging_sidebar_connection_state.js | 99 +- ...aboutdebugging_sidebar_network_runtimes.js | 15 +- ...wser_aboutdebugging_sidebar_usb_runtime.js | 11 +- ...utdebugging_sidebar_usb_runtime_connect.js | 18 +- ...utdebugging_sidebar_usb_runtime_refresh.js | 10 +- ...outdebugging_sidebar_usb_runtime_select.js | 19 +- ...owser_aboutdebugging_sidebar_usb_status.js | 12 +- ...bugging_sidebar_usb_unavailable_runtime.js | 21 +- ...tdebugging_sidebar_usb_unplugged_device.js | 22 +- .../browser_aboutdebugging_tab_favicons.js | 25 +- .../browser_aboutdebugging_telemetry_basic.js | 32 +- ...tdebugging_telemetry_connection_attempt.js | 216 ++- ...rowser_aboutdebugging_telemetry_inspect.js | 34 +- ...owser_aboutdebugging_telemetry_navigate.js | 22 +- ...boutdebugging_telemetry_runtime_actions.js | 48 +- ...ing_telemetry_runtime_connected_details.js | 21 +- ...boutdebugging_telemetry_runtime_updates.js | 93 +- ...bugging_telemetry_runtime_updates_multi.js | 69 +- ...gging_telemetry_runtime_updates_network.js | 52 +- .../browser_aboutdebugging_thisfirefox.js | 46 +- ...aboutdebugging_thisfirefox_runtime_info.js | 23 +- ...debugging_thisfirefox_worker_inspection.js | 30 +- ...r_aboutdebugging_workers_remote_runtime.js | 71 +- .../aboutdebugging-new/test/browser/head.js | 80 +- .../test/browser/helper-adb.js | 6 +- .../test/browser/helper-addons.js | 46 +- .../test/browser/helper-mocks.js | 38 +- .../test/browser/helper-real-usb.js | 12 +- .../test/browser/helper-serviceworker.js | 14 +- .../test/browser/helper-telemetry.js | 31 +- .../test/browser/mocks/helper-adb-mock.js | 16 +- .../mocks/helper-client-wrapper-mock.js | 15 +- .../helper-runtime-client-factory-mock.js | 17 +- .../resources/service-workers/push-sw.js | 8 +- .../test/jest/babel.config.js | 2 +- .../jest/components/shared-message.test.js | 71 +- .../test/jest/jest.config.js | 8 +- .../test/unit/test_extensions_path.js | 14 +- .../components/Aboutdebugging.js | 95 +- .../aboutdebugging/components/PanelHeader.js | 6 +- .../aboutdebugging/components/PanelMenu.js | 19 +- .../components/PanelMenuEntry.js | 21 +- .../aboutdebugging/components/TargetList.js | 18 +- .../components/addons/Controls.js | 76 +- .../components/addons/InstallError.js | 22 +- .../aboutdebugging/components/addons/Panel.js | 218 ++- .../components/addons/Target.js | 185 ++- .../aboutdebugging/components/tabs/Panel.js | 66 +- .../aboutdebugging/components/tabs/Target.js | 32 +- .../components/workers/MultiE10sWarning.js | 23 +- .../components/workers/Panel.js | 76 +- .../components/workers/ServiceWorkerTarget.js | 140 +- .../components/workers/Target.js | 38 +- devtools/client/aboutdebugging/initializer.js | 40 +- .../client/aboutdebugging/modules/addon.js | 6 +- .../client/aboutdebugging/modules/connect.js | 4 +- .../test/browser_addons_debug_info.js | 55 +- .../test/browser_addons_debug_webextension.js | 51 +- ...ser_addons_debug_webextension_inspector.js | 74 +- .../browser_addons_debug_webextension_nobg.js | 71 +- ...browser_addons_debug_webextension_popup.js | 171 +- .../browser_addons_debugging_initial_state.js | 34 +- .../test/browser_addons_install.js | 25 +- .../test/browser_addons_reload.js | 42 +- .../test/browser_addons_remove.js | 6 +- .../test/browser_addons_toggle_debug.js | 17 +- .../test/browser_service_workers.js | 6 +- .../browser_service_workers_fetch_flag.js | 7 +- ...r_service_workers_multi_content_process.js | 10 +- .../browser_service_workers_not_compatible.js | 10 +- .../test/browser_service_workers_push.js | 29 +- .../browser_service_workers_push_service.js | 22 +- .../test/browser_service_workers_start.js | 10 +- .../test/browser_service_workers_status.js | 11 +- .../test/browser_service_workers_timeout.js | 10 +- .../browser_service_workers_unregister.js | 13 +- .../aboutdebugging/test/browser_tabs.js | 4 +- devtools/client/aboutdebugging/test/head.js | 126 +- .../test/service-workers/push-sw.js | 8 +- .../accessibility/accessibility-startup.js | 18 +- .../accessibility/accessibility-view.js | 10 +- .../accessibility/actions/accessibles.js | 25 +- .../client/accessibility/actions/audit.js | 29 +- .../client/accessibility/actions/details.js | 12 +- devtools/client/accessibility/actions/ui.js | 22 +- .../components/AccessibilityRow.js | 81 +- .../components/AccessibilityRowValue.js | 28 +- .../components/AccessibilityTree.js | 101 +- .../components/AccessibilityTreeFilter.js | 35 +- .../accessibility/components/Accessible.js | 143 +- .../components/AuditController.js | 4 +- .../accessibility/components/AuditFilter.js | 13 +- .../components/AuditProgressOverlay.js | 46 +- .../client/accessibility/components/Badges.js | 25 +- .../client/accessibility/components/Button.js | 45 +- .../client/accessibility/components/Checks.js | 32 +- .../components/ColorContrastAccessibility.js | 147 +- .../accessibility/components/ContrastBadge.js | 17 +- .../accessibility/components/Description.js | 92 +- .../accessibility/components/LearnMoreLink.js | 17 +- .../accessibility/components/MainFrame.js | 52 +- .../accessibility/components/RightSidebar.js | 27 +- .../components/TextLabelBadge.js | 13 +- .../components/TextLabelCheck.js | 44 +- .../accessibility/components/Toolbar.js | 89 +- devtools/client/accessibility/constants.js | 20 +- devtools/client/accessibility/main.js | 5 +- devtools/client/accessibility/panel.js | 77 +- devtools/client/accessibility/picker.js | 43 +- .../accessibility/reducers/accessibles.js | 3 +- .../client/accessibility/reducers/audit.js | 15 +- .../client/accessibility/reducers/details.js | 2 +- ...wser_accessibility_context_menu_browser.js | 80 +- ...er_accessibility_context_menu_inspector.js | 47 +- .../browser_accessibility_mutations.js | 188 ++- ...browser_accessibility_panel_highlighter.js | 16 +- ...cessibility_panel_highlighter_multi_tab.js | 12 +- ...wser_accessibility_panel_toolbar_checks.js | 146 +- ...owser_accessibility_relation_navigation.js | 172 +- .../browser/browser_accessibility_reload.js | 99 +- .../browser/browser_accessibility_sidebar.js | 71 +- .../browser_accessibility_sidebar_checks.js | 72 +- .../browser/browser_accessibility_tree.js | 72 +- .../browser_accessibility_tree_audit.js | 173 +- .../browser_accessibility_tree_audit_long.js | 97 +- .../browser_accessibility_tree_audit_reset.js | 144 +- ...rowser_accessibility_tree_audit_toolbar.js | 128 +- .../browser_accessibility_tree_contrast.js | 51 +- .../browser_accessibility_tree_nagivation.js | 249 +-- .../client/accessibility/test/browser/head.js | 139 +- .../accessibility/test/jest/babel.config.js | 2 +- .../accessibility-row-value.test.js | 44 +- .../accessibility-tree-filter.test.js | 303 ++-- .../jest/components/audit-controller.test.js | 57 +- .../test/jest/components/audit-filter.test.js | 105 +- .../components/audit-progress-overlay.test.js | 18 +- .../test/jest/components/badge.test.js | 12 +- .../test/jest/components/badges.test.js | 85 +- .../jest/components/contrast-badge.test.js | 61 +- .../jest/components/text-label-badge.test.js | 45 +- .../jest/components/text-label-check.test.js | 5 +- .../client/accessibility/test/jest/helpers.js | 4 +- .../accessibility/test/jest/jest.config.js | 8 +- .../test/mochitest/contrast.snapshots.js | 303 ++-- .../accessibility/test/mochitest/head.js | 4 +- devtools/client/application/initializer.js | 23 +- .../client/application/src/actions/index.js | 5 +- .../client/application/src/actions/page.js | 4 +- .../client/application/src/actions/workers.js | 5 +- .../client/application/src/components/App.js | 28 +- .../application/src/components/Worker.js | 151 +- .../application/src/components/WorkerList.js | 47 +- .../src/components/WorkerListEmpty.js | 68 +- .../client/application/src/modules/l10n.js | 4 +- .../application/src/reducers/page-state.js | 4 +- .../application/src/reducers/workers-state.js | 9 +- .../client/application/test/babel.config.js | 2 +- ..._application_panel_debug-service-worker.js | 13 +- ...r_application_panel_list-domain-workers.js | 29 +- ..._application_panel_list-several-workers.js | 14 +- ...er_application_panel_list-single-worker.js | 18 +- .../browser_application_panel_list-unicode.js | 9 +- ...er_application_panel_list-workers-empty.js | 2 +- .../browser_application_panel_open-links.js | 11 +- ..._application_panel_start-service-worker.js | 13 +- .../application/test/fixtures/Chrome.js | 6 +- devtools/client/application/test/head.js | 16 +- .../client/application/test/jest.config.js | 8 +- devtools/client/application/test/setup.js | 38 +- .../client/bin/devtools-node-test-runner.js | 29 +- devtools/client/definitions.js | 259 ++- devtools/client/dom/content/actions/grips.js | 2 +- .../client/dom/content/components/DomTree.js | 86 +- .../dom/content/components/MainFrame.js | 38 +- .../dom/content/components/MainToolbar.js | 44 +- devtools/client/dom/content/dom-decorator.js | 6 +- devtools/client/dom/content/dom-view.js | 13 +- devtools/client/dom/content/grip-provider.js | 13 +- devtools/client/dom/main.js | 8 +- devtools/client/dom/panel.js | 18 +- devtools/client/dom/test/browser_dom_array.js | 34 +- .../dom/test/browser_dom_nodes_highlight.js | 43 +- .../dom/test/browser_dom_nodes_select.js | 6 +- devtools/client/dom/test/head.js | 14 +- devtools/client/framework/ToolboxProcess.jsm | 103 +- devtools/client/framework/browser-menus.js | 33 +- .../components/DebugTargetErrorPage.js | 11 +- .../framework/components/DebugTargetInfo.js | 60 +- .../framework/components/MeatballMenu.js | 20 +- .../framework/components/ToolboxController.js | 42 +- .../client/framework/components/ToolboxTab.js | 65 +- .../framework/components/ToolboxTabs.js | 124 +- .../framework/components/ToolboxToolbar.js | 203 +-- devtools/client/framework/connect/connect.js | 56 +- devtools/client/framework/devtools-browser.js | 240 ++- devtools/client/framework/devtools.js | 165 +- devtools/client/framework/gDevTools.jsm | 9 +- devtools/client/framework/menu-item.js | 26 +- devtools/client/framework/menu.js | 6 +- devtools/client/framework/selection.js | 81 +- devtools/client/framework/sidebar.js | 66 +- .../framework/source-map-url-service.js | 79 +- devtools/client/framework/target-from-url.js | 17 +- devtools/client/framework/target.js | 9 +- .../allocations/browser_allocations_target.js | 45 +- .../browser_about-devtools-toolbox_load.js | 5 +- .../browser_about-devtools-toolbox_reload.js | 22 +- .../framework/test/browser_browser_toolbox.js | 39 +- .../test/browser_browser_toolbox_debugger.js | 71 +- .../test/browser_browser_toolbox_rtl.js | 32 +- .../framework/test/browser_devtools_api.js | 38 +- .../test/browser_devtools_api_destroy.js | 6 +- .../test/browser_dynamic_tool_enabling.js | 22 +- ...browser_ignore_toolbox_network_requests.js | 6 +- .../framework/test/browser_keybindings_01.js | 18 +- .../framework/test/browser_keybindings_02.js | 16 +- .../framework/test/browser_keybindings_03.js | 10 +- .../client/framework/test/browser_menu_api.js | 90 +- .../test/browser_new_activation_workflow.js | 12 +- .../framework/test/browser_source_map-01.js | 16 +- .../test/browser_source_map-absolute.js | 4 +- .../test/browser_source_map-inline.js | 4 +- .../test/browser_source_map-late-script.js | 15 +- .../test/browser_source_map-pub-sub.js | 36 +- .../test/browser_source_map-reload.js | 4 +- .../framework/test/browser_target_from_url.js | 29 +- .../test/browser_target_get-front.js | 6 +- .../test/browser_target_listeners.js | 12 +- .../test/browser_target_server_compartment.js | 43 +- .../framework/test/browser_target_support.js | 79 +- .../test/browser_toolbox_custom_host.js | 7 +- .../browser_toolbox_dynamic_registration.js | 3 +- .../test/browser_toolbox_getpanelwhenready.js | 14 +- .../test/browser_toolbox_highlight.js | 41 +- .../framework/test/browser_toolbox_hosts.js | 7 +- .../test/browser_toolbox_hosts_size.js | 46 +- .../test/browser_toolbox_hosts_telemetry.js | 11 +- .../browser_toolbox_keyboard_navigation.js | 32 +- .../test/browser_toolbox_meatball.js | 69 +- .../framework/test/browser_toolbox_options.js | 208 ++- ...browser_toolbox_options_disable_buttons.js | 131 +- .../browser_toolbox_options_disable_js.js | 43 +- ...x_options_enable_serviceworkers_testing.js | 25 +- .../browser_toolbox_options_frames_button.js | 7 +- .../browser_toolbox_options_multiple_tabs.js | 59 +- .../browser_toolbox_options_panel_toggle.js | 38 +- .../framework/test/browser_toolbox_races.js | 9 +- .../framework/test/browser_toolbox_raise.js | 33 +- .../test/browser_toolbox_remoteness_change.js | 28 +- .../test/browser_toolbox_select_event.js | 1 - ...owser_toolbox_selected_tool_unavailable.js | 10 +- .../browser_toolbox_selectionchanged_event.js | 15 +- ...browser_toolbox_show_toolbox_tool_ready.js | 12 +- .../framework/test/browser_toolbox_sidebar.js | 106 +- .../test/browser_toolbox_sidebar_events.js | 53 +- .../browser_toolbox_sidebar_existing_tabs.js | 22 +- .../browser_toolbox_sidebar_overflow_menu.js | 21 +- .../test/browser_toolbox_split_console.js | 20 +- .../browser_toolbox_tabsswitch_shortcuts.js | 42 +- .../framework/test/browser_toolbox_target.js | 7 +- ...toolbox_telemetry_activate_splitconsole.js | 18 +- .../test/browser_toolbox_telemetry_close.js | 10 +- .../test/browser_toolbox_telemetry_enter.js | 23 +- .../test/browser_toolbox_telemetry_exit.js | 20 +- .../browser_toolbox_textbox_context_menu.js | 16 +- .../framework/test/browser_toolbox_theme.js | 21 +- .../browser_toolbox_theme_registration.js | 71 +- .../framework/test/browser_toolbox_toggle.js | 28 +- .../test/browser_toolbox_tool_ready.js | 7 +- .../browser_toolbox_tool_remote_reopen.js | 7 +- .../browser_toolbox_toolbar_minimum_width.js | 12 +- .../test/browser_toolbox_toolbar_overflow.js | 32 +- ...lbox_toolbar_overflow_button_visibility.js | 43 +- .../browser_toolbox_toolbar_reorder_by_dnd.js | 133 +- ...rowser_toolbox_toolbar_reorder_by_width.js | 30 +- ..._toolbox_toolbar_reorder_with_extension.js | 76 +- ...x_toolbar_reorder_with_hidden_extension.js | 172 +- ..._toolbar_reorder_with_secondary_toolbox.js | 21 +- ..._toolbox_tools_per_toolbox_registration.js | 39 +- .../test/browser_toolbox_view_source_01.js | 2 +- .../test/browser_toolbox_view_source_02.js | 2 +- .../test/browser_toolbox_view_source_03.js | 27 +- .../test/browser_toolbox_view_source_04.js | 9 +- .../browser_toolbox_window_reload_target.js | 49 +- .../test/browser_toolbox_window_shortcuts.js | 35 +- .../browser_toolbox_window_title_changes.js | 39 +- ...owser_toolbox_window_title_frame_select.js | 67 +- .../framework/test/browser_toolbox_zoom.js | 28 +- .../test/browser_toolbox_zoom_popup.js | 51 +- .../client/framework/test/browser_two_tabs.js | 32 +- devtools/client/framework/test/head.js | 176 +- .../framework/test/helper_disable_cache.js | 39 +- .../jest/components/debug-target-info.test.js | 62 +- .../test/metrics/browser_metrics_debugger.js | 3 +- .../test/metrics/browser_metrics_inspector.js | 3 +- .../metrics/browser_metrics_netmonitor.js | 3 +- .../metrics/browser_metrics_webconsole.js | 3 +- .../client/framework/test/metrics/head.js | 63 +- .../test/unit/test_tabs_absolute_order.js | 32 +- .../client/framework/toolbox-context-menu.js | 126 +- .../client/framework/toolbox-host-manager.js | 73 +- devtools/client/framework/toolbox-hosts.js | 63 +- devtools/client/framework/toolbox-init.js | 33 +- devtools/client/framework/toolbox-options.js | 176 +- .../framework/toolbox-process-window.js | 118 +- .../framework/toolbox-tabs-order-manager.js | 49 +- devtools/client/framework/toolbox.js | 1049 +++++++----- .../inspector/animation/actions/index.js | 37 +- .../client/inspector/animation/animation.js | 239 ++- .../components/AnimatedPropertyItem.js | 38 +- .../components/AnimatedPropertyList.js | 54 +- .../AnimatedPropertyListContainer.js | 62 +- .../components/AnimatedPropertyName.js | 17 +- .../components/AnimationDetailContainer.js | 32 +- .../components/AnimationDetailHeader.js | 10 +- .../animation/components/AnimationItem.js | 66 +- .../animation/components/AnimationList.js | 33 +- .../components/AnimationListContainer.js | 100 +- .../animation/components/AnimationTarget.js | 81 +- .../animation/components/AnimationToolbar.js | 45 +- .../inspector/animation/components/App.js | 124 +- .../animation/components/CurrentTimeLabel.js | 4 +- .../components/CurrentTimeScrubber.js | 31 +- .../animation/components/IndicationBar.js | 14 +- .../components/KeyframesProgressBar.js | 31 +- .../animation/components/NoAnimationPanel.js | 31 +- .../animation/components/PauseResumeButton.js | 31 +- .../components/PlaybackRateSelector.js | 13 +- .../components/ProgressInspectionPanel.js | 11 +- .../animation/components/RewindButton.js | 18 +- .../animation/components/TickLabels.js | 4 +- .../animation/components/TickLines.js | 10 +- .../components/graph/AnimationName.js | 4 +- .../components/graph/ComputedTimingPath.js | 19 +- .../animation/components/graph/DelaySign.js | 34 +- .../components/graph/EffectTimingPath.js | 24 +- .../components/graph/EndDelaySign.js | 30 +- .../components/graph/NegativeDelayPath.js | 8 +- .../components/graph/NegativeEndDelayPath.js | 8 +- .../components/graph/NegativePath.js | 19 +- .../components/graph/SummaryGraph.js | 98 +- .../components/graph/SummaryGraphPath.js | 121 +- .../animation/components/graph/TimingPath.js | 246 ++- .../components/keyframes-graph/ColorPath.js | 62 +- .../keyframes-graph/ComputedStylePath.js | 58 +- .../keyframes-graph/KeyframeMarkerItem.js | 16 +- .../keyframes-graph/KeyframeMarkerList.js | 5 +- .../keyframes-graph/KeyframesGraph.js | 23 +- .../keyframes-graph/KeyframesGraphPath.js | 48 +- .../animation/reducers/animations.js | 23 +- ...rowser_animation_animated-property-list.js | 39 +- ..._animated-property-list_unchanged-items.js | 25 +- ...rowser_animation_animated-property-name.js | 103 +- ...animation_animation-detail_close-button.js | 14 +- ...rowser_animation_animation-detail_title.js | 18 +- ...r_animation_animation-detail_visibility.js | 44 +- .../test/browser_animation_animation-list.js | 31 +- ...ion_animation-list_one-animation-select.js | 18 +- ...browser_animation_animation-list_select.js | 13 +- .../browser_animation_animation-target.js | 41 +- ...er_animation_animation-target_highlight.js | 75 +- ...owser_animation_animation-target_select.js | 7 +- ...owser_animation_animation-timeline-tick.js | 72 +- ...tion_css-transition-with-playstate-idle.js | 6 +- .../browser_animation_current-time-label.js | 14 +- ...ser_animation_current-time-scrubber-rtl.js | 4 +- ...rrent-time-scrubber-with-negative-delay.js | 21 +- ...browser_animation_current-time-scrubber.js | 4 +- ...each-different-creation-time-animations.js | 13 +- ...rowser_animation_empty_on_invalid_nodes.js | 32 +- .../test/browser_animation_indication-bar.js | 12 +- ...infinity-duration_current-time-scrubber.js | 16 +- ...imation_infinity-duration_summary-graph.js | 86 +- ..._animation_infinity-duration_tick-label.js | 6 +- ...s-graph_computed-value-path_easing-hint.js | 145 +- ...ion_keyframes-graph_keyframe-marker-rtl.js | 4 +- ...imation_keyframes-graph_keyframe-marker.js | 4 +- ...nimation_keyframes-graph_special-colors.js | 17 +- ...rowser_animation_keyframes-progress-bar.js | 33 +- ...n_keyframes-progress-bar_after-resuming.js | 43 +- ...on_logic_adjust-time-with-playback-rate.js | 38 +- .../browser_animation_logic_adjust-time.js | 39 +- .../test/browser_animation_logic_auto-stop.js | 57 +- ...tion_logic_avoid-updating-during-hiding.js | 62 +- .../browser_animation_logic_created-time.js | 38 +- .../test/browser_animation_logic_mutations.js | 103 +- ..._logic_mutations_add_remove_immediately.js | 10 +- .../browser_animation_logic_mutations_fast.js | 6 +- ...er_animation_logic_mutations_properties.js | 75 +- ...mation_logic_overflowed_delay_end-delay.js | 17 +- .../browser_animation_logic_scroll-amount.js | 62 +- .../browser_animation_pause-resume-button.js | 10 +- ..._animation_pause-resume-button_end-time.js | 43 +- ...mation_pause-resume-button_respectively.js | 74 +- ..._animation_pause-resume-button_spacebar.js | 4 +- ...rowser_animation_playback-rate-selector.js | 37 +- .../test/browser_animation_pseudo-element.js | 88 +- .../test/browser_animation_rewind-button.js | 3 +- .../test/browser_animation_short-duration.js | 24 +- ..._animation_summary-graph_animation-name.js | 29 +- ...wser_animation_summary-graph_compositor.js | 116 +- ...tion_summary-graph_computed-timing-path.js | 102 +- ...omputed-timing-path_different-timescale.js | 14 +- ..._animation_summary-graph_delay-sign-rtl.js | 4 +- ...wser_animation_summary-graph_delay-sign.js | 4 +- ...mation_summary-graph_effect-timing-path.js | 31 +- ...mation_summary-graph_end-delay-sign-rtl.js | 4 +- ..._animation_summary-graph_end-delay-sign.js | 4 +- ..._animation_summary-graph_layout-by-seek.js | 80 +- ...ation_summary-graph_negative-delay-path.js | 61 +- ...n_summary-graph_negative-end-delay-path.js | 27 +- ...browser_animation_summary-graph_tooltip.js | 88 +- ...ive-playback-rate_current-time-scrubber.js | 16 +- ...ng_negative-playback-rate_summary-graph.js | 98 +- .../test/current-time-scrubber_head.js | 59 +- .../client/inspector/animation/test/head.js | 361 ++-- .../keyframes-graph_keyframe-marker_head.js | 56 +- .../test/summary-graph_delay-sign_head.js | 52 +- .../test/summary-graph_end-delay-sign_head.js | 57 +- .../inspector/animation/utils/graph-helper.js | 69 +- .../client/inspector/animation/utils/l10n.js | 10 +- .../inspector/animation/utils/timescale.js | 16 +- .../client/inspector/animation/utils/utils.js | 4 +- .../inspector/boxmodel/actions/box-model.js | 2 - .../inspector/boxmodel/actions/index.js | 21 +- .../client/inspector/boxmodel/box-model.js | 171 +- .../inspector/boxmodel/components/BoxModel.js | 60 +- .../boxmodel/components/BoxModelEditable.js | 68 +- .../boxmodel/components/BoxModelInfo.js | 31 +- .../boxmodel/components/BoxModelMain.js | 523 +++--- .../boxmodel/components/BoxModelProperties.js | 48 +- .../boxmodel/components/ComputedProperty.js | 111 +- .../inspector/boxmodel/reducers/box-model.js | 2 - .../boxmodel/test/browser_boxmodel.js | 30 +- ...l_edit-position-visible-position-change.js | 30 +- .../test/browser_boxmodel_editablemodel.js | 181 +- ...er_boxmodel_editablemodel_allproperties.js | 106 +- ...wser_boxmodel_editablemodel_bluronclick.js | 56 +- .../browser_boxmodel_editablemodel_border.js | 55 +- .../browser_boxmodel_editablemodel_pseudo.js | 44 +- ...owser_boxmodel_editablemodel_stylerules.js | 92 +- .../boxmodel/test/browser_boxmodel_guides.js | 32 +- .../browser_boxmodel_jump-to-rule-on-hover.js | 31 +- ...browser_boxmodel_layout-accordion-state.js | 68 +- .../test/browser_boxmodel_navigation.js | 79 +- .../test/browser_boxmodel_offsetparent.js | 20 +- .../test/browser_boxmodel_positions.js | 9 +- .../test/browser_boxmodel_properties.js | 21 +- .../test/browser_boxmodel_pseudo-element.js | 9 +- ...browser_boxmodel_rotate-labels-on-sides.js | 54 +- ...odel_show-tooltip-for-unassociated-rule.js | 39 +- .../boxmodel/test/browser_boxmodel_sync.js | 11 +- .../test/browser_boxmodel_tooltips.js | 175 +- ...rowser_boxmodel_update-after-navigation.js | 14 +- .../browser_boxmodel_update-after-reload.js | 5 +- .../browser_boxmodel_update-in-iframes.js | 8 +- .../client/inspector/boxmodel/test/head.js | 3 +- .../boxmodel/utils/editing-session.js | 14 +- devtools/client/inspector/breadcrumbs.js | 113 +- .../inspector/changes/ChangesContextMenu.js | 36 +- .../client/inspector/changes/ChangesView.js | 42 +- .../inspector/changes/actions/changes.js | 7 +- .../client/inspector/changes/actions/index.js | 17 +- .../changes/components/CSSDeclaration.js | 13 +- .../changes/components/ChangesApp.js | 40 +- .../client/inspector/changes/constants.js | 5 +- .../inspector/changes/reducers/changes.js | 157 +- .../inspector/changes/selectors/changes.js | 108 +- .../browser_changes_declaration_disable.js | 6 +- .../browser_changes_declaration_duplicate.js | 26 +- .../browser_changes_declaration_edit_value.js | 17 +- ...ser_changes_declaration_identical_rules.js | 24 +- .../browser_changes_declaration_remove.js | 12 +- ...rowser_changes_declaration_remove_ahead.js | 6 +- ...ser_changes_declaration_remove_disabled.js | 4 +- .../browser_changes_declaration_rename.js | 12 +- .../changes/test/browser_changes_rule_add.js | 6 +- .../test/browser_changes_rule_selector.js | 4 +- .../client/inspector/changes/test/head.js | 8 +- .../inspector/changes/test/unit/mocks.js | 80 +- .../test/unit/test_changes_stylesheet.js | 26 +- .../inspector/changes/utils/changes-utils.js | 72 +- .../client/inspector/changes/utils/l10n.js | 4 +- .../inspector/components/InspectorTabPanel.js | 10 +- .../client/inspector/computed/computed.js | 368 +++-- .../test/browser_computed_browser-styles.js | 26 +- .../test/browser_computed_cycle_color.js | 54 +- .../test/browser_computed_default_tab.js | 8 +- .../test/browser_computed_getNodeInfo.js | 12 +- .../test/browser_computed_keybindings_01.js | 28 +- .../test/browser_computed_keybindings_02.js | 13 +- ...owser_computed_matched-selectors-toggle.js | 63 +- .../browser_computed_matched-selectors_01.js | 26 +- .../browser_computed_matched-selectors_02.js | 7 +- .../test/browser_computed_media-queries.js | 18 +- ...browser_computed_no-results-placeholder.js | 4 +- .../browser_computed_original-source-link.js | 11 +- .../browser_computed_pseudo-element_01.js | 2 +- ...ser_computed_refresh-on-style-change_01.js | 9 +- .../test/browser_computed_search-filter.js | 20 +- .../browser_computed_search-filter_clear.js | 22 +- ...ser_computed_search-filter_context-menu.js | 8 +- ..._computed_search-filter_escape-keypress.js | 18 +- ...ser_computed_search-filter_noproperties.js | 16 +- ...wser_computed_select-and-copy-styles-01.js | 30 +- ...wser_computed_select-and-copy-styles-02.js | 22 +- .../browser_computed_style-editor-link.js | 36 +- .../client/inspector/computed/test/head.js | 44 +- .../inspector/extensions/actions/index.js | 25 +- .../inspector/extensions/actions/sidebar.js | 2 - .../extensions/components/ExtensionPage.js | 5 +- .../extensions/components/ExtensionSidebar.js | 20 +- .../extensions/components/ObjectTreeView.js | 29 +- .../components/ObjectValueGripView.js | 29 +- .../inspector/extensions/extension-sidebar.js | 121 +- .../inspector/extensions/reducers/sidebar.js | 11 +- .../browser_inspector_extension_sidebar.js | 165 +- .../client/inspector/extensions/test/head.js | 6 +- .../test/head_devtools_inspector_sidebar.js | 135 +- .../inspector/flexbox/actions/flexbox.js | 2 - .../client/inspector/flexbox/actions/index.js | 25 +- .../flexbox/components/FlexContainer.js | 19 +- .../inspector/flexbox/components/FlexItem.js | 40 +- .../flexbox/components/FlexItemList.js | 25 +- .../flexbox/components/FlexItemSelector.js | 37 +- .../components/FlexItemSizingOutline.js | 88 +- .../components/FlexItemSizingProperties.js | 180 +- .../inspector/flexbox/components/Flexbox.js | 52 +- .../inspector/flexbox/components/Header.js | 58 +- devtools/client/inspector/flexbox/flexbox.js | 197 ++- .../inspector/flexbox/reducers/flexbox.js | 2 - .../test/browser_flexbox_accordion_state.js | 52 +- .../browser_flexbox_container_and_item.js | 14 +- ...xbox_container_and_item_accordion_state.js | 60 +- ...ox_container_and_item_updates_on_change.js | 14 +- .../browser_flexbox_container_element_rep.js | 28 +- .../browser_flexbox_container_properties.js | 38 +- .../test/browser_flexbox_empty_state.js | 14 +- .../test/browser_flexbox_grand_parent_flex.js | 18 +- ...flexbox_highlighter_color_picker_on_ESC.js | 40 +- ...xbox_highlighter_color_picker_on_RETURN.js | 46 +- ...er_flexbox_highlighter_opened_telemetry.js | 13 +- .../test/browser_flexbox_item_list_01.js | 16 +- .../test/browser_flexbox_item_list_02.js | 7 +- ...ser_flexbox_item_list_updates_on_change.js | 7 +- .../browser_flexbox_item_outline_exists.js | 7 +- ...flexbox_item_outline_has_correct_layout.js | 63 +- ...lexbox_item_outline_hidden_when_useless.js | 20 +- ...ine_renders_basisfinal_points_correctly.js | 11 +- ...flexbox_item_outline_rotates_for_column.js | 22 +- ...ine_rotates_for_different_writing_modes.js | 23 +- ...wser_flexbox_non_flex_item_is_not_shown.js | 11 +- ...wser_flexbox_pseudo_elements_are_listed.js | 6 +- ..._flexibility_not_displayed_when_useless.js | 29 +- ...o_do_not_show_unspecified_min_dimension.js | 24 +- .../browser_flexbox_sizing_info_exists.js | 10 +- ...sizing_info_for_different_writing_modes.js | 59 +- ...browser_flexbox_sizing_info_for_pseudos.js | 7 +- ...wser_flexbox_sizing_info_for_text_nodes.js | 7 +- ...lexbox_sizing_info_has_correct_sections.js | 70 +- ...info_matches_properties_with_!important.js | 22 +- ...r_flexbox_sizing_info_updates_on_change.js | 13 +- ...x_sizing_wanted_to_grow_but_was_clamped.js | 20 +- .../browser_flexbox_text_nodes_are_listed.js | 6 +- ...wser_flexbox_text_nodes_are_not_inlined.js | 27 +- ...r_flexbox_toggle_flexbox_highlighter_01.js | 20 +- ...r_flexbox_toggle_flexbox_highlighter_02.js | 65 +- .../client/inspector/flexbox/test/head.js | 16 +- devtools/client/inspector/flexbox/types.js | 36 +- .../inspector/fonts/actions/font-editor.js | 2 - .../inspector/fonts/actions/font-options.js | 6 +- .../client/inspector/fonts/actions/fonts.js | 6 +- .../client/inspector/fonts/actions/index.js | 48 +- .../client/inspector/fonts/components/Font.js | 33 +- .../inspector/fonts/components/FontAxis.js | 5 +- .../inspector/fonts/components/FontEditor.js | 134 +- .../inspector/fonts/components/FontList.js | 14 +- .../inspector/fonts/components/FontName.js | 10 +- .../inspector/fonts/components/FontOrigin.js | 18 +- .../fonts/components/FontOverview.js | 15 +- .../inspector/fonts/components/FontPreview.js | 17 +- .../fonts/components/FontPreviewInput.js | 7 +- .../fonts/components/FontPropertyValue.js | 113 +- .../inspector/fonts/components/FontSize.js | 5 +- .../inspector/fonts/components/FontStyle.js | 25 +- .../inspector/fonts/components/FontWeight.js | 5 +- .../inspector/fonts/components/FontsApp.js | 5 +- .../fonts/components/LetterSpacing.js | 5 +- .../inspector/fonts/components/LineHeight.js | 5 +- devtools/client/inspector/fonts/fonts.js | 191 ++- .../inspector/fonts/reducers/font-editor.js | 7 +- .../inspector/fonts/reducers/font-options.js | 6 +- .../client/inspector/fonts/reducers/fonts.js | 6 +- .../fonts/test/browser_fontinspector.js | 80 +- .../test/browser_fontinspector_all-fonts.js | 84 +- .../browser_fontinspector_edit-previews.js | 21 +- ...ntinspector_editor-font-size-conversion.js | 50 +- .../browser_fontinspector_editor-keywords.js | 14 +- ...pector_editor-letter-spacing-conversion.js | 25 +- .../browser_fontinspector_editor-values.js | 12 +- .../browser_fontinspector_expand-css-code.js | 7 +- ...owser_fontinspector_font-type-telemetry.js | 7 +- ...r_fontinspector_input-element-used-font.js | 6 +- .../test/browser_fontinspector_no-fonts.js | 4 +- .../browser_fontinspector_reveal-in-page.js | 29 +- .../test/browser_fontinspector_text-node.js | 6 +- .../browser_fontinspector_theme-change.js | 14 +- devtools/client/inspector/fonts/test/head.js | 47 +- devtools/client/inspector/fonts/types.js | 16 +- .../inspector/fonts/utils/font-utils.js | 32 +- devtools/client/inspector/fonts/utils/l10n.js | 4 +- .../client/inspector/grids/actions/grids.js | 2 - .../grids/actions/highlighter-settings.js | 2 - .../client/inspector/grids/actions/index.js | 33 +- .../client/inspector/grids/components/Grid.js | 62 +- .../grids/components/GridDisplaySettings.js | 120 +- .../inspector/grids/components/GridItem.js | 114 +- .../inspector/grids/components/GridList.js | 48 +- .../inspector/grids/components/GridOutline.js | 235 +-- .../client/inspector/grids/grid-inspector.js | 166 +- .../client/inspector/grids/reducers/grids.js | 17 +- .../grids/reducers/highlighter-settings.js | 7 +- .../test/browser_grids_accordion-state.js | 50 +- ...rowser_grids_color-in-rules-grid-toggle.js | 29 +- ...grids_display-setting-extend-grid-lines.js | 24 +- ...r_grids_display-setting-show-grid-areas.js | 24 +- ..._display-setting-show-grid-line-numbers.js | 30 +- ...ser_grids_grid-list-color-picker-on-ESC.js | 39 +- ..._grids_grid-list-color-picker-on-RETURN.js | 39 +- .../browser_grids_grid-list-element-rep.js | 30 +- .../test/browser_grids_grid-list-no-grids.js | 10 +- ...wser_grids_grid-list-on-iframe-reloaded.js | 23 +- ...ids_grid-list-on-mutation-element-added.js | 39 +- ...s_grid-list-on-mutation-element-removed.js | 10 +- .../test/browser_grids_grid-list-subgrids.js | 95 +- ...browser_grids_grid-list-toggle-grids_01.js | 19 +- ...browser_grids_grid-list-toggle-grids_02.js | 43 +- ...r_grids_grid-list-toggle-multiple-grids.js | 207 ++- ..._grids_grid-outline-cannot-show-outline.js | 17 +- ...owser_grids_grid-outline-highlight-area.js | 27 +- ...owser_grids_grid-outline-highlight-cell.js | 21 +- ...owser_grids_grid-outline-multiple-grids.js | 32 +- ...rowser_grids_grid-outline-selected-grid.js | 13 +- ...ids_grid-outline-updates-on-grid-change.js | 6 +- ...browser_grids_grid-outline-writing-mode.js | 56 +- ...s_highlighter-setting-rules-grid-toggle.js | 15 +- ...wser_grids_highlighter-toggle-telemetry.js | 21 +- ...ser_grids_number-of-css-grids-telemetry.js | 19 +- .../browser_grids_persist-color-palette.js | 24 +- .../browser_grids_restored-after-reload.js | 61 +- ...ds_restored-multiple-grids-after-reload.js | 122 +- devtools/client/inspector/grids/test/head.js | 6 +- .../unit/test_compare_fragments_geometry.js | 175 +- .../client/inspector/grids/utils/utils.js | 14 +- devtools/client/inspector/inspector-search.js | 31 +- devtools/client/inspector/inspector.js | 563 +++++-- .../inspector/layout/components/Accordion.js | 28 +- .../inspector/layout/components/LayoutApp.js | 79 +- devtools/client/inspector/layout/layout.js | 42 +- .../client/inspector/layout/utils/l10n.js | 4 +- .../inspector/markup/components/TextNode.js | 34 +- .../inspector/markup/markup-context-menu.js | 773 +++++---- devtools/client/inspector/markup/markup.js | 566 ++++--- ...browser_markup_accessibility_focus_blur.js | 50 +- ...browser_markup_accessibility_navigation.js | 48 +- ...kup_accessibility_navigation_after_edit.js | 20 +- ...wser_markup_accessibility_new_selection.js | 16 +- .../browser_markup_accessibility_semantics.js | 124 +- .../test/browser_markup_anonymous_01.js | 9 +- .../test/browser_markup_anonymous_02.js | 2 +- .../test/browser_markup_anonymous_03.js | 2 +- .../test/browser_markup_anonymous_04.js | 8 +- .../markup/test/browser_markup_copy_html.js | 34 +- .../test/browser_markup_copy_image_data.js | 40 +- ...arkup_css_completion_style_attribute_01.js | 86 +- ...arkup_css_completion_style_attribute_02.js | 50 +- ...arkup_css_completion_style_attribute_03.js | 37 +- .../test/browser_markup_display_node_01.js | 39 +- .../test/browser_markup_display_node_02.js | 51 +- .../browser_markup_dragdrop_autoscroll_01.js | 2 +- .../browser_markup_dragdrop_autoscroll_02.js | 2 +- ...er_markup_dragdrop_before_marker_pseudo.js | 43 +- .../test/browser_markup_dragdrop_distance.js | 2 +- .../browser_markup_dragdrop_dragRootNode.js | 2 +- .../test/browser_markup_dragdrop_draggable.js | 8 +- .../browser_markup_dragdrop_escapeKeyPress.js | 25 +- .../browser_markup_dragdrop_invalidNodes.js | 7 +- .../test/browser_markup_dragdrop_reorder.js | 61 +- .../test/browser_markup_dragdrop_tooltip.js | 10 +- .../test/browser_markup_events-overflow.js | 31 +- .../browser_markup_events-windowed-host.js | 13 +- .../markup/test/browser_markup_events_01.js | 88 +- .../markup/test/browser_markup_events_02.js | 95 +- .../markup/test/browser_markup_events_03.js | 57 +- .../markup/test/browser_markup_events_04.js | 100 +- .../browser_markup_events_chrome_blocked.js | 4 +- ...rowser_markup_events_chrome_not_blocked.js | 9 +- .../browser_markup_events_click_to_close.js | 33 +- .../browser_markup_events_object_listener.js | 18 +- ..._markup_events_react_development_15.4.1.js | 4 +- ...kup_events_react_development_15.4.1_jsx.js | 7 +- ...r_markup_events_react_production_15.3.1.js | 4 +- ...rkup_events_react_production_15.3.1_jsx.js | 7 +- ...r_markup_events_react_production_16.2.0.js | 4 +- ...rkup_events_react_production_16.2.0_jsx.js | 7 +- .../test/browser_markup_events_source_map.js | 9 +- .../test/browser_markup_flex_display_badge.js | 57 +- ...ser_markup_flex_display_badge_telemetry.js | 11 +- .../browser_markup_grid_display_badge_01.js | 67 +- .../browser_markup_grid_display_badge_02.js | 273 ++- ...ser_markup_grid_display_badge_telemetry.js | 10 +- .../test/browser_markup_html_edit_01.js | 136 +- .../test/browser_markup_html_edit_02.js | 63 +- .../test/browser_markup_html_edit_03.js | 246 ++- .../browser_markup_html_edit_undo-redo.js | 50 +- .../test/browser_markup_image_tooltip.js | 31 +- .../browser_markup_image_tooltip_mutations.js | 30 +- .../test/browser_markup_keybindings_01.js | 4 +- .../test/browser_markup_keybindings_02.js | 4 +- .../test/browser_markup_keybindings_03.js | 47 +- .../test/browser_markup_keybindings_04.js | 33 +- ...er_markup_keybindings_delete_attributes.js | 49 +- ...browser_markup_keybindings_scrolltonode.js | 12 +- .../markup/test/browser_markup_links_01.js | 247 +-- .../markup/test/browser_markup_links_02.js | 19 +- .../markup/test/browser_markup_links_03.js | 11 +- .../markup/test/browser_markup_links_04.js | 164 +- .../markup/test/browser_markup_links_05.js | 24 +- .../markup/test/browser_markup_links_06.js | 6 +- .../markup/test/browser_markup_links_07.js | 54 +- .../markup/test/browser_markup_load_01.js | 21 +- .../markup/test/browser_markup_mutation_01.js | 207 ++- .../markup/test/browser_markup_mutation_02.js | 128 +- .../markup/test/browser_markup_navigation.js | 26 +- .../markup/test/browser_markup_node_names.js | 19 +- .../browser_markup_node_names_namespaced.js | 24 +- .../browser_markup_node_not_displayed_01.js | 23 +- .../browser_markup_node_not_displayed_02.js | 23 +- .../markup/test/browser_markup_pagesize_01.js | 62 +- .../markup/test/browser_markup_pagesize_02.js | 10 +- .../test/browser_markup_pseudo_on_reload.js | 10 +- .../browser_markup_remove_xul_attributes.js | 15 +- .../test/browser_markup_screenshot_node.js | 6 +- .../browser_markup_screenshot_node_iframe.js | 6 +- ...rowser_markup_screenshot_node_shadowdom.js | 12 +- .../test/browser_markup_scrollable_badge.js | 12 +- .../markup/test/browser_markup_search_01.js | 16 +- .../markup/test/browser_markup_shadowdom.js | 32 +- .../browser_markup_shadowdom_clickreveal.js | 35 +- ...ser_markup_shadowdom_clickreveal_scroll.js | 12 +- .../browser_markup_shadowdom_copy_paths.js | 40 +- .../test/browser_markup_shadowdom_delete.js | 19 +- .../test/browser_markup_shadowdom_dynamic.js | 10 +- .../test/browser_markup_shadowdom_hover.js | 13 +- ...kup_shadowdom_marker_and_before_pseudos.js | 17 +- .../browser_markup_shadowdom_maxchildren.js | 41 +- ...owser_markup_shadowdom_mutations_shadow.js | 18 +- .../browser_markup_shadowdom_navigation.js | 32 +- ...er_markup_shadowdom_nested_pick_inspect.js | 55 +- .../test/browser_markup_shadowdom_noslot.js | 10 +- .../browser_markup_shadowdom_open_debugger.js | 31 +- ...rowser_markup_shadowdom_shadowroot_mode.js | 2 +- ...wser_markup_shadowdom_show_nodes_button.js | 7 +- ...markup_shadowdom_slotted_keyboard_focus.js | 6 +- .../browser_markup_shadowdom_slotupdate.js | 2 +- .../browser_markup_shadowdom_ua_widgets.js | 41 +- ...er_markup_shadowdom_ua_widgets_with_nac.js | 31 +- .../browser_markup_subgrid_display_badge.js | 70 +- ...owser_markup_tag_delete_whitespace_node.js | 23 +- .../markup/test/browser_markup_tag_edit_01.js | 104 +- .../markup/test/browser_markup_tag_edit_02.js | 45 +- .../markup/test/browser_markup_tag_edit_03.js | 26 +- .../browser_markup_tag_edit_04-backspace.js | 42 +- .../test/browser_markup_tag_edit_04-delete.js | 42 +- .../markup/test/browser_markup_tag_edit_05.js | 105 +- .../markup/test/browser_markup_tag_edit_06.js | 121 +- .../markup/test/browser_markup_tag_edit_07.js | 216 +-- .../markup/test/browser_markup_tag_edit_08.js | 102 +- .../markup/test/browser_markup_tag_edit_09.js | 50 +- .../markup/test/browser_markup_tag_edit_10.js | 16 +- .../markup/test/browser_markup_tag_edit_11.js | 2 +- .../markup/test/browser_markup_tag_edit_12.js | 32 +- .../test/browser_markup_tag_edit_13-other.js | 8 +- .../browser_markup_tag_edit_avoid_refocus.js | 21 +- .../browser_markup_tag_edit_long-classname.js | 27 +- .../markup/test/browser_markup_template.js | 15 +- .../browser_markup_textcontent_display.js | 122 +- .../browser_markup_textcontent_edit_01.js | 71 +- .../browser_markup_textcontent_edit_02.js | 18 +- .../markup/test/browser_markup_toggle_01.js | 31 +- .../markup/test/browser_markup_toggle_02.js | 31 +- .../markup/test/browser_markup_toggle_03.js | 32 +- .../markup/test/browser_markup_toggle_04.js | 13 +- .../browser_markup_toggle_closing_tag_line.js | 26 +- .../browser_markup_update-on-navigtion.js | 6 +- .../browser_markup_view-original-source.js | 27 +- .../markup/test/browser_markup_view-source.js | 33 +- .../test/browser_markup_void_elements_html.js | 30 +- .../browser_markup_void_elements_xhtml.js | 24 +- .../markup/test/browser_markup_whitespace.js | 49 +- devtools/client/inspector/markup/test/head.js | 190 ++- .../test/helper_attributes_test_runner.js | 17 +- .../markup/test/helper_events_test_runner.js | 77 +- .../helper_markup_accessibility_navigation.js | 20 +- .../test/helper_outerhtml_test_runner.js | 38 +- .../markup/test/helper_screenshot_node.js | 15 +- .../test/helper_style_attr_test_runner.js | 28 +- devtools/client/inspector/markup/utils.js | 25 +- .../client/inspector/markup/utils/l10n.js | 4 +- .../markup/views/element-container.js | 56 +- .../inspector/markup/views/element-editor.js | 283 +++- .../inspector/markup/views/html-editor.js | 7 +- .../markup/views/markup-container.js | 80 +- .../markup/views/read-only-container.js | 13 +- .../inspector/markup/views/root-container.js | 5 +- .../markup/views/slotted-node-container.js | 13 +- .../markup/views/slotted-node-editor.js | 11 +- .../inspector/markup/views/text-container.js | 10 +- .../inspector/markup/views/text-editor.js | 51 +- .../inspector/rules/actions/class-list.js | 7 +- .../client/inspector/rules/actions/index.js | 57 +- .../inspector/rules/actions/pseudo-classes.js | 2 - .../client/inspector/rules/actions/rules.js | 2 - .../rules/components/ClassListPanel.js | 70 +- .../inspector/rules/components/Declaration.js | 265 +-- .../rules/components/Declarations.js | 39 +- .../rules/components/PseudoClassPanel.js | 43 +- .../client/inspector/rules/components/Rule.js | 140 +- .../inspector/rules/components/Rules.js | 5 +- .../inspector/rules/components/RulesApp.js | 69 +- .../inspector/rules/components/SearchBox.js | 25 +- .../inspector/rules/components/Selector.js | 73 +- .../rules/components/SelectorHighlighter.js | 23 +- .../inspector/rules/components/SourceLink.js | 31 +- .../inspector/rules/components/Toolbar.js | 108 +- .../inspector/rules/models/class-list.js | 39 +- .../inspector/rules/models/element-style.js | 253 +-- .../client/inspector/rules/models/rule.js | 160 +- .../inspector/rules/models/text-property.js | 16 +- devtools/client/inspector/rules/new-rules.js | 154 +- .../inspector/rules/reducers/class-list.js | 2 - .../rules/reducers/pseudo-classes.js | 19 +- .../client/inspector/rules/reducers/rules.js | 9 +- devtools/client/inspector/rules/rules.js | 506 ++++-- ...browser_rules_add-property-and-reselect.js | 2 +- .../browser_rules_add-property-cancel_01.js | 29 +- .../browser_rules_add-property-cancel_02.js | 23 +- .../browser_rules_add-property-cancel_03.js | 23 +- .../browser_rules_add-property-commented.js | 12 +- .../test/browser_rules_add-property-svg.js | 9 +- .../test/browser_rules_add-property_01.js | 2 +- .../test/browser_rules_add-property_02.js | 36 +- .../browser_rules_add-rule-and-property.js | 6 +- .../browser_rules_add-rule-button-state.js | 2 +- .../browser_rules_add-rule-edit-selector.js | 2 +- .../test/browser_rules_add-rule-iframes.js | 5 +- ...owser_rules_add-rule-namespace-elements.js | 4 +- .../browser_rules_add-rule-pseudo-class.js | 2 +- ...es_add-rule-then-property-edit-selector.js | 9 +- .../test/browser_rules_add-rule-with-menu.js | 9 +- .../rules/test/browser_rules_add-rule.js | 4 +- .../rules/test/browser_rules_authored.js | 64 +- .../test/browser_rules_authored_color.js | 33 +- .../test/browser_rules_authored_override.js | 28 +- .../test/browser_rules_blob_stylesheet.js | 16 +- .../test/browser_rules_class_panel_add.js | 86 +- .../test/browser_rules_class_panel_content.js | 134 +- .../test/browser_rules_class_panel_edit.js | 28 +- ...browser_rules_class_panel_invalid_nodes.js | 10 +- .../browser_rules_class_panel_mutation.js | 30 +- ...owser_rules_class_panel_state_preserved.js | 13 +- .../test/browser_rules_class_panel_toggle.js | 17 +- .../rules/test/browser_rules_colorUnit.js | 27 +- ..._rules_colorpicker-and-image-tooltip_01.js | 12 +- ..._rules_colorpicker-and-image-tooltip_02.js | 12 +- ...les_colorpicker-appears-on-swatch-click.js | 8 +- ...owser_rules_colorpicker-commit-on-ENTER.js | 44 +- ...browser_rules_colorpicker-edit-gradient.js | 20 +- ..._rules_colorpicker-hides-element-picker.js | 3 +- ...wser_rules_colorpicker-hides-on-tooltip.js | 12 +- ...wser_rules_colorpicker-multiple-changes.js | 46 +- ...rules_colorpicker-release-outside-frame.js | 35 +- ...browser_rules_colorpicker-revert-on-ESC.js | 42 +- ...wser_rules_colorpicker-swatch-displayed.js | 24 +- ...r_rules_completion-existing-property_01.js | 25 +- ...r_rules_completion-existing-property_02.js | 27 +- ...rowser_rules_completion-new-property_01.js | 18 +- ...rowser_rules_completion-new-property_02.js | 27 +- ...rowser_rules_completion-new-property_03.js | 11 +- ...rowser_rules_completion-new-property_04.js | 28 +- ...rules_completion-new-property_multiline.js | 35 +- ...ompletion-popup-hidden-after-navigation.js | 7 +- .../test/browser_rules_computed-lists_01.js | 40 +- .../test/browser_rules_computed-lists_02.js | 39 +- .../test/browser_rules_computed-lists_03.js | 12 +- .../rules/test/browser_rules_content_01.js | 44 +- .../rules/test/browser_rules_content_02.js | 44 +- .../rules/test/browser_rules_copy_styles.js | 201 ++- .../rules/test/browser_rules_cssom.js | 8 +- ...les_cubicbezier-appears-on-swatch-click.js | 32 +- ...owser_rules_cubicbezier-commit-on-ENTER.js | 41 +- ...browser_rules_cubicbezier-revert-on-ESC.js | 35 +- .../rules/test/browser_rules_custom.js | 42 +- .../rules/test/browser_rules_cycle-angle.js | 59 +- .../rules/test/browser_rules_cycle-color.js | 140 +- ...rowser_rules_edit-display-grid-property.js | 2 +- .../browser_rules_edit-property-cancel.js | 36 +- .../test/browser_rules_edit-property-click.js | 2 +- .../browser_rules_edit-property-commit.js | 28 +- .../browser_rules_edit-property-computed.js | 53 +- .../browser_rules_edit-property-increments.js | 387 +++-- .../test/browser_rules_edit-property-order.js | 110 +- .../browser_rules_edit-property-remove_01.js | 26 +- .../browser_rules_edit-property-remove_02.js | 26 +- .../browser_rules_edit-property-remove_03.js | 40 +- .../browser_rules_edit-property-remove_04.js | 2 +- .../test/browser_rules_edit-property_01.js | 34 +- .../test/browser_rules_edit-property_02.js | 55 +- .../test/browser_rules_edit-property_03.js | 12 +- .../test/browser_rules_edit-property_04.js | 38 +- .../test/browser_rules_edit-property_05.js | 20 +- .../test/browser_rules_edit-property_06.js | 44 +- .../test/browser_rules_edit-property_07.js | 37 +- .../test/browser_rules_edit-property_08.js | 18 +- .../test/browser_rules_edit-property_09.js | 24 +- ..._rules_edit-selector-click-on-scrollbar.js | 29 +- .../test/browser_rules_edit-selector-click.js | 48 +- .../browser_rules_edit-selector-commit.js | 54 +- .../test/browser_rules_edit-selector_01.js | 15 +- .../test/browser_rules_edit-selector_02.js | 23 +- .../test/browser_rules_edit-selector_03.js | 22 +- .../test/browser_rules_edit-selector_04.js | 21 +- .../test/browser_rules_edit-selector_05.js | 15 +- .../test/browser_rules_edit-selector_06.js | 38 +- .../test/browser_rules_edit-selector_07.js | 15 +- .../test/browser_rules_edit-selector_08.js | 24 +- .../test/browser_rules_edit-selector_09.js | 38 +- .../test/browser_rules_edit-selector_10.js | 8 +- .../test/browser_rules_edit-selector_11.js | 8 +- .../test/browser_rules_edit-selector_12.js | 8 +- .../browser_rules_edit-value-after-name_01.js | 42 +- .../browser_rules_edit-value-after-name_02.js | 30 +- .../browser_rules_edit-value-after-name_03.js | 28 +- .../browser_rules_edit-value-after-name_04.js | 32 +- .../browser_rules_editable-field-focus_01.js | 44 +- .../browser_rules_editable-field-focus_02.js | 58 +- .../rules/test/browser_rules_eyedropper.js | 42 +- ...es_filtereditor-appears-on-swatch-click.js | 15 +- ...wser_rules_filtereditor-commit-on-ENTER.js | 16 +- ...rowser_rules_filtereditor-revert-on-ESC.js | 24 +- ...r_rules_flexbox-highlighter-on-mutation.js | 4 +- ...r_rules_flexbox-highlighter-on-navigate.js | 4 +- ...ser_rules_flexbox-highlighter-on-reload.js | 8 +- ...exbox-highlighter-restored-after-reload.js | 11 +- .../browser_rules_flexbox-toggle-telemetry.js | 12 +- .../test/browser_rules_flexbox-toggle_01.js | 46 +- .../test/browser_rules_flexbox-toggle_01b.js | 46 +- .../test/browser_rules_flexbox-toggle_02.js | 75 +- .../test/browser_rules_flexbox-toggle_03.js | 99 +- .../test/browser_rules_flexbox-toggle_04.js | 46 +- .../test/browser_rules_font-family-parsing.js | 21 +- ...wser_rules_grid-highlighter-on-mutation.js | 2 +- ...wser_rules_grid-highlighter-on-navigate.js | 2 +- ...rowser_rules_grid-highlighter-on-reload.js | 8 +- ..._grid-highlighter-restored-after-reload.js | 11 +- .../browser_rules_grid-toggle-telemetry.js | 2 +- .../test/browser_rules_grid-toggle_01.js | 47 +- .../test/browser_rules_grid-toggle_01b.js | 47 +- .../test/browser_rules_grid-toggle_02.js | 66 +- .../test/browser_rules_grid-toggle_03.js | 109 +- .../test/browser_rules_grid-toggle_04.js | 47 +- .../test/browser_rules_grid-toggle_05.js | 71 +- ...ules_gridline-names-are-shown-correctly.js | 85 +- ...owser_rules_gridline-names-autocomplete.js | 60 +- .../test/browser_rules_guessIndentation.js | 2 +- .../browser_rules_highlight-element-rule.js | 12 +- .../test/browser_rules_highlight-property.js | 27 +- .../browser_rules_highlight-used-fonts.js | 41 +- .../browser_rules_inactive_css_flexbox.js | 10 +- .../test/browser_rules_inactive_css_grid.js | 2 +- .../browser_rules_inherited-properties_01.js | 25 +- .../browser_rules_inherited-properties_02.js | 8 +- .../browser_rules_inherited-properties_03.js | 24 +- .../browser_rules_inherited-properties_04.js | 5 +- .../test/browser_rules_inline-source-map.js | 2 +- .../test/browser_rules_inline-style-order.js | 37 +- .../test/browser_rules_invalid-source-map.js | 7 +- .../rules/test/browser_rules_invalid.js | 2 +- .../rules/test/browser_rules_keybindings.js | 2 +- .../browser_rules_keyframes-rule-shadowdom.js | 10 +- .../test/browser_rules_keyframes-rule_01.js | 42 +- .../test/browser_rules_keyframes-rule_02.js | 14 +- .../rules/test/browser_rules_lineNumbers.js | 5 +- .../rules/test/browser_rules_livepreview.js | 25 +- .../test/browser_rules_mark_overridden_01.js | 46 +- .../test/browser_rules_mark_overridden_02.js | 14 +- .../test/browser_rules_mark_overridden_03.js | 2 +- .../test/browser_rules_mark_overridden_04.js | 8 +- .../test/browser_rules_mark_overridden_05.js | 2 +- .../test/browser_rules_mark_overridden_06.js | 16 +- .../test/browser_rules_mark_overridden_07.js | 18 +- .../test/browser_rules_mark_overridden_08.js | 28 +- .../test/browser_rules_mathml-element.js | 32 +- .../rules/test/browser_rules_media-queries.js | 9 +- .../browser_rules_media-queries_reload.js | 7 +- ...er_rules_multiple-properties-duplicates.js | 120 +- ...wser_rules_multiple-properties-priority.js | 64 +- ...rules_multiple-properties-unfinished_01.js | 92 +- ...rules_multiple-properties-unfinished_02.js | 91 +- .../browser_rules_multiple_properties_01.js | 78 +- .../browser_rules_multiple_properties_02.js | 65 +- .../rules/test/browser_rules_non_ascii.js | 13 +- .../browser_rules_original-source-link.js | 24 +- .../browser_rules_original-source-link2.js | 19 +- .../browser_rules_preview-tooltips-sizes.js | 61 +- .../test/browser_rules_pseudo-element_01.js | 315 ++-- .../test/browser_rules_pseudo-element_02.js | 30 +- .../test/browser_rules_pseudo_lock_options.js | 53 +- .../test/browser_rules_refresh-no-flicker.js | 35 +- ...er_rules_refresh-on-attribute-change_01.js | 33 +- .../browser_rules_refresh-on-style-change.js | 16 +- ...er_rules_search-filter-computed-list_01.js | 87 +- ...er_rules_search-filter-computed-list_02.js | 78 +- ...er_rules_search-filter-computed-list_03.js | 21 +- ...er_rules_search-filter-computed-list_04.js | 45 +- ...es_search-filter-computed-list_expander.js | 72 +- ...rules_search-filter-overridden-property.js | 50 +- .../test/browser_rules_search-filter_01.js | 32 +- .../test/browser_rules_search-filter_02.js | 15 +- .../test/browser_rules_search-filter_03.js | 9 +- .../test/browser_rules_search-filter_04.js | 39 +- .../test/browser_rules_search-filter_05.js | 15 +- .../test/browser_rules_search-filter_06.js | 9 +- .../test/browser_rules_search-filter_07.js | 21 +- .../test/browser_rules_search-filter_08.js | 21 +- .../test/browser_rules_search-filter_09.js | 24 +- .../test/browser_rules_search-filter_10.js | 41 +- ...rowser_rules_search-filter_context-menu.js | 8 +- ...ser_rules_search-filter_escape-keypress.js | 22 +- .../browser_rules_select-and-copy-styles.js | 106 +- ..._rules_selector-highlighter-on-navigate.js | 12 +- .../browser_rules_selector-highlighter_01.js | 8 +- .../browser_rules_selector-highlighter_02.js | 30 +- .../browser_rules_selector-highlighter_03.js | 26 +- .../browser_rules_selector-highlighter_04.js | 26 +- .../browser_rules_selector-highlighter_05.js | 25 +- .../test/browser_rules_selector_highlight.js | 73 +- .../browser_rules_shadowdom_slot_rules.js | 22 +- .../test/browser_rules_shapes-toggle_01.js | 54 +- .../test/browser_rules_shapes-toggle_02.js | 37 +- .../test/browser_rules_shapes-toggle_03.js | 104 +- .../test/browser_rules_shapes-toggle_04.js | 6 +- .../test/browser_rules_shapes-toggle_05.js | 2 +- .../test/browser_rules_shapes-toggle_06.js | 79 +- .../test/browser_rules_shapes-toggle_07.js | 65 +- ...rowser_rules_shorthand-overridden-lists.js | 54 +- ...ser_rules_shorthand-overridden-lists_01.js | 6 +- ...s_strict-search-filter-computed-list_01.js | 101 +- .../browser_rules_strict-search-filter_01.js | 75 +- .../browser_rules_strict-search-filter_02.js | 15 +- .../browser_rules_strict-search-filter_03.js | 17 +- .../test/browser_rules_style-editor-link.js | 69 +- .../browser_rules_url-click-opens-new-tab.js | 15 +- .../test/browser_rules_urls-clickable.js | 40 +- ...wser_rules_user-agent-styles-uneditable.js | 29 +- .../test/browser_rules_user-agent-styles.js | 71 +- .../test/browser_rules_user-property-reset.js | 46 +- .../rules/test/browser_rules_variables_01.js | 61 +- .../rules/test/browser_rules_variables_02.js | 320 ++-- ...owser_rules_variables_03-case-sensitive.js | 22 +- .../inspector/rules/test/doc_frame_script.js | 26 +- devtools/client/inspector/rules/test/head.js | 178 +- devtools/client/inspector/rules/types.js | 30 +- devtools/client/inspector/rules/utils/l10n.js | 4 +- .../rules/views/class-list-previewer.js | 33 +- .../inspector/rules/views/rule-editor.js | 158 +- .../rules/views/text-property-editor.js | 352 ++-- .../inspector/shared/highlighters-overlay.js | 265 ++- .../inspector/shared/style-inspector-menu.js | 107 +- ...yleinspector_context-menu-copy-color_01.js | 17 +- ...yleinspector_context-menu-copy-color_02.js | 39 +- ...r_styleinspector_context-menu-copy-urls.js | 109 +- ...einspector_csslogic-content-stylesheets.js | 47 +- .../browser_styleinspector_output-parser.js | 80 +- ...wser_styleinspector_refresh_when_active.js | 30 +- ...yleinspector_refresh_when_style_changes.js | 88 +- ...styleinspector_tooltip-background-image.js | 52 +- ...spector_tooltip-closes-on-new-selection.js | 16 +- ...leinspector_tooltip-longhand-fontfamily.js | 84 +- ...ctor_tooltip-multiple-background-images.js | 12 +- ...einspector_tooltip-shorthand-fontfamily.js | 24 +- .../browser_styleinspector_tooltip-size.js | 30 +- ...styleinspector_transform-highlighter-01.js | 23 +- ...styleinspector_transform-highlighter-02.js | 24 +- ...styleinspector_transform-highlighter-03.js | 57 +- ...styleinspector_transform-highlighter-04.js | 26 +- .../inspector/shared/test/doc_frame_script.js | 25 +- devtools/client/inspector/shared/test/head.js | 38 +- .../inspector/shared/tooltips-overlay.js | 175 +- devtools/client/inspector/shared/utils.js | 39 +- .../test/browser_inspector_addNode_01.js | 9 +- .../test/browser_inspector_addNode_02.js | 44 +- .../test/browser_inspector_addNode_03.js | 40 +- .../test/browser_inspector_addSidebarTab.js | 37 +- .../test/browser_inspector_breadcrumbs.js | 148 +- ...r_inspector_breadcrumbs_highlight_hover.js | 39 +- ...rowser_inspector_breadcrumbs_keybinding.js | 76 +- ...ser_inspector_breadcrumbs_keyboard_trap.js | 25 +- ...browser_inspector_breadcrumbs_mutations.js | 327 ++-- ...rowser_inspector_breadcrumbs_namespaced.js | 34 +- ...browser_inspector_breadcrumbs_shadowdom.js | 49 +- ...rowser_inspector_breadcrumbs_visibility.js | 24 +- ...owser_inspector_delete-selected-node-01.js | 9 +- ...owser_inspector_delete-selected-node-02.js | 83 +- .../test/browser_inspector_expand-collapse.js | 27 +- .../test/browser_inspector_highlighter-01.js | 18 +- .../test/browser_inspector_highlighter-02.js | 15 +- .../test/browser_inspector_highlighter-03.js | 49 +- .../test/browser_inspector_highlighter-04.js | 36 +- .../test/browser_inspector_highlighter-05.js | 15 +- .../test/browser_inspector_highlighter-07.js | 48 +- .../browser_inspector_highlighter-by-type.js | 22 +- .../browser_inspector_highlighter-cancel.js | 30 +- .../browser_inspector_highlighter-comments.js | 37 +- ...rowser_inspector_highlighter-cssgrid_01.js | 20 +- ...rowser_inspector_highlighter-cssgrid_02.js | 15 +- ...owser_inspector_highlighter-cssshape_01.js | 24 +- ...owser_inspector_highlighter-cssshape_02.js | 80 +- ...owser_inspector_highlighter-cssshape_03.js | 70 +- ...owser_inspector_highlighter-cssshape_04.js | 288 +++- ...owser_inspector_highlighter-cssshape_05.js | 72 +- ...inspector_highlighter-cssshape_06-scale.js | 70 +- ...ector_highlighter-cssshape_06-translate.js | 39 +- ...owser_inspector_highlighter-cssshape_07.js | 58 +- ...nspector_highlighter-cssshape_iframe_01.js | 10 +- ...r_inspector_highlighter-csstransform_01.js | 115 +- ...r_inspector_highlighter-csstransform_02.js | 25 +- .../browser_inspector_highlighter-embed.js | 12 +- ...pector_highlighter-eyedropper-clipboard.js | 23 +- ...er_inspector_highlighter-eyedropper-csp.js | 13 +- ...inspector_highlighter-eyedropper-events.js | 96 +- ..._inspector_highlighter-eyedropper-image.js | 9 +- ..._inspector_highlighter-eyedropper-label.js | 121 +- ...pector_highlighter-eyedropper-show-hide.js | 15 +- ...er_inspector_highlighter-eyedropper-xul.js | 2 +- ...owser_inspector_highlighter-geometry_01.js | 21 +- ...owser_inspector_highlighter-geometry_02.js | 89 +- ...owser_inspector_highlighter-geometry_03.js | 39 +- ...owser_inspector_highlighter-geometry_04.js | 70 +- ...owser_inspector_highlighter-geometry_05.js | 157 +- ...owser_inspector_highlighter-geometry_06.js | 94 +- .../browser_inspector_highlighter-hover_01.js | 12 +- .../browser_inspector_highlighter-hover_02.js | 14 +- .../browser_inspector_highlighter-hover_03.js | 6 +- ...rowser_inspector_highlighter-iframes_01.js | 65 +- ...rowser_inspector_highlighter-iframes_02.js | 9 +- .../browser_inspector_highlighter-inline.js | 57 +- ...ser_inspector_highlighter-keybinding_01.js | 42 +- ...ser_inspector_highlighter-keybinding_02.js | 46 +- ...ser_inspector_highlighter-keybinding_03.js | 36 +- ...ser_inspector_highlighter-keybinding_04.js | 8 +- ...rowser_inspector_highlighter-measure_01.js | 18 +- ...rowser_inspector_highlighter-measure_02.js | 22 +- .../browser_inspector_highlighter-options.js | 109 +- .../browser_inspector_highlighter-preview.js | 20 +- ...browser_inspector_highlighter-rulers_01.js | 25 +- ...browser_inspector_highlighter-rulers_02.js | 126 +- ...browser_inspector_highlighter-rulers_03.js | 22 +- ...owser_inspector_highlighter-selector_01.js | 79 +- ...owser_inspector_highlighter-selector_02.js | 61 +- .../test/browser_inspector_highlighter-xbl.js | 13 +- .../browser_inspector_highlighter-zoom.js | 23 +- .../browser_inspector_iframe-navigation.js | 5 +- .../test/browser_inspector_infobar_01.js | 28 +- .../test/browser_inspector_infobar_02.js | 5 +- .../test/browser_inspector_infobar_03.js | 24 +- .../test/browser_inspector_infobar_04.js | 8 +- .../test/browser_inspector_infobar_05.js | 6 +- .../browser_inspector_infobar_textnode.js | 11 +- .../test/browser_inspector_initialization.js | 14 +- ...rowser_inspector_inspect-object-element.js | 3 +- ...wser_inspector_inspect_node_contextmenu.js | 19 +- .../test/browser_inspector_invalidate.js | 13 +- ...ector_keyboard-shortcuts-copy-outerhtml.js | 6 +- .../browser_inspector_keyboard-shortcuts.js | 17 +- .../browser_inspector_menu-01-sensitivity.js | 42 +- ...owser_inspector_menu-03-paste-items-svg.js | 14 +- .../browser_inspector_menu-03-paste-items.js | 70 +- ...rowser_inspector_menu-04-use-in-console.js | 14 +- ...owser_inspector_menu-05-attribute-items.js | 27 +- .../test/browser_inspector_menu-06-other.js | 58 +- .../browser_inspector_navigate_to_errors.js | 33 +- .../test/browser_inspector_navigation.js | 17 +- .../browser_inspector_open_on_neterror.js | 32 +- .../test/browser_inspector_pane-toggle-01.js | 16 +- .../test/browser_inspector_pane-toggle-02.js | 64 +- .../test/browser_inspector_pane-toggle-03.js | 21 +- .../test/browser_inspector_pane-toggle-04.js | 18 +- .../browser_inspector_pane_state_restore.js | 49 +- ...er_inspector_picker-stop-on-tool-change.js | 3 +- .../test/browser_inspector_portrait_mode.js | 10 +- .../browser_inspector_pseudoclass-lock.js | 92 +- .../browser_inspector_pseudoclass-menu.js | 14 +- .../test/browser_inspector_reload-02.js | 25 +- .../test/browser_inspector_reload_xul.js | 7 +- ...ser_inspector_remove-iframe-during-load.js | 34 +- .../test/browser_inspector_search-01.js | 101 +- .../test/browser_inspector_search-02.js | 91 +- .../test/browser_inspector_search-03.js | 155 +- .../test/browser_inspector_search-04.js | 79 +- .../test/browser_inspector_search-05.js | 10 +- .../test/browser_inspector_search-06.js | 37 +- .../test/browser_inspector_search-07.js | 44 +- .../test/browser_inspector_search-08.js | 44 +- .../test/browser_inspector_search-clear.js | 15 +- ...er_inspector_search-filter_context-menu.js | 10 +- .../browser_inspector_search-navigation.js | 3 +- .../test/browser_inspector_search-reserved.js | 54 +- .../browser_inspector_search-selection.js | 31 +- .../test/browser_inspector_search-sidebar.js | 35 +- ...spector_search-suggests-ids-and-classes.js | 53 +- .../browser_inspector_search_keyboard_trap.js | 18 +- .../test/browser_inspector_select-docshell.js | 57 +- .../browser_inspector_select-last-selected.js | 7 +- .../test/browser_inspector_sidebarstate.js | 30 +- .../test/browser_inspector_startup.js | 16 +- ...r_inspector_switch-to-inspector-on-pick.js | 13 +- .../test/browser_inspector_textbox-menu.js | 19 +- ...r_inspector_textbox-menu_reopen_toolbox.js | 17 +- devtools/client/inspector/test/head.js | 382 +++-- devtools/client/inspector/test/shared-head.js | 152 +- devtools/client/inspector/toolsidebar.js | 31 +- .../client/jsonview/components/Headers.js | 68 +- .../jsonview/components/HeadersPanel.js | 11 +- .../jsonview/components/HeadersToolbar.js | 74 +- .../client/jsonview/components/JsonPanel.js | 59 +- .../client/jsonview/components/JsonToolbar.js | 44 +- .../client/jsonview/components/LiveText.js | 2 +- .../jsonview/components/MainTabbedArea.js | 73 +- .../client/jsonview/components/SearchBox.js | 10 +- .../client/jsonview/components/TextPanel.js | 17 +- .../client/jsonview/components/TextToolbar.js | 125 +- .../jsonview/components/reps/Toolbar.js | 17 +- devtools/client/jsonview/converter-child.js | 155 +- .../client/jsonview/converter-observer.js | 64 +- devtools/client/jsonview/json-viewer.js | 61 +- .../jsonview/test/browser_json_refresh.js | 94 +- .../test/browser_jsonview_chunked_json.js | 41 +- .../test/browser_jsonview_content_type.js | 50 +- .../test/browser_jsonview_copy_headers.js | 19 +- .../test/browser_jsonview_copy_json.js | 23 +- .../test/browser_jsonview_copy_rawdata.js | 39 +- .../test/browser_jsonview_empty_object.js | 12 +- .../test/browser_jsonview_encoding.js | 32 +- .../test/browser_jsonview_expand_collapse.js | 17 +- .../jsonview/test/browser_jsonview_filter.js | 3 +- .../jsonview/test/browser_jsonview_nojs.js | 8 +- .../jsonview/test/browser_jsonview_nul.js | 5 +- .../test/browser_jsonview_object-type.js | 4 +- .../test/browser_jsonview_row_selection.js | 158 +- .../test/browser_jsonview_save_json.js | 60 +- .../test/browser_jsonview_serviceworker.js | 66 +- .../jsonview/test/browser_jsonview_slash.js | 6 +- .../browser_jsonview_url_linkification.js | 24 +- .../test/browser_jsonview_valid_json.js | 11 +- .../client/jsonview/test/doc_frame_script.js | 29 +- devtools/client/jsonview/test/head.js | 138 +- devtools/client/jsonview/viewer-config.js | 16 +- .../client/memory/actions/census-display.js | 18 +- devtools/client/memory/actions/diffing.js | 63 +- devtools/client/memory/actions/filter.js | 12 +- devtools/client/memory/actions/io.js | 18 +- .../client/memory/actions/label-display.js | 18 +- devtools/client/memory/actions/refresh.js | 5 +- devtools/client/memory/actions/snapshot.js | 393 +++-- devtools/client/memory/actions/task-cache.js | 46 +- .../client/memory/actions/tree-map-display.js | 18 +- devtools/client/memory/actions/view.js | 8 +- devtools/client/memory/app.js | 363 ++-- devtools/client/memory/components/Census.js | 19 +- .../memory/components/CensusTreeItem.js | 59 +- .../client/memory/components/DominatorTree.js | 71 +- .../memory/components/DominatorTreeHeader.js | 2 +- .../memory/components/DominatorTreeItem.js | 44 +- devtools/client/memory/components/Heap.js | 213 ++- .../client/memory/components/Individuals.js | 12 +- .../memory/components/IndividualsHeader.js | 2 +- devtools/client/memory/components/List.js | 21 +- .../client/memory/components/ShortestPaths.js | 10 +- .../memory/components/SnapshotListItem.js | 84 +- devtools/client/memory/components/Toolbar.js | 223 +-- devtools/client/memory/components/TreeMap.js | 10 +- .../components/tree-map/canvas-utils.js | 6 +- .../components/tree-map/color-coarse-type.js | 2 +- .../memory/components/tree-map/drag-zoom.js | 88 +- .../client/memory/components/tree-map/draw.js | 58 +- .../memory/components/tree-map/start.js | 14 +- devtools/client/memory/constants.js | 37 +- .../memory/dominator-tree-lazy-children.js | 4 +- devtools/client/memory/initializer.js | 10 +- devtools/client/memory/models.js | 146 +- devtools/client/memory/panel.js | 5 +- .../client/memory/reducers/allocations.js | 24 +- devtools/client/memory/reducers/diffing.js | 66 +- devtools/client/memory/reducers/errors.js | 4 +- .../client/memory/reducers/individuals.js | 12 +- devtools/client/memory/reducers/sizes.js | 2 +- devtools/client/memory/reducers/snapshots.js | 224 ++- ...rowser_memory_allocationStackDisplay_01.js | 23 +- .../browser/browser_memory_clear_snapshots.js | 50 +- .../test/browser/browser_memory_diff_01.js | 59 +- .../browser/browser_memory_displays_01.js | 17 +- .../browser_memory_dominator_trees_01.js | 91 +- .../browser_memory_dominator_trees_02.js | 49 +- .../test/browser/browser_memory_filter_01.js | 80 +- .../browser/browser_memory_individuals_01.js | 34 +- .../browser_memory_keyboard-snapshot-list.js | 33 +- .../test/browser/browser_memory_keyboard.js | 22 +- .../browser_memory_no_allocation_stacks.js | 38 +- .../browser/browser_memory_no_auto_expand.js | 18 +- .../browser/browser_memory_percents_01.js | 27 +- .../browser_memory_refresh_does_not_leak.js | 56 +- .../test/browser/browser_memory_simple_01.js | 37 +- ...ser_memory_transferHeapSnapshot_e10s_01.js | 12 +- .../browser/browser_memory_tree_map-01.js | 114 +- .../browser/browser_memory_tree_map-02.js | 148 +- devtools/client/memory/test/browser/head.js | 85 +- devtools/client/memory/test/chrome/head.js | 99 +- devtools/client/memory/test/unit/head.js | 63 +- .../unit/test_action-clear-snapshots_01.js | 5 +- .../unit/test_action-clear-snapshots_02.js | 32 +- .../unit/test_action-clear-snapshots_03.js | 16 +- .../unit/test_action-clear-snapshots_04.js | 21 +- .../unit/test_action-clear-snapshots_05.js | 11 +- .../unit/test_action-clear-snapshots_06.js | 21 +- .../test/unit/test_action-export-snapshot.js | 9 +- .../memory/test/unit/test_action-filter-02.js | 49 +- .../memory/test/unit/test_action-filter-03.js | 47 +- .../test_action-import-snapshot-and-census.js | 73 +- ...t_action-import-snapshot-dominator-tree.js | 37 +- .../test/unit/test_action-select-snapshot.js | 13 +- .../test_action-set-display-and-refresh-01.js | 169 +- .../test_action-set-display-and-refresh-02.js | 42 +- .../test/unit/test_action-set-display.js | 42 +- .../test/unit/test_action-take-census.js | 25 +- .../test_action-take-snapshot-and-census.js | 19 +- .../test/unit/test_action-take-snapshot.js | 16 +- ...t_action-toggle-inverted-and-refresh-01.js | 47 +- ...t_action-toggle-inverted-and-refresh-02.js | 53 +- .../test/unit/test_action-toggle-inverted.js | 14 +- ...est_action-toggle-recording-allocations.js | 11 +- .../test/unit/test_action_diffing_02.js | 23 +- .../test/unit/test_action_diffing_03.js | 98 +- .../test/unit/test_action_diffing_04.js | 72 +- .../test/unit/test_action_diffing_05.js | 89 +- .../test/unit/test_dominator_trees_01.js | 57 +- .../test/unit/test_dominator_trees_02.js | 57 +- .../test/unit/test_dominator_trees_03.js | 57 +- .../test/unit/test_dominator_trees_04.js | 69 +- .../test/unit/test_dominator_trees_05.js | 24 +- .../test/unit/test_dominator_trees_06.js | 91 +- .../test/unit/test_dominator_trees_07.js | 96 +- .../test/unit/test_dominator_trees_08.js | 89 +- .../test/unit/test_dominator_trees_09.js | 74 +- .../test/unit/test_dominator_trees_10.js | 68 +- .../memory/test/unit/test_individuals_01.js | 26 +- .../memory/test/unit/test_individuals_02.js | 34 +- .../memory/test/unit/test_individuals_03.js | 45 +- .../memory/test/unit/test_individuals_04.js | 33 +- .../memory/test/unit/test_individuals_05.js | 23 +- .../memory/test/unit/test_individuals_06.js | 26 +- .../memory/test/unit/test_pop_view_01.js | 16 +- .../memory/test/unit/test_tree-map-01.js | 34 +- .../memory/test/unit/test_tree-map-02.js | 68 +- .../unit/test_utils-get-snapshot-totals.js | 60 +- .../client/memory/test/unit/test_utils.js | 101 +- devtools/client/memory/utils.js | 50 +- devtools/client/menus.js | 106 +- devtools/client/netmonitor/initializer.js | 20 +- .../client/netmonitor/src/actions/index.js | 5 +- .../client/netmonitor/src/actions/requests.js | 2 +- .../netmonitor/src/actions/selection.js | 4 +- .../netmonitor/src/actions/timing-markers.js | 2 +- devtools/client/netmonitor/src/api.js | 32 +- devtools/client/netmonitor/src/app.js | 34 +- .../client/netmonitor/src/components/App.js | 36 +- .../netmonitor/src/components/CachePanel.js | 192 +-- .../netmonitor/src/components/CookiesPanel.js | 39 +- .../src/components/CustomRequestPanel.js | 260 +-- .../src/components/DropHarHandler.js | 27 +- .../netmonitor/src/components/HeadersPanel.js | 316 ++-- .../netmonitor/src/components/HtmlPreview.js | 13 +- .../netmonitor/src/components/MonitorPanel.js | 92 +- .../src/components/NetworkDetailsPanel.js | 27 +- .../netmonitor/src/components/ParamsPanel.js | 76 +- .../src/components/PropertiesView.js | 151 +- .../netmonitor/src/components/RequestList.js | 16 +- .../src/components/RequestListColumnCause.js | 22 +- .../RequestListColumnContentSize.js | 8 +- .../components/RequestListColumnCookies.js | 18 +- .../src/components/RequestListColumnDomain.js | 43 +- .../src/components/RequestListColumnFile.js | 35 +- .../src/components/RequestListColumnMethod.js | 5 +- .../components/RequestListColumnProtocol.js | 13 +- .../components/RequestListColumnRemoteIP.js | 12 +- .../RequestListColumnResponseHeader.js | 7 +- .../src/components/RequestListColumnScheme.js | 11 +- .../components/RequestListColumnSetCookies.js | 20 +- .../src/components/RequestListColumnStatus.js | 13 +- .../src/components/RequestListColumnTime.js | 22 +- .../RequestListColumnTransferredSize.js | 17 +- .../src/components/RequestListColumnType.js | 7 +- .../src/components/RequestListColumnUrl.js | 62 +- .../components/RequestListColumnWaterfall.js | 59 +- .../src/components/RequestListContent.js | 117 +- .../src/components/RequestListEmptyNotice.js | 23 +- .../src/components/RequestListHeader.js | 148 +- .../src/components/RequestListItem.js | 72 +- .../src/components/ResponsePanel.js | 89 +- .../src/components/SecurityPanel.js | 143 +- .../src/components/SecurityState.js | 39 +- .../netmonitor/src/components/SourceEditor.js | 14 +- .../src/components/StackTracePanel.js | 41 +- .../src/components/StatisticsPanel.js | 123 +- .../netmonitor/src/components/StatusBar.js | 151 +- .../netmonitor/src/components/StatusCode.js | 49 +- .../netmonitor/src/components/TabboxPanel.js | 155 +- .../netmonitor/src/components/TimingsPanel.js | 50 +- .../netmonitor/src/components/Toolbar.js | 393 +++-- .../src/connector/chrome-connector.js | 10 +- .../src/connector/chrome/bulk-loader.js | 16 +- .../netmonitor/src/connector/chrome/events.js | 107 +- .../src/connector/chrome/request.js | 62 +- .../src/connector/chrome/response.js | 21 +- .../netmonitor/src/connector/chrome/utils.js | 100 +- .../src/connector/firefox-connector.js | 75 +- .../src/connector/firefox-data-provider.js | 152 +- devtools/client/netmonitor/src/constants.js | 21 +- .../client/netmonitor/src/create-store.js | 14 +- .../netmonitor/src/har/har-automation.js | 23 +- .../client/netmonitor/src/har/har-builder.js | 104 +- .../netmonitor/src/har/har-collector.js | 108 +- .../client/netmonitor/src/har/har-exporter.js | 92 +- .../client/netmonitor/src/har/har-importer.js | 34 +- .../netmonitor/src/har/har-menu-utils.js | 20 +- .../client/netmonitor/src/har/har-utils.js | 29 +- .../test/browser_net_har_copy_all_as_har.js | 20 +- .../src/har/test/browser_net_har_import.js | 58 +- .../src/har/test/browser_net_har_post_data.js | 27 +- .../test/browser_net_har_post_data_on_get.js | 13 +- .../test/browser_net_har_throttle_upload.js | 20 +- .../client/netmonitor/src/har/test/head.js | 6 +- .../netmonitor/src/har/toolbox-overlay.js | 10 +- .../netmonitor/src/middleware/batching.js | 9 +- .../src/middleware/event-telemetry.js | 51 +- .../client/netmonitor/src/middleware/prefs.js | 30 +- .../netmonitor/src/middleware/recording.js | 8 +- .../client/netmonitor/src/middleware/thunk.js | 2 +- .../client/netmonitor/src/reducers/filters.js | 29 +- .../netmonitor/src/reducers/requests.js | 15 +- .../netmonitor/src/reducers/timing-markers.js | 12 +- devtools/client/netmonitor/src/reducers/ui.js | 13 +- .../client/netmonitor/src/selectors/index.js | 7 +- .../netmonitor/src/selectors/requests.js | 43 +- .../client/netmonitor/src/selectors/ui.js | 26 +- .../src/utils/filter-autocomplete-provider.js | 52 +- .../netmonitor/src/utils/filter-predicates.js | 43 +- .../netmonitor/src/utils/filter-text-utils.js | 29 +- .../src/utils/firefox/open-request-in-tab.js | 18 +- .../netmonitor/src/utils/format-utils.js | 20 +- .../netmonitor/src/utils/headers-provider.js | 9 +- .../client/netmonitor/src/utils/mdn-utils.js | 22 +- .../src/utils/open-request-in-tab.js | 11 +- .../netmonitor/src/utils/request-utils.js | 117 +- .../netmonitor/src/utils/sort-predicates.js | 42 +- .../client/netmonitor/src/utils/sort-utils.js | 22 +- .../src/widgets/PropertiesViewContextMenu.js | 14 +- .../src/widgets/RequestListContextMenu.js | 193 ++- .../widgets/RequestListHeaderContextMenu.js | 35 +- .../src/widgets/WaterfallBackground.js | 32 +- .../test/browser_net_accessibility-01.js | 20 +- .../test/browser_net_accessibility-02.js | 26 +- .../netmonitor/test/browser_net_api-calls.js | 9 +- .../netmonitor/test/browser_net_autoscroll.js | 22 +- .../test/browser_net_background_update.js | 17 +- .../netmonitor/test/browser_net_block-csp.js | 7 +- .../netmonitor/test/browser_net_block.js | 40 +- .../netmonitor/test/browser_net_brotli.js | 31 +- .../test/browser_net_cached-status.js | 7 +- .../netmonitor/test/browser_net_cause.js | 68 +- .../test/browser_net_cause_redirect.js | 16 +- .../test/browser_net_cause_source_map.js | 7 +- .../netmonitor/test/browser_net_charts-01.js | 113 +- .../netmonitor/test/browser_net_charts-02.js | 38 +- .../netmonitor/test/browser_net_charts-03.js | 203 ++- .../netmonitor/test/browser_net_charts-04.js | 85 +- .../netmonitor/test/browser_net_charts-05.js | 60 +- .../netmonitor/test/browser_net_charts-06.js | 36 +- .../netmonitor/test/browser_net_charts-07.js | 61 +- .../netmonitor/test/browser_net_clear.js | 28 +- .../browser_net_column_headers_tooltips.js | 9 +- .../test/browser_net_columns_last_column.js | 11 +- .../test/browser_net_columns_pref.js | 30 +- .../test/browser_net_columns_reset.js | 12 +- .../test/browser_net_columns_showhide.js | 118 +- .../test/browser_net_columns_time.js | 14 +- .../test/browser_net_complex-params.js | 406 +++-- .../test/browser_net_content-type.js | 142 +- .../test/browser_net_cookies_sorted.js | 48 +- .../test/browser_net_copy_as_curl.js | 120 +- .../test/browser_net_copy_as_fetch.js | 56 +- .../test/browser_net_copy_headers.js | 72 +- .../browser_net_copy_image_as_data_uri.js | 17 +- .../test/browser_net_copy_params.js | 125 +- .../test/browser_net_copy_response.js | 12 +- .../browser_net_copy_svg_image_as_data_uri.js | 28 +- .../netmonitor/test/browser_net_copy_url.js | 18 +- .../test/browser_net_cors_requests.js | 13 +- .../netmonitor/test/browser_net_curl-utils.js | 177 +- .../test/browser_net_cyrillic-01.js | 27 +- .../test/browser_net_cyrillic-02.js | 28 +- .../test/browser_net_decode-params.js | 24 +- .../netmonitor/test/browser_net_decode-url.js | 18 +- .../test/browser_net_edit_resend_cancel.js | 21 +- .../test/browser_net_edit_resend_caret.js | 29 +- .../browser_net_edit_resend_with_filtering.js | 22 +- .../test/browser_net_edit_resend_xhr.js | 13 +- .../netmonitor/test/browser_net_filter-01.js | 272 ++- .../netmonitor/test/browser_net_filter-02.js | 157 +- .../netmonitor/test/browser_net_filter-03.js | 97 +- .../netmonitor/test/browser_net_filter-04.js | 39 +- .../test/browser_net_filter-autocomplete.js | 183 +- .../test/browser_net_filter-flags.js | 39 +- .../browser_net_filter-value-preserved.js | 19 +- .../test/browser_net_footer-summary.js | 61 +- .../netmonitor/test/browser_net_frame.js | 92 +- .../test/browser_net_header-docs.js | 32 +- .../test/browser_net_header-ref-policy.js | 35 +- .../test/browser_net_headers-alignment.js | 12 +- .../test/browser_net_headers-resize.js | 82 +- .../test/browser_net_headers_filter.js | 47 +- .../test/browser_net_headers_sorted.js | 115 +- .../test/browser_net_image-tooltip.js | 47 +- .../netmonitor/test/browser_net_json-b64.js | 79 +- .../netmonitor/test/browser_net_json-empty.js | 53 +- .../netmonitor/test/browser_net_json-long.js | 122 +- .../test/browser_net_json-malformed.js | 63 +- .../test/browser_net_json-nogrip.js | 25 +- .../netmonitor/test/browser_net_json-null.js | 82 +- .../test/browser_net_json_custom_mime.js | 89 +- .../test/browser_net_json_text_mime.js | 89 +- .../netmonitor/test/browser_net_jsonp.js | 97 +- .../test/browser_net_large-response.js | 26 +- .../test/browser_net_open_in_debugger.js | 19 +- .../test/browser_net_open_in_style_editor.js | 24 +- .../test/browser_net_open_request_in_tab.js | 67 +- .../test/browser_net_pane-collapse.js | 50 +- .../test/browser_net_pane-network-details.js | 105 +- .../test/browser_net_pane-toggle.js | 93 +- .../test/browser_net_params_sorted.js | 30 +- .../netmonitor/test/browser_net_pause.js | 7 +- .../test/browser_net_persistent_logs.js | 33 +- .../test/browser_net_post-data-01.js | 203 ++- .../test/browser_net_post-data-02.js | 72 +- .../test/browser_net_post-data-03.js | 121 +- .../test/browser_net_post-data-04.js | 66 +- .../test/browser_net_prefs-and-l10n.js | 58 +- .../test/browser_net_prefs-reload.js | 152 +- .../test/browser_net_propertiesview-copy.js | 57 +- .../test/browser_net_raw_headers.js | 66 +- .../test/browser_net_reload-button.js | 13 +- .../test/browser_net_reload-markers.js | 10 +- .../test/browser_net_req-resp-bodies.js | 16 +- .../netmonitor/test/browser_net_resend.js | 102 +- .../test/browser_net_resend_cors.js | 53 +- .../test/browser_net_resend_headers.js | 8 +- .../netmonitor/test/browser_net_resend_xhr.js | 10 +- .../test/browser_net_response-ui-limit.js | 9 +- .../test/browser_net_security-details.js | 51 +- .../test/browser_net_security-error.js | 6 +- .../test/browser_net_security-icon-click.js | 38 +- .../test/browser_net_security-redirect.js | 35 +- .../test/browser_net_security-state.js | 28 +- .../test/browser_net_security-tab-deselect.js | 28 +- .../browser_net_security-tab-visibility.js | 92 +- .../test/browser_net_security-warnings.js | 18 +- .../test/browser_net_send-beacon-other-tab.js | 18 +- .../test/browser_net_send-beacon.js | 17 +- .../test/browser_net_service-worker-status.js | 27 +- .../test/browser_net_set-cookie-same-site.js | 68 +- .../test/browser_net_simple-request-data.js | 345 ++-- .../browser_net_simple-request-details.js | 272 ++- .../test/browser_net_simple-request.js | 80 +- .../netmonitor/test/browser_net_sort-01.js | 210 ++- .../netmonitor/test/browser_net_sort-02.js | 312 ++-- .../netmonitor/test/browser_net_sort-reset.js | 201 ++- .../test/browser_net_statistics-01.js | 37 +- .../test/browser_net_statistics-02.js | 62 +- ...browser_net_status-bar-transferred-size.js | 22 +- .../netmonitor/test/browser_net_status-bar.js | 12 +- .../test/browser_net_status-codes.js | 135 +- .../test/browser_net_streaming-response.js | 31 +- .../test/browser_net_telemetry_edit_resend.js | 13 +- .../browser_net_telemetry_filters_changed.js | 69 +- ...er_net_telemetry_persist_toggle_changed.js | 8 +- ...browser_net_telemetry_sidepanel_changed.js | 31 +- .../browser_net_telemetry_throttle_changed.js | 13 +- .../netmonitor/test/browser_net_throttle.js | 10 +- .../test/browser_net_timeline_ticks.js | 161 +- .../test/browser_net_timing-division.js | 34 +- .../test/browser_net_tracking-resources.js | 25 +- .../test/browser_net_truncate-post-data.js | 39 +- .../netmonitor/test/browser_net_truncate.js | 28 +- .../test/browser_net_use_as_fetch.js | 44 +- .../test/browser_net_view-source-debugger.js | 16 +- .../test/browser_net_waterfall-click.js | 12 +- .../test/browser_net_websocket_stacks.js | 22 +- .../test/browser_net_worker_stacks.js | 20 +- devtools/client/netmonitor/test/head.js | 510 ++++-- .../netmonitor/test/reducers/sort.spec.js | 2 +- .../status-codes-service-worker.js | 4 +- .../netmonitor/test/unit/test_mdn-utils.js | 45 +- ...t_request-utils-js-getFormattedProtocol.js | 152 +- devtools/client/netmonitor/webpack.config.js | 97 +- devtools/client/performance-new/browser.js | 64 +- .../performance-new/components/Description.js | 17 +- .../components/DirectoryPicker.js | 31 +- .../client/performance-new/components/Perf.js | 110 +- .../performance-new/components/Range.js | 55 +- .../components/RecordingButton.js | 47 +- .../performance-new/components/Settings.js | 203 ++- .../client/performance-new/frame-script.js | 38 +- .../client/performance-new/initializer.js | 50 +- .../performance-new/popup/background.jsm | 79 +- .../performance-new/popup/initializer.js | 5 +- .../performance-new/popup/menu-button.jsm | 31 +- .../client/performance-new/popup/popup.js | 53 +- .../client/performance-new/store/actions.js | 91 +- .../client/performance-new/store/reducers.js | 6 +- .../client/performance-new/store/selectors.js | 7 +- .../performance-new/test/chrome/head.js | 52 +- devtools/client/performance-new/utils.js | 6 +- .../components/JITOptimizations.js | 57 +- .../components/JITOptimizationsItem.js | 87 +- .../performance/components/RecordingButton.js | 10 +- .../components/RecordingControls.js | 46 +- .../performance/components/RecordingList.js | 10 +- .../components/RecordingListItem.js | 24 +- .../performance/components/WaterfallHeader.js | 13 +- .../performance/components/WaterfallTree.js | 9 +- .../components/WaterfallTreeRow.js | 31 +- .../performance/components/test/head.js | 234 ++- devtools/client/performance/events.js | 6 +- devtools/client/performance/initializer.js | 4 +- .../client/performance/modules/categories.js | 96 +- devtools/client/performance/modules/io.js | 8 +- .../performance/modules/logic/frame-utils.js | 108 +- .../client/performance/modules/logic/jit.js | 34 +- .../performance/modules/logic/telemetry.js | 41 +- .../performance/modules/logic/tree-model.js | 67 +- .../modules/logic/waterfall-utils.js | 25 +- .../modules/marker-blueprint-utils.js | 16 +- .../performance/modules/marker-dom-utils.js | 52 +- .../performance/modules/marker-formatters.js | 25 +- .../client/performance/modules/markers.js | 46 +- devtools/client/performance/modules/utils.js | 5 +- .../performance/modules/waterfall-ticks.js | 10 +- .../performance/modules/widgets/graphs.js | 53 +- .../modules/widgets/marker-details.js | 33 +- .../modules/widgets/markers-overview.js | 48 +- .../performance/modules/widgets/tree-view.js | 122 +- devtools/client/performance/panel.js | 20 +- .../performance/performance-controller.js | 54 +- .../client/performance/performance-view.js | 123 +- .../test/browser_aaa-run-first-leaktest.js | 20 +- .../test/browser_perf-button-states.js | 63 +- .../browser_perf-calltree-js-categories.js | 48 +- .../test/browser_perf-calltree-js-columns.js | 55 +- .../test/browser_perf-calltree-js-events.js | 35 +- .../browser_perf-calltree-memory-columns.js | 58 +- .../test/browser_perf-console-record-01.js | 28 +- .../test/browser_perf-console-record-02.js | 60 +- .../test/browser_perf-console-record-03.js | 56 +- .../test/browser_perf-console-record-04.js | 33 +- .../test/browser_perf-console-record-05.js | 71 +- .../test/browser_perf-console-record-06.js | 61 +- .../test/browser_perf-console-record-07.js | 169 +- .../test/browser_perf-console-record-08.js | 107 +- .../test/browser_perf-console-record-09.js | 39 +- .../test/browser_perf-details-01-toggle.js | 44 +- .../browser_perf-details-02-utility-fun.js | 38 +- ...ser_perf-details-03-without-allocations.js | 115 +- ...browser_perf-details-04-toolbar-buttons.js | 280 +++- .../browser_perf-details-05-preserve-view.js | 33 +- ...r_perf-details-06-rerender-on-selection.js | 46 +- .../browser_perf-details-07-bleed-events.js | 27 +- ...rowser_perf-details-render-00-waterfall.js | 27 +- ...wser_perf-details-render-01-js-calltree.js | 19 +- ...er_perf-details-render-02-js-flamegraph.js | 19 +- ..._perf-details-render-03-memory-calltree.js | 28 +- ...erf-details-render-04-memory-flamegraph.js | 29 +- .../performance/test/browser_perf-docload.js | 33 +- .../test/browser_perf-highlighted.js | 40 +- .../test/browser_perf-loading-01.js | 63 +- .../test/browser_perf-loading-02.js | 109 +- .../browser_perf-options-01-toggle-throw.js | 15 +- ...rowser_perf-options-02-toggle-throw-alt.js | 10 +- .../browser_perf-options-03-toggle-meta.js | 33 +- ...rowser_perf-options-enable-framerate-01.js | 57 +- ...rowser_perf-options-enable-framerate-02.js | 28 +- .../browser_perf-options-enable-memory-01.js | 82 +- .../browser_perf-options-enable-memory-02.js | 42 +- ..._perf-options-flatten-tree-recursion-01.js | 70 +- ..._perf-options-flatten-tree-recursion-02.js | 89 +- ...rowser_perf-options-invert-call-tree-01.js | 18 +- ...rowser_perf-options-invert-call-tree-02.js | 24 +- ...wser_perf-options-invert-flame-graph-01.js | 18 +- ...wser_perf-options-invert-flame-graph-02.js | 29 +- ...wser_perf-options-propagate-allocations.js | 35 +- ...browser_perf-options-propagate-profiler.js | 15 +- ...rowser_perf-options-show-idle-blocks-01.js | 18 +- ...rowser_perf-options-show-idle-blocks-02.js | 29 +- ...wser_perf-options-show-platform-data-01.js | 18 +- ...wser_perf-options-show-platform-data-02.js | 18 +- .../test/browser_perf-overview-render-01.js | 14 +- .../test/browser_perf-overview-render-02.js | 159 +- .../test/browser_perf-overview-render-03.js | 104 +- .../test/browser_perf-overview-render-04.js | 66 +- .../browser_perf-overview-selection-01.js | 72 +- .../browser_perf-overview-selection-02.js | 95 +- .../browser_perf-overview-selection-03.js | 86 +- .../browser_perf-overview-time-interval.js | 47 +- .../test/browser_perf-private-browsing.js | 61 +- .../test/browser_perf-range-changed-render.js | 35 +- .../test/browser_perf-recording-notices-01.js | 16 +- .../test/browser_perf-recording-notices-02.js | 45 +- .../test/browser_perf-recording-notices-03.js | 133 +- .../test/browser_perf-recording-notices-04.js | 63 +- .../test/browser_perf-recording-notices-05.js | 19 +- .../browser_perf-recording-selected-01.js | 44 +- .../browser_perf-recording-selected-02.js | 58 +- .../browser_perf-recording-selected-03.js | 30 +- .../browser_perf-recording-selected-04.js | 15 +- .../test/browser_perf-recordings-clear-01.js | 73 +- .../test/browser_perf-recordings-clear-02.js | 101 +- .../performance/test/browser_perf-refresh.js | 21 +- .../performance/test/browser_perf-states.js | 200 ++- .../test/browser_perf-telemetry-01.js | 56 +- .../test/browser_perf-telemetry-02.js | 36 +- .../test/browser_perf-telemetry-03.js | 42 +- .../test/browser_perf-telemetry-04.js | 52 +- .../test/browser_perf-tree-abstract-01.js | 229 ++- .../test/browser_perf-tree-abstract-02.js | 227 ++- .../test/browser_perf-tree-abstract-03.js | 188 ++- .../test/browser_perf-tree-abstract-04.js | 19 +- .../test/browser_perf-tree-abstract-05.js | 78 +- .../test/browser_perf-tree-view-01.js | 129 +- .../test/browser_perf-tree-view-02.js | 362 ++-- .../test/browser_perf-tree-view-03.js | 193 ++- .../test/browser_perf-tree-view-04.js | 171 +- .../test/browser_perf-tree-view-05.js | 43 +- .../test/browser_perf-tree-view-06.js | 24 +- .../test/browser_perf-tree-view-07.js | 40 +- .../test/browser_perf-tree-view-08.js | 174 +- .../test/browser_perf-tree-view-09.js | 91 +- .../test/browser_perf-tree-view-10.js | 239 +-- .../test/browser_perf-ui-recording.js | 34 +- .../browser_timeline-waterfall-background.js | 26 +- .../browser_timeline-waterfall-generic.js | 139 +- devtools/client/performance/test/head.js | 30 +- .../performance/test/helpers/actions.js | 59 +- .../performance/test/helpers/dom-utils.js | 6 +- .../performance/test/helpers/event-utils.js | 71 +- .../performance/test/helpers/input-utils.js | 17 +- .../performance/test/helpers/panel-utils.js | 9 +- .../client/performance/test/helpers/prefs.js | 18 +- .../test/helpers/profiler-mm-utils.js | 24 +- .../performance/test/helpers/synth-utils.js | 154 +- .../performance/test/helpers/tab-utils.js | 20 +- .../client/performance/test/helpers/urls.js | 3 +- .../performance/test/helpers/wait-utils.js | 9 +- devtools/client/performance/test/unit/head.js | 17 +- .../test/unit/test_frame-utils-01.js | 226 ++- .../test/unit/test_frame-utils-02.js | 98 +- .../test/unit/test_jit-graph-data.js | 113 +- .../test/unit/test_jit-model-01.js | 108 +- .../test/unit/test_jit-model-02.js | 165 +- .../test/unit/test_marker-blueprint.js | 31 +- .../test/unit/test_marker-utils.js | 223 ++- .../test_perf-utils-allocations-to-samples.js | 72 +- .../test/unit/test_profiler-categories.js | 22 +- .../test/unit/test_tree-model-01.js | 319 ++-- .../test/unit/test_tree-model-02.js | 94 +- .../test/unit/test_tree-model-03.js | 150 +- .../test/unit/test_tree-model-04.js | 159 +- .../test/unit/test_tree-model-05.js | 91 +- .../test/unit/test_tree-model-06.js | 171 +- .../test/unit/test_tree-model-07.js | 163 +- .../test/unit/test_tree-model-08.js | 277 +++- .../test/unit/test_tree-model-09.js | 131 +- .../test/unit/test_tree-model-10.js | 196 +-- .../test/unit/test_tree-model-11.js | 104 +- .../test/unit/test_tree-model-12.js | 143 +- .../test/unit/test_tree-model-13.js | 128 +- .../unit/test_tree-model-allocations-01.js | 70 +- .../unit/test_tree-model-allocations-02.js | 122 +- .../unit/test_waterfall-utils-collapse-01.js | 69 +- .../unit/test_waterfall-utils-collapse-02.js | 50 +- .../unit/test_waterfall-utils-collapse-03.js | 50 +- .../unit/test_waterfall-utils-collapse-04.js | 95 +- .../unit/test_waterfall-utils-collapse-05.js | 181 +- .../views/details-abstract-subview.js | 71 +- .../performance/views/details-js-call-tree.js | 74 +- .../views/details-js-flamegraph.js | 34 +- .../views/details-memory-call-tree.js | 22 +- .../views/details-memory-flamegraph.js | 15 +- .../performance/views/details-waterfall.js | 39 +- devtools/client/performance/views/details.js | 44 +- devtools/client/performance/views/overview.js | 57 +- .../client/performance/views/recordings.js | 81 +- devtools/client/performance/views/toolbar.js | 44 +- .../client/scratchpad/scratchpad-manager.jsm | 27 +- devtools/client/scratchpad/scratchpad.js | 511 ++++-- .../test/browser_scratchpad_autocomplete.js | 36 +- ..._scratchpad_browser_last_window_closing.js | 5 +- .../browser_scratchpad_chrome_context_pref.js | 35 +- .../test/browser_scratchpad_close_toolbox.js | 13 +- .../test/browser_scratchpad_confirm_close.js | 188 ++- .../test/browser_scratchpad_contexts.js | 262 +-- ...wser_scratchpad_disable_view_menu_items.js | 23 +- ...scratchpad_display_non_error_exceptions.js | 137 +- ...owser_scratchpad_display_outputs_errors.js | 83 +- .../browser_scratchpad_edit_ui_updates.js | 55 +- .../test/browser_scratchpad_eval_func.js | 42 +- .../test/browser_scratchpad_execute_print.js | 158 +- .../test/browser_scratchpad_falsy.js | 39 +- .../test/browser_scratchpad_files.js | 75 +- .../test/browser_scratchpad_goto_line_ui.js | 9 +- .../test/browser_scratchpad_help_key.js | 7 +- .../test/browser_scratchpad_initialization.js | 37 +- .../test/browser_scratchpad_inspect.js | 5 +- .../test/browser_scratchpad_long_string.js | 13 +- .../test/browser_scratchpad_menubar.js | 7 +- .../test/browser_scratchpad_modeline.js | 26 +- .../test/browser_scratchpad_open.js | 117 +- .../browser_scratchpad_open_error_console.js | 8 +- .../test/browser_scratchpad_recent_files.js | 141 +- .../test/browser_scratchpad_reload_and_run.js | 37 +- ...rowser_scratchpad_remember_view_options.js | 54 +- .../test/browser_scratchpad_reset_undo.js | 95 +- .../test/browser_scratchpad_restore.js | 83 +- .../browser_scratchpad_revert_to_saved.js | 92 +- .../browser_scratchpad_run_error_goto_line.js | 99 +- .../test/browser_scratchpad_sessions.js | 60 +- .../scratchpad/test/browser_scratchpad_tab.js | 5 +- .../test/browser_scratchpad_tab_switch.js | 65 +- .../test/browser_scratchpad_throw_output.js | 34 +- .../scratchpad/test/browser_scratchpad_ui.js | 18 +- .../test/browser_scratchpad_unsaved.js | 135 +- .../browser_scratchpad_wrong_window_focus.js | 46 +- devtools/client/scratchpad/test/head.js | 60 +- devtools/client/shared/DOMHelpers.jsm | 30 +- devtools/client/shared/SplitView.jsm | 97 +- devtools/client/shared/autocomplete-popup.js | 52 +- .../client/shared/browser-loader-mocks.js | 2 +- devtools/client/shared/browser-loader.js | 58 +- devtools/client/shared/build/build.js | 7 +- .../client/shared/components/Accordion.js | 97 +- .../shared/components/AutoCompletePopup.js | 51 +- devtools/client/shared/components/Frame.js | 159 +- .../client/shared/components/HSplitBox.js | 15 +- devtools/client/shared/components/List.js | 99 +- devtools/client/shared/components/MdnLink.js | 19 +- .../shared/components/NotificationBox.js | 101 +- .../client/shared/components/SearchBox.js | 54 +- devtools/client/shared/components/Sidebar.js | 40 +- .../client/shared/components/SidebarToggle.js | 18 +- .../client/shared/components/SmartTrace.js | 134 +- .../client/shared/components/StackTrace.js | 57 +- .../shared/components/VirtualizedTree.js | 149 +- .../shared/components/menu/MenuButton.js | 68 +- .../client/shared/components/menu/MenuItem.js | 5 +- .../client/shared/components/menu/MenuList.js | 22 +- .../client/shared/components/menu/utils.js | 4 +- .../shared/components/splitter/SplitBox.js | 148 +- .../client/shared/components/tabs/TabBar.js | 110 +- .../client/shared/components/tabs/Tabs.js | 107 +- .../browser/browser_notification_box_basic.js | 4 +- .../test/mochitest/accordion.snapshots.js | 144 +- .../shared/components/test/mochitest/head.js | 77 +- .../throttling/NetworkThrottlingMenu.js | 41 +- .../shared/components/throttling/profiles.js | 64 +- .../shared/components/throttling/reducer.js | 4 +- .../shared/components/tree/LabelCell.js | 21 +- .../shared/components/tree/ObjectProvider.js | 16 +- .../client/shared/components/tree/TreeCell.js | 36 +- .../shared/components/tree/TreeHeader.js | 52 +- .../client/shared/components/tree/TreeRow.js | 14 +- .../client/shared/components/tree/TreeView.js | 79 +- devtools/client/shared/css-angle.js | 31 +- devtools/client/shared/curl.js | 71 +- devtools/client/shared/devices.js | 4 +- devtools/client/shared/enum.js | 2 - .../client/shared/fluent-l10n/fluent-l10n.js | 5 +- devtools/client/shared/getjson.js | 27 +- devtools/client/shared/inplace-editor.js | 325 ++-- devtools/client/shared/key-shortcuts.js | 128 +- devtools/client/shared/natural-sort.js | 31 +- .../client/shared/node-attribute-parser.js | 370 +++-- devtools/client/shared/options-view.js | 2 +- devtools/client/shared/output-parser.js | 741 ++++++--- devtools/client/shared/prefs.js | 21 +- devtools/client/shared/redux/create-store.js | 19 +- .../shared/redux/middleware/debounce.js | 12 +- .../client/shared/redux/middleware/history.js | 8 +- .../client/shared/redux/middleware/promise.js | 74 +- .../client/shared/redux/middleware/task.js | 38 +- .../test/test_middleware-task-01.js | 25 +- .../test/test_middleware-task-02.js | 47 +- .../test/test_middleware-task-03.js | 26 +- .../client/shared/redux/middleware/thunk.js | 2 +- .../shared/redux/middleware/wait-service.js | 2 +- .../redux/visibility-handler-connect.js | 9 +- .../remote-debugging/remote-client-manager.js | 4 +- .../test/unit/test_remote_client_manager.js | 162 +- .../test/unit/test_version_checker.js | 25 +- .../remote-debugging/version-checker.js | 6 +- devtools/client/shared/scroll.js | 45 +- devtools/client/shared/source-utils.js | 120 +- .../shared/sourceeditor/autocomplete.js | 126 +- .../shared/sourceeditor/css-autocompleter.js | 214 ++- .../client/shared/sourceeditor/debugger.js | 45 +- .../editor-commands-controller.js | 12 +- devtools/client/shared/sourceeditor/editor.js | 179 +- .../sourceeditor/test/browser_codemirror.js | 10 +- .../test/browser_css_autocompletion.js | 164 +- .../sourceeditor/test/browser_css_getInfo.js | 218 ++- .../test/browser_css_statemachine.js | 154 +- .../sourceeditor/test/browser_detectindent.js | 14 +- .../test/browser_editor_addons.js | 2 +- .../test/browser_editor_alt_b_f.js | 16 +- .../test/browser_editor_autocomplete_basic.js | 2 +- .../browser_editor_autocomplete_events.js | 54 +- .../test/browser_editor_autocomplete_js.js | 11 +- .../sourceeditor/test/browser_editor_basic.js | 4 +- .../test/browser_editor_cursor.js | 33 +- .../test/browser_editor_disableSearchAddon.js | 10 +- .../test/browser_editor_find_again.js | 117 +- .../test/browser_editor_goto_line.js | 137 +- .../test/browser_editor_history.js | 2 +- .../test/browser_editor_markers.js | 22 +- .../test/browser_editor_movelines.js | 8 +- .../sourceeditor/test/browser_editor_prefs.js | 69 +- .../sourceeditor/test/browser_vimemacs.js | 5 +- .../client/shared/sourceeditor/test/head.js | 27 +- .../test/helper_codemirror_runner.js | 32 +- devtools/client/shared/sourceeditor/wasm.js | 18 +- .../shared/sourceeditor/webpack.config.js | 76 +- devtools/client/shared/stylesheet-utils.js | 6 +- devtools/client/shared/telemetry.js | 171 +- .../shared/test/browser_autocomplete_popup.js | 22 +- .../test/browser_browserloader_mocks.js | 94 +- .../client/shared/test/browser_css_angle.js | 252 +-- .../client/shared/test/browser_css_color.js | 40 +- .../shared/test/browser_cubic-bezier-01.js | 19 +- .../shared/test/browser_cubic-bezier-02.js | 64 +- .../shared/test/browser_cubic-bezier-03.js | 15 +- .../shared/test/browser_cubic-bezier-04.js | 42 +- .../shared/test/browser_cubic-bezier-05.js | 56 +- .../shared/test/browser_cubic-bezier-06.js | 61 +- .../shared/test/browser_cubic-bezier-07.js | 29 +- .../browser_dbg_WorkerTargetActor.attach.js | 3 +- .../test/browser_dbg_debugger-statement.js | 5 +- .../shared/test/browser_dbg_globalactor.js | 16 +- .../shared/test/browser_dbg_listaddons.js | 31 +- .../shared/test/browser_dbg_listtabs-01.js | 17 +- .../shared/test/browser_dbg_listtabs-02.js | 18 +- .../shared/test/browser_dbg_listtabs-03.js | 6 +- .../shared/test/browser_dbg_listworkers.js | 3 +- .../test/browser_dbg_multiple-windows.js | 18 +- .../shared/test/browser_dbg_navigation.js | 7 +- .../browser_dbg_target-scoped-actor-01.js | 14 +- .../browser_dbg_target-scoped-actor-02.js | 26 +- .../test/browser_dbg_worker-console-01.js | 15 +- .../test/browser_dbg_worker-console-02.js | 22 +- .../test/browser_dbg_worker-console-03.js | 23 +- .../test/browser_dbg_worker-console-04.js | 21 +- .../shared/test/browser_dbg_worker-window.js | 28 +- .../client/shared/test/browser_devices.js | 16 +- .../shared/test/browser_filter-editor-01.js | 115 +- .../shared/test/browser_filter-editor-02.js | 27 +- .../shared/test/browser_filter-editor-03.js | 68 +- .../shared/test/browser_filter-editor-04.js | 50 +- .../shared/test/browser_filter-editor-05.js | 76 +- .../shared/test/browser_filter-editor-06.js | 24 +- .../shared/test/browser_filter-editor-07.js | 21 +- .../shared/test/browser_filter-editor-08.js | 52 +- .../shared/test/browser_filter-editor-09.js | 83 +- .../shared/test/browser_filter-editor-10.js | 38 +- .../shared/test/browser_filter-presets-01.js | 68 +- .../shared/test/browser_filter-presets-02.js | 20 +- .../shared/test/browser_filter-presets-03.js | 20 +- .../shared/test/browser_flame-graph-01.js | 66 +- .../shared/test/browser_flame-graph-02.js | 38 +- .../shared/test/browser_flame-graph-03a.js | 136 +- .../shared/test/browser_flame-graph-03b.js | 80 +- .../shared/test/browser_flame-graph-03c.js | 203 ++- .../shared/test/browser_flame-graph-04.js | 61 +- .../shared/test/browser_flame-graph-05.js | 75 +- .../test/browser_flame-graph-utils-01.js | 539 +++--- .../test/browser_flame-graph-utils-02.js | 246 +-- .../test/browser_flame-graph-utils-03.js | 259 +-- .../test/browser_flame-graph-utils-04.js | 375 +++-- .../test/browser_flame-graph-utils-05.js | 57 +- .../test/browser_flame-graph-utils-06.js | 208 ++- .../test/browser_flame-graph-utils-hash.js | 32 +- .../client/shared/test/browser_graphs-01.js | 82 +- .../client/shared/test/browser_graphs-02.js | 102 +- .../client/shared/test/browser_graphs-03.js | 102 +- .../client/shared/test/browser_graphs-04.js | 90 +- .../client/shared/test/browser_graphs-05.js | 259 ++- .../client/shared/test/browser_graphs-06.js | 143 +- .../client/shared/test/browser_graphs-07a.js | 321 ++-- .../client/shared/test/browser_graphs-07b.js | 80 +- .../client/shared/test/browser_graphs-07c.js | 185 ++- .../client/shared/test/browser_graphs-07d.js | 73 +- .../client/shared/test/browser_graphs-07e.js | 119 +- .../client/shared/test/browser_graphs-08.js | 79 +- .../client/shared/test/browser_graphs-09a.js | 205 ++- .../client/shared/test/browser_graphs-09b.js | 138 +- .../client/shared/test/browser_graphs-09c.js | 18 +- .../client/shared/test/browser_graphs-09d.js | 14 +- .../client/shared/test/browser_graphs-09e.js | 111 +- .../client/shared/test/browser_graphs-09f.js | 51 +- .../client/shared/test/browser_graphs-10a.js | 229 ++- .../client/shared/test/browser_graphs-10b.js | 65 +- .../client/shared/test/browser_graphs-10c.js | 122 +- .../client/shared/test/browser_graphs-11a.js | 69 +- .../client/shared/test/browser_graphs-11b.js | 118 +- .../client/shared/test/browser_graphs-12.js | 254 ++- .../client/shared/test/browser_graphs-13.js | 36 +- .../client/shared/test/browser_graphs-14.js | 105 +- .../client/shared/test/browser_graphs-15.js | 9 +- .../client/shared/test/browser_graphs-16.js | 8 +- .../shared/test/browser_html_tooltip-01.js | 10 +- .../shared/test/browser_html_tooltip-02.js | 62 +- .../shared/test/browser_html_tooltip-03.js | 13 +- .../shared/test/browser_html_tooltip-04.js | 37 +- .../shared/test/browser_html_tooltip-05.js | 34 +- .../test/browser_html_tooltip_arrow-01.js | 46 +- .../test/browser_html_tooltip_arrow-02.js | 46 +- .../browser_html_tooltip_consecutive-show.js | 25 +- .../browser_html_tooltip_doorhanger-01.js | 30 +- .../browser_html_tooltip_doorhanger-02.js | 15 +- .../test/browser_html_tooltip_height-auto.js | 12 +- .../shared/test/browser_html_tooltip_hover.js | 27 +- .../test/browser_html_tooltip_offset.js | 30 +- .../test/browser_html_tooltip_resize.js | 72 +- .../shared/test/browser_html_tooltip_rtl.js | 114 +- .../browser_html_tooltip_variable-height.js | 32 +- .../test/browser_html_tooltip_width-auto.js | 10 +- .../test/browser_html_tooltip_xul-wrapper.js | 12 +- .../shared/test/browser_html_tooltip_zoom.js | 24 +- .../shared/test/browser_inplace-editor-01.js | 131 +- .../shared/test/browser_inplace-editor-02.js | 52 +- ...er_inplace-editor_autoclose_parentheses.js | 26 +- .../browser_inplace-editor_autocomplete_01.js | 20 +- .../browser_inplace-editor_autocomplete_02.js | 32 +- ...nplace-editor_autocomplete_css_variable.js | 25 +- ...wser_inplace-editor_autocomplete_offset.js | 43 +- .../test/browser_inplace-editor_maxwidth.js | 65 +- .../shared/test/browser_key_shortcuts.js | 116 +- .../client/shared/test/browser_keycodes.js | 2 +- .../test/browser_layoutHelpers-getBoxQuads.js | 202 ++- .../shared/test/browser_layoutHelpers.js | 99 +- devtools/client/shared/test/browser_link.js | 17 +- .../client/shared/test/browser_num-l10n.js | 83 +- .../shared/test/browser_options-view-01.js | 66 +- .../shared/test/browser_outputparser.js | 293 ++-- devtools/client/shared/test/browser_poller.js | 87 +- .../client/shared/test/browser_prefs-01.js | 33 +- .../client/shared/test/browser_prefs-02.js | 38 +- .../client/shared/test/browser_require_raw.js | 8 +- .../client/shared/test/browser_spectrum.js | 75 +- .../shared/test/browser_tableWidget_basic.js | 181 +- ...rowser_tableWidget_keyboard_interaction.js | 72 +- .../browser_tableWidget_mouse_interaction.js | 239 ++- .../browser_telemetry_button_eyedropper.js | 3 +- .../browser_telemetry_button_paintflashing.js | 17 +- .../browser_telemetry_button_responsive.js | 30 +- .../browser_telemetry_button_scratchpad.js | 54 +- .../shared/test/browser_telemetry_misc.js | 35 +- .../shared/test/browser_telemetry_sidebar.js | 74 +- .../shared/test/browser_telemetry_toolbox.js | 13 +- ...browser_telemetry_toolboxtabs_inspector.js | 17 +- ...rowser_telemetry_toolboxtabs_jsdebugger.js | 17 +- ...rowser_telemetry_toolboxtabs_jsprofiler.js | 17 +- ...rowser_telemetry_toolboxtabs_netmonitor.js | 17 +- .../browser_telemetry_toolboxtabs_options.js | 12 +- .../browser_telemetry_toolboxtabs_storage.js | 12 +- ...owser_telemetry_toolboxtabs_styleeditor.js | 17 +- ...rowser_telemetry_toolboxtabs_webconsole.js | 17 +- devtools/client/shared/test/browser_theme.js | 103 +- .../shared/test/browser_theme_switching.js | 25 +- .../shared/test/browser_treeWidget_basic.js | 396 +++-- ...browser_treeWidget_keyboard_interaction.js | 196 ++- .../browser_treeWidget_mouse_interaction.js | 150 +- .../client/shared/test/frame-script-utils.js | 32 +- devtools/client/shared/test/head.js | 52 +- devtools/client/shared/test/helper_addons.js | 16 +- .../client/shared/test/helper_color_data.js | 1467 +++++++++++++++-- .../client/shared/test/helper_html_tooltip.js | 20 +- .../shared/test/helper_inplace_editor.js | 29 +- devtools/client/shared/test/helper_workers.js | 53 +- devtools/client/shared/test/leakhunt.js | 19 +- devtools/client/shared/test/shared-head.js | 160 +- .../shared/test/telemetry-test-helpers.js | 62 +- .../client/shared/test/test-actor-registry.js | 21 +- devtools/client/shared/test/test-actor.js | 228 ++- devtools/client/shared/test/testactors.js | 5 +- ...iablesView_filtering-without-controller.js | 22 +- .../test_VariablesView_getString_promise.js | 97 +- .../shared/test/unit/test_advanceValidate.js | 13 +- .../test/unit/test_attribute-parsing-01.js | 99 +- .../test/unit/test_attribute-parsing-02.js | 224 +-- .../shared/test/unit/test_bezierCanvas.js | 43 +- .../client/shared/test/unit/test_cssAngle.js | 4 +- .../shared/test/unit/test_cssColor-01.js | 11 +- .../shared/test/unit/test_cssColor-02.js | 12 +- .../shared/test/unit/test_cssColor-03.js | 18 +- .../test/unit/test_cssColor-8-digit-hex.js | 4 +- .../shared/test/unit/test_cssColorDatabase.js | 39 +- .../shared/test/unit/test_cubicBezier.js | 44 +- devtools/client/shared/test/unit/test_curl.js | 154 +- .../shared/test/unit/test_escapeCSSComment.js | 7 +- .../test/unit/test_parseDeclarations.js | 568 ++++--- .../test_parsePseudoClassesAndAttributes.js | 59 +- .../shared/test/unit/test_parseSingleValue.js | 67 +- .../test/unit/test_rewriteDeclarations.js | 524 ++++-- .../shared/test/unit/test_source-utils.js | 207 ++- .../test/unit/test_suggestion-picker.js | 14 +- .../client/shared/test/unit/test_undoStack.js | 22 +- .../shared/test/unit/test_unicode-url.js | 89 +- devtools/client/shared/theme-switching.js | 20 +- devtools/client/shared/theme.js | 23 +- devtools/client/shared/undo.js | 20 +- devtools/client/shared/unicode-url.js | 11 +- devtools/client/shared/view-source.js | 13 +- devtools/client/shared/webgl-utils.js | 11 +- .../webpack/rewrite-css-logic-importer.js | 2 +- .../shared/webpack/rewrite-lazy-require.js | 4 +- .../shared/webpack/rewrite-react-redux.js | 16 +- .../shared/webpack/shims/jsterm-stub.js | 11 +- .../shared/webpack/shims/test/test_stack.js | 2 +- .../shared/widgets/AbstractTreeItem.jsm | 39 +- .../client/shared/widgets/BarGraphWidget.js | 61 +- devtools/client/shared/widgets/Chart.js | 66 +- .../shared/widgets/CubicBezierPresets.js | 4 +- .../shared/widgets/CubicBezierWidget.js | 162 +- .../client/shared/widgets/FilterWidget.js | 310 ++-- devtools/client/shared/widgets/FlameGraph.js | 326 ++-- devtools/client/shared/widgets/Graphs.js | 153 +- .../client/shared/widgets/GraphsWorker.js | 7 +- .../client/shared/widgets/LineGraphWidget.js | 107 +- .../shared/widgets/MountainGraphWidget.js | 16 +- .../shared/widgets/ShapesInContextEditor.js | 122 +- devtools/client/shared/widgets/Spectrum.js | 93 +- devtools/client/shared/widgets/TableWidget.js | 128 +- devtools/client/shared/widgets/TreeWidget.js | 53 +- .../client/shared/widgets/VariablesView.jsm | 711 +++++--- .../widgets/VariablesViewController.jsm | 203 ++- .../widgets/tooltip/EventTooltipHelper.js | 60 +- .../shared/widgets/tooltip/HTMLTooltip.js | 129 +- .../widgets/tooltip/ImageTooltipHelper.js | 19 +- .../shared/widgets/tooltip/InlineTooltip.js | 5 +- .../widgets/tooltip/RulePreviewTooltip.js | 20 +- .../tooltip/SwatchBasedEditorTooltip.js | 12 +- .../tooltip/SwatchColorPickerTooltip.js | 30 +- .../tooltip/SwatchCubicBezierTooltip.js | 4 +- .../widgets/tooltip/SwatchFilterTooltip.js | 10 +- .../shared/widgets/tooltip/TooltipToggle.js | 56 +- .../widgets/tooltip/VariableTooltipHelper.js | 2 +- .../tooltip/inactive-css-tooltip-helper.js | 16 +- .../client/shared/widgets/view-helpers.js | 79 +- devtools/client/shared/zoom-keys.js | 12 +- devtools/client/storage/panel.js | 11 +- .../storage/test/browser_storage_basic.js | 133 +- .../browser_storage_basic_usercontextid_1.js | 133 +- .../browser_storage_basic_usercontextid_2.js | 148 +- .../browser_storage_basic_with_fragment.js | 136 +- .../test/browser_storage_cache_delete.js | 23 +- .../test/browser_storage_cache_error.js | 6 +- .../browser_storage_cookies_delete_all.js | 78 +- .../test/browser_storage_cookies_hostOnly.js | 6 +- .../test/browser_storage_cookies_samesite.js | 26 +- .../browser_storage_cookies_tab_navigation.js | 12 +- .../storage/test/browser_storage_delete.js | 54 +- .../test/browser_storage_delete_all.js | 89 +- .../test/browser_storage_delete_tree.js | 25 +- .../browser_storage_delete_usercontextid.js | 191 ++- .../browser_storage_dom_cache_disabled.js | 27 +- ...browser_storage_dynamic_updates_cookies.js | 119 +- ...er_storage_dynamic_updates_localStorage.js | 19 +- ..._storage_dynamic_updates_sessionStorage.js | 33 +- .../browser_storage_empty_objectstores.js | 46 +- .../storage/test/browser_storage_file_url.js | 16 +- .../test/browser_storage_indexeddb_delete.js | 13 +- ...rowser_storage_indexeddb_delete_blocked.js | 14 +- ...owser_storage_indexeddb_duplicate_names.js | 3 +- .../browser_storage_indexeddb_overflow.js | 10 +- .../browser_storage_localstorage_error.js | 5 +- .../storage/test/browser_storage_overflow.js | 5 +- .../storage/test/browser_storage_search.js | 9 +- .../browser_storage_search_keyboard_trap.js | 6 +- .../storage/test/browser_storage_sidebar.js | 17 +- .../test/browser_storage_sidebar_toggle.js | 14 +- .../test/browser_storage_sidebar_update.js | 10 +- .../storage/test/browser_storage_values.js | 322 ++-- devtools/client/storage/test/head.js | 178 +- devtools/client/storage/ui.js | 432 +++-- devtools/client/styleeditor/StyleEditorUI.jsm | 310 ++-- .../client/styleeditor/StyleEditorUtil.jsm | 81 +- .../client/styleeditor/StyleSheetEditor.jsm | 205 ++- .../client/styleeditor/original-source.js | 50 +- devtools/client/styleeditor/panel.js | 46 +- ...owser_styleeditor_autocomplete-disabled.js | 20 +- .../test/browser_styleeditor_autocomplete.js | 166 +- .../test/browser_styleeditor_bom.js | 34 +- ...ditor_bug_1405342_serviceworker_iframes.js | 10 +- .../browser_styleeditor_bug_740541_iframes.js | 106 +- ...ser_styleeditor_bug_851132_middle_click.js | 6 +- .../test/browser_styleeditor_bug_870339.js | 27 +- .../test/browser_styleeditor_copyurl.js | 35 +- .../test/browser_styleeditor_enabled.js | 35 +- ...owser_styleeditor_fetch-from-netmonitor.js | 27 +- .../test/browser_styleeditor_filesave.js | 24 +- .../browser_styleeditor_highlight-selector.js | 4 +- .../test/browser_styleeditor_import.js | 19 +- .../test/browser_styleeditor_import_rule.js | 24 +- .../test/browser_styleeditor_init.js | 22 +- ...owser_styleeditor_inline_friendly_names.js | 52 +- .../test/browser_styleeditor_loading.js | 12 +- ...ser_styleeditor_loading_with_containers.js | 26 +- .../test/browser_styleeditor_media_sidebar.js | 29 +- ...browser_styleeditor_media_sidebar_links.js | 70 +- ...er_styleeditor_media_sidebar_sourcemaps.js | 6 +- .../browser_styleeditor_missing_stylesheet.js | 16 +- .../test/browser_styleeditor_navigate.js | 2 +- .../test/browser_styleeditor_new.js | 25 +- .../test/browser_styleeditor_nostyle.js | 12 +- .../test/browser_styleeditor_opentab.js | 83 +- .../test/browser_styleeditor_pretty.js | 48 +- ...browser_styleeditor_private_perwindowpb.js | 19 +- .../test/browser_styleeditor_reload.js | 9 +- .../browser_styleeditor_resize_performance.js | 10 +- .../test/browser_styleeditor_scroll.js | 34 +- .../browser_styleeditor_selectstylesheet.js | 2 +- .../browser_styleeditor_sourcemap_large.js | 6 +- .../browser_styleeditor_sourcemap_watching.js | 34 +- .../test/browser_styleeditor_sourcemaps.js | 28 +- .../browser_styleeditor_sourcemaps_inline.js | 27 +- .../test/browser_styleeditor_sv_keynav.js | 35 +- .../test/browser_styleeditor_sv_resize.js | 16 +- .../test/browser_styleeditor_sync.js | 7 +- .../browser_styleeditor_syncAddProperty.js | 7 +- .../browser_styleeditor_syncIntoRuleView.js | 2 +- .../browser_styleeditor_transition_rule.js | 13 +- .../test/browser_styleeditor_xul.js | 6 +- devtools/client/styleeditor/test/head.js | 43 +- .../styleeditor/test/iframe_service_worker.js | 2 +- .../client/webconsole/actions/autocomplete.js | 82 +- devtools/client/webconsole/actions/filters.js | 13 +- .../client/webconsole/actions/messages.js | 28 +- .../webconsole/actions/notifications.js | 9 +- devtools/client/webconsole/actions/ui.js | 15 +- devtools/client/webconsole/browser-console.js | 30 +- devtools/client/webconsole/components/App.js | 214 +-- .../components/FilterBar/FilterBar.js | 201 ++- .../components/FilterBar/FilterButton.js | 22 +- .../components/FilterBar/FilterCheckbox.js | 16 +- .../components/Input/ConfirmDialog.js | 138 +- .../components/Input/EditorToolbar.js | 31 +- .../webconsole/components/Input/JSTerm.js | 458 +++-- .../components/Input/ReverseSearchInput.js | 113 +- .../components/Output/CollapseButton.js | 8 +- .../components/Output/ConsoleOutput.js | 157 +- .../components/Output/ConsoleTable.js | 82 +- .../components/Output/GripMessageBody.js | 43 +- .../webconsole/components/Output/Message.js | 305 ++-- .../components/Output/MessageContainer.js | 59 +- .../components/Output/MessageIcon.js | 37 +- .../components/Output/MessageIndent.js | 2 +- .../components/Output/MessageRepeat.js | 15 +- .../Output/message-types/CSSWarning.js | 60 +- .../Output/message-types/ConsoleApiCall.js | 83 +- .../Output/message-types/ConsoleCommand.js | 18 +- .../Output/message-types/DefaultRenderer.js | 4 +- .../Output/message-types/EvaluationResult.js | 13 +- .../message-types/NetworkEventMessage.js | 115 +- .../Output/message-types/PageError.js | 4 +- .../Output/message-types/WarningGroup.js | 24 +- .../client/webconsole/components/SideBar.js | 81 +- devtools/client/webconsole/constants.js | 24 +- .../webconsole/enhancers/actor-releaser.js | 8 +- .../enhancers/message-cache-clearing.js | 4 +- devtools/client/webconsole/hudservice.js | 62 +- devtools/client/webconsole/main.js | 6 +- .../webconsole/middleware/event-telemetry.js | 25 +- .../middleware/history-persistence.js | 24 +- .../client/webconsole/middleware/thunk.js | 4 +- devtools/client/webconsole/panel.js | 25 +- .../webconsole/reducers/autocomplete.js | 22 +- .../client/webconsole/reducers/filters.js | 13 +- .../client/webconsole/reducers/history.js | 11 +- devtools/client/webconsole/reducers/index.js | 4 +- .../client/webconsole/reducers/messages.js | 638 ++++--- .../webconsole/reducers/notifications.js | 14 +- devtools/client/webconsole/reducers/prefs.js | 22 +- devtools/client/webconsole/reducers/ui.js | 54 +- .../client/webconsole/selectors/history.js | 14 +- .../client/webconsole/selectors/messages.js | 14 +- devtools/client/webconsole/store.js | 17 +- .../client/webconsole/test/chrome/head.js | 4 +- .../console-api-call.log-messages.test.js | 46 +- .../test/components/console-api-call.test.js | 524 +++--- .../test/components/console-output.test.js | 24 +- .../test/components/css-warning.test.js | 69 +- .../test/components/evaluation-result.test.js | 44 +- .../test/components/filter-bar.test.js | 88 +- .../test/components/filter-button.test.js | 6 +- .../test/components/filter-checkbox.test.js | 6 +- .../test/components/message-container.test.js | 23 +- .../test/components/message-icon.test.js | 18 +- .../test/components/message-location.test.js | 40 +- .../test/components/message-repeat.test.js | 4 +- .../components/message-types-aria.test.js | 20 +- .../components/network-event-message.test.js | 105 +- .../test/components/page-error.test.js | 245 +-- .../test/components/warning-group.test.js | 93 +- .../components/webconsole-wrapper.test.js | 167 +- .../client/webconsole/test/fixtures/L10n.js | 3 +- ...wser_webconsole_check_stubs_console_api.js | 13 +- ...wser_webconsole_check_stubs_css_message.js | 13 +- ...ebconsole_check_stubs_evaluation_result.js | 13 +- ...er_webconsole_check_stubs_network_event.js | 19 +- ...owser_webconsole_check_stubs_page_error.js | 13 +- .../test/fixtures/stub-generators/head.js | 209 +-- .../fixtures/stub-generators/stub-snippets.js | 103 +- .../webconsole/test/fixtures/stubs/index.js | 8 +- devtools/client/webconsole/test/helpers.js | 24 +- .../test/mochitest/browser_console.js | 69 +- .../mochitest/browser_console_clear_cache.js | 6 +- .../mochitest/browser_console_clear_method.js | 16 +- .../browser_console_consolejsm_output.js | 12 +- .../browser_console_context_menu_entries.js | 58 +- .../mochitest/browser_console_dead_objects.js | 5 +- ...owser_console_devtools_loader_exception.js | 9 +- .../browser_console_error_source_click.js | 15 +- .../mochitest/browser_console_jsterm_await.js | 25 +- .../browser_console_nsiconsolemessage.js | 31 +- .../browser_console_open_or_focus.js | 14 +- .../test/mochitest/browser_console_restore.js | 24 +- ...er_console_webconsole_console_api_calls.js | 15 +- ...wser_console_webconsole_ctrlw_close_tab.js | 39 +- ...wser_console_webconsole_iframe_messages.js | 12 +- ...ser_console_webconsole_private_browsing.js | 43 +- .../mochitest/browser_jsterm_accessibility.js | 48 +- ...wser_jsterm_add_edited_input_to_history.js | 30 +- ...-properties-with-non-alphanumeric-names.js | 5 +- ...er_jsterm_autocomplete_accept_no_scroll.js | 18 +- ...wser_jsterm_autocomplete_array_no_index.js | 10 +- .../browser_jsterm_autocomplete_arrow_keys.js | 151 +- .../browser_jsterm_autocomplete_await.js | 6 +- ...wser_jsterm_autocomplete_cached_results.js | 62 +- .../browser_jsterm_autocomplete_commands.js | 26 +- ...owser_jsterm_autocomplete_control_space.js | 6 +- ..._jsterm_autocomplete_crossdomain_iframe.js | 11 +- .../browser_jsterm_autocomplete_disabled.js | 2 +- ...owser_jsterm_autocomplete_getters_cache.js | 68 +- ...wser_jsterm_autocomplete_getters_cancel.js | 22 +- ...ser_jsterm_autocomplete_getters_confirm.js | 110 +- ...rm_autocomplete_getters_learn_more_link.js | 24 +- .../browser_jsterm_autocomplete_helpers.js | 14 +- ...owser_jsterm_autocomplete_in_chrome_tab.js | 2 +- ...erm_autocomplete_in_debugger_stackframe.js | 10 +- ...browser_jsterm_autocomplete_inside_text.js | 35 +- ...wser_jsterm_autocomplete_native_getters.js | 24 +- ...ser_jsterm_autocomplete_nav_and_tab_key.js | 89 +- .../browser_jsterm_autocomplete_paste_undo.js | 20 +- .../browser_jsterm_autocomplete_return_key.js | 38 +- ...rm_autocomplete_return_key_no_selection.js | 18 +- .../browser_jsterm_autocomplete_width.js | 33 +- .../test/mochitest/browser_jsterm_await.js | 34 +- .../browser_jsterm_await_assignments.js | 14 +- .../browser_jsterm_await_concurrent.js | 24 +- .../browser_jsterm_await_dynamic_import.js | 3 +- .../mochitest/browser_jsterm_await_error.js | 79 +- ...r_jsterm_await_helper_dollar_underscore.js | 37 +- .../mochitest/browser_jsterm_await_paused.js | 22 +- .../mochitest/browser_jsterm_completion.js | 37 +- .../browser_jsterm_completion_bracket.js | 292 ++-- ...sterm_completion_bracket_cached_results.js | 169 +- ...wser_jsterm_completion_case_sensitivity.js | 56 +- ...ser_jsterm_completion_dollar_underscore.js | 31 +- .../browser_jsterm_completion_dollar_zero.js | 18 +- ...browser_jsterm_completion_perfect_match.js | 18 +- .../browser_jsterm_content_defined_helpers.js | 21 +- .../browser_jsterm_context_menu_labels.js | 7 +- .../mochitest/browser_jsterm_copy_command.js | 14 +- .../browser_jsterm_ctrl_a_select_all.js | 16 +- .../mochitest/browser_jsterm_ctrl_key_nav.js | 140 +- .../browser_jsterm_document_no_xray.js | 4 +- .../test/mochitest/browser_jsterm_editor.js | 16 +- .../mochitest/browser_jsterm_editor_enter.js | 18 +- .../browser_jsterm_editor_execute.js | 5 +- .../mochitest/browser_jsterm_editor_gutter.js | 27 +- ..._jsterm_editor_toggle_keyboard_shortcut.js | 3 +- .../browser_jsterm_editor_toolbar.js | 18 +- .../mochitest/browser_jsterm_error_docs.js | 27 +- ...rowser_jsterm_error_outside_valid_range.js | 14 +- .../mochitest/browser_jsterm_focus_reload.js | 10 +- .../mochitest/browser_jsterm_helper_clear.js | 5 +- .../browser_jsterm_helper_dollar_x.js | 54 +- .../mochitest/browser_jsterm_helper_help.js | 8 +- .../mochitest/browser_jsterm_helper_pprint.js | 2 +- ...hide_when_devtools_chrome_enabled_false.js | 21 +- .../test/mochitest/browser_jsterm_history.js | 8 +- .../browser_jsterm_history_arrow_keys.js | 75 +- .../mochitest/browser_jsterm_history_nav.js | 12 +- .../browser_jsterm_history_persist.js | 109 +- .../test/mochitest/browser_jsterm_inspect.js | 34 +- .../mochitest/browser_jsterm_instance_of.js | 2 +- .../browser_jsterm_middle_click_paste.js | 16 +- .../mochitest/browser_jsterm_multiline.js | 67 +- ...ser_jsterm_no_input_and_tab_key_pressed.js | 38 +- .../browser_jsterm_null_undefined.js | 3 +- ...rowser_jsterm_popup_close_on_tab_switch.js | 8 +- ...ser_jsterm_screenshot_command_clipboard.js | 117 +- .../browser_jsterm_screenshot_command_file.js | 11 +- .../browser_jsterm_screenshot_command_user.js | 5 +- .../test/mochitest/browser_jsterm_selfxss.js | 17 +- .../browser_jsterm_syntax_highlight_output.js | 8 +- ...nsole_allow_mixedcontent_securityerrors.js | 23 +- .../mochitest/browser_webconsole_batching.js | 31 +- ...nsole_block_mixedcontent_securityerrors.js | 50 +- .../browser_webconsole_cached_messages.js | 7 +- .../mochitest/browser_webconsole_cd_iframe.js | 40 +- ...browser_webconsole_certificate_messages.js | 32 +- .../browser_webconsole_clear_cache.js | 27 +- .../browser_webconsole_clickable_urls.js | 37 +- .../browser_webconsole_close_sidebar.js | 13 +- ...owser_webconsole_close_unfocused_window.js | 13 +- ...ser_webconsole_closing_after_completion.js | 5 +- .../browser_webconsole_console_api_iframe.js | 5 +- .../browser_webconsole_console_dir.js | 47 +- ...er_webconsole_console_dir_uninspectable.js | 12 +- ..._webconsole_console_error_expand_object.js | 13 +- .../browser_webconsole_console_group.js | 51 +- ...webconsole_console_group_open_no_scroll.js | 32 +- ..._webconsole_console_logging_workers_api.js | 9 +- .../browser_webconsole_console_table.js | 262 ++- .../browser_webconsole_console_timeStamp.js | 4 +- ...owser_webconsole_console_trace_distinct.js | 32 +- ...ser_webconsole_console_trace_duplicates.js | 91 +- ...onsole_context_menu_copy_entire_message.js | 107 +- ...console_context_menu_copy_link_location.js | 11 +- ..._copy_message_with_framework_stacktrace.js | 52 +- ...ser_webconsole_context_menu_copy_object.js | 56 +- ...sole_context_menu_export_console_output.js | 20 +- ...bconsole_context_menu_object_in_sidebar.js | 43 +- ...rowser_webconsole_context_menu_open_url.js | 21 +- ...webconsole_context_menu_store_as_global.js | 45 +- .../browser_webconsole_cors_errors.js | 105 +- ...onsole_csp_ignore_reflected_xss_message.js | 17 +- .../browser_webconsole_csp_violation.js | 12 +- .../mochitest/browser_webconsole_cspro.js | 22 +- .../browser_webconsole_document_focus.js | 13 +- .../browser_webconsole_duplicate_errors.js | 18 +- ...ser_webconsole_error_with_grouped_stack.js | 15 +- ..._webconsole_error_with_longstring_stack.js | 16 +- .../browser_webconsole_error_with_url.js | 21 +- ...ser_webconsole_errors_after_page_reload.js | 11 +- .../browser_webconsole_eval_error.js | 16 +- ..._webconsole_eval_in_debugger_stackframe.js | 11 +- ...webconsole_eval_in_debugger_stackframe2.js | 9 +- .../browser_webconsole_eval_sources.js | 5 +- .../browser_webconsole_execution_scope.js | 19 +- ...owser_webconsole_external_script_errors.js | 13 +- .../mochitest/browser_webconsole_file_uri.js | 56 +- ...wser_webconsole_filter_buttons_overflow.js | 32 +- .../browser_webconsole_filter_by_input.js | 157 +- ...rowser_webconsole_filter_by_regex_input.js | 31 +- ...ser_webconsole_filter_navigation_marker.js | 5 +- .../browser_webconsole_filter_scroll.js | 74 +- .../mochitest/browser_webconsole_filters.js | 23 +- .../browser_webconsole_filters_persist.js | 5 +- ...r_webconsole_highlighter_console_helper.js | 10 +- ...browser_webconsole_hpkp_invalid-headers.js | 171 +- ...browser_webconsole_hsts_invalid-headers.js | 121 +- .../browser_webconsole_iframe_wrong_hud.js | 16 +- .../browser_webconsole_in_line_layout.js | 79 +- ...sole_ineffective_iframe_sandbox_warning.js | 20 +- .../test/mochitest/browser_webconsole_init.js | 25 +- ...nsole_input_field_focus_on_panel_select.js | 5 +- .../browser_webconsole_input_focus.js | 7 +- ...sswords_about_blank_web_console_warning.js | 16 +- ..._insecure_passwords_web_console_warning.js | 39 +- ..._webconsole_inspect_cross_domain_object.js | 19 +- ...owser_webconsole_keyboard_accessibility.js | 34 +- ...owser_webconsole_location_debugger_link.js | 9 +- ...ser_webconsole_location_scratchpad_link.js | 37 +- ...er_webconsole_location_styleeditor_link.js | 35 +- .../mochitest/browser_webconsole_loglimit.js | 17 +- .../browser_webconsole_longstring.js | 11 +- .../browser_webconsole_longstring_getter.js | 4 +- .../browser_webconsole_message_categories.js | 13 +- ...er_webconsole_multiple_windows_and_tabs.js | 10 +- .../browser_webconsole_network_attach.js | 9 +- .../browser_webconsole_network_exceptions.js | 5 +- ...r_webconsole_network_message_ctrl_click.js | 36 +- ...wser_webconsole_network_messages_expand.js | 118 +- ...r_webconsole_network_messages_openinnet.js | 9 +- ...console_network_messages_resend_request.js | 14 +- ...es_stacktrace_console_initiated_request.js | 29 +- ...webconsole_network_messages_status_code.js | 18 +- ...webconsole_network_requests_from_chrome.js | 25 +- ...browser_webconsole_network_reset_filter.js | 4 +- .../browser_webconsole_nodes_highlight.js | 28 +- .../browser_webconsole_nodes_select.js | 13 +- ..._webconsole_non_javascript_mime_warning.js | 16 +- ...onsole_non_javascript_mime_worker_error.js | 16 +- .../browser_webconsole_object_ctrl_click.js | 58 +- ...bconsole_object_in_sidebar_keyboard_nav.js | 37 +- .../browser_webconsole_object_inspector.js | 77 +- ...er_webconsole_object_inspector__proto__.js | 16 +- ...ser_webconsole_object_inspector_entries.js | 78 +- ...ser_webconsole_object_inspector_getters.js | 351 ++-- ...sole_object_inspector_getters_prototype.js | 42 +- ...nsole_object_inspector_getters_shadowed.js | 9 +- ...webconsole_object_inspector_key_sorting.js | 64 +- ..._object_inspector_local_session_storage.js | 54 +- ...ebconsole_object_inspector_nested_proxy.js | 18 +- ...wser_webconsole_object_inspector_scroll.js | 12 +- ...bconsole_object_inspector_selected_text.js | 2 +- ...nspector_while_debugging_and_inspecting.js | 12 +- ...owser_webconsole_observer_notifications.js | 16 +- .../browser_webconsole_optimized_out_vars.js | 7 +- .../browser_webconsole_output_copy.js | 8 +- ...browser_webconsole_output_copy_newlines.js | 16 +- .../browser_webconsole_output_order.js | 26 +- .../mochitest/browser_webconsole_persist.js | 42 +- ...browser_webconsole_primitive_stacktrace.js | 7 +- .../browser_webconsole_reopen_closed_tab.js | 5 +- ...ser_webconsole_repeat_different_objects.js | 6 +- .../browser_webconsole_reverse_search.js | 104 +- ...webconsole_reverse_search_initial_value.js | 56 +- ...sole_reverse_search_keyboard_navigation.js | 56 +- ...console_reverse_search_mouse_navigation.js | 46 +- ...rowser_webconsole_reverse_search_toggle.js | 21 +- ...console_sandbox_update_after_navigation.js | 19 +- ...browser_webconsole_script_errordoc_urls.js | 7 +- .../mochitest/browser_webconsole_scroll.js | 108 +- .../browser_webconsole_select_all.js | 13 +- ...onsole_show_subresource_security_errors.js | 9 +- ...r_webconsole_shows_reqs_from_netmonitor.js | 33 +- ...ser_webconsole_shows_reqs_in_netmonitor.js | 26 +- ...debar_object_expand_when_message_pruned.js | 3 +- .../browser_webconsole_sidebar_scroll.js | 23 +- .../browser_webconsole_sourcemap_error.js | 9 +- .../browser_webconsole_sourcemap_nosource.js | 7 +- .../mochitest/browser_webconsole_split.js | 284 ++-- .../browser_webconsole_split_close_button.js | 16 +- .../browser_webconsole_split_escape_key.js | 20 +- .../browser_webconsole_split_focus.js | 13 +- .../browser_webconsole_split_persist.js | 113 +- ...nsole_stacktrace_location_debugger_link.js | 23 +- ...ole_stacktrace_location_scratchpad_link.js | 34 +- .../browser_webconsole_strict_mode_errors.js | 15 +- .../mochitest/browser_webconsole_string.js | 19 +- ...er_webconsole_telemetry_filters_changed.js | 23 +- .../browser_webconsole_telemetry_js_errors.js | 18 +- ...webconsole_telemetry_jump_to_definition.js | 9 +- ...er_webconsole_telemetry_object_expanded.js | 9 +- ...onsole_telemetry_persist_toggle_changed.js | 15 +- .../browser_webconsole_time_methods.js | 57 +- .../browser_webconsole_timestamps.js | 15 +- ...er_webconsole_trackingprotection_errors.js | 134 +- .../browser_webconsole_view_source.js | 21 +- .../browser_webconsole_visibility_messages.js | 21 +- ...wser_webconsole_warn_about_replaced_api.js | 10 +- ...bconsole_warning_group_content_blocking.js | 123 +- ...wser_webconsole_warning_group_multiples.js | 144 +- .../browser_webconsole_warning_groups.js | 98 +- ...ser_webconsole_warning_groups_filtering.js | 68 +- ...le_warning_groups_outside_console_group.js | 48 +- ...rowser_webconsole_warning_groups_toggle.js | 82 +- .../mochitest/browser_webconsole_websocket.js | 10 +- .../browser_webconsole_worker_error.js | 5 +- .../browser_webconsole_worker_evaluate.js | 7 +- .../client/webconsole/test/mochitest/head.js | 407 +++-- .../test/mochitest/test-cu-reporterror.js | 4 +- .../test/mochitest/test-dynamic-import.js | 2 +- .../test-message-categories-workers.js | 1 - .../webconsole/test/store/filters.test.js | 71 +- .../test/store/hidden-messages.test.js | 30 +- .../webconsole/test/store/messages.test.js | 198 ++- .../test/store/network-messages.test.js | 34 +- .../test/store/private-messages.test.js | 109 +- .../test/store/release-actors.test.js | 49 +- .../webconsole/test/store/search.test.js | 8 +- .../client/webconsole/test/store/ui.test.js | 19 +- .../test/unit/test_webconsole_l10n.js | 24 +- .../webconsole/test/utils/getRepeatId.test.js | 20 +- devtools/client/webconsole/types.js | 129 +- devtools/client/webconsole/utils.js | 14 +- devtools/client/webconsole/utils/clipboard.js | 3 +- .../client/webconsole/utils/context-menu.js | 397 +++-- .../client/webconsole/utils/id-generator.js | 2 +- devtools/client/webconsole/utils/messages.js | 104 +- .../webconsole/utils/object-inspector.js | 62 +- devtools/client/webconsole/utils/prefs.js | 17 +- .../webconsole/webconsole-connection-proxy.js | 63 +- devtools/client/webconsole/webconsole-l10n.js | 7 +- devtools/client/webconsole/webconsole-ui.js | 105 +- .../client/webconsole/webconsole-wrapper.js | 306 ++-- devtools/client/webconsole/webconsole.js | 92 +- devtools/client/webide/content/addons.js | 73 +- devtools/client/webide/content/details.js | 34 +- .../webide/content/devicepreferences.js | 57 +- devtools/client/webide/content/newapp.js | 134 +- devtools/client/webide/content/prefs.js | 56 +- .../client/webide/content/project-listing.js | 32 +- .../client/webide/content/project-panel.js | 8 +- .../client/webide/content/runtime-listing.js | 50 +- .../client/webide/content/runtime-panel.js | 8 +- .../client/webide/content/runtimedetails.js | 43 +- devtools/client/webide/content/webide.js | 461 ++++-- devtools/client/webide/content/wifi-auth.js | 19 +- devtools/client/webide/modules/app-manager.js | 206 ++- .../client/webide/modules/app-projects.js | 62 +- .../client/webide/modules/app-validator.js | 167 +- devtools/client/webide/modules/config-view.js | 83 +- .../client/webide/modules/project-list.js | 192 ++- .../client/webide/modules/runtime-list.js | 47 +- devtools/client/webide/modules/runtimes.js | 77 +- devtools/client/webide/modules/tab-store.js | 56 +- devtools/client/webide/modules/utils.js | 40 +- devtools/client/webide/test/browser_tabs.js | 7 +- .../client/webide/test/device_front_shared.js | 12 +- devtools/client/webide/test/head.js | 105 +- .../webreplay/components/WebReplayPlayer.js | 49 +- devtools/client/webreplay/menu.js | 41 +- .../browser_dbg_rr_breakpoints-01.js | 9 +- .../browser_dbg_rr_breakpoints-02.js | 7 +- .../browser_dbg_rr_breakpoints-03.js | 2 +- .../browser_dbg_rr_breakpoints-04.js | 2 +- .../browser_dbg_rr_breakpoints-05.js | 9 +- .../browser_dbg_rr_console_warp-01.js | 9 +- .../browser_dbg_rr_console_warp-02.js | 9 +- .../mochitest/browser_dbg_rr_logpoint-01.js | 24 +- .../mochitest/browser_dbg_rr_logpoint-02.js | 30 +- .../mochitest/browser_dbg_rr_record.js | 4 +- .../mochitest/browser_dbg_rr_replay-01.js | 10 +- .../mochitest/browser_dbg_rr_replay-02.js | 9 +- .../mochitest/browser_dbg_rr_replay-03.js | 9 +- .../mochitest/browser_dbg_rr_stepping-02.js | 3 +- .../mochitest/browser_rr_inspector-01.js | 33 +- .../mochitest/browser_rr_inspector-02.js | 18 +- .../mochitest/browser_rr_inspector-03.js | 16 +- devtools/client/webreplay/mochitest/head.js | 36 +- 2792 files changed, 96115 insertions(+), 52865 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9fe2eec5d41c..236f593c15c1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,14 +43,6 @@ module.exports = { "mozilla" ], "overrides": [{ - "files": [ - "devtools/**", - ], - "rules": { - // Temporarily disable the curly everywhere, pending Prettier. - "curly": "off" - } - }, { "files": [ "*.html", "*.xhtml", diff --git a/.prettierignore b/.prettierignore index d1617f15bb3b..2b34049a071a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -40,31 +40,6 @@ toolkit/components/telemetry/datareporting-prefs.js toolkit/components/telemetry/healthreport-prefs.js # Ignore all devtools directories for now, except the debugger. -devtools/client/*.js -devtools/client/aboutdebugging/** -devtools/client/aboutdebugging-new/** -devtools/client/accessibility/** -devtools/client/application/** -devtools/client/bin/** -devtools/client/dom/** -devtools/client/framework/** -devtools/client/inspector/** -devtools/client/jsonview/** -devtools/client/locales/** -devtools/client/memory/** -devtools/client/netmonitor/** -devtools/client/performance/** -devtools/client/performance-new/** -devtools/client/preferences/** -devtools/client/responsive.html/** -devtools/client/scratchpad/** -devtools/client/shared/** -devtools/client/storage/** -devtools/client/styleeditor/** -devtools/client/themes/** -devtools/client/webconsole/** -devtools/client/webide/** -devtools/client/webreplay/** devtools/docs/** devtools/platform/** devtools/server/** diff --git a/devtools/client/aboutdebugging-new/aboutdebugging.js b/devtools/client/aboutdebugging-new/aboutdebugging.js index 9e94f299dddf..965d3bcb4706 100644 --- a/devtools/client/aboutdebugging-new/aboutdebugging.js +++ b/devtools/client/aboutdebugging-new/aboutdebugging.js @@ -8,10 +8,13 @@ const Services = require("Services"); const { bindActionCreators } = require("devtools/client/shared/vendor/redux"); const { createFactory } = require("devtools/client/shared/vendor/react"); -const { render, unmountComponentAtNode } = - require("devtools/client/shared/vendor/react-dom"); -const Provider = - createFactory(require("devtools/client/shared/vendor/react-redux").Provider); +const { + render, + unmountComponentAtNode, +} = require("devtools/client/shared/vendor/react-dom"); +const Provider = createFactory( + require("devtools/client/shared/vendor/react-redux").Provider +); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const LocalizationProvider = createFactory(FluentReact.LocalizationProvider); @@ -36,10 +39,22 @@ const { } = require("./src/modules/usb-runtimes"); loader.lazyRequireGetter(this, "adb", "devtools/shared/adb/adb", true); -loader.lazyRequireGetter(this, "adbAddon", "devtools/shared/adb/adb-addon", true); -loader.lazyRequireGetter(this, "adbProcess", "devtools/shared/adb/adb-process", true); +loader.lazyRequireGetter( + this, + "adbAddon", + "devtools/shared/adb/adb-addon", + true +); +loader.lazyRequireGetter( + this, + "adbProcess", + "devtools/shared/adb/adb-process", + true +); -const Router = createFactory(require("devtools/client/shared/vendor/react-router-dom").HashRouter); +const Router = createFactory( + require("devtools/client/shared/vendor/react-router-dom").HashRouter +); const App = createFactory(require("./src/components/App")); const AboutDebugging = { @@ -61,10 +76,7 @@ const AboutDebugging = { const width = this.getRoundedViewportWidth(); this.actions.recordTelemetryEvent("open_adbg", { width }); - await l10n.init([ - "branding/brand.ftl", - "devtools/aboutdebugging.ftl", - ]); + await l10n.init(["branding/brand.ftl", "devtools/aboutdebugging.ftl"]); this.actions.createThisFirefoxRuntime(); @@ -77,7 +89,9 @@ const AboutDebugging = { // If ADB is already started, wait for the initial runtime list to be able to restore // already connected runtimes. const isProcessStarted = await adb.isProcessStarted(); - const onAdbRuntimesReady = isProcessStarted ? adb.once("runtime-list-ready") : null; + const onAdbRuntimesReady = isProcessStarted + ? adb.once("runtime-list-ready") + : null; addUSBRuntimesObserver(this.onUSBRuntimesUpdated); await onAdbRuntimesReady; @@ -90,12 +104,7 @@ const AboutDebugging = { }, LocalizationProvider( { messages: l10n.getBundles() }, - Router( - {}, - App( - {} - ) - ) + Router({}, App({})) ) ), this.mount @@ -161,13 +170,21 @@ const AboutDebugging = { }, }; -window.addEventListener("DOMContentLoaded", () => { - AboutDebugging.init(); -}, { once: true }); +window.addEventListener( + "DOMContentLoaded", + () => { + AboutDebugging.init(); + }, + { once: true } +); -window.addEventListener("unload", () => { - AboutDebugging.destroy(); -}, {once: true}); +window.addEventListener( + "unload", + () => { + AboutDebugging.destroy(); + }, + { once: true } +); // Expose AboutDebugging to tests so that they can access to the store. window.AboutDebugging = AboutDebugging; diff --git a/devtools/client/aboutdebugging-new/initializer.js b/devtools/client/aboutdebugging-new/initializer.js index 7695b78a1082..c9dc2716e34c 100644 --- a/devtools/client/aboutdebugging-new/initializer.js +++ b/devtools/client/aboutdebugging-new/initializer.js @@ -4,8 +4,9 @@ "use strict"; -const { BrowserLoader } = - ChromeUtils.import("resource://devtools/client/shared/browser-loader.js"); +const { BrowserLoader } = ChromeUtils.import( + "resource://devtools/client/shared/browser-loader.js" +); const { require } = BrowserLoader({ baseURI: "resource://devtools/client/aboutdebugging-new/", window, diff --git a/devtools/client/aboutdebugging-new/src/actions/debug-targets.js b/devtools/client/aboutdebugging-new/src/actions/debug-targets.js index 57d85cbdab1a..1183e6f9feac 100644 --- a/devtools/client/aboutdebugging-new/src/actions/debug-targets.js +++ b/devtools/client/aboutdebugging-new/src/actions/debug-targets.js @@ -5,13 +5,16 @@ "use strict"; const { AddonManager } = require("resource://gre/modules/AddonManager.jsm"); -const { remoteClientManager } = - require("devtools/client/shared/remote-debugging/remote-client-manager"); +const { + remoteClientManager, +} = require("devtools/client/shared/remote-debugging/remote-client-manager"); const Services = require("Services"); const { l10n } = require("../modules/l10n"); -const { isSupportedDebugTargetPane } = require("../modules/debug-target-support"); +const { + isSupportedDebugTargetPane, +} = require("../modules/debug-target-support"); const { openTemporaryExtension, @@ -54,14 +57,19 @@ function isCachedActorNeeded(runtime, type, id) { // older browsers, the id falls back to the actor ID. Check if the target id is a worker // actorID (which means getActor() should return an actor with id). // Can be removed when Firefox 68 is in Release channel. - return type === DEBUG_TARGETS.WORKER && - runtime.runtimeDetails.clientWrapper.client.getActor(id); + return ( + type === DEBUG_TARGETS.WORKER && + runtime.runtimeDetails.clientWrapper.client.getActor(id) + ); } function getTabForUrl(url) { for (const navigator of Services.wm.getEnumerator("navigator:browser")) { for (const browser of navigator.gBrowser.browsers) { - if (browser.contentWindow && browser.contentWindow.location.href === url) { + if ( + browser.contentWindow && + browser.contentWindow.location.href === url + ) { return navigator.gBrowser.getTabForBrowser(browser); } } @@ -76,7 +84,10 @@ function inspectDebugTarget(type, id) { id = encodeURIComponent(id); let url; - if (runtime.id === RUNTIMES.THIS_FIREFOX && !isCachedActorNeeded(runtime, type, id)) { + if ( + runtime.id === RUNTIMES.THIS_FIREFOX && + !isCachedActorNeeded(runtime, type, id) + ) { // Even when debugging on This Firefox we need to re-use the client since the worker // actor is cached in the client instance. Instead we should pass an id that does // not depend on the client (such as the worker url). This will be fixed in @@ -88,7 +99,10 @@ function inspectDebugTarget(type, id) { // will fail. See Bug 1534201. url = `about:devtools-toolbox?type=${type}&id=${id}`; } else { - const remoteId = remoteClientManager.getRemoteId(runtime.id, runtime.type); + const remoteId = remoteClientManager.getRemoteId( + runtime.id, + runtime.type + ); url = `about:devtools-toolbox?type=${type}&id=${id}&remoteId=${remoteId}`; } @@ -101,15 +115,19 @@ function inspectDebugTarget(type, id) { window.open(url); } - dispatch(Actions.recordTelemetryEvent("inspect", { - "target_type": type.toUpperCase(), - "runtime_type": runtime.type, - })); + dispatch( + Actions.recordTelemetryEvent("inspect", { + target_type: type.toUpperCase(), + runtime_type: runtime.type, + }) + ); }; } function installTemporaryExtension() { - const message = l10n.getString("about-debugging-tmp-extension-install-message"); + const message = l10n.getString( + "about-debugging-tmp-extension-install-message" + ); return async (dispatch, getState) => { dispatch({ type: TEMPORARY_EXTENSION_INSTALL_START }); const file = await openTemporaryExtension(window, message); @@ -169,9 +187,13 @@ function requestTabs() { const clientWrapper = getCurrentClient(getState().runtimes); try { - const isSupported = isSupportedDebugTargetPane(runtime.runtimeDetails.info.type, - DEBUG_TARGET_PANE.TAB); - const tabs = isSupported ? (await clientWrapper.listTabs({ favicons: true })) : []; + const isSupported = isSupportedDebugTargetPane( + runtime.runtimeDetails.info.type, + DEBUG_TARGET_PANE.TAB + ); + const tabs = isSupported + ? await clientWrapper.listTabs({ favicons: true }) + : []; dispatch({ type: REQUEST_TABS_SUCCESS, tabs }); } catch (e) { @@ -189,8 +211,9 @@ function requestExtensions() { try { const isIconDataURLRequired = runtime.type !== RUNTIMES.THIS_FIREFOX; - const addons = - await clientWrapper.listAddons({ iconDataURL: isIconDataURLRequired }); + const addons = await clientWrapper.listAddons({ + iconDataURL: isIconDataURLRequired, + }); let extensions = addons.filter(a => a.debuggable); // Filter out hidden & system addons unless the dedicated preference is set to true. @@ -209,8 +232,12 @@ function requestExtensions() { }); } - const installedExtensions = extensions.filter(e => !e.temporarilyInstalled); - const temporaryExtensions = extensions.filter(e => e.temporarilyInstalled); + const installedExtensions = extensions.filter( + e => !e.temporarilyInstalled + ); + const temporaryExtensions = extensions.filter( + e => e.temporarilyInstalled + ); dispatch({ type: REQUEST_EXTENSIONS_SUCCESS, diff --git a/devtools/client/aboutdebugging-new/src/actions/runtimes.js b/devtools/client/aboutdebugging-new/src/actions/runtimes.js index ed8322ee9aa4..10a69f834d8f 100644 --- a/devtools/client/aboutdebugging-new/src/actions/runtimes.js +++ b/devtools/client/aboutdebugging-new/src/actions/runtimes.js @@ -20,8 +20,9 @@ const { isSupportedDebugTargetPane, } = require("../modules/debug-target-support"); -const { remoteClientManager } = - require("devtools/client/shared/remote-debugging/remote-client-manager"); +const { + remoteClientManager, +} = require("devtools/client/shared/remote-debugging/remote-client-manager"); const { CONNECT_RUNTIME_CANCEL, @@ -67,8 +68,8 @@ async function getRuntimeIcon(runtime, channel) { } } - return (channel === "release" || channel === "beta" || channel === "aurora") - ? `chrome://devtools/skin/images/aboutdebugging-firefox-${ channel }.svg` + return channel === "release" || channel === "beta" || channel === "aurora" + ? `chrome://devtools/skin/images/aboutdebugging-firefox-${channel}.svg` : "chrome://devtools/skin/images/aboutdebugging-firefox-nightly.svg"; } @@ -92,9 +93,12 @@ function connectRuntime(id) { // don't have a default value but will be overridden during our tests. const connectionTimingOutDelay = Services.prefs.getIntPref( "devtools.aboutdebugging.test-connection-timing-out-delay", - CONNECTION_TIMING_OUT_DELAY); + CONNECTION_TIMING_OUT_DELAY + ); const connectionCancelDelay = Services.prefs.getIntPref( - "devtools.aboutdebugging.test-connection-cancel-delay", CONNECTION_CANCEL_DELAY); + "devtools.aboutdebugging.test-connection-cancel-delay", + CONNECTION_CANCEL_DELAY + ); const connectionNotRespondingTimer = setTimeout(() => { // If connecting to the runtime takes time over CONNECTION_TIMING_OUT_DELAY, @@ -124,12 +128,18 @@ function connectRuntime(id) { PERMANENT_PRIVATE_BROWSING, SERVICE_WORKERS_ENABLED, } = RUNTIME_PREFERENCE; - const connectionPromptEnabled = - await clientWrapper.getPreference(CONNECTION_PROMPT, false); - const privateBrowsing = - await clientWrapper.getPreference(PERMANENT_PRIVATE_BROWSING, false); - const serviceWorkersEnabled = - await clientWrapper.getPreference(SERVICE_WORKERS_ENABLED, true); + const connectionPromptEnabled = await clientWrapper.getPreference( + CONNECTION_PROMPT, + false + ); + const privateBrowsing = await clientWrapper.getPreference( + PERMANENT_PRIVATE_BROWSING, + false + ); + const serviceWorkersEnabled = await clientWrapper.getPreference( + SERVICE_WORKERS_ENABLED, + true + ); const serviceWorkersAvailable = serviceWorkersEnabled && !privateBrowsing; // Fenix specific workarounds are needed until we can get proper server side APIs @@ -138,12 +148,15 @@ function connectRuntime(id) { // For Fenix runtimes, the ADB runtime name is more accurate than the one returned // by the Device actor. - const runtimeName = runtime.isFenix ? runtime.name : deviceDescription.name; + const runtimeName = runtime.isFenix + ? runtime.name + : deviceDescription.name; // For Fenix runtimes, the version we should display is the application version // retrieved from ADB, and not the Gecko version returned by the Device actor. - const version = runtime.isFenix ? - runtime.extra.adbPackageVersion : deviceDescription.version; + const version = runtime.isFenix + ? runtime.extra.adbPackageVersion + : deviceDescription.version; const runtimeDetails = { clientWrapper, @@ -203,7 +216,10 @@ function createThisFirefoxRuntime() { name: l10n.getString("about-debugging-this-firefox-runtime-name"), type: RUNTIMES.THIS_FIREFOX, }; - dispatch({ type: THIS_FIREFOX_RUNTIME_CREATED, runtime: thisFirefoxRuntime }); + dispatch({ + type: THIS_FIREFOX_RUNTIME_CREATED, + runtime: thisFirefoxRuntime, + }); }; } @@ -224,7 +240,9 @@ function disconnectRuntime(id, shouldRedirect = false) { } await clientWrapper.close(); if (shouldRedirect) { - await dispatch(Actions.selectPage(PAGE_TYPES.RUNTIME, RUNTIMES.THIS_FIREFOX)); + await dispatch( + Actions.selectPage(PAGE_TYPES.RUNTIME, RUNTIMES.THIS_FIREFOX) + ); } dispatch({ @@ -247,13 +265,21 @@ function updateConnectionPromptSetting(connectionPromptEnabled) { const runtime = getCurrentRuntime(getState().runtimes); const { clientWrapper } = runtime.runtimeDetails; const promptPrefName = RUNTIME_PREFERENCE.CONNECTION_PROMPT; - await clientWrapper.setPreference(promptPrefName, connectionPromptEnabled); + await clientWrapper.setPreference( + promptPrefName, + connectionPromptEnabled + ); // Re-get actual value from the runtime. - connectionPromptEnabled = - await clientWrapper.getPreference(promptPrefName, connectionPromptEnabled); + connectionPromptEnabled = await clientWrapper.getPreference( + promptPrefName, + connectionPromptEnabled + ); - dispatch({ type: UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS, - runtime, connectionPromptEnabled }); + dispatch({ + type: UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS, + runtime, + connectionPromptEnabled, + }); } catch (e) { dispatch({ type: UPDATE_CONNECTION_PROMPT_SETTING_FAILURE, error: e }); } @@ -269,7 +295,11 @@ function updateMultiE10s() { // Re-get actual value from the runtime. const { isMultiE10s } = await clientWrapper.getDeviceDescription(); - dispatch({ type: UPDATE_RUNTIME_MULTIE10S_SUCCESS, runtime, isMultiE10s }); + dispatch({ + type: UPDATE_RUNTIME_MULTIE10S_SUCCESS, + runtime, + isMultiE10s, + }); } catch (e) { dispatch({ type: UPDATE_RUNTIME_MULTIE10S_FAILURE, error: e }); } @@ -294,8 +324,12 @@ function watchRuntime(id) { dispatch(Actions.requestTabs()); dispatch(Actions.requestWorkers()); - if (isSupportedDebugTargetPane(runtime.runtimeDetails.info.type, - DEBUG_TARGET_PANE.PROCESSES)) { + if ( + isSupportedDebugTargetPane( + runtime.runtimeDetails.info.type, + DEBUG_TARGET_PANE.PROCESSES + ) + ) { dispatch(Actions.requestProcesses()); } } catch (e) { @@ -325,7 +359,7 @@ function unwatchRuntime(id) { function updateNetworkRuntimes(locations) { const runtimes = locations.map(location => { - const [ host, port ] = location.split(":"); + const [host, port] = location.split(":"); return { id: location, extra: { @@ -381,8 +415,8 @@ function updateUSBRuntimes(adbRuntimes) { */ function _isRuntimeValid(runtime, runtimes) { const isRuntimeAvailable = runtimes.some(r => r.id === runtime.id); - const isConnectionValid = runtime.runtimeDetails && - !runtime.runtimeDetails.clientWrapper.isClosed(); + const isConnectionValid = + runtime.runtimeDetails && !runtime.runtimeDetails.clientWrapper.isClosed(); return isRuntimeAvailable && isConnectionValid; } @@ -392,8 +426,11 @@ function updateRemoteRuntimes(runtimes, type) { // Check if the updated remote runtimes should trigger a navigation out of the current // runtime page. - if (currentRuntime && currentRuntime.type === type && - !_isRuntimeValid(currentRuntime, runtimes)) { + if ( + currentRuntime && + currentRuntime.type === type && + !_isRuntimeValid(currentRuntime, runtimes) + ) { // Since current remote runtime is invalid, move to this firefox page. // This case is considered as followings and so on: // * Remove ADB addon @@ -403,7 +440,9 @@ function updateRemoteRuntimes(runtimes, type) { // Current runtime can not be retrieved after REMOTE_RUNTIMES_UPDATED action, since // that updates runtime state. So, before that we fire selectPage action to execute // `unwatchRuntime` correctly. - await dispatch(Actions.selectPage(PAGE_TYPES.RUNTIME, RUNTIMES.THIS_FIREFOX)); + await dispatch( + Actions.selectPage(PAGE_TYPES.RUNTIME, RUNTIMES.THIS_FIREFOX) + ); } // For existing runtimes, transfer all properties that are not available in the @@ -416,16 +455,25 @@ function updateRemoteRuntimes(runtimes, type) { // - isConnectionTimeout (set by about:debugging if connection was timeout) runtimes.forEach(runtime => { const existingRuntime = findRuntimeById(runtime.id, getState().runtimes); - const isConnectionValid = existingRuntime && existingRuntime.runtimeDetails && - !existingRuntime.runtimeDetails.clientWrapper.isClosed(); - runtime.runtimeDetails = isConnectionValid ? existingRuntime.runtimeDetails : null; - runtime.isConnecting = existingRuntime ? existingRuntime.isConnecting : false; - runtime.isConnectionFailed = - existingRuntime ? existingRuntime.isConnectionFailed : false; - runtime.isConnectionNotResponding = - existingRuntime ? existingRuntime.isConnectionNotResponding : false; - runtime.isConnectionTimeout = - existingRuntime ? existingRuntime.isConnectionTimeout : false; + const isConnectionValid = + existingRuntime && + existingRuntime.runtimeDetails && + !existingRuntime.runtimeDetails.clientWrapper.isClosed(); + runtime.runtimeDetails = isConnectionValid + ? existingRuntime.runtimeDetails + : null; + runtime.isConnecting = existingRuntime + ? existingRuntime.isConnecting + : false; + runtime.isConnectionFailed = existingRuntime + ? existingRuntime.isConnectionFailed + : false; + runtime.isConnectionNotResponding = existingRuntime + ? existingRuntime.isConnectionNotResponding + : false; + runtime.isConnectionTimeout = existingRuntime + ? existingRuntime.isConnectionTimeout + : false; }); const existingRuntimes = getAllRuntimes(getState().runtimes); @@ -449,7 +497,10 @@ function updateRemoteRuntimes(runtimes, type) { // Reconnect clients already available in the RemoteClientManager. const isConnected = !!runtime.runtimeDetails; - const hasConnectedClient = remoteClientManager.hasClient(runtime.id, runtime.type); + const hasConnectedClient = remoteClientManager.hasClient( + runtime.id, + runtime.type + ); if (!isConnected && hasConnectedClient) { await dispatch(connectRuntime(runtime.id)); } @@ -465,7 +516,9 @@ function updateRemoteRuntimes(runtimes, type) { function removeRuntimeListeners() { return (dispatch, getState) => { const allRuntimes = getAllRuntimes(getState().runtimes); - const remoteRuntimes = allRuntimes.filter(r => r.type !== RUNTIMES.THIS_FIREFOX); + const remoteRuntimes = allRuntimes.filter( + r => r.type !== RUNTIMES.THIS_FIREFOX + ); for (const runtime of remoteRuntimes) { if (runtime.runtimeDetails) { const { clientWrapper } = runtime.runtimeDetails; diff --git a/devtools/client/aboutdebugging-new/src/actions/telemetry.js b/devtools/client/aboutdebugging-new/src/actions/telemetry.js index 9d212db09e0d..9e045ed8d64a 100644 --- a/devtools/client/aboutdebugging-new/src/actions/telemetry.js +++ b/devtools/client/aboutdebugging-new/src/actions/telemetry.js @@ -4,9 +4,7 @@ "use strict"; -const { - TELEMETRY_RECORD, -} = require("../constants"); +const { TELEMETRY_RECORD } = require("../constants"); /** * If a given event cannot be mapped to an existing action, use this action that will only diff --git a/devtools/client/aboutdebugging-new/src/components/App.js b/devtools/client/aboutdebugging-new/src/components/App.js index 1d9127780d9f..973920da8526 100644 --- a/devtools/client/aboutdebugging-new/src/components/App.js +++ b/devtools/client/aboutdebugging-new/src/components/App.js @@ -5,16 +5,25 @@ "use strict"; const { connect } = require("devtools/client/shared/vendor/react-redux"); -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const Localized = createFactory(FluentReact.Localized); -const Route = createFactory(require("devtools/client/shared/vendor/react-router-dom").Route); -const Switch = createFactory(require("devtools/client/shared/vendor/react-router-dom").Switch); -const Redirect = createFactory(require("devtools/client/shared/vendor/react-router-dom").Redirect); +const Route = createFactory( + require("devtools/client/shared/vendor/react-router-dom").Route +); +const Switch = createFactory( + require("devtools/client/shared/vendor/react-router-dom").Switch +); +const Redirect = createFactory( + require("devtools/client/shared/vendor/react-router-dom").Redirect +); const Types = require("../types/index"); const { PAGE_TYPES, RUNTIMES } = require("../constants"); @@ -50,19 +59,18 @@ class App extends PureComponent { updateTitle() { const { getString, selectedPage, selectedRuntimeId } = this.props; - const pageTitle = selectedPage === PAGE_TYPES.RUNTIME ? - getString("about-debugging-page-title-runtime-page", { selectedRuntimeId }) : - getString("about-debugging-page-title-setup-page"); + const pageTitle = + selectedPage === PAGE_TYPES.RUNTIME + ? getString("about-debugging-page-title-runtime-page", { + selectedRuntimeId, + }) + : getString("about-debugging-page-title-setup-page"); document.title = pageTitle; } renderConnect() { - const { - adbAddonStatus, - dispatch, - networkLocations, - } = this.props; + const { adbAddonStatus, dispatch, networkLocations } = this.props; return ConnectPage({ adbAddonStatus, @@ -125,10 +133,14 @@ class App extends PureComponent { // about:debugging#workers, about:debugging#addons and about:debugging#tabs. // Such links can still be found in external documentation pages. // We redirect to This Firefox rather than the Setup Page here. - if (pathname === "/workers" || pathname === "/addons" || pathname === "/tabs") { - return Redirect({ to: `/runtime/${RUNTIMES.THIS_FIREFOX}`}); + if ( + pathname === "/workers" || + pathname === "/addons" || + pathname === "/tabs" + ) { + return Redirect({ to: `/runtime/${RUNTIMES.THIS_FIREFOX}` }); } - return Redirect({ to: "/setup"}); + return Redirect({ to: "/setup" }); }, }) ); @@ -147,7 +159,7 @@ class App extends PureComponent { } = this.props; return Localized( - { }, + {}, dom.div( { className: "app" }, Sidebar({ @@ -184,6 +196,9 @@ const mapDispatchToProps = dispatch => ({ dispatch, }); -module.exports = FluentReact - .withLocalization( - connect(mapStateToProps, mapDispatchToProps)(App)); +module.exports = FluentReact.withLocalization( + connect( + mapStateToProps, + mapDispatchToProps + )(App) +); diff --git a/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js b/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js index 8edab231fe06..1e9228140b59 100644 --- a/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js +++ b/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); @@ -13,9 +16,12 @@ const Localized = createFactory(FluentReact.Localized); const Message = createFactory(require("./shared/Message")); const { MESSAGE_LEVEL } = require("../constants"); -const { COMPATIBILITY_STATUS } = require("devtools/client/shared/remote-debugging/version-checker"); +const { + COMPATIBILITY_STATUS, +} = require("devtools/client/shared/remote-debugging/version-checker"); -const TROUBLESHOOTING_URL = "https://developer.mozilla.org/docs/Tools/about:debugging#Troubleshooting"; +const TROUBLESHOOTING_URL = + "https://developer.mozilla.org/docs/Tools/about:debugging#Troubleshooting"; const Types = require("../types/index"); @@ -27,8 +33,14 @@ class CompatibilityWarning extends PureComponent { } render() { - const { localID, localVersion, minVersion, runtimeID, runtimeVersion, status } = - this.props.compatibilityReport; + const { + localID, + localVersion, + minVersion, + runtimeID, + runtimeVersion, + status, + } = this.props.compatibilityReport; if (status === COMPATIBILITY_STATUS.COMPATIBLE) { return null; @@ -72,8 +84,8 @@ class CompatibilityWarning extends PureComponent { { className: `qa-compatibility-warning ${statusClassName}`, }, - localizationId, - ), + localizationId + ) ) ); } diff --git a/devtools/client/aboutdebugging-new/src/components/ConnectionPromptSetting.js b/devtools/client/aboutdebugging-new/src/components/ConnectionPromptSetting.js index 650ebeea7d54..2a1528b0636e 100644 --- a/devtools/client/aboutdebugging-new/src/components/ConnectionPromptSetting.js +++ b/devtools/client/aboutdebugging-new/src/components/ConnectionPromptSetting.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -31,8 +34,8 @@ class ConnectionPromptSetting extends PureComponent { const { className, connectionPromptEnabled } = this.props; const localizedState = connectionPromptEnabled - ? "about-debugging-connection-prompt-disable-button" - : "about-debugging-connection-prompt-enable-button"; + ? "about-debugging-connection-prompt-disable-button" + : "about-debugging-connection-prompt-enable-button"; return Localized( { @@ -40,7 +43,7 @@ class ConnectionPromptSetting extends PureComponent { }, dom.button( { - className: `${ className } default-button qa-connection-prompt-toggle-button`, + className: `${className} default-button qa-connection-prompt-toggle-button`, onClick: () => this.onToggleClick(), }, localizedState diff --git a/devtools/client/aboutdebugging-new/src/components/ProfilerDialog.js b/devtools/client/aboutdebugging-new/src/components/ProfilerDialog.js index f994eb7bc5f0..8328a4c75546 100644 --- a/devtools/client/aboutdebugging-new/src/components/ProfilerDialog.js +++ b/devtools/client/aboutdebugging-new/src/components/ProfilerDialog.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -54,7 +57,7 @@ class ProfilerDialog extends PureComponent { { className: "profiler-dialog__header__title", }, - "about-debugging-profiler-dialog-title2", + "about-debugging-profiler-dialog-title2" ) ), dom.button( @@ -62,17 +65,15 @@ class ProfilerDialog extends PureComponent { className: "ghost-button qa-profiler-dialog-close", onClick: () => this.hide(), }, - dom.img( - { - src: "chrome://devtools/skin/images/close.svg", - } - ) + dom.img({ + src: "chrome://devtools/skin/images/close.svg", + }) ) ), dom.iframe({ className: "profiler-dialog__frame", src: clientWrapper.getPerformancePanelUrl(), - onLoad: (e) => { + onLoad: e => { clientWrapper.loadPerformanceProfiler(e.target.contentWindow); }, }) diff --git a/devtools/client/aboutdebugging-new/src/components/RuntimeActions.js b/devtools/client/aboutdebugging-new/src/components/RuntimeActions.js index fc47183eb750..4575cf234852 100644 --- a/devtools/client/aboutdebugging-new/src/components/RuntimeActions.js +++ b/devtools/client/aboutdebugging-new/src/components/RuntimeActions.js @@ -4,14 +4,19 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const Localized = createFactory(FluentReact.Localized); -const ConnectionPromptSetting = createFactory(require("./ConnectionPromptSetting")); +const ConnectionPromptSetting = createFactory( + require("./ConnectionPromptSetting") +); const Actions = require("../actions/index"); const { RUNTIMES } = require("../constants"); @@ -35,30 +40,30 @@ class RuntimeActions extends PureComponent { const { connectionPromptEnabled } = runtimeDetails; // do not show the connection prompt setting in 'This Firefox' return runtimeId !== RUNTIMES.THIS_FIREFOX - ? ConnectionPromptSetting({ - connectionPromptEnabled, - dispatch, - }) - : null; + ? ConnectionPromptSetting({ + connectionPromptEnabled, + dispatch, + }) + : null; } renderProfileButton() { const { runtimeId } = this.props; return runtimeId !== RUNTIMES.THIS_FIREFOX - ? Localized( - { - id: "about-debugging-runtime-profile-button2", - }, - dom.button( - { - className: "default-button qa-profile-runtime-button", - onClick: () => this.onProfilerButtonClick(), - }, - "about-debugging-runtime-profile-button2" - ), - ) - : null; + ? Localized( + { + id: "about-debugging-runtime-profile-button2", + }, + dom.button( + { + className: "default-button qa-profile-runtime-button", + onClick: () => this.onProfilerButtonClick(), + }, + "about-debugging-runtime-profile-button2" + ) + ) + : null; } render() { @@ -67,7 +72,7 @@ class RuntimeActions extends PureComponent { className: "runtime-actions__toolbar", }, this.renderProfileButton(), - this.renderConnectionPromptSetting(), + this.renderConnectionPromptSetting() ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/RuntimeInfo.js b/devtools/client/aboutdebugging-new/src/components/RuntimeInfo.js index 4f62483be67e..7ecbb2ab673d 100644 --- a/devtools/client/aboutdebugging-new/src/components/RuntimeInfo.js +++ b/devtools/client/aboutdebugging-new/src/components/RuntimeInfo.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -35,12 +38,10 @@ class RuntimeInfo extends PureComponent { { className: "main-heading runtime-info", }, - dom.img( - { - className: "main-heading__icon runtime-info__icon qa-runtime-icon", - src: icon, - } - ), + dom.img({ + className: "main-heading__icon runtime-info__icon qa-runtime-icon", + src: icon, + }), Localized( { id: "about-debugging-runtime-name", @@ -51,31 +52,34 @@ class RuntimeInfo extends PureComponent { { className: "qa-runtime-name runtime-info__title", }, - `${ name } (${ version })` + `${name} (${version})` ) ), - deviceName ? - dom.label( - { - className: "main-heading-subtitle runtime-info__subtitle", - }, - deviceName - ) : null, - runtimeId !== RUNTIMES.THIS_FIREFOX ? - Localized( - { - id: "about-debugging-runtime-disconnect-button", - }, - dom.button( + deviceName + ? dom.label( { - className: "default-button runtime-info__action qa-runtime-info__action", - onClick() { - dispatch(Actions.disconnectRuntime(runtimeId, true)); - }, + className: "main-heading-subtitle runtime-info__subtitle", }, - "Disconnect" + deviceName ) - ) : null, + : null, + runtimeId !== RUNTIMES.THIS_FIREFOX + ? Localized( + { + id: "about-debugging-runtime-disconnect-button", + }, + dom.button( + { + className: + "default-button runtime-info__action qa-runtime-info__action", + onClick() { + dispatch(Actions.disconnectRuntime(runtimeId, true)); + }, + }, + "Disconnect" + ) + ) + : null ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/RuntimePage.js b/devtools/client/aboutdebugging-new/src/components/RuntimePage.js index 5d2dbcfc1df0..0f0949a0e8d3 100644 --- a/devtools/client/aboutdebugging-new/src/components/RuntimePage.js +++ b/devtools/client/aboutdebugging-new/src/components/RuntimePage.js @@ -5,7 +5,10 @@ "use strict"; const { connect } = require("devtools/client/shared/vendor/react-redux"); -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -19,25 +22,40 @@ const InspectAction = createFactory(require("./debugtarget/InspectAction")); const ProfilerDialog = createFactory(require("./ProfilerDialog")); const RuntimeActions = createFactory(require("./RuntimeActions")); const RuntimeInfo = createFactory(require("./RuntimeInfo")); -const ServiceWorkerAction = createFactory(require("./debugtarget/ServiceWorkerAction")); -const ServiceWorkerAdditionalActions = - createFactory(require("./debugtarget/ServiceWorkerAdditionalActions")); +const ServiceWorkerAction = createFactory( + require("./debugtarget/ServiceWorkerAction") +); +const ServiceWorkerAdditionalActions = createFactory( + require("./debugtarget/ServiceWorkerAdditionalActions") +); const ServiceWorkersWarning = createFactory(require("./ServiceWorkersWarning")); const ProcessDetail = createFactory(require("./debugtarget/ProcessDetail")); const TabDetail = createFactory(require("./debugtarget/TabDetail")); -const TemporaryExtensionAdditionalActions = - createFactory(require("./debugtarget/TemporaryExtensionAdditionalActions")); -const TemporaryExtensionDetail = createFactory(require("./debugtarget/TemporaryExtensionDetail")); -const TemporaryExtensionInstallSection = - createFactory(require("./debugtarget/TemporaryExtensionInstallSection")); +const TemporaryExtensionAdditionalActions = createFactory( + require("./debugtarget/TemporaryExtensionAdditionalActions") +); +const TemporaryExtensionDetail = createFactory( + require("./debugtarget/TemporaryExtensionDetail") +); +const TemporaryExtensionInstallSection = createFactory( + require("./debugtarget/TemporaryExtensionInstallSection") +); const WorkerDetail = createFactory(require("./debugtarget/WorkerDetail")); const Actions = require("../actions/index"); -const { DEBUG_TARGETS, DEBUG_TARGET_PANE, PAGE_TYPES } = require("../constants"); +const { + DEBUG_TARGETS, + DEBUG_TARGET_PANE, + PAGE_TYPES, +} = require("../constants"); const Types = require("../types/index"); -const { getCurrentRuntimeDetails } = require("../modules/runtimes-state-helper"); -const { isSupportedDebugTargetPane } = require("../modules/debug-target-support"); +const { + getCurrentRuntimeDetails, +} = require("../modules/runtimes-state-helper"); +const { + isSupportedDebugTargetPane, +} = require("../modules/debug-target-support"); class RuntimePage extends PureComponent { static get propTypes() { @@ -77,12 +95,20 @@ class RuntimePage extends PureComponent { return "chrome://devtools/skin/images/debugging-workers.svg"; } - throw new Error(`Unsupported type [${ type }]`); + throw new Error(`Unsupported type [${type}]`); } - renderDebugTargetPane(name, icon, targets, children, actionComponent, - additionalActionsComponent, detailComponent, - paneKey, localizationId) { + renderDebugTargetPane( + name, + icon, + targets, + children, + actionComponent, + additionalActionsComponent, + detailComponent, + paneKey, + localizationId + ) { const { collapsibilities, dispatch, runtimeDetails } = this.props; if (!isSupportedDebugTargetPane(runtimeDetails.info.type, paneKey)) { @@ -112,13 +138,20 @@ class RuntimePage extends PureComponent { } renderTemporaryExtensionInstallSection() { - if (!isSupportedDebugTargetPane(this.props.runtimeDetails.info.type, - DEBUG_TARGET_PANE.TEMPORARY_EXTENSION)) { + if ( + !isSupportedDebugTargetPane( + this.props.runtimeDetails.info.type, + DEBUG_TARGET_PANE.TEMPORARY_EXTENSION + ) + ) { return null; } const { dispatch, temporaryInstallError } = this.props; - return TemporaryExtensionInstallSection({ dispatch, temporaryInstallError }); + return TemporaryExtensionInstallSection({ + dispatch, + temporaryInstallError, + }); } render() { @@ -152,71 +185,85 @@ class RuntimePage extends PureComponent { RuntimeActions({ dispatch, runtimeId, runtimeDetails }), runtimeDetails.serviceWorkersAvailable ? null : ServiceWorkersWarning(), CompatibilityWarning({ compatibilityReport }), - this.renderDebugTargetPane("Tabs", - this.getIconByType(DEBUG_TARGETS.TAB), - tabs, - null, - InspectAction, - null, - TabDetail, - DEBUG_TARGET_PANE.TAB, - "about-debugging-runtime-tabs"), - this.renderDebugTargetPane("Temporary Extensions", - this.getIconByType(DEBUG_TARGETS.EXTENSION), - temporaryExtensions, - this.renderTemporaryExtensionInstallSection(), - InspectAction, - TemporaryExtensionAdditionalActions, - TemporaryExtensionDetail, - DEBUG_TARGET_PANE.TEMPORARY_EXTENSION, - "about-debugging-runtime-temporary-extensions"), - this.renderDebugTargetPane("Extensions", - this.getIconByType(DEBUG_TARGETS.EXTENSION), - installedExtensions, - null, - InspectAction, - null, - ExtensionDetail, - DEBUG_TARGET_PANE.INSTALLED_EXTENSION, - "about-debugging-runtime-extensions"), - this.renderDebugTargetPane("Service Workers", - this.getIconByType(DEBUG_TARGETS.WORKER), - serviceWorkers, - null, - ServiceWorkerAction, - ServiceWorkerAdditionalActions, - WorkerDetail, - DEBUG_TARGET_PANE.SERVICE_WORKER, - "about-debugging-runtime-service-workers"), - this.renderDebugTargetPane("Shared Workers", - this.getIconByType(DEBUG_TARGETS.WORKER), - sharedWorkers, - null, - InspectAction, - null, - WorkerDetail, - DEBUG_TARGET_PANE.SHARED_WORKER, - "about-debugging-runtime-shared-workers"), - this.renderDebugTargetPane("Other Workers", - this.getIconByType(DEBUG_TARGETS.WORKER), - otherWorkers, - null, - InspectAction, - null, - WorkerDetail, - DEBUG_TARGET_PANE.OTHER_WORKER, - "about-debugging-runtime-other-workers"), - this.renderDebugTargetPane("Processes", - this.getIconByType(DEBUG_TARGETS.PROCESS), - processes, - null, - InspectAction, - null, - ProcessDetail, - DEBUG_TARGET_PANE.PROCESSES, - "about-debugging-runtime-processes"), + this.renderDebugTargetPane( + "Tabs", + this.getIconByType(DEBUG_TARGETS.TAB), + tabs, + null, + InspectAction, + null, + TabDetail, + DEBUG_TARGET_PANE.TAB, + "about-debugging-runtime-tabs" + ), + this.renderDebugTargetPane( + "Temporary Extensions", + this.getIconByType(DEBUG_TARGETS.EXTENSION), + temporaryExtensions, + this.renderTemporaryExtensionInstallSection(), + InspectAction, + TemporaryExtensionAdditionalActions, + TemporaryExtensionDetail, + DEBUG_TARGET_PANE.TEMPORARY_EXTENSION, + "about-debugging-runtime-temporary-extensions" + ), + this.renderDebugTargetPane( + "Extensions", + this.getIconByType(DEBUG_TARGETS.EXTENSION), + installedExtensions, + null, + InspectAction, + null, + ExtensionDetail, + DEBUG_TARGET_PANE.INSTALLED_EXTENSION, + "about-debugging-runtime-extensions" + ), + this.renderDebugTargetPane( + "Service Workers", + this.getIconByType(DEBUG_TARGETS.WORKER), + serviceWorkers, + null, + ServiceWorkerAction, + ServiceWorkerAdditionalActions, + WorkerDetail, + DEBUG_TARGET_PANE.SERVICE_WORKER, + "about-debugging-runtime-service-workers" + ), + this.renderDebugTargetPane( + "Shared Workers", + this.getIconByType(DEBUG_TARGETS.WORKER), + sharedWorkers, + null, + InspectAction, + null, + WorkerDetail, + DEBUG_TARGET_PANE.SHARED_WORKER, + "about-debugging-runtime-shared-workers" + ), + this.renderDebugTargetPane( + "Other Workers", + this.getIconByType(DEBUG_TARGETS.WORKER), + otherWorkers, + null, + InspectAction, + null, + WorkerDetail, + DEBUG_TARGET_PANE.OTHER_WORKER, + "about-debugging-runtime-other-workers" + ), + this.renderDebugTargetPane( + "Processes", + this.getIconByType(DEBUG_TARGETS.PROCESS), + processes, + null, + InspectAction, + null, + ProcessDetail, + DEBUG_TARGET_PANE.PROCESSES, + "about-debugging-runtime-processes" + ), - showProfilerDialog ? ProfilerDialog({ dispatch, runtimeDetails }) : null, + showProfilerDialog ? ProfilerDialog({ dispatch, runtimeDetails }) : null ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/ServiceWorkersWarning.js b/devtools/client/aboutdebugging-new/src/components/ServiceWorkersWarning.js index 2eeff38ff35e..4d5642d81be8 100644 --- a/devtools/client/aboutdebugging-new/src/components/ServiceWorkersWarning.js +++ b/devtools/client/aboutdebugging-new/src/components/ServiceWorkersWarning.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); @@ -13,7 +16,8 @@ const Localized = createFactory(FluentReact.Localized); const Message = createFactory(require("./shared/Message")); const { MESSAGE_LEVEL } = require("../constants"); -const DOC_URL = "https://developer.mozilla.org/docs/Tools/about:debugging#Service_workers_not_compatible"; +const DOC_URL = + "https://developer.mozilla.org/docs/Tools/about:debugging#Service_workers_not_compatible"; class ServiceWorkersWarning extends PureComponent { render() { @@ -34,8 +38,8 @@ class ServiceWorkersWarning extends PureComponent { { className: "qa-service-workers-warning", }, - "about-debugging-runtime-service-workers-not-compatible", - ), + "about-debugging-runtime-service-workers-not-compatible" + ) ) ); } diff --git a/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js b/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js index 4507562588cd..dc15ce557c47 100644 --- a/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js +++ b/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js @@ -4,22 +4,30 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const Localized = createFactory(FluentReact.Localized); -const { - USB_STATES, -} = require("../../constants"); +const { USB_STATES } = require("../../constants"); const Actions = require("../../actions/index"); -loader.lazyRequireGetter(this, "ADB_ADDON_STATES", "devtools/shared/adb/adb-addon", true); +loader.lazyRequireGetter( + this, + "ADB_ADDON_STATES", + "devtools/shared/adb/adb-addon", + true +); -const Link = createFactory(require("devtools/client/shared/vendor/react-router-dom").Link); +const Link = createFactory( + require("devtools/client/shared/vendor/react-router-dom").Link +); const ConnectSection = createFactory(require("./ConnectSection")); const ConnectSteps = createFactory(require("./ConnectSteps")); const NetworkLocationsForm = createFactory(require("./NetworkLocationsForm")); @@ -28,8 +36,10 @@ const NetworkLocationsList = createFactory(require("./NetworkLocationsList")); const { PAGE_TYPES, RUNTIMES } = require("../../constants"); const Types = require("../../types/index"); -const USB_ICON_SRC = "chrome://devtools/skin/images/aboutdebugging-usb-icon.svg"; -const GLOBE_ICON_SRC = "chrome://devtools/skin/images/aboutdebugging-globe-icon.svg"; +const USB_ICON_SRC = + "chrome://devtools/skin/images/aboutdebugging-usb-icon.svg"; +const GLOBE_ICON_SRC = + "chrome://devtools/skin/images/aboutdebugging-globe-icon.svg"; const TROUBLESHOOT_USB_URL = "https://developer.mozilla.org/docs/Tools/Remote_Debugging/Debugging_over_USB"; @@ -87,8 +97,8 @@ class ConnectPage extends PureComponent { { className: "connect-page__usb-section__heading__status", }, - statusTextId, - ), + statusTextId + ) ); } @@ -138,45 +148,45 @@ class ConnectPage extends PureComponent { { className: "connect-page__usb-section__heading__title", }, - "USB", - ), + "USB" + ) ), this.renderUsbStatus(), - this.renderUsbToggleButton(), + this.renderUsbToggleButton() ), }, isAddonInstalled - ? ConnectSteps( - { + ? ConnectSteps({ steps: [ { - localizationId: "about-debugging-setup-usb-step-enable-dev-menu2", + localizationId: + "about-debugging-setup-usb-step-enable-dev-menu2", }, { localizationId: "about-debugging-setup-usb-step-enable-debug2", }, { - localizationId: "about-debugging-setup-usb-step-enable-debug-firefox2", + localizationId: + "about-debugging-setup-usb-step-enable-debug-firefox2", }, { localizationId: "about-debugging-setup-usb-step-plug-device", }, ], - } - ) + }) : Localized( - { - id: "about-debugging-setup-usb-disabled", - }, - dom.aside( { - className: "qa-connect-usb-disabled-message", + id: "about-debugging-setup-usb-disabled", }, - "Enabling this will download and add the required Android USB debugging " + - "components to Firefox." - ) - ), - this.renderTroubleshootText(RUNTIMES.USB), + dom.aside( + { + className: "qa-connect-usb-disabled-message", + }, + "Enabling this will download and add the required Android USB debugging " + + "components to Firefox." + ) + ), + this.renderTroubleshootText(RUNTIMES.USB) ); } @@ -196,24 +206,26 @@ class ConnectPage extends PureComponent { {}, NetworkLocationsList({ dispatch, networkLocations }), NetworkLocationsForm({ dispatch, networkLocations }), - this.renderTroubleshootText(RUNTIMES.NETWORK), + this.renderTroubleshootText(RUNTIMES.NETWORK) ), - }, - ) + }) ); } renderTroubleshootText(connectionType) { - const localizationId = connectionType === RUNTIMES.USB - ? "about-debugging-setup-usb-troubleshoot" - : "about-debugging-setup-network-troubleshoot"; + const localizationId = + connectionType === RUNTIMES.USB + ? "about-debugging-setup-usb-troubleshoot" + : "about-debugging-setup-network-troubleshoot"; - const className = "connect-page__troubleshoot connect-page__troubleshoot--" + + const className = + "connect-page__troubleshoot connect-page__troubleshoot--" + `${connectionType === RUNTIMES.USB ? "usb" : "network"}`; - const url = connectionType === RUNTIMES.USB - ? TROUBLESHOOT_USB_URL - : TROUBLESHOOT_NETWORK_URL; + const url = + connectionType === RUNTIMES.USB + ? TROUBLESHOOT_USB_URL + : TROUBLESHOOT_NETWORK_URL; return dom.aside( { @@ -222,17 +234,12 @@ class ConnectPage extends PureComponent { Localized( { id: localizationId, - a: dom.a( - { - href: url, - target: "_blank", - } - ), + a: dom.a({ + href: url, + target: "_blank", + }), }, - dom.p( - {}, - localizationId, - ), + dom.p({}, localizationId) ) ); } @@ -251,7 +258,7 @@ class ConnectPage extends PureComponent { className: "alt-heading alt-heading--larger", }, "Setup" - ), + ) ), Localized( { @@ -269,10 +276,7 @@ class ConnectPage extends PureComponent { to: `/runtime/${RUNTIMES.THIS_FIREFOX}`, }), }, - dom.p( - {}, - "about-debugging-setup-this-firefox", - ), + dom.p({}, "about-debugging-setup-this-firefox") ), dom.section( { @@ -286,12 +290,12 @@ class ConnectPage extends PureComponent { { className: "alt-heading", }, - "Connect a device", - ), + "Connect a device" + ) ), this.renderUsb(), this.renderNetwork() - ), + ) ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/connect/ConnectSection.js b/devtools/client/aboutdebugging-new/src/components/connect/ConnectSection.js index a3139a474862..06038c72978e 100644 --- a/devtools/client/aboutdebugging-new/src/components/connect/ConnectSection.js +++ b/devtools/client/aboutdebugging-new/src/components/connect/ConnectSection.js @@ -25,7 +25,7 @@ class ConnectSection extends PureComponent { { className: "connect-section__extra", }, - extraContent, + extraContent ); } @@ -40,28 +40,26 @@ class ConnectSection extends PureComponent { { className: "connect-section__header", }, - dom.img( - { - className: "connect-section__header__icon", - src: this.props.icon, - }, - ), + dom.img({ + className: "connect-section__header__icon", + src: this.props.icon, + }), dom.h1( { className: "card__heading connect-section__header__title", }, - this.props.title, - ), + this.props.title + ) ), this.props.children ? dom.div( - { - className: "connect-section__content", - }, - this.props.children - ) + { + className: "connect-section__content", + }, + this.props.children + ) : null, - extraContent ? this.renderExtraContent() : null, + extraContent ? this.renderExtraContent() : null ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/connect/ConnectSteps.js b/devtools/client/aboutdebugging-new/src/components/connect/ConnectSteps.js index 457ff0d1633a..5ac051c4cb56 100644 --- a/devtools/client/aboutdebugging-new/src/components/connect/ConnectSteps.js +++ b/devtools/client/aboutdebugging-new/src/components/connect/ConnectSteps.js @@ -4,7 +4,10 @@ "use strict"; -const { PureComponent, createFactory } = require("devtools/client/shared/vendor/react"); +const { + PureComponent, + createFactory, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -17,7 +20,7 @@ class ConnectSteps extends PureComponent { steps: PropTypes.arrayOf( PropTypes.shape({ localizationId: PropTypes.string.isRequired, - }).isRequired, + }).isRequired ), }; } diff --git a/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsForm.js b/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsForm.js index daa768599aa4..95d15c688d09 100644 --- a/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsForm.js +++ b/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsForm.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -73,8 +76,9 @@ class NetworkLocationsForm extends PureComponent { return Message( { - className: "connect-page__network-form__error-message " + - "qa-connect-page__network-form__error-message", + className: + "connect-page__network-form__error-message " + + "qa-connect-page__network-form__error-message", level: MESSAGE_LEVEL.ERROR, isCloseable: true, }, @@ -85,11 +89,11 @@ class NetworkLocationsForm extends PureComponent { }, dom.p( { - className: "technical-text", + className: "technical-text", }, errorMessageId ) - ), + ) ); } @@ -97,7 +101,7 @@ class NetworkLocationsForm extends PureComponent { return dom.form( { className: "connect-page__network-form", - onSubmit: (e) => this.onSubmit(e), + onSubmit: e => this.onSubmit(e), }, this.renderError(), Localized( @@ -108,7 +112,7 @@ class NetworkLocationsForm extends PureComponent { { htmlFor: "about-debugging-network-locations-host-input", }, - "Host", + "Host" ) ), dom.input({ @@ -117,7 +121,7 @@ class NetworkLocationsForm extends PureComponent { placeholder: "localhost:6080", type: "text", value: this.state.value, - onChange: (e) => { + onChange: e => { const value = e.target.value; this.setState({ value }); }, @@ -132,7 +136,7 @@ class NetworkLocationsForm extends PureComponent { }, "Add" ) - ), + ) ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsList.js b/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsList.js index 2197548aa50a..a809c6ce77a3 100644 --- a/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsList.js +++ b/devtools/client/aboutdebugging-new/src/components/connect/NetworkLocationsList.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -48,8 +51,8 @@ class NetworkLocationsList extends PureComponent { this.props.dispatch(Actions.removeNetworkLocation(location)); }, }, - "Remove", - ), + "Remove" + ) ) ) ) @@ -57,8 +60,7 @@ class NetworkLocationsList extends PureComponent { } render() { - return this.props.networkLocations.length > 0 ? - this.renderList() : null; + return this.props.networkLocations.length > 0 ? this.renderList() : null; } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetItem.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetItem.js index bfbdb3369062..3985e0d2345f 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetItem.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetItem.js @@ -30,7 +30,7 @@ class DebugTargetItem extends PureComponent { { className: "debug-target-item__action", }, - actionComponent({ dispatch, target }), + actionComponent({ dispatch, target }) ); } @@ -45,7 +45,7 @@ class DebugTargetItem extends PureComponent { { className: "debug-target-item__additional_actions", }, - additionalActionsComponent({ dispatch, target }), + additionalActionsComponent({ dispatch, target }) ); } @@ -67,7 +67,7 @@ class DebugTargetItem extends PureComponent { className: "debug-target-item__name ellipsis-text", title: this.props.target.name, }, - this.props.target.name, + this.props.target.name ); } @@ -80,7 +80,7 @@ class DebugTargetItem extends PureComponent { this.renderName(), this.renderAction(), this.renderDetail(), - this.renderAdditionalActions(), + this.renderAdditionalActions() ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetList.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetList.js index 8d8396212477..dfd2efbf7c6f 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetList.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetList.js @@ -4,8 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = - require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -56,20 +58,20 @@ class DebugTargetList extends PureComponent { return targets.length === 0 ? this.renderEmptyList() : dom.ul( - { - className: "debug-target-list qa-debug-target-list", - }, - targets.map((target, key) => - DebugTargetItem({ - actionComponent, - additionalActionsComponent, - detailComponent, - dispatch, - key, - target, - }) - ), - ); + { + className: "debug-target-list qa-debug-target-list", + }, + targets.map((target, key) => + DebugTargetItem({ + actionComponent, + additionalActionsComponent, + detailComponent, + dispatch, + key, + target, + }) + ) + ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetPane.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetPane.js index 5c5a4ce605d5..4cc7ad02d8f3 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetPane.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/DebugTargetPane.js @@ -4,7 +4,11 @@ "use strict"; -const { createFactory, createRef, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + createRef, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -53,8 +57,10 @@ class DebugTargetPane extends PureComponent { animation.cancel(); } - el.animate({ maxHeight: [`${ snapshot }px`, `${ el.clientHeight }px`] }, - { duration: 150, easing: "cubic-bezier(.07, .95, 0, 1)" }); + el.animate( + { maxHeight: [`${snapshot}px`, `${el.clientHeight}px`] }, + { duration: 150, easing: "cubic-bezier(.07, .95, 0, 1)" } + ); } getSnapshotBeforeUpdate(prevProps) { @@ -67,7 +73,9 @@ class DebugTargetPane extends PureComponent { toggleCollapsibility() { const { collapsibilityKey, dispatch, isCollapsed } = this.props; - dispatch(Actions.updateDebugTargetCollapsibility(collapsibilityKey, !isCollapsed)); + dispatch( + Actions.updateDebugTargetCollapsibility(collapsibilityKey, !isCollapsed) + ); } render() { @@ -92,33 +100,32 @@ class DebugTargetPane extends PureComponent { }, dom.a( { - className: "undecorated-link debug-target-pane__title " + - "qa-debug-target-pane-title", + className: + "undecorated-link debug-target-pane__title " + + "qa-debug-target-pane-title", title, onClick: e => this.toggleCollapsibility(), }, dom.h2( { className: "main-subheading debug-target-pane__heading" }, - dom.img( - { - className: "main-subheading__icon", - src: icon, - } - ), - `${ name } (${ targets.length })`, - dom.img( - { - className: "main-subheading__icon debug-target-pane__icon" + - (isCollapsed ? " debug-target-pane__icon--collapsed" : ""), - src: "chrome://devtools/skin/images/arrow-e.svg", - } - ), + dom.img({ + className: "main-subheading__icon", + src: icon, + }), + `${name} (${targets.length})`, + dom.img({ + className: + "main-subheading__icon debug-target-pane__icon" + + (isCollapsed ? " debug-target-pane__icon--collapsed" : ""), + src: "chrome://devtools/skin/images/arrow-e.svg", + }) ) ), dom.div( { - className: "debug-target-pane__collapsable qa-debug-target-pane__collapsable" + - (isCollapsed ? " debug-target-pane__collapsable--collapsed" : ""), + className: + "debug-target-pane__collapsable qa-debug-target-pane__collapsable" + + (isCollapsed ? " debug-target-pane__collapsable--collapsed" : ""), ref: this.collapsableRef, }, children, @@ -129,8 +136,8 @@ class DebugTargetPane extends PureComponent { dispatch, isCollapsed, targets, - }), - ), + }) + ) ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js index 97e957b23873..1854ff110e56 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ExtensionDetail.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -58,7 +61,7 @@ class ExtensionDetail extends PureComponent { className: "technical-text", }, warning - ), + ) ) ); }) @@ -76,12 +79,10 @@ class ExtensionDetail extends PureComponent { id: "about-debugging-extension-uuid", attrs: { label: true }, }, - FieldPair( - { - label: "Internal UUID", - value: uuid, - } - ) + FieldPair({ + label: "Internal UUID", + value: uuid, + }) ); } @@ -93,12 +94,10 @@ class ExtensionDetail extends PureComponent { id: "about-debugging-extension-id", attrs: { label: true }, }, - FieldPair( - { - label: "Extension ID", - value: id, - } - ) + FieldPair({ + label: "Extension ID", + value: id, + }) ); } @@ -113,12 +112,10 @@ class ExtensionDetail extends PureComponent { id: "about-debugging-extension-location", attrs: { label: true }, }, - FieldPair( - { - label: "Location", - value: location, - } - ) + FieldPair({ + label: "Location", + value: location, + }) ); } @@ -134,7 +131,7 @@ class ExtensionDetail extends PureComponent { href: manifestURL, target: "_blank", }, - manifestURL, + manifestURL ); return Localized( @@ -142,12 +139,10 @@ class ExtensionDetail extends PureComponent { id: "about-debugging-extension-manifest-url", attrs: { label: true }, }, - FieldPair( - { - label: "Manifest URL", - value: link, - } - ) + FieldPair({ + label: "Manifest URL", + value: link, + }) ); } @@ -163,8 +158,8 @@ class ExtensionDetail extends PureComponent { this.renderExtensionId(), this.renderUUID(), this.renderManifest(), - this.props.children, - ), + this.props.children + ) ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/FieldPair.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/FieldPair.js index 19e8d0bef316..1e3bade84158 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/FieldPair.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/FieldPair.js @@ -26,16 +26,20 @@ class FieldPair extends PureComponent { }, dom.dt( { - className: "fieldpair__title " + - (this.props.className ? this.props.className : ""), + className: + "fieldpair__title " + + (this.props.className ? this.props.className : ""), }, label ), - value ? dom.dd( - { - className: "fieldpair__description ellipsis-text", - }, - value) : null, + value + ? dom.dd( + { + className: "fieldpair__description ellipsis-text", + }, + value + ) + : null ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/InspectAction.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/InspectAction.js index 79388fdc6a6e..3ffcefc65038 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/InspectAction.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/InspectAction.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/ProcessDetail.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/ProcessDetail.js index 44d5a5c67e39..578540c90b4b 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ProcessDetail.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ProcessDetail.js @@ -20,7 +20,10 @@ class ProcessDetail extends PureComponent { render() { const { description } = this.props.target.details; - return dom.p({ className: "debug-target-item__subname ellipsis-text" }, description); + return dom.p( + { className: "debug-target-item__subname ellipsis-text" }, + description + ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAction.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAction.js index 51695ca6d609..3d240be74219 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAction.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAction.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { connect } = require("devtools/client/shared/vendor/react-redux"); @@ -12,7 +15,9 @@ const { connect } = require("devtools/client/shared/vendor/react-redux"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const Localized = createFactory(FluentReact.Localized); -const { getCurrentRuntimeDetails } = require("../../modules/runtimes-state-helper"); +const { + getCurrentRuntimeDetails, +} = require("../../modules/runtimes-state-helper"); const InspectAction = createFactory(require("./InspectAction")); @@ -34,8 +39,9 @@ class ServiceWorkerAction extends PureComponent { _renderInspectAction() { const { status } = this.props.target.details; - const shallRenderInspectAction = status === SERVICE_WORKER_STATUSES.RUNNING || - status === SERVICE_WORKER_STATUSES.REGISTERING; + const shallRenderInspectAction = + status === SERVICE_WORKER_STATUSES.RUNNING || + status === SERVICE_WORKER_STATUSES.REGISTERING; if (!shallRenderInspectAction) { return null; @@ -64,8 +70,10 @@ class ServiceWorkerAction extends PureComponent { _renderStatus() { const status = this.props.target.details.status.toLowerCase(); - const statusClassName = status === SERVICE_WORKER_STATUSES.RUNNING.toLowerCase() - ? "service-worker-action__status--running" : ""; + const statusClassName = + status === SERVICE_WORKER_STATUSES.RUNNING.toLowerCase() + ? "service-worker-action__status--running" + : ""; return Localized( { @@ -73,8 +81,7 @@ class ServiceWorkerAction extends PureComponent { }, dom.span( { - className: - `service-worker-action__status qa-worker-status ${ statusClassName }`, + className: `service-worker-action__status qa-worker-status ${statusClassName}`, }, status ) @@ -87,7 +94,7 @@ class ServiceWorkerAction extends PureComponent { className: "service-worker-action", }, this._renderStatus(), - this._renderInspectAction(), + this._renderInspectAction() ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAdditionalActions.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAdditionalActions.js index 2ec2e8ac6f3c..3af1583a5eaf 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAdditionalActions.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/ServiceWorkerAdditionalActions.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { connect } = require("devtools/client/shared/vendor/react-redux"); @@ -12,7 +15,9 @@ const { connect } = require("devtools/client/shared/vendor/react-redux"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const Localized = createFactory(FluentReact.Localized); -const { getCurrentRuntimeDetails } = require("../../modules/runtimes-state-helper"); +const { + getCurrentRuntimeDetails, +} = require("../../modules/runtimes-state-helper"); const Actions = require("../../actions/index"); const Types = require("../../types/index"); @@ -60,7 +65,7 @@ class ServiceWorkerAdditionalActions extends PureComponent { disabled, onClick: e => onClick(), }, - labelId, + labelId ) ); } @@ -99,17 +104,11 @@ class ServiceWorkerAdditionalActions extends PureComponent { switch (status) { case SERVICE_WORKER_STATUSES.RUNNING: - return [ - this._renderUnregisterButton(), - this._renderPushButton(), - ]; + return [this._renderUnregisterButton(), this._renderPushButton()]; case SERVICE_WORKER_STATUSES.REGISTERING: return null; case SERVICE_WORKER_STATUSES.STOPPED: - return [ - this._renderUnregisterButton(), - this._renderStartButton(), - ]; + return [this._renderUnregisterButton(), this._renderStartButton()]; default: console.error("Unexpected service worker status: " + status); return null; @@ -121,7 +120,7 @@ class ServiceWorkerAdditionalActions extends PureComponent { { className: "toolbar toolbar--right-align", }, - this._renderActionButtons(), + this._renderActionButtons() ); } } @@ -133,4 +132,5 @@ const mapStateToProps = state => { }; module.exports = FluentReact.withLocalization( - connect(mapStateToProps)(ServiceWorkerAdditionalActions)); + connect(mapStateToProps)(ServiceWorkerAdditionalActions) +); diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/TabDetail.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/TabDetail.js index ee3f6a521c34..8cf93dc44da4 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/TabDetail.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/TabDetail.js @@ -19,8 +19,10 @@ class TabDetail extends PureComponent { } render() { - return dom.div({ className: "debug-target-item__subname ellipsis-text" }, - this.props.target.details.url); + return dom.div( + { className: "debug-target-item__subname ellipsis-text" }, + this.props.target.details.url + ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionAdditionalActions.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionAdditionalActions.js index 199e79b64e5d..cac2f4203f35 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionAdditionalActions.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionAdditionalActions.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -61,7 +64,7 @@ class TemporaryExtensionAdditionalActions extends PureComponent { className: "technical-text", }, reloadError - ), + ) ) ); } @@ -79,11 +82,12 @@ class TemporaryExtensionAdditionalActions extends PureComponent { }, dom.button( { - className: "default-button default-button--micro " + - "qa-temporary-extension-reload-button", + className: + "default-button default-button--micro " + + "qa-temporary-extension-reload-button", onClick: e => this.reload(), }, - "Reload", + "Reload" ) ), Localized( @@ -92,13 +96,14 @@ class TemporaryExtensionAdditionalActions extends PureComponent { }, dom.button( { - className: "default-button default-button--micro " + - "qa-temporary-extension-remove-button", + className: + "default-button default-button--micro " + + "qa-temporary-extension-remove-button", onClick: e => this.remove(), }, - "Remove", + "Remove" ) - ), + ) ), this.renderReloadError(), ]; diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionDetail.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionDetail.js index b4f21031ef8e..3e7fddf6d88c 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionDetail.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionDetail.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -43,7 +46,7 @@ class TemporaryExtensionDetail extends PureComponent { }, dom.div({ className: "qa-temporary-id-message", - }), + }) ); } @@ -52,7 +55,7 @@ class TemporaryExtensionDetail extends PureComponent { { target: this.props.target, }, - FieldPair({ label: this.renderTemporaryIdMessage() }), + FieldPair({ label: this.renderTemporaryIdMessage() }) ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstallSection.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstallSection.js index 358b484b8e1e..613625e47c1e 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstallSection.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstallSection.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -13,8 +16,9 @@ const Localized = createFactory(FluentReact.Localized); const DetailsLog = createFactory(require("../shared/DetailsLog")); const Message = createFactory(require("../shared/Message")); -const TemporaryExtensionInstaller = - createFactory(require("./TemporaryExtensionInstaller")); +const TemporaryExtensionInstaller = createFactory( + require("./TemporaryExtensionInstaller") +); const { MESSAGE_LEVEL } = require("../../constants"); @@ -61,10 +65,7 @@ class TemporaryExtensionInstallSection extends PureComponent { { id: "about-debugging-tmp-extension-install-error", }, - dom.p( - { }, - "about-debugging-tmp-extension-install-error" - ) + dom.p({}, "about-debugging-tmp-extension-install-error") ), DetailsLog( { @@ -84,9 +85,9 @@ class TemporaryExtensionInstallSection extends PureComponent { { className: "temporary-extension-install-section__toolbar", }, - TemporaryExtensionInstaller({ dispatch }), + TemporaryExtensionInstaller({ dispatch }) ), - this.renderError(), + this.renderError() ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstaller.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstaller.js index c5537610986d..66ae4bbad733 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstaller.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/TemporaryExtensionInstaller.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -37,8 +40,7 @@ class TemporaryExtensionInstaller extends PureComponent { }, dom.button( { - className: - `${ className } default-button qa-temporary-extension-install-button`, + className: `${className} default-button qa-temporary-extension-install-button`, onClick: e => this.install(), }, "Load Temporary Add-on…" diff --git a/devtools/client/aboutdebugging-new/src/components/debugtarget/WorkerDetail.js b/devtools/client/aboutdebugging-new/src/components/debugtarget/WorkerDetail.js index b0ba81185c1d..b102275d8c6e 100644 --- a/devtools/client/aboutdebugging-new/src/components/debugtarget/WorkerDetail.js +++ b/devtools/client/aboutdebugging-new/src/components/debugtarget/WorkerDetail.js @@ -4,16 +4,17 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); const Localized = createFactory(FluentReact.Localized); -const { - SERVICE_WORKER_FETCH_STATES, -} = require("../../constants"); +const { SERVICE_WORKER_FETCH_STATES } = require("../../constants"); const FieldPair = createFactory(require("./FieldPair")); @@ -35,8 +36,8 @@ class WorkerDetail extends PureComponent { const { fetch } = this.props.target.details; const isListening = fetch === SERVICE_WORKER_FETCH_STATES.LISTENING; const localizationId = isListening - ? "about-debugging-worker-fetch-listening" - : "about-debugging-worker-fetch-not-listening"; + ? "about-debugging-worker-fetch-listening" + : "about-debugging-worker-fetch-not-listening"; return Localized( { @@ -46,15 +47,14 @@ class WorkerDetail extends PureComponent { value: true, }, }, - FieldPair( - { - className: isListening ? - "qa-worker-fetch-listening" : "qa-worker-fetch-not-listening", - label: "Fetch", - slug: "fetch", - value: "about-debugging-worker-fetch-value", - } - ) + FieldPair({ + className: isListening + ? "qa-worker-fetch-listening" + : "qa-worker-fetch-not-listening", + label: "Fetch", + slug: "fetch", + value: "about-debugging-worker-fetch-value", + }) ); } @@ -66,18 +66,16 @@ class WorkerDetail extends PureComponent { id: "about-debugging-worker-push-service", attrs: { label: true }, }, - FieldPair( - { - slug: "push-service", - label: "Push Service", - value: dom.span( - { - className: "qa-worker-push-service-value", - }, - pushServiceEndpoint, - ), - } - ), + FieldPair({ + slug: "push-service", + label: "Push Service", + value: dom.span( + { + className: "qa-worker-push-service-value", + }, + pushServiceEndpoint + ), + }) ); } @@ -89,13 +87,11 @@ class WorkerDetail extends PureComponent { id: "about-debugging-worker-scope", attrs: { label: true }, }, - FieldPair( - { - slug: "scope", - label: "Scope", - value: scope, - } - ), + FieldPair({ + slug: "scope", + label: "Scope", + value: scope, + }) ); } @@ -106,12 +102,13 @@ class WorkerDetail extends PureComponent { return dom.dl( { - className: "debug-target-item__detail" + - (isEmptyList ? " debug-target-item__detail--empty" : ""), + className: + "debug-target-item__detail" + + (isEmptyList ? " debug-target-item__detail--empty" : ""), }, pushServiceEndpoint ? this.renderPushService() : null, fetch ? this.renderFetch() : null, - scope ? this.renderScope() : null, + scope ? this.renderScope() : null ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/shared/DetailsLog.js b/devtools/client/aboutdebugging-new/src/components/shared/DetailsLog.js index 6ef994250704..9b23ea574949 100644 --- a/devtools/client/aboutdebugging-new/src/components/shared/DetailsLog.js +++ b/devtools/client/aboutdebugging-new/src/components/shared/DetailsLog.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -45,13 +48,11 @@ class DetailsLog extends PureComponent { { className: "details--log", }, - Localized({ + Localized( + { id: this.getLocalizationString(), - }, - dom.summary( - {}, - this.getLocalizationString() - ) + }, + dom.summary({}, this.getLocalizationString()) ), children ); diff --git a/devtools/client/aboutdebugging-new/src/components/shared/IconLabel.js b/devtools/client/aboutdebugging-new/src/components/shared/IconLabel.js index 1d462c5bc0e6..4f1049d6503d 100644 --- a/devtools/client/aboutdebugging-new/src/components/shared/IconLabel.js +++ b/devtools/client/aboutdebugging-new/src/components/shared/IconLabel.js @@ -32,13 +32,11 @@ class IconLabel extends PureComponent { { className: `icon-label icon-label--${level} ${className || ""}`, }, - dom.img( - { - className: "icon-label__icon", - src: ICONS[level], - } - ), - children, + dom.img({ + className: "icon-label__icon", + src: ICONS[level], + }), + children ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/shared/Message.js b/devtools/client/aboutdebugging-new/src/components/shared/Message.js index 12b47e2229e9..1551916d3caf 100644 --- a/devtools/client/aboutdebugging-new/src/components/shared/Message.js +++ b/devtools/client/aboutdebugging-new/src/components/shared/Message.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -14,8 +17,10 @@ const Localized = createFactory(FluentReact.Localized); const { MESSAGE_LEVEL } = require("../../constants"); const ICONS = { - [MESSAGE_LEVEL.ERROR]: "chrome://devtools/skin/images/aboutdebugging-error.svg", - [MESSAGE_LEVEL.INFO]: "chrome://devtools/skin/images/aboutdebugging-information.svg", + [MESSAGE_LEVEL.ERROR]: + "chrome://devtools/skin/images/aboutdebugging-error.svg", + [MESSAGE_LEVEL.INFO]: + "chrome://devtools/skin/images/aboutdebugging-information.svg", [MESSAGE_LEVEL.WARNING]: "chrome://global/skin/icons/warning.svg", }; const CLOSE_ICON_SRC = "chrome://devtools/skin/images/close.svg"; @@ -49,7 +54,8 @@ class Message extends PureComponent { renderButton(level) { return dom.button( { - className: `ghost-button message__button message__button--${level} ` + + className: + `ghost-button message__button message__button--${level} ` + `qa-message-button-close-button`, onClick: () => this.closeMessage(), }, @@ -60,13 +66,11 @@ class Message extends PureComponent { alt: true, }, }, - dom.img( - { - className: "qa-message-button-close-icon", - src: CLOSE_ICON_SRC, - }, - ), - ), + dom.img({ + className: "qa-message-button-close-icon", + src: CLOSE_ICON_SRC, + }) + ) ); } @@ -80,15 +84,14 @@ class Message extends PureComponent { return dom.aside( { - className: `message message--level-${level} qa-message` + - (className ? ` ${ className }` : ""), + className: + `message message--level-${level} qa-message` + + (className ? ` ${className}` : ""), }, - dom.img( - { - className: "message__icon", - src: ICONS[level], - } - ), + dom.img({ + className: "message__icon", + src: ICONS[level], + }), dom.div( { className: "message__body", @@ -96,9 +99,7 @@ class Message extends PureComponent { children ), // if the message is closeable, render a closing button - isCloseable - ? this.renderButton(level) - : null, + isCloseable ? this.renderButton(level) : null ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/sidebar/RefreshDevicesButton.js b/devtools/client/aboutdebugging-new/src/components/sidebar/RefreshDevicesButton.js index 7f22f397563c..4f0e286a3a00 100644 --- a/devtools/client/aboutdebugging-new/src/components/sidebar/RefreshDevicesButton.js +++ b/devtools/client/aboutdebugging-new/src/components/sidebar/RefreshDevicesButton.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const FluentReact = require("devtools/client/shared/vendor/fluent-react"); diff --git a/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js b/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js index 032e4abb6de2..8c4eee6ef1ed 100644 --- a/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js +++ b/devtools/client/aboutdebugging-new/src/components/sidebar/Sidebar.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -13,17 +16,25 @@ const Localized = createFactory(FluentReact.Localized); const { ICON_LABEL_LEVEL, PAGE_TYPES, RUNTIMES } = require("../../constants"); const Types = require("../../types/index"); -loader.lazyRequireGetter(this, "ADB_ADDON_STATES", "devtools/shared/adb/adb-addon", true); +loader.lazyRequireGetter( + this, + "ADB_ADDON_STATES", + "devtools/shared/adb/adb-addon", + true +); const IconLabel = createFactory(require("../shared/IconLabel")); const SidebarItem = createFactory(require("./SidebarItem")); const SidebarFixedItem = createFactory(require("./SidebarFixedItem")); const SidebarRuntimeItem = createFactory(require("./SidebarRuntimeItem")); const RefreshDevicesButton = createFactory(require("./RefreshDevicesButton")); -const FIREFOX_ICON = "chrome://devtools/skin/images/aboutdebugging-firefox-logo.svg"; +const FIREFOX_ICON = + "chrome://devtools/skin/images/aboutdebugging-firefox-logo.svg"; const CONNECT_ICON = "chrome://devtools/skin/images/settings.svg"; -const GLOBE_ICON = "chrome://devtools/skin/images/aboutdebugging-globe-icon.svg"; -const USB_ICON = "chrome://devtools/skin/images/aboutdebugging-connect-icon.svg"; +const GLOBE_ICON = + "chrome://devtools/skin/images/aboutdebugging-globe-icon.svg"; +const USB_ICON = + "chrome://devtools/skin/images/aboutdebugging-connect-icon.svg"; class Sidebar extends PureComponent { static get propTypes() { @@ -41,13 +52,15 @@ class Sidebar extends PureComponent { } renderAdbStatus() { - const isUsbEnabled = this.props.isAdbReady && + const isUsbEnabled = + this.props.isAdbReady && this.props.adbAddonStatus === ADB_ADDON_STATES.INSTALLED; - const localizationId = isUsbEnabled ? "about-debugging-sidebar-usb-enabled" : - "about-debugging-sidebar-usb-disabled"; + const localizationId = isUsbEnabled + ? "about-debugging-sidebar-usb-enabled" + : "about-debugging-sidebar-usb-disabled"; return IconLabel( { - level: isUsbEnabled ? ICON_LABEL_LEVEL.OK : ICON_LABEL_LEVEL.INFO, + level: isUsbEnabled ? ICON_LABEL_LEVEL.OK : ICON_LABEL_LEVEL.INFO, }, Localized( { @@ -100,8 +113,8 @@ class Sidebar extends PureComponent { return runtimes.map(runtime => { const keyId = `${runtime.type}-${runtime.id}`; const runtimeHasDetails = !!runtime.runtimeDetails; - const isSelected = selectedPage === PAGE_TYPES.RUNTIME && - runtime.id === selectedRuntimeId; + const isSelected = + selectedPage === PAGE_TYPES.RUNTIME && runtime.id === selectedRuntimeId; let name = runtime.name; if (runtime.type === RUNTIMES.USB && runtimeHasDetails) { @@ -130,7 +143,8 @@ class Sidebar extends PureComponent { renderFooter() { const HELP_ICON_SRC = "chrome://global/skin/icons/help.svg"; - const SUPPORT_URL = "https://developer.mozilla.org/docs/Tools/about:debugging"; + const SUPPORT_URL = + "https://developer.mozilla.org/docs/Tools/about:debugging"; return dom.footer( { @@ -154,27 +168,30 @@ class Sidebar extends PureComponent { alt: true, }, }, - dom.img( - { - className: "sidebar__footer__icon", - src: HELP_ICON_SRC, - } - ), + dom.img({ + className: "sidebar__footer__icon", + src: HELP_ICON_SRC, + }) ), Localized( { id: "about-debugging-sidebar-support", }, - dom.span({}, "about-debugging-sidebar-support"), + dom.span({}, "about-debugging-sidebar-support") ) ) - ), + ) ) ); } render() { - const { dispatch, selectedPage, selectedRuntimeId, isScanningUsb } = this.props; + const { + dispatch, + selectedPage, + selectedRuntimeId, + isScanningUsb, + } = this.props; return dom.aside( { @@ -197,7 +214,8 @@ class Sidebar extends PureComponent { { id: "about-debugging-sidebar-this-firefox", attrs: { name: true } }, SidebarFixedItem({ icon: FIREFOX_ICON, - isSelected: PAGE_TYPES.RUNTIME === selectedPage && + isSelected: + PAGE_TYPES.RUNTIME === selectedPage && selectedRuntimeId === RUNTIMES.THIS_FIREFOX, key: RUNTIMES.THIS_FIREFOX, name: "This Firefox", @@ -209,7 +227,7 @@ class Sidebar extends PureComponent { className: "sidebar__adb-status", }, dom.hr({ className: "separator separator--breathe" }), - this.renderAdbStatus(), + this.renderAdbStatus() ), this.renderDevices(), SidebarItem( @@ -221,9 +239,9 @@ class Sidebar extends PureComponent { dispatch, isScanning: isScanningUsb, }) - ), + ) ), - this.renderFooter(), + this.renderFooter() ); } } diff --git a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarFixedItem.js b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarFixedItem.js index 769d10d32abc..9c4da3d9d793 100644 --- a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarFixedItem.js +++ b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarFixedItem.js @@ -4,7 +4,10 @@ "use strict"; -const { PureComponent, createFactory } = require("devtools/client/shared/vendor/react"); +const { + PureComponent, + createFactory, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -24,12 +27,7 @@ class SidebarFixedItem extends PureComponent { } render() { - const { - icon, - isSelected, - name, - to, - } = this.props; + const { icon, isSelected, name, to } = this.props; return SidebarItem( { @@ -41,12 +39,10 @@ class SidebarFixedItem extends PureComponent { { className: "sidebar-fixed-item__container", }, - dom.img( - { - className: "sidebar-fixed-item__icon", - src: icon, - } - ), + dom.img({ + className: "sidebar-fixed-item__icon", + src: icon, + }), dom.span( { className: "ellipsis-text", diff --git a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarItem.js b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarItem.js index 7be4e489f178..9949ac82ec9b 100644 --- a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarItem.js +++ b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarItem.js @@ -4,10 +4,15 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); -const Link = createFactory(require("devtools/client/shared/vendor/react-router-dom").Link); +const Link = createFactory( + require("devtools/client/shared/vendor/react-router-dom").Link +); /** * This component is used as a wrapper by items in the sidebar. @@ -36,20 +41,20 @@ class SidebarItem extends PureComponent { return isExternalUrl ? dom.a( - { - className: "sidebar-item__link", - href: to, - target: "_blank", - }, - children, - ) + { + className: "sidebar-item__link", + href: to, + target: "_blank", + }, + children + ) : Link( - { - className: "sidebar-item__link qa-sidebar-link", - to, - }, - children, - ); + { + className: "sidebar-item__link qa-sidebar-link", + to, + }, + children + ); } return children; @@ -60,13 +65,13 @@ class SidebarItem extends PureComponent { return dom.li( { - className: "sidebar-item qa-sidebar-item" + - (className ? ` ${className}` : "") + - (isSelected ? - " sidebar-item--selected qa-sidebar-item-selected" : - "" - ) + - (to ? " sidebar-item--selectable" : ""), + className: + "sidebar-item qa-sidebar-item" + + (className ? ` ${className}` : "") + + (isSelected + ? " sidebar-item--selected qa-sidebar-item-selected" + : "") + + (to ? " sidebar-item--selectable" : ""), }, this.renderContent() ); diff --git a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js index 0b28c7d73ee8..6fa36ba39396 100644 --- a/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js +++ b/devtools/client/aboutdebugging-new/src/components/sidebar/SidebarRuntimeItem.js @@ -4,7 +4,10 @@ "use strict"; -const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + PureComponent, +} = require("devtools/client/shared/vendor/react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); @@ -43,8 +46,8 @@ class SidebarRuntimeItem extends PureComponent { renderConnectButton() { const { isConnecting } = this.props; const localizationId = isConnecting - ? "about-debugging-sidebar-item-connect-button-connecting" - : "about-debugging-sidebar-item-connect-button"; + ? "about-debugging-sidebar-item-connect-button-connecting" + : "about-debugging-sidebar-item-connect-button"; return Localized( { id: localizationId, @@ -84,14 +87,22 @@ class SidebarRuntimeItem extends PureComponent { } renderName() { - const { deviceName, getString, isUnavailable, isUnplugged, name } = this.props; + const { + deviceName, + getString, + isUnavailable, + isUnplugged, + name, + } = this.props; let displayName, qaClassName; if (isUnplugged) { displayName = getString("about-debugging-sidebar-runtime-item-unplugged"); qaClassName = "qa-runtime-item-unplugged"; } else if (isUnavailable) { - displayName = getString("about-debugging-sidebar-runtime-item-waiting-for-browser"); + displayName = getString( + "about-debugging-sidebar-runtime-item-waiting-for-browser" + ); qaClassName = "qa-runtime-item-waiting-for-browser"; } else { displayName = name; @@ -116,8 +127,8 @@ class SidebarRuntimeItem extends PureComponent { { className: `sidebar-runtime-item__runtime__details ${qaClassName}`, }, - displayName, - ), + displayName + ) ); } @@ -127,7 +138,7 @@ class SidebarRuntimeItem extends PureComponent { className, title: localizationId, }, - displayName, + displayName ); } @@ -138,7 +149,7 @@ class SidebarRuntimeItem extends PureComponent { $deviceName: deviceName, $displayName: displayName, }, - deviceName ? renderWithDevice() : renderNoDevice(), + deviceName ? renderWithDevice() : renderNoDevice() ); } @@ -155,9 +166,11 @@ class SidebarRuntimeItem extends PureComponent { runtimeId, } = this.props; - const connectionStatus = isConnected ? - getString("aboutdebugging-sidebar-runtime-connection-status-connected") : - getString("aboutdebugging-sidebar-runtime-connection-status-disconnected"); + const connectionStatus = isConnected + ? getString("aboutdebugging-sidebar-runtime-connection-status-connected") + : getString( + "aboutdebugging-sidebar-runtime-connection-status-disconnected" + ); return SidebarItem( { @@ -168,14 +181,12 @@ class SidebarRuntimeItem extends PureComponent { { className: "sidebar-runtime-item__container", }, - dom.img( - { - className: "sidebar-runtime-item__icon ", - src: icon, - alt: connectionStatus, - title: connectionStatus, - } - ), + dom.img({ + className: "sidebar-runtime-item__icon ", + src: icon, + alt: connectionStatus, + title: connectionStatus, + }), this.renderName(), !isUnavailable && !isConnected ? this.renderConnectButton() : null ), @@ -196,7 +207,7 @@ class SidebarRuntimeItem extends PureComponent { MESSAGE_LEVEL.WARNING, "about-debugging-sidebar-item-connect-button-connection-not-responding", "qa-connection-not-responding" - ), + ) ); } } diff --git a/devtools/client/aboutdebugging-new/src/constants.js b/devtools/client/aboutdebugging-new/src/constants.js index b337c42d10cb..9cf8f747b327 100644 --- a/devtools/client/aboutdebugging-new/src/constants.js +++ b/devtools/client/aboutdebugging-new/src/constants.js @@ -4,8 +4,10 @@ "use strict"; -const { CONNECTION_TYPES, DEBUG_TARGET_TYPES } = - require("devtools/client/shared/remote-debugging/constants"); +const { + CONNECTION_TYPES, + DEBUG_TARGET_TYPES, +} = require("devtools/client/shared/remote-debugging/constants"); const actionTypes = { ADB_ADDON_INSTALL_START: "ADB_ADDON_INSTALL_START", @@ -58,9 +60,12 @@ const actionTypes = { UNWATCH_RUNTIME_FAILURE: "UNWATCH_RUNTIME_FAILURE", UNWATCH_RUNTIME_START: "UNWATCH_RUNTIME_START", UNWATCH_RUNTIME_SUCCESS: "UNWATCH_RUNTIME_SUCCESS", - UPDATE_CONNECTION_PROMPT_SETTING_FAILURE: "UPDATE_CONNECTION_PROMPT_SETTING_FAILURE", - UPDATE_CONNECTION_PROMPT_SETTING_START: "UPDATE_CONNECTION_PROMPT_SETTING_START", - UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS: "UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS", + UPDATE_CONNECTION_PROMPT_SETTING_FAILURE: + "UPDATE_CONNECTION_PROMPT_SETTING_FAILURE", + UPDATE_CONNECTION_PROMPT_SETTING_START: + "UPDATE_CONNECTION_PROMPT_SETTING_START", + UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS: + "UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS", UPDATE_RUNTIME_MULTIE10S_FAILURE: "UPDATE_RUNTIME_MULTIE10S_FAILURE", UPDATE_RUNTIME_MULTIE10S_START: "UPDATE_RUNTIME_MULTIE10S_START", UPDATE_RUNTIME_MULTIE10S_SUCCESS: "UPDATE_RUNTIME_MULTIE10S_SUCCESS", @@ -142,16 +147,20 @@ const USB_STATES = { }; // flatten constants -module.exports = Object.assign({}, { - DEBUG_TARGETS, - DEBUG_TARGET_PANE, - ICON_LABEL_LEVEL, - MESSAGE_LEVEL, - PAGE_TYPES, - PREFERENCES, - RUNTIME_PREFERENCE, - RUNTIMES, - SERVICE_WORKER_FETCH_STATES, - SERVICE_WORKER_STATUSES, - USB_STATES, -}, actionTypes); +module.exports = Object.assign( + {}, + { + DEBUG_TARGETS, + DEBUG_TARGET_PANE, + ICON_LABEL_LEVEL, + MESSAGE_LEVEL, + PAGE_TYPES, + PREFERENCES, + RUNTIME_PREFERENCE, + RUNTIMES, + SERVICE_WORKER_FETCH_STATES, + SERVICE_WORKER_STATUSES, + USB_STATES, + }, + actionTypes +); diff --git a/devtools/client/aboutdebugging-new/src/create-store.js b/devtools/client/aboutdebugging-new/src/create-store.js index e793707aa9cc..12a98a1f91c9 100644 --- a/devtools/client/aboutdebugging-new/src/create-store.js +++ b/devtools/client/aboutdebugging-new/src/create-store.js @@ -6,9 +6,14 @@ const Services = require("Services"); -const { applyMiddleware, createStore } = require("devtools/client/shared/vendor/redux"); +const { + applyMiddleware, + createStore, +} = require("devtools/client/shared/vendor/redux"); const { thunk } = require("devtools/client/shared/redux/middleware/thunk.js"); -const { waitUntilService } = require("devtools/client/shared/redux/middleware/wait-service.js"); +const { + waitUntilService, +} = require("devtools/client/shared/redux/middleware/wait-service.js"); const rootReducer = require("./reducers/index"); const { DebugTargetsState } = require("./reducers/debug-targets-state"); @@ -21,7 +26,9 @@ const extensionComponentDataMiddleware = require("./middleware/extension-compone const processComponentDataMiddleware = require("./middleware/process-component-data"); const tabComponentDataMiddleware = require("./middleware/tab-component-data"); const workerComponentDataMiddleware = require("./middleware/worker-component-data"); -const { getDebugTargetCollapsibilities } = require("./modules/debug-target-collapsibilities"); +const { + getDebugTargetCollapsibilities, +} = require("./modules/debug-target-collapsibilities"); const { getNetworkLocations } = require("./modules/network-locations"); const { PREFERENCES } = require("./constants"); @@ -33,15 +40,17 @@ function configureStore() { ui: getUiState(), }; - const middleware = applyMiddleware(thunk, - debugTargetListenerMiddleware, - errorLoggingMiddleware, - eventRecordingMiddleware, - extensionComponentDataMiddleware, - processComponentDataMiddleware, - tabComponentDataMiddleware, - workerComponentDataMiddleware, - waitUntilService); + const middleware = applyMiddleware( + thunk, + debugTargetListenerMiddleware, + errorLoggingMiddleware, + eventRecordingMiddleware, + extensionComponentDataMiddleware, + processComponentDataMiddleware, + tabComponentDataMiddleware, + workerComponentDataMiddleware, + waitUntilService + ); return createStore(rootReducer, initialState, middleware); } @@ -49,8 +58,10 @@ function configureStore() { function getUiState() { const collapsibilities = getDebugTargetCollapsibilities(); const locations = getNetworkLocations(); - const showHiddenAddons = Services.prefs.getBoolPref(PREFERENCES.SHOW_HIDDEN_ADDONS, - false); + const showHiddenAddons = Services.prefs.getBoolPref( + PREFERENCES.SHOW_HIDDEN_ADDONS, + false + ); return new UiState(locations, collapsibilities, showHiddenAddons); } diff --git a/devtools/client/aboutdebugging-new/src/middleware/error-logging.js b/devtools/client/aboutdebugging-new/src/middleware/error-logging.js index e26aa07194fe..fd04f34b76ec 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/error-logging.js +++ b/devtools/client/aboutdebugging-new/src/middleware/error-logging.js @@ -18,7 +18,9 @@ function errorLoggingMiddleware() { // All failure actions should dispatch an error object instead of a message. // We allow some flexibility to still provide some error logging. console.error(`[ACTION FAILED] ${action.type}: ${error}`); - console.error(`[ACTION FAILED] ${action.type} should dispatch the error object!`); + console.error( + `[ACTION FAILED] ${action.type} should dispatch the error object!` + ); } if (error.stack) { diff --git a/devtools/client/aboutdebugging-new/src/middleware/event-recording.js b/devtools/client/aboutdebugging-new/src/middleware/event-recording.js index 914f9398f4a2..c34558b04ff3 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/event-recording.js +++ b/devtools/client/aboutdebugging-new/src/middleware/event-recording.js @@ -7,7 +7,9 @@ const Telemetry = require("devtools/client/shared/telemetry"); loader.lazyGetter(this, "telemetry", () => new Telemetry()); // This is a unique id that should be submitted with all about:debugging events. -loader.lazyGetter(this, "sessionId", () => parseInt(telemetry.msSinceProcessStart(), 10)); +loader.lazyGetter(this, "sessionId", () => + parseInt(telemetry.msSinceProcessStart(), 10) +); const { CONNECT_RUNTIME_CANCEL, @@ -32,7 +34,7 @@ const { function recordEvent(method, details) { // Add the session id to the event details. - const eventDetails = Object.assign({}, details, { "session_id": sessionId }); + const eventDetails = Object.assign({}, details, { session_id: sessionId }); telemetry.recordEvent(method, "aboutdebugging", null, eventDetails); } @@ -56,14 +58,14 @@ function getRuntimeEventExtras(runtime) { const { extra, runtimeDetails } = runtime; // deviceName can be undefined for non-usb devices, but we should not log "undefined". - const deviceName = extra && extra.deviceName || ""; + const deviceName = (extra && extra.deviceName) || ""; const runtimeShortName = runtime.type === RUNTIMES.USB ? runtime.name : ""; - const runtimeName = runtimeDetails && runtimeDetails.info.name || ""; + const runtimeName = (runtimeDetails && runtimeDetails.info.name) || ""; return { - "connection_type": runtime.type, - "device_name": deviceName, - "runtime_id": getTelemetryRuntimeId(runtime.id), - "runtime_name": runtimeName || runtimeShortName, + connection_type: runtime.type, + device_name: deviceName, + runtime_id: getTelemetryRuntimeId(runtime.id), + runtime_name: runtimeName || runtimeShortName, }; } @@ -74,13 +76,16 @@ function onConnectRuntimeSuccess(action, store) { } // When we just connected to a runtime, the runtimeDetails are not in the store yet, // so we merge it here to retrieve the expected telemetry data. - const storeRuntime = findRuntimeById(action.runtime.id, store.getState().runtimes); + const storeRuntime = findRuntimeById( + action.runtime.id, + store.getState().runtimes + ); const runtime = Object.assign({}, storeRuntime, { runtimeDetails: action.runtime.runtimeDetails, }); const extras = Object.assign({}, getRuntimeEventExtras(runtime), { - "runtime_os": action.runtime.runtimeDetails.info.os, - "runtime_version": action.runtime.runtimeDetails.info.version, + runtime_os: action.runtime.runtimeDetails.info.os, + runtime_version: action.runtime.runtimeDetails.info.version, }); recordEvent("runtime_connected", extras); } @@ -114,13 +119,18 @@ function onRemoteRuntimesUpdated(action, store) { // Using device names as unique IDs is inaccurate. See Bug 1544582. const oldDeviceNames = new Set(oldRuntimes.map(r => r.extra.deviceName)); for (const oldDeviceName of oldDeviceNames) { - const newRuntime = newRuntimes.find(r => r.extra.deviceName === oldDeviceName); - const oldRuntime = oldRuntimes.find(r => r.extra.deviceName === oldDeviceName); - const isUnplugged = newRuntime && newRuntime.isUnplugged && !oldRuntime.isUnplugged; + const newRuntime = newRuntimes.find( + r => r.extra.deviceName === oldDeviceName + ); + const oldRuntime = oldRuntimes.find( + r => r.extra.deviceName === oldDeviceName + ); + const isUnplugged = + newRuntime && newRuntime.isUnplugged && !oldRuntime.isUnplugged; if (oldDeviceName && (!newRuntime || isUnplugged)) { recordEvent("device_removed", { - "connection_type": action.runtimeType, - "device_name": oldDeviceName, + connection_type: action.runtimeType, + device_name: oldDeviceName, }); } } @@ -137,14 +147,19 @@ function onRemoteRuntimesUpdated(action, store) { // Using device names as unique IDs is inaccurate. See Bug 1544582. const newDeviceNames = new Set(newRuntimes.map(r => r.extra.deviceName)); for (const newDeviceName of newDeviceNames) { - const newRuntime = newRuntimes.find(r => r.extra.deviceName === newDeviceName); - const oldRuntime = oldRuntimes.find(r => r.extra.deviceName === newDeviceName); - const isPlugged = oldRuntime && oldRuntime.isUnplugged && !newRuntime.isUnplugged; + const newRuntime = newRuntimes.find( + r => r.extra.deviceName === newDeviceName + ); + const oldRuntime = oldRuntimes.find( + r => r.extra.deviceName === newDeviceName + ); + const isPlugged = + oldRuntime && oldRuntime.isUnplugged && !newRuntime.isUnplugged; if (newDeviceName && (!oldRuntime || isPlugged)) { recordEvent("device_added", { - "connection_type": action.runtimeType, - "device_name": newDeviceName, + connection_type: action.runtimeType, + device_name: newDeviceName, }); } } @@ -158,10 +173,10 @@ function recordConnectionAttempt(connectionId, runtimeId, status, store) { } recordEvent("connection_attempt", { - "connection_id": connectionId, - "connection_type": runtime.type, - "runtime_id": getTelemetryRuntimeId(runtimeId), - "status": status, + connection_id: connectionId, + connection_type: runtime.type, + runtime_id: getTelemetryRuntimeId(runtimeId), + status: status, }); } @@ -172,19 +187,39 @@ function eventRecordingMiddleware(store) { return next => action => { switch (action.type) { case CONNECT_RUNTIME_CANCEL: - recordConnectionAttempt(action.connectionId, action.id, "cancelled", store); + recordConnectionAttempt( + action.connectionId, + action.id, + "cancelled", + store + ); break; case CONNECT_RUNTIME_FAILURE: - recordConnectionAttempt(action.connectionId, action.id, "failed", store); + recordConnectionAttempt( + action.connectionId, + action.id, + "failed", + store + ); break; case CONNECT_RUNTIME_NOT_RESPONDING: - recordConnectionAttempt(action.connectionId, action.id, "not responding", store); + recordConnectionAttempt( + action.connectionId, + action.id, + "not responding", + store + ); break; case CONNECT_RUNTIME_START: recordConnectionAttempt(action.connectionId, action.id, "start", store); break; case CONNECT_RUNTIME_SUCCESS: - recordConnectionAttempt(action.connectionId, action.runtime.id, "success", store); + recordConnectionAttempt( + action.connectionId, + action.runtime.id, + "success", + store + ); onConnectRuntimeSuccess(action, store); break; case DISCONNECT_RUNTIME_SUCCESS: @@ -194,11 +229,11 @@ function eventRecordingMiddleware(store) { onRemoteRuntimesUpdated(action, store); break; case SELECT_PAGE_SUCCESS: - recordEvent("select_page", { "page_type": action.page }); + recordEvent("select_page", { page_type: action.page }); break; case SHOW_PROFILER_DIALOG: recordEvent("show_profiler", { - "runtime_id": getCurrentRuntimeIdForTelemetry(store), + runtime_id: getCurrentRuntimeIdForTelemetry(store), }); break; case TELEMETRY_RECORD: @@ -206,13 +241,15 @@ function eventRecordingMiddleware(store) { if (method) { recordEvent(method, details); } else { - console.error(`[RECORD EVENT FAILED] ${action.type}: no "method" property`); + console.error( + `[RECORD EVENT FAILED] ${action.type}: no "method" property` + ); } break; case UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS: recordEvent("update_conn_prompt", { - "prompt_enabled": `${action.connectionPromptEnabled}`, - "runtime_id": getCurrentRuntimeIdForTelemetry(store), + prompt_enabled: `${action.connectionPromptEnabled}`, + runtime_id: getCurrentRuntimeIdForTelemetry(store), }); break; } diff --git a/devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js b/devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js index 0cf4a873bc12..0885ce94ccc1 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js +++ b/devtools/client/aboutdebugging-new/src/middleware/extension-component-data.js @@ -4,10 +4,7 @@ "use strict"; -const { - DEBUG_TARGETS, - REQUEST_EXTENSIONS_SUCCESS, -} = require("../constants"); +const { DEBUG_TARGETS, REQUEST_EXTENSIONS_SUCCESS } = require("../constants"); const { getExtensionUuid, @@ -32,9 +29,11 @@ const extensionComponentDataMiddleware = store => next => action => { function getFilePath(extension) { // Only show file system paths, and only for temporarily installed add-ons. - if (!extension.temporarilyInstalled || - !extension.url || - !extension.url.startsWith("file://")) { + if ( + !extension.temporarilyInstalled || + !extension.url || + !extension.url.startsWith("file://") + ) { return null; } @@ -44,9 +43,19 @@ function getFilePath(extension) { function toComponentData(extensions) { return extensions.map(extension => { const type = DEBUG_TARGETS.EXTENSION; - const { actor, iconDataURL, iconURL, id, manifestURL, name, warnings } = extension; + const { + actor, + iconDataURL, + iconURL, + id, + manifestURL, + name, + warnings, + } = extension; const icon = - iconDataURL || iconURL || "chrome://mozapps/skin/extensions/extensionGeneric.svg"; + iconDataURL || + iconURL || + "chrome://mozapps/skin/extensions/extensionGeneric.svg"; const location = getFilePath(extension); const uuid = getExtensionUuid(extension); return { diff --git a/devtools/client/aboutdebugging-new/src/middleware/process-component-data.js b/devtools/client/aboutdebugging-new/src/middleware/process-component-data.js index 46a6f1e98d7e..c745fc4cb208 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/process-component-data.js +++ b/devtools/client/aboutdebugging-new/src/middleware/process-component-data.js @@ -6,10 +6,7 @@ const { l10n } = require("../modules/l10n"); -const { - DEBUG_TARGETS, - REQUEST_PROCESSES_SUCCESS, -} = require("../constants"); +const { DEBUG_TARGETS, REQUEST_PROCESSES_SUCCESS } = require("../constants"); /** * This middleware converts tabs object that get from DebuggerClient.listProcesses() to @@ -18,7 +15,9 @@ const { const processComponentDataMiddleware = store => next => action => { switch (action.type) { case REQUEST_PROCESSES_SUCCESS: { - const mainProcessComponentData = toMainProcessComponentData(action.mainProcess); + const mainProcessComponentData = toMainProcessComponentData( + action.mainProcess + ); action.processes = [mainProcessComponentData]; break; } @@ -32,7 +31,9 @@ function toMainProcessComponentData(process) { const id = process.processFront.actorID; const icon = "chrome://devtools/skin/images/aboutdebugging-process-icon.svg"; const name = l10n.getString("about-debugging-main-process-name"); - const description = l10n.getString("about-debugging-main-process-description2"); + const description = l10n.getString( + "about-debugging-main-process-description2" + ); return { name, diff --git a/devtools/client/aboutdebugging-new/src/middleware/tab-component-data.js b/devtools/client/aboutdebugging-new/src/middleware/tab-component-data.js index 0b4835d6cec0..6123a53b5d6c 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/tab-component-data.js +++ b/devtools/client/aboutdebugging-new/src/middleware/tab-component-data.js @@ -4,10 +4,7 @@ "use strict"; -const { - DEBUG_TARGETS, - REQUEST_TABS_SUCCESS, -} = require("../constants"); +const { DEBUG_TARGETS, REQUEST_TABS_SUCCESS } = require("../constants"); /** * This middleware converts tabs object that get from DebuggerClient.listTabs() to data @@ -29,7 +26,9 @@ function toComponentData(tabs) { const type = DEBUG_TARGETS.TAB; const id = tab.outerWindowID; const icon = tab.favicon - ? `data:image/png;base64,${ btoa(String.fromCharCode.apply(String, tab.favicon)) }` + ? `data:image/png;base64,${btoa( + String.fromCharCode.apply(String, tab.favicon) + )}` : "chrome://devtools/skin/images/globe.svg"; const name = tab.title || tab.url; const url = tab.url; diff --git a/devtools/client/aboutdebugging-new/src/middleware/worker-component-data.js b/devtools/client/aboutdebugging-new/src/middleware/worker-component-data.js index 174d26db699d..72e2f2a04e06 100644 --- a/devtools/client/aboutdebugging-new/src/middleware/worker-component-data.js +++ b/devtools/client/aboutdebugging-new/src/middleware/worker-component-data.js @@ -49,20 +49,15 @@ function toComponentData(workers, isServiceWorker) { const type = DEBUG_TARGETS.WORKER; const icon = "chrome://devtools/skin/images/debugging-workers.svg"; let { fetch } = worker; - const { - id, - name, - registrationFront, - scope, - subscription, - } = worker; + const { id, name, registrationFront, scope, subscription } = worker; let pushServiceEndpoint = null; let status = null; if (isServiceWorker) { - fetch = fetch ? SERVICE_WORKER_FETCH_STATES.LISTENING - : SERVICE_WORKER_FETCH_STATES.NOT_LISTENING; + fetch = fetch + ? SERVICE_WORKER_FETCH_STATES.LISTENING + : SERVICE_WORKER_FETCH_STATES.NOT_LISTENING; status = getServiceWorkerStatus(worker); pushServiceEndpoint = subscription ? subscription.endpoint : null; } diff --git a/devtools/client/aboutdebugging-new/src/modules/client-wrapper.js b/devtools/client/aboutdebugging-new/src/modules/client-wrapper.js index b702f7a9cbbe..f69e7d96e97a 100644 --- a/devtools/client/aboutdebugging-new/src/modules/client-wrapper.js +++ b/devtools/client/aboutdebugging-new/src/modules/client-wrapper.js @@ -4,12 +4,12 @@ "use strict"; -const { checkVersionCompatibility } = - require("devtools/client/shared/remote-debugging/version-checker"); +const { + checkVersionCompatibility, +} = require("devtools/client/shared/remote-debugging/version-checker"); const { RUNTIME_PREFERENCE } = require("../constants"); -const { WorkersListener } = - require("devtools/client/shared/workers-listener"); +const { WorkersListener } = require("devtools/client/shared/workers-listener"); const PREF_TYPES = { BOOL: "BOOL", @@ -25,10 +25,7 @@ const PREF_TO_TYPE = { }; // Some events are fired by mainRoot rather than client. -const MAIN_ROOT_EVENTS = [ - "addonListChanged", - "tabListChanged", -]; +const MAIN_ROOT_EVENTS = ["addonListChanged", "tabListChanged"]; /** * The ClientWrapper class is used to isolate aboutdebugging from the DevTools client API @@ -107,8 +104,10 @@ class ClientWrapper { async getPreference(prefName, defaultValue) { if (typeof defaultValue === "undefined") { - throw new Error("Default value is mandatory for getPreference, the actor will " + - "throw if the preference is not set on the target runtime"); + throw new Error( + "Default value is mandatory for getPreference, the actor will " + + "throw if the preference is not set on the target runtime" + ); } const prefType = PREF_TO_TYPE[prefName]; @@ -150,7 +149,11 @@ class ClientWrapper { } async listWorkers() { - const { other, service, shared } = await this.client.mainRoot.listAllWorkers(); + const { + other, + service, + shared, + } = await this.client.mainRoot.listAllWorkers(); return { otherWorkers: other, diff --git a/devtools/client/aboutdebugging-new/src/modules/debug-target-support.js b/devtools/client/aboutdebugging-new/src/modules/debug-target-support.js index e3ef2d13632e..8256cae01ed4 100644 --- a/devtools/client/aboutdebugging-new/src/modules/debug-target-support.js +++ b/devtools/client/aboutdebugging-new/src/modules/debug-target-support.js @@ -10,12 +10,18 @@ const Services = require("Services"); // Process target debugging is disabled by default. function isProcessDebuggingSupported() { - return Services.prefs.getBoolPref(PREFERENCES.PROCESS_DEBUGGING_ENABLED, false); + return Services.prefs.getBoolPref( + PREFERENCES.PROCESS_DEBUGGING_ENABLED, + false + ); } // Process target debugging is disabled by default. function isLocalTabDebuggingSupported() { - return Services.prefs.getBoolPref(PREFERENCES.LOCAL_TAB_DEBUGGING_ENABLED, false); + return Services.prefs.getBoolPref( + PREFERENCES.LOCAL_TAB_DEBUGGING_ENABLED, + false + ); } // Installing extensions can be disabled in enterprise policy. @@ -33,12 +39,15 @@ const ALL_DEBUG_TARGET_PANES = [ DEBUG_TARGET_PANE.SERVICE_WORKER, DEBUG_TARGET_PANE.SHARED_WORKER, DEBUG_TARGET_PANE.TAB, - ...(isTemporaryExtensionSupported() ? [DEBUG_TARGET_PANE.TEMPORARY_EXTENSION] : []), + ...(isTemporaryExtensionSupported() + ? [DEBUG_TARGET_PANE.TEMPORARY_EXTENSION] + : []), ]; // All debug target panes except temporary extensions -const REMOTE_DEBUG_TARGET_PANES = ALL_DEBUG_TARGET_PANES.filter(p => - p !== DEBUG_TARGET_PANE.TEMPORARY_EXTENSION); +const REMOTE_DEBUG_TARGET_PANES = ALL_DEBUG_TARGET_PANES.filter( + p => p !== DEBUG_TARGET_PANE.TEMPORARY_EXTENSION +); const THIS_FIREFOX_DEBUG_TARGET_PANES = ALL_DEBUG_TARGET_PANES // Main process debugging is not available for This Firefox. @@ -59,6 +68,8 @@ const SUPPORTED_TARGET_PANE_BY_RUNTIME = { * a DEBUG_TARGET but INSTALLED_EXTENSION and TEMPORARY_EXTENSION are DEBUG_TARGET_PANES. */ function isSupportedDebugTargetPane(runtimeType, debugTargetPaneKey) { - return SUPPORTED_TARGET_PANE_BY_RUNTIME[runtimeType].includes(debugTargetPaneKey); + return SUPPORTED_TARGET_PANE_BY_RUNTIME[runtimeType].includes( + debugTargetPaneKey + ); } exports.isSupportedDebugTargetPane = isSupportedDebugTargetPane; diff --git a/devtools/client/aboutdebugging-new/src/modules/extensions-helper.js b/devtools/client/aboutdebugging-new/src/modules/extensions-helper.js index c135cea26a2d..7d0a69d9957e 100644 --- a/devtools/client/aboutdebugging-new/src/modules/extensions-helper.js +++ b/devtools/client/aboutdebugging-new/src/modules/extensions-helper.js @@ -6,11 +6,20 @@ const { Cc, Ci } = require("chrome"); const Services = require("Services"); -loader.lazyImporter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm"); -loader.lazyRequireGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm", true); +loader.lazyImporter( + this, + "AddonManager", + "resource://gre/modules/AddonManager.jsm" +); +loader.lazyRequireGetter( + this, + "FileUtils", + "resource://gre/modules/FileUtils.jsm", + true +); -const {Toolbox} = require("devtools/client/framework/toolbox"); -const {gDevTools} = require("devtools/client/framework/devtools"); +const { Toolbox } = require("devtools/client/framework/toolbox"); +const { gDevTools } = require("devtools/client/framework/devtools"); const { PREFERENCES } = require("../constants"); @@ -91,8 +100,10 @@ exports.openTemporaryExtension = function(win, message) { // Try to set the last directory used as "displayDirectory". try { - const lastDirPath = - Services.prefs.getCharPref(PREFERENCES.TEMPORARY_EXTENSION_PATH, ""); + const lastDirPath = Services.prefs.getCharPref( + PREFERENCES.TEMPORARY_EXTENSION_PATH, + "" + ); const lastDir = new FileUtils.File(lastDirPath); fp.displayDirectory = lastDir; } catch (e) { @@ -106,13 +117,19 @@ exports.openTemporaryExtension = function(win, message) { let file = fp.file; // AddonManager.installTemporaryAddon accepts either // addon directory or final xpi file. - if (!file.isDirectory() && - !file.leafName.endsWith(".xpi") && !file.leafName.endsWith(".zip")) { + if ( + !file.isDirectory() && + !file.leafName.endsWith(".xpi") && + !file.leafName.endsWith(".zip") + ) { file = file.parent; } // We are about to resolve, store the path to the file for the next call. - Services.prefs.setCharPref(PREFERENCES.TEMPORARY_EXTENSION_PATH, file.path); + Services.prefs.setCharPref( + PREFERENCES.TEMPORARY_EXTENSION_PATH, + file.path + ); resolve(file); }); diff --git a/devtools/client/aboutdebugging-new/src/modules/l10n.js b/devtools/client/aboutdebugging-new/src/modules/l10n.js index 6dc195d78a5a..a496fc7e4969 100644 --- a/devtools/client/aboutdebugging-new/src/modules/l10n.js +++ b/devtools/client/aboutdebugging-new/src/modules/l10n.js @@ -4,7 +4,9 @@ "use strict"; -const { FluentL10n } = require("devtools/client/shared/fluent-l10n/fluent-l10n"); +const { + FluentL10n, +} = require("devtools/client/shared/fluent-l10n/fluent-l10n"); // exports a singleton, which will be used across all aboutdebugging-new modules exports.l10n = new FluentL10n(); diff --git a/devtools/client/aboutdebugging-new/src/modules/network-locations.js b/devtools/client/aboutdebugging-new/src/modules/network-locations.js index cf2c00787a28..53cae51ef3ae 100644 --- a/devtools/client/aboutdebugging-new/src/modules/network-locations.js +++ b/devtools/client/aboutdebugging-new/src/modules/network-locations.js @@ -51,8 +51,10 @@ function addNetworkLocation(location) { const locationsSet = new Set(locations); locationsSet.add(location); - Services.prefs.setStringPref(NETWORK_LOCATIONS_PREF, - JSON.stringify([...locationsSet])); + Services.prefs.setStringPref( + NETWORK_LOCATIONS_PREF, + JSON.stringify([...locationsSet]) + ); } exports.addNetworkLocation = addNetworkLocation; @@ -61,7 +63,9 @@ function removeNetworkLocation(location) { const locationsSet = new Set(locations); locationsSet.delete(location); - Services.prefs.setStringPref(NETWORK_LOCATIONS_PREF, - JSON.stringify([...locationsSet])); + Services.prefs.setStringPref( + NETWORK_LOCATIONS_PREF, + JSON.stringify([...locationsSet]) + ); } exports.removeNetworkLocation = removeNetworkLocation; diff --git a/devtools/client/aboutdebugging-new/src/modules/runtime-client-factory.js b/devtools/client/aboutdebugging-new/src/modules/runtime-client-factory.js index c4966f8101cc..c0624131ff53 100644 --- a/devtools/client/aboutdebugging-new/src/modules/runtime-client-factory.js +++ b/devtools/client/aboutdebugging-new/src/modules/runtime-client-factory.js @@ -8,8 +8,9 @@ const { prepareTCPConnection } = require("devtools/shared/adb/commands/index"); const { DebuggerClient } = require("devtools/shared/client/debugger-client"); const { DebuggerServer } = require("devtools/server/main"); const { ClientWrapper } = require("./client-wrapper"); -const { remoteClientManager } = - require("devtools/client/shared/remote-debugging/remote-client-manager"); +const { + remoteClientManager, +} = require("devtools/client/shared/remote-debugging/remote-client-manager"); const { RUNTIMES } = require("../constants"); diff --git a/devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js b/devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js index 800007375217..1804a9e6e935 100644 --- a/devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js +++ b/devtools/client/aboutdebugging-new/src/modules/usb-runtimes.js @@ -80,7 +80,8 @@ async function getUSBRuntimes() { // Get devices found by ADB, but without any available runtime. const runtimeDevices = runtimes.map(r => r.deviceId); - const unavailableRuntimes = adb.getDevices() + const unavailableRuntimes = adb + .getDevices() .filter(d => !runtimeDevices.includes(d.id)) .map(d => new UnavailableUsbRuntime(d)); @@ -93,7 +94,9 @@ async function getUSBRuntimes() { // Get devices previously found by ADB but no longer available. const currentDevices = allRuntimes.map(r => r.deviceId); const detectedDevices = [...devices.keys()]; - const unpluggedDevices = detectedDevices.filter(id => !currentDevices.includes(id)); + const unpluggedDevices = detectedDevices.filter( + id => !currentDevices.includes(id) + ); const unpluggedRuntimes = unpluggedDevices.map(deviceId => { const deviceName = devices.get(deviceId); return new UnpluggedUsbRuntime(deviceId, deviceName); diff --git a/devtools/client/aboutdebugging-new/src/reducers/debug-targets-state.js b/devtools/client/aboutdebugging-new/src/reducers/debug-targets-state.js index 28980566428c..d5e865674e4a 100644 --- a/devtools/client/aboutdebugging-new/src/reducers/debug-targets-state.js +++ b/devtools/client/aboutdebugging-new/src/reducers/debug-targets-state.js @@ -43,7 +43,10 @@ function debugTargetsReducer(state = DebugTargetsState(), action) { } case REQUEST_EXTENSIONS_SUCCESS: { const { installedExtensions, temporaryExtensions } = action; - return Object.assign({}, state, { installedExtensions, temporaryExtensions }); + return Object.assign({}, state, { + installedExtensions, + temporaryExtensions, + }); } case REQUEST_PROCESSES_SUCCESS: { const { processes } = action; @@ -55,18 +58,24 @@ function debugTargetsReducer(state = DebugTargetsState(), action) { } case REQUEST_WORKERS_SUCCESS: { const { otherWorkers, serviceWorkers, sharedWorkers } = action; - return Object.assign({}, state, { otherWorkers, serviceWorkers, sharedWorkers }); + return Object.assign({}, state, { + otherWorkers, + serviceWorkers, + sharedWorkers, + }); } case TEMPORARY_EXTENSION_RELOAD_FAILURE: { const { id, error } = action; - const temporaryExtensions = - updateTemporaryExtension(state, id, { reloadError: error.message }); + const temporaryExtensions = updateTemporaryExtension(state, id, { + reloadError: error.message, + }); return Object.assign({}, state, { temporaryExtensions }); } case TEMPORARY_EXTENSION_RELOAD_START: { const { id } = action; - const temporaryExtensions = - updateTemporaryExtension(state, id, { reloadError: null }); + const temporaryExtensions = updateTemporaryExtension(state, id, { + reloadError: null, + }); return Object.assign({}, state, { temporaryExtensions }); } diff --git a/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js b/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js index 3485a93757a7..4f0fc617aa4d 100644 --- a/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js +++ b/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js @@ -19,12 +19,11 @@ const { THIS_FIREFOX_RUNTIME_CREATED, } = require("../constants"); -const { - findRuntimeById, -} = require("../modules/runtimes-state-helper"); +const { findRuntimeById } = require("../modules/runtimes-state-helper"); -const { remoteClientManager } = - require("devtools/client/shared/remote-debugging/remote-client-manager"); +const { + remoteClientManager, +} = require("devtools/client/shared/remote-debugging/remote-client-manager"); // Map between known runtime types and nodes in the runtimes state. const TYPE_TO_RUNTIMES_KEY = { @@ -146,8 +145,9 @@ function runtimesReducer(state = RuntimesState(), action) { const { connectionPromptEnabled } = action; const { id: runtimeId } = action.runtime; const runtime = findRuntimeById(runtimeId, state); - const runtimeDetails = - Object.assign({}, runtime.runtimeDetails, { connectionPromptEnabled }); + const runtimeDetails = Object.assign({}, runtime.runtimeDetails, { + connectionPromptEnabled, + }); return _updateRuntimeById(runtimeId, { runtimeDetails }, state); } @@ -155,8 +155,9 @@ function runtimesReducer(state = RuntimesState(), action) { const { isMultiE10s } = action; const { id: runtimeId } = action.runtime; const runtime = findRuntimeById(runtimeId, state); - const runtimeDetails = - Object.assign({}, runtime.runtimeDetails, { isMultiE10s }); + const runtimeDetails = Object.assign({}, runtime.runtimeDetails, { + isMultiE10s, + }); return _updateRuntimeById(runtimeId, { runtimeDetails }, state); } diff --git a/devtools/client/aboutdebugging-new/src/reducers/ui-state.js b/devtools/client/aboutdebugging-new/src/reducers/ui-state.js index 1c8ce2a63a3b..dbec32d4f52c 100644 --- a/devtools/client/aboutdebugging-new/src/reducers/ui-state.js +++ b/devtools/client/aboutdebugging-new/src/reducers/ui-state.js @@ -18,8 +18,11 @@ const { USB_RUNTIMES_SCAN_SUCCESS, } = require("../constants"); -function UiState(locations = [], debugTargetCollapsibilities = {}, - showHiddenAddons = false) { +function UiState( + locations = [], + debugTargetCollapsibilities = {}, + showHiddenAddons = false +) { return { adbAddonStatus: null, debugTargetCollapsibilities, @@ -47,7 +50,9 @@ function uiReducer(state = UiState(), action) { case DEBUG_TARGET_COLLAPSIBILITY_UPDATED: { const { isCollapsed, key } = action; - const debugTargetCollapsibilities = new Map(state.debugTargetCollapsibilities); + const debugTargetCollapsibilities = new Map( + state.debugTargetCollapsibilities + ); debugTargetCollapsibilities.set(key, isCollapsed); return Object.assign({}, state, { debugTargetCollapsibilities }); } diff --git a/devtools/client/aboutdebugging-new/src/types/index.js b/devtools/client/aboutdebugging-new/src/types/index.js index b0098c194d5f..92303bf0b27a 100644 --- a/devtools/client/aboutdebugging-new/src/types/index.js +++ b/devtools/client/aboutdebugging-new/src/types/index.js @@ -8,8 +8,11 @@ const debugTargetTypes = require("./debug-target"); const runtimeTypes = require("./runtime"); const uiTypes = require("./ui"); -module.exports = Object.assign({}, { - ...debugTargetTypes, - ...runtimeTypes, - ...uiTypes, -}); +module.exports = Object.assign( + {}, + { + ...debugTargetTypes, + ...runtimeTypes, + ...uiTypes, + } +); diff --git a/devtools/client/aboutdebugging-new/src/types/runtime.js b/devtools/client/aboutdebugging-new/src/types/runtime.js index 0e088f8b799e..0badf786e83d 100644 --- a/devtools/client/aboutdebugging-new/src/types/runtime.js +++ b/devtools/client/aboutdebugging-new/src/types/runtime.js @@ -6,7 +6,9 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { ClientWrapper } = require("../modules/client-wrapper"); -const { COMPATIBILITY_STATUS } = require("devtools/client/shared/remote-debugging/version-checker"); +const { + COMPATIBILITY_STATUS, +} = require("devtools/client/shared/remote-debugging/version-checker"); const runtimeInfo = { // device name which is running the runtime, diff --git a/devtools/client/aboutdebugging-new/src/types/ui.js b/devtools/client/aboutdebugging-new/src/types/ui.js index 3d82ea11cd0f..0173fc3f2b41 100644 --- a/devtools/client/aboutdebugging-new/src/types/ui.js +++ b/devtools/client/aboutdebugging-new/src/types/ui.js @@ -12,12 +12,14 @@ function makeCollapsibilitiesType(isRequired) { return (props, propName, componentName, _, propFullName) => { if (isRequired && props[propName] === null) { return new Error( - `Missing prop ${propFullName} marked as required in ${componentName}`); + `Missing prop ${propFullName} marked as required in ${componentName}` + ); } const error = new Error( `Invalid prop ${propFullName} (${props[propName]}) supplied to ` + - `${componentName}. Collapsibilities needs to be a Map`); + `${componentName}. Collapsibilities needs to be a Map` + ); const map = props[propName]; @@ -27,8 +29,9 @@ function makeCollapsibilitiesType(isRequired) { } // check that the keys refer to debug target panes - const areKeysValid = [...map.keys()] - .every(x => Object.values(DEBUG_TARGET_PANE).includes(x)); + const areKeysValid = [...map.keys()].every(x => + Object.values(DEBUG_TARGET_PANE).includes(x) + ); // check that the values are boolean const areValuesValid = [...map.values()].every(x => typeof x === "boolean"); // error if values or keys fail their checks @@ -44,13 +47,16 @@ function makeLocationType(isRequired) { return (props, propName, componentName, _, propFullName) => { if (isRequired && props[propName] === null) { return new Error( - `Missing prop ${propFullName} marked as required in ${componentName}`); + `Missing prop ${propFullName} marked as required in ${componentName}` + ); } // check that location is a string with a semicolon in it if (!/\:/.test(props[propName])) { - return new Error(`Invalid prop ${propFullName} (${props[propName]}) supplied to ` + - `${componentName}. Location needs to be a string with a host:port format`); + return new Error( + `Invalid prop ${propFullName} (${props[propName]}) supplied to ` + + `${componentName}. Location needs to be a string with a host:port format` + ); } return null; diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_console.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_console.js index 0a4274fcf15b..845b62742bd8 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_console.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_console.js @@ -7,7 +7,9 @@ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -29,19 +31,28 @@ add_task(async function testWebExtensionsToolboxWebConsole() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installTemporaryExtensionFromXPI({ - background: function() { - window.myWebExtensionAddonFunction = function() { - console.log("Background page function called", - this.browser.runtime.getManifest()); - }; + await installTemporaryExtensionFromXPI( + { + background: function() { + window.myWebExtensionAddonFunction = function() { + console.log( + "Background page function called", + this.browser.runtime.getManifest() + ); + }; + }, + id: ADDON_ID, + name: ADDON_NAME, }, - id: ADDON_ID, - name: ADDON_NAME, - }, document); + document + ); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, ADDON_NAME); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + ADDON_NAME + ); const toolbox = getToolbox(devtoolsWindow); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -60,9 +71,8 @@ add_task(async function testWebExtensionsToolboxWebConsole() { function toolboxTestScript(toolbox, devtoolsTab) { function findMessages(hud, text, selector = ".message") { const messages = hud.ui.outputNode.querySelectorAll(selector); - const elements = Array.prototype.filter.call( - messages, - (el) => el.textContent.includes(text) + const elements = Array.prototype.filter.call(messages, el => + el.textContent.includes(text) ); return elements; } @@ -73,7 +83,8 @@ function toolboxTestScript(toolbox, devtoolsTab) { } } - toolbox.selectTool("webconsole") + toolbox + .selectTool("webconsole") .then(async console => { const { hud } = console; const { jsterm } = hud; diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_debugger.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_debugger.js index 8dd1e3ff0e57..6ecb0addc260 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_debugger.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_debugger.js @@ -11,40 +11,53 @@ add_task(async () => { await enableExtensionDebugging(); - info("The debugger should show the source codes of extension even if " + - "devtools.chrome.enabled and devtools.debugger.remote-enabled are off"); + info( + "The debugger should show the source codes of extension even if " + + "devtools.chrome.enabled and devtools.debugger.remote-enabled are off" + ); await pushPref("devtools.chrome.enabled", false); await pushPref("devtools.debugger.remote-enabled", false); const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installTemporaryExtensionFromXPI({ - background: function() { - window.someRandomMethodName = () => { - // This will not be referred from anywhere. - // However this is necessary to show as the source code in the debugger. - }; + await installTemporaryExtensionFromXPI( + { + background: function() { + window.someRandomMethodName = () => { + // This will not be referred from anywhere. + // However this is necessary to show as the source code in the debugger. + }; + }, + id: EXTENSION_ID, + name: EXTENSION_NAME, }, - id: EXTENSION_ID, - name: EXTENSION_NAME, - }, document); + document + ); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, EXTENSION_NAME); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + EXTENSION_NAME + ); const toolbox = getToolbox(devtoolsWindow); await toolbox.selectTool("jsdebugger"); const { panelWin } = toolbox.getCurrentPanel(); info("Check the state of redux"); - ok(panelWin.dbg.store.getState().debuggee.isWebExtension, - "isWebExtension flag in debuggee is true"); + ok( + panelWin.dbg.store.getState().debuggee.isWebExtension, + "isWebExtension flag in debuggee is true" + ); info("Check whether the element displays correctly"); const sourceList = panelWin.document.querySelector(".sources-list"); ok(sourceList, "Source list element displays correctly"); - ok(sourceList.textContent.includes("temporary-web-extension"), - "Extension name displays correctly"); + ok( + sourceList.textContent.includes("temporary-web-extension"), + "Extension name displays correctly" + ); await closeAboutDevtoolsToolbox(document, devtoolsTab, window); await removeTemporaryExtension(EXTENSION_NAME, document); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_inspector.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_inspector.js index 5815637db045..6c00538f1be1 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_inspector.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_inspector.js @@ -7,7 +7,9 @@ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -29,17 +31,24 @@ add_task(async function testWebExtensionsToolboxWebConsole() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installTemporaryExtensionFromXPI({ - background: function() { - document.body.innerText = "Background Page Body Test Content"; + await installTemporaryExtensionFromXPI( + { + background: function() { + document.body.innerText = "Background Page Body Test Content"; + }, + id: ADDON_ID, + name: ADDON_NAME, }, - id: ADDON_ID, - name: ADDON_NAME, - }, document); + document + ); info("Open a toolbox to debug the addon"); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, ADDON_NAME); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + ADDON_NAME + ); const toolbox = getToolbox(devtoolsWindow); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -56,18 +65,19 @@ add_task(async function testWebExtensionsToolboxWebConsole() { }); async function toolboxTestScript(toolbox, devtoolsTab) { - toolbox.selectTool("inspector") + toolbox + .selectTool("inspector") .then(inspector => { return inspector.walker.querySelector(inspector.walker.rootNode, "body"); }) - .then((nodeActor) => { + .then(nodeActor => { if (!nodeActor) { throw new Error("nodeActor not found"); } dump("Got a nodeActor\n"); - if (!(nodeActor.inlineTextChild)) { + if (!nodeActor.inlineTextChild) { throw new Error("inlineTextChild not found"); } @@ -86,7 +96,7 @@ async function toolboxTestScript(toolbox, devtoolsTab) { return Promise.resolve(); }) .then(() => removeTab(devtoolsTab)) - .catch((error) => { + .catch(error => { dump("Error while running code in the browser toolbox process:\n"); dump(error + "\n"); dump("stack:\n" + error.stack + "\n"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_nobg.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_nobg.js index 108db9df9276..190cee3e6ac0 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_nobg.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_nobg.js @@ -7,7 +7,9 @@ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); const ADDON_NOBG_ID = "test-devtools-webextension-nobg@mozilla.org"; @@ -26,15 +28,22 @@ add_task(async function testWebExtensionsToolboxNoBackgroundPage() { const store = window.AboutDebugging.store; await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installTemporaryExtensionFromXPI({ - // Do not pass any `background` script. - id: ADDON_NOBG_ID, - name: ADDON_NOBG_NAME, - }, document); + await installTemporaryExtensionFromXPI( + { + // Do not pass any `background` script. + id: ADDON_NOBG_ID, + name: ADDON_NOBG_NAME, + }, + document + ); info("Open a toolbox to debug the addon"); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, ADDON_NOBG_NAME); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + ADDON_NOBG_NAME + ); const toolbox = getToolbox(devtoolsWindow); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -60,31 +69,37 @@ async function toolboxTestScript(toolbox, devtoolsTab) { throw new Error("Toolbox doesn't have the expected target"); } - toolbox.selectTool("inspector").then(async inspector => { - let nodeActor; + toolbox + .selectTool("inspector") + .then(async inspector => { + let nodeActor; - dump(`Wait the fallback window to be fully loaded\n`); - await asyncWaitUntil(async () => { - nodeActor = await inspector.walker.querySelector(inspector.walker.rootNode, "h1"); - return nodeActor && nodeActor.inlineTextChild; + dump(`Wait the fallback window to be fully loaded\n`); + await asyncWaitUntil(async () => { + nodeActor = await inspector.walker.querySelector( + inspector.walker.rootNode, + "h1" + ); + return nodeActor && nodeActor.inlineTextChild; + }); + + dump("Got a nodeActor with an inline text child\n"); + const expectedValue = "Your addon does not have any document opened yet."; + const actualValue = nodeActor.inlineTextChild._form.nodeValue; + + if (actualValue !== expectedValue) { + throw new Error( + `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"` + ); + } + + dump("Got the expected inline text content in the selected node\n"); + + await removeTab(devtoolsTab); + }) + .catch(error => { + dump("Error while running code in the browser toolbox process:\n"); + dump(error + "\n"); + dump("stack:\n" + error.stack + "\n"); }); - - dump("Got a nodeActor with an inline text child\n"); - const expectedValue = "Your addon does not have any document opened yet."; - const actualValue = nodeActor.inlineTextChild._form.nodeValue; - - if (actualValue !== expectedValue) { - throw new Error( - `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"` - ); - } - - dump("Got the expected inline text content in the selected node\n"); - - await removeTab(devtoolsTab); - }).catch((error) => { - dump("Error while running code in the browser toolbox process:\n"); - dump(error + "\n"); - dump("stack:\n" + error.stack + "\n"); - }); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_popup.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_popup.js index 00c9714e41dd..d847dbc3ce13 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_popup.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_debug_popup.js @@ -7,7 +7,9 @@ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -36,13 +38,19 @@ const ADDON_NAME = "test-devtools-webextension"; add_task(async function testWebExtensionsToolboxWebConsole() { await enableExtensionDebugging(); - is(Services.prefs.getBoolPref("ui.popup.disable_autohide"), false, - "disable_autohide should be initially false"); + is( + Services.prefs.getBoolPref("ui.popup.disable_autohide"), + false, + "disable_autohide should be initially false" + ); info("Create promises waiting for the messages emitted by the test addon"); let onReadyForOpenPopup; let onPopupCustomMessage; - const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", null); + const { Management } = ChromeUtils.import( + "resource://gre/modules/Extension.jsm", + null + ); Management.on("startup", function listener(event, extension) { if (extension.name != ADDON_NAME) { return; @@ -53,7 +61,7 @@ add_task(async function testWebExtensionsToolboxWebConsole() { function waitForExtensionTestMessage(expectedMessage) { return new Promise(done => { extension.on("test-message", function testLogListener(evt, ...args) { - const [message ] = args; + const [message] = args; if (message !== expectedMessage) { return; @@ -71,27 +79,37 @@ add_task(async function testWebExtensionsToolboxWebConsole() { // Wait for a notification sent by a script evaluated the test addon via // the web console. - onPopupCustomMessage = waitForExtensionTestMessage("popupPageFunctionCalled"); + onPopupCustomMessage = waitForExtensionTestMessage( + "popupPageFunctionCalled" + ); }); - const { document, tab, window: aboutDebuggingWindow } = await openAboutDebugging(); - await selectThisFirefoxPage(document, aboutDebuggingWindow.AboutDebugging.store); + const { + document, + tab, + window: aboutDebuggingWindow, + } = await openAboutDebugging(); + await selectThisFirefoxPage( + document, + aboutDebuggingWindow.AboutDebugging.store + ); - await installTemporaryExtensionFromXPI({ - background: function() { - const {browser} = this; - window.myWebExtensionShowPopup = function() { - browser.test.sendMessage("readyForOpenPopup"); - }; - }, - extraProperties: { - browser_action: { - default_title: "WebExtension Popup Debugging", - default_popup: "popup.html", + await installTemporaryExtensionFromXPI( + { + background: function() { + const { browser } = this; + window.myWebExtensionShowPopup = function() { + browser.test.sendMessage("readyForOpenPopup"); + }; }, - }, - files: { - "popup.html": ` + extraProperties: { + browser_action: { + default_title: "WebExtension Popup Debugging", + default_popup: "popup.html", + }, + }, + files: { + "popup.html": ` @@ -102,21 +120,29 @@ add_task(async function testWebExtensionsToolboxWebConsole() { `, - "popup.js": function() { - const {browser} = this; - window.myWebExtensionPopupAddonFunction = function() { - browser.test.sendMessage("popupPageFunctionCalled", - browser.runtime.getManifest()); - }; + "popup.js": function() { + const { browser } = this; + window.myWebExtensionPopupAddonFunction = function() { + browser.test.sendMessage( + "popupPageFunctionCalled", + browser.runtime.getManifest() + ); + }; + }, }, + id: ADDON_ID, + name: ADDON_NAME, }, - id: ADDON_ID, - name: ADDON_NAME, - }, document); + document + ); info("Open a toolbox to debug the addon"); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, aboutDebuggingWindow, ADDON_NAME); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + aboutDebuggingWindow, + ADDON_NAME + ); const toolbox = getToolbox(devtoolsWindow); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -136,14 +162,20 @@ add_task(async function testWebExtensionsToolboxWebConsole() { const args = await onPopupCustomMessage; ok(true, "Received console message from the popup page function as expected"); is(args[0], "popupPageFunctionCalled", "Got the expected console message"); - is(args[1] && args[1].name, ADDON_NAME, - "Got the expected manifest from WebExtension API"); + is( + args[1] && args[1].name, + ADDON_NAME, + "Got the expected manifest from WebExtension API" + ); info("Wait for the toolbox to close"); await onToolboxClose; - is(Services.prefs.getBoolPref("ui.popup.disable_autohide"), false, - "disable_autohide should be reset to false when the toolbox is closed"); + is( + Services.prefs.getBoolPref("ui.popup.disable_autohide"), + false, + "disable_autohide should be reset to false when the toolbox is closed" + ); // The test script will not close the toolbox and will timeout if it fails, so reaching // this point in the test is enough to assume the test was successful. @@ -157,7 +189,7 @@ async function toolboxTestScript(toolbox, devtoolsTab) { let jsterm; const popupFramePromise = new Promise(resolve => { const listener = data => { - if (data.frames.some(({url}) => url && url.endsWith("popup.html"))) { + if (data.frames.some(({ url }) => url && url.endsWith("popup.html"))) { toolbox.target.off("frame-update", listener); resolve(); } @@ -167,17 +199,23 @@ async function toolboxTestScript(toolbox, devtoolsTab) { const waitForFrameListUpdate = toolbox.target.once("frame-update"); - toolbox.selectTool("webconsole") - .then(async (console) => { + toolbox + .selectTool("webconsole") + .then(async console => { const clickNoAutoHideMenu = () => { return new Promise(resolve => { toolbox.doc.getElementById("toolbox-meatball-menu-button").click(); - toolbox.doc.addEventListener("popupshown", () => { - const menuItem = - toolbox.doc.getElementById("toolbox-meatball-menu-noautohide"); - menuItem.click(); - resolve(); - }, { once: true }); + toolbox.doc.addEventListener( + "popupshown", + () => { + const menuItem = toolbox.doc.getElementById( + "toolbox-meatball-menu-noautohide" + ); + menuItem.click(); + resolve(); + }, + { once: true } + ); }); }; @@ -206,9 +244,13 @@ async function toolboxTestScript(toolbox, devtoolsTab) { throw Error(`Number of frames found is wrong: ${frames.length} != 2`); } - const popupFrameBtn = frames.filter((frame) => { - return frame.querySelector(".label").textContent.endsWith("popup.html"); - }).pop(); + const popupFrameBtn = frames + .filter(frame => { + return frame + .querySelector(".label") + .textContent.endsWith("popup.html"); + }) + .pop(); if (!popupFrameBtn) { throw Error("Extension Popup frame not found in the listed frames"); @@ -218,7 +260,10 @@ async function toolboxTestScript(toolbox, devtoolsTab) { popupFrameBtn.click(); // Clicking the menu item may do highlighting. await waitUntil(() => toolbox.highlighter); - await Promise.race([toolbox.highlighter.once("node-highlight"), wait(1000)]); + await Promise.race([ + toolbox.highlighter.once("node-highlight"), + wait(1000), + ]); await waitForNavigated; await jsterm.execute("myWebExtensionPopupAddonFunction()"); @@ -227,7 +272,7 @@ async function toolboxTestScript(toolbox, devtoolsTab) { await removeTab(devtoolsTab); }) - .catch((error) => { + .catch(error => { dump("Error while running code in the browser toolbox process:\n"); dump(error + "\n"); dump("stack:\n" + error.stack + "\n"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_manifest_url.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_manifest_url.js index c9ff59e35250..37da49a89631 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_manifest_url.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_manifest_url.js @@ -13,8 +13,10 @@ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-adb.js", this); // Test that manifest URLs for addon targets show the manifest correctly in a new tab. // This test reuses the ADB extension to be sure to have a valid manifest URL to open. add_task(async function() { - await pushPref("devtools.remote.adb.extensionURL", - CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi"); + await pushPref( + "devtools.remote.adb.extensionURL", + CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi" + ); await checkAdbNotRunning(); const { document, tab, window } = await openAboutDebugging(); @@ -40,13 +42,21 @@ add_task(async function() { await BrowserTestUtils.browserLoaded(target.linkedBrowser); info("Retrieve the text content of the new tab"); - const textContent = await ContentTask.spawn(target.linkedBrowser, {}, function() { - return content.wrappedJSObject.document.body.textContent; - }); + const textContent = await ContentTask.spawn( + target.linkedBrowser, + {}, + function() { + return content.wrappedJSObject.document.body.textContent; + } + ); const manifestObject = JSON.parse(textContent); ok(manifestObject, "The displayed content is a valid JSON object"); - is(manifestObject.name, ABD_ADDON_NAME, "Manifest tab shows the expected content"); + is( + manifestObject.name, + ABD_ADDON_NAME, + "Manifest tab shows the expected content" + ); info("Close the manifest.json tab"); await removeTab(target); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_remote_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_remote_runtime.js index 89dbf257ab55..e262cd1a1f4e 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_remote_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_remote_runtime.js @@ -26,7 +26,11 @@ add_task(async function() { info("Test addons in runtime page for USB client"); await connectToRuntime(USB_RUNTIME_DEVICE_NAME, document); await selectRuntime(USB_RUNTIME_DEVICE_NAME, USB_RUNTIME_APP_NAME, document); - await testAddonsOnMockedRemoteClient(usbClient, mocks.thisFirefoxClient, document); + await testAddonsOnMockedRemoteClient( + usbClient, + mocks.thisFirefoxClient, + document + ); info("Prepare Network client mock"); const networkClient = mocks.createNetworkRuntime(NETWORK_RUNTIME_HOST, { @@ -36,7 +40,11 @@ add_task(async function() { info("Test addons in runtime page for Network client"); await connectToRuntime(NETWORK_RUNTIME_HOST, document); await selectRuntime(NETWORK_RUNTIME_HOST, NETWORK_RUNTIME_APP_NAME, document); - await testAddonsOnMockedRemoteClient(networkClient, mocks.thisFirefoxClient, document); + await testAddonsOnMockedRemoteClient( + networkClient, + mocks.thisFirefoxClient, + document + ); await removeTab(tab); }); @@ -44,11 +52,17 @@ add_task(async function() { /** * Check that addons are visible in the runtime page for a remote client (USB or network). */ -async function testAddonsOnMockedRemoteClient(remoteClient, firefoxClient, document) { +async function testAddonsOnMockedRemoteClient( + remoteClient, + firefoxClient, + document +) { const extensionPane = getDebugTargetPane("Extensions", document); info("Check an empty target pane message is displayed"); - ok(extensionPane.querySelector(".qa-debug-target-list-empty"), - "Extensions list is empty"); + ok( + extensionPane.querySelector(".qa-debug-target-list-empty"), + "Extensions list is empty" + ); info("Add an extension to the remote client"); const addon = { name: "Test extension name", debuggable: true }; @@ -56,9 +70,14 @@ async function testAddonsOnMockedRemoteClient(remoteClient, firefoxClient, docum remoteClient._eventEmitter.emit("addonListChanged"); info("Wait until the extension appears"); - await waitUntil(() => !extensionPane.querySelector(".qa-debug-target-list-empty")); + await waitUntil( + () => !extensionPane.querySelector(".qa-debug-target-list-empty") + ); - const extensionTarget = findDebugTargetByText("Test extension name", document); + const extensionTarget = findDebugTargetByText( + "Test extension name", + document + ); ok(extensionTarget, "Extension target appeared for the remote runtime"); // The goal here is to check that runtimes addons are only updated when the remote @@ -78,12 +97,20 @@ async function testAddonsOnMockedRemoteClient(remoteClient, firefoxClient, docum const testTab = { outerWindowID: 0, url: "http://some.random/url.com" }; remoteClient.listTabs = () => [testTab]; remoteClient._eventEmitter.emit("tabListChanged"); - await waitUntil(() => findDebugTargetByText("http://some.random/url.com", document)); + await waitUntil(() => + findDebugTargetByText("http://some.random/url.com", document) + ); - ok(findDebugTargetByText("Test extension name", document), - "The test extension is still visible"); + ok( + findDebugTargetByText("Test extension name", document), + "The test extension is still visible" + ); - info("Emit `addonListChanged` on remoteClient and wait for the target list to update"); + info( + "Emit `addonListChanged` on remoteClient and wait for the target list to update" + ); remoteClient._eventEmitter.emit("addonListChanged"); - await waitUntil(() => !findDebugTargetByText("Test extension name", document)); + await waitUntil( + () => !findDebugTargetByText("Test extension name", document) + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_addon_buttons.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_addon_buttons.js index b11b47664fa7..9d46452ad8b8 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_addon_buttons.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_addon_buttons.js @@ -14,38 +14,62 @@ add_task(async function() { const UPDATED_EXTENSION_NAME = "Temporary web extension (updated)"; const EXTENSION_ID = "test-devtools@mozilla.org"; - const addonFile = await installTemporaryExtensionFromXPI({ - id: EXTENSION_ID, - name: ORIGINAL_EXTENSION_NAME, - }, document); + const addonFile = await installTemporaryExtensionFromXPI( + { + id: EXTENSION_ID, + name: ORIGINAL_EXTENSION_NAME, + }, + document + ); - const originalTarget = findDebugTargetByText(ORIGINAL_EXTENSION_NAME, document); - ok(!!originalTarget, "The temporary extension isinstalled with the expected name"); + const originalTarget = findDebugTargetByText( + ORIGINAL_EXTENSION_NAME, + document + ); + ok( + !!originalTarget, + "The temporary extension isinstalled with the expected name" + ); info("Update the name of the temporary extension in the manifest"); - updateTemporaryXPI({ id: EXTENSION_ID, name: UPDATED_EXTENSION_NAME }, addonFile); + updateTemporaryXPI( + { id: EXTENSION_ID, name: UPDATED_EXTENSION_NAME }, + addonFile + ); info("Click on the reload button for the temporary extension"); - const reloadButton = - originalTarget.querySelector(".qa-temporary-extension-reload-button"); + const reloadButton = originalTarget.querySelector( + ".qa-temporary-extension-reload-button" + ); reloadButton.click(); - info("Wait until the debug target with the original extension name disappears"); - await waitUntil(() => !findDebugTargetByText(ORIGINAL_EXTENSION_NAME, document)); + info( + "Wait until the debug target with the original extension name disappears" + ); + await waitUntil( + () => !findDebugTargetByText(ORIGINAL_EXTENSION_NAME, document) + ); info("Wait until the debug target with the updated extension name appears"); - await waitUntil(() => findDebugTargetByText(UPDATED_EXTENSION_NAME, document)); + await waitUntil(() => + findDebugTargetByText(UPDATED_EXTENSION_NAME, document) + ); const updatedTarget = findDebugTargetByText(UPDATED_EXTENSION_NAME, document); ok(!!updatedTarget, "The temporary extension name has been updated"); info("Click on the remove button for the temporary extension"); - const removeButton = - updatedTarget.querySelector(".qa-temporary-extension-remove-button"); + const removeButton = updatedTarget.querySelector( + ".qa-temporary-extension-remove-button" + ); removeButton.click(); - info("Wait until the debug target with the updated extension name disappears"); - await waitUntil(() => !findDebugTargetByText(UPDATED_EXTENSION_NAME, document)); + info( + "Wait until the debug target with the updated extension name disappears" + ); + await waitUntil( + () => !findDebugTargetByText(UPDATED_EXTENSION_NAME, document) + ); await removeTab(tab); }); @@ -57,18 +81,36 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installRegularExtension("resources/packaged-extension/packaged-extension.xpi"); + await installRegularExtension( + "resources/packaged-extension/packaged-extension.xpi" + ); info("Wait until extension appears in about:debugging"); - await waitUntil(() => findDebugTargetByText(PACKAGED_EXTENSION_NAME, document)); + await waitUntil(() => + findDebugTargetByText(PACKAGED_EXTENSION_NAME, document) + ); const target = findDebugTargetByText(PACKAGED_EXTENSION_NAME, document); - const reloadButton = target.querySelector(".qa-temporary-extension-reload-button"); - ok(!reloadButton, "No reload button displayed for a regularly installed extension"); + const reloadButton = target.querySelector( + ".qa-temporary-extension-reload-button" + ); + ok( + !reloadButton, + "No reload button displayed for a regularly installed extension" + ); - const removeButton = target.querySelector(".qa-temporary-extension-remove-button"); - ok(!removeButton, "No remove button displayed for a regularly installed extension"); + const removeButton = target.querySelector( + ".qa-temporary-extension-remove-button" + ); + ok( + !removeButton, + "No remove button displayed for a regularly installed extension" + ); - await removeExtension(PACKAGED_EXTENSION_ID, PACKAGED_EXTENSION_NAME, document); + await removeExtension( + PACKAGED_EXTENSION_ID, + PACKAGED_EXTENSION_NAME, + document + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_id_message.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_id_message.js index f29a1a1c6c4f..cf518a503732 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_id_message.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_id_message.js @@ -14,10 +14,13 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installTemporaryExtensionFromXPI({ - id: EXTENSION_ID, - name: EXTENSION_NAME, - }, document); + await installTemporaryExtensionFromXPI( + { + id: EXTENSION_ID, + name: EXTENSION_NAME, + }, + document + ); info("Wait until a debug target item appears"); await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document)); @@ -42,15 +45,26 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installRegularExtension("resources/packaged-extension/packaged-extension.xpi"); + await installRegularExtension( + "resources/packaged-extension/packaged-extension.xpi" + ); info("Wait until extension appears in about:debugging"); - await waitUntil(() => findDebugTargetByText(PACKAGED_EXTENSION_NAME, document)); + await waitUntil(() => + findDebugTargetByText(PACKAGED_EXTENSION_NAME, document) + ); const target = findDebugTargetByText(PACKAGED_EXTENSION_NAME, document); const tmpIdMessage = target.querySelector(".qa-temporary-id-message"); - ok(!tmpIdMessage, "No temporary id message is displayed for a regular extension"); + ok( + !tmpIdMessage, + "No temporary id message is displayed for a regular extension" + ); - await removeExtension(PACKAGED_EXTENSION_ID, PACKAGED_EXTENSION_NAME, document); + await removeExtension( + PACKAGED_EXTENSION_ID, + PACKAGED_EXTENSION_NAME, + document + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_error.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_error.js index b72e1ab014a1..21a30ab3bf09 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_error.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_error.js @@ -11,7 +11,8 @@ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); * extensions. */ -const INVALID_JSON_EXTENSION_PATH = "resources/bad-extensions/invalid-json/manifest.json"; +const INVALID_JSON_EXTENSION_PATH = + "resources/bad-extensions/invalid-json/manifest.json"; const INVALID_PROP_EXTENSION_PATH = "resources/bad-extensions/invalid-property/manifest.json"; const EXTENSION_PATH = "resources/test-temporary-extension/manifest.json"; @@ -23,15 +24,22 @@ add_task(async function testInvalidJsonExtension() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const installError = await installBadExtension(INVALID_JSON_EXTENSION_PATH, document); - ok(installError.textContent.includes("JSON.parse: unexpected keyword"), - "The expected installation error is displayed: " + installError.textContent); + const installError = await installBadExtension( + INVALID_JSON_EXTENSION_PATH, + document + ); + ok( + installError.textContent.includes("JSON.parse: unexpected keyword"), + "The expected installation error is displayed: " + installError.textContent + ); info("Install a valid extension to make the message disappear"); await installTemporaryExtension(EXTENSION_PATH, EXTENSION_NAME, document); info("Wait until the error message disappears"); - await waitUntil(() => !document.querySelector(".qa-tmp-extension-install-error")); + await waitUntil( + () => !document.querySelector(".qa-tmp-extension-install-error") + ); info("Wait for the temporary addon to be displayed as a debug target"); await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document)); @@ -47,13 +55,22 @@ add_task(async function testInvalidPropertyExtension() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const installError = await installBadExtension(INVALID_PROP_EXTENSION_PATH, document); + const installError = await installBadExtension( + INVALID_PROP_EXTENSION_PATH, + document + ); - ok(installError.textContent.includes("Extension is invalid"), - "The basic installation error is displayed: " + installError.textContent); - ok(installError.textContent.includes( - "Reading manifest: Error processing content_scripts.0.matches"), - "The detailed installation error is also displayed: " + installError.textContent); + ok( + installError.textContent.includes("Extension is invalid"), + "The basic installation error is displayed: " + installError.textContent + ); + ok( + installError.textContent.includes( + "Reading manifest: Error processing content_scripts.0.matches" + ), + "The detailed installation error is also displayed: " + + installError.textContent + ); await removeTab(tab); }); @@ -65,6 +82,8 @@ async function installBadExtension(path, document) { document.querySelector(".qa-temporary-extension-install-button").click(); info("Wait until the install error message appears"); - await waitUntil(() => document.querySelector(".qa-tmp-extension-install-error")); + await waitUntil(() => + document.querySelector(".qa-tmp-extension-install-error") + ); return document.querySelector(".qa-tmp-extension-install-error"); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_path.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_path.js index acf8704f94e7..a6f9fde0c180 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_path.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_install_path.js @@ -55,7 +55,11 @@ add_task(async function testPreferenceRetrievedWhenInstallingExtension() { info("Check whether the shown dir is same as the pref"); const fp = await onFilePickerShown; - is(fp.displayDirectory.path, selectedDir, "Shown directory sets as same as the pref"); + is( + fp.displayDirectory.path, + selectedDir, + "Shown directory sets as same as the pref" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_reload_error.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_reload_error.js index d63f13ab2cda..08a37116bdd9 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_reload_error.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_temporary_reload_error.js @@ -13,10 +13,13 @@ add_task(async function() { const EXTENSION_ID = "test-devtools@mozilla.org"; const EXTENSION_NAME = "Temporary web extension"; - let addonFile = await installTemporaryExtensionFromXPI({ - id: EXTENSION_ID, - name: EXTENSION_NAME, - }, document); + let addonFile = await installTemporaryExtensionFromXPI( + { + id: EXTENSION_ID, + name: EXTENSION_NAME, + }, + document + ); const target = findDebugTargetByText(EXTENSION_NAME, document); ok(!!target, "The temporary extension is installed with the expected name"); @@ -25,25 +28,37 @@ add_task(async function() { addonFile = updateTemporaryXPI({ id: EXTENSION_ID }, addonFile); info("Click on the reload button for the invalid temporary extension"); - const waitForError = - waitForDispatch(window.AboutDebugging.store, "TEMPORARY_EXTENSION_RELOAD_FAILURE"); - const reloadButton = target.querySelector(".qa-temporary-extension-reload-button"); + const waitForError = waitForDispatch( + window.AboutDebugging.store, + "TEMPORARY_EXTENSION_RELOAD_FAILURE" + ); + const reloadButton = target.querySelector( + ".qa-temporary-extension-reload-button" + ); reloadButton.click(); await waitForError; - ok(target.querySelector(".qa-temporary-extension-reload-error"), - "The error message of reloading appears"); + ok( + target.querySelector(".qa-temporary-extension-reload-error"), + "The error message of reloading appears" + ); info("Click on the reload button for the valid temporary extension"); - const waitForSuccess = - waitForDispatch(window.AboutDebugging.store, "TEMPORARY_EXTENSION_RELOAD_SUCCESS"); + const waitForSuccess = waitForDispatch( + window.AboutDebugging.store, + "TEMPORARY_EXTENSION_RELOAD_SUCCESS" + ); updateTemporaryXPI({ id: EXTENSION_ID, name: EXTENSION_NAME }, addonFile); reloadButton.click(); await waitForSuccess; - ok(!target.querySelector(".qa-temporary-extension-reload-error"), - "The error message of reloading disappears"); + ok( + !target.querySelector(".qa-temporary-extension-reload-error"), + "The error message of reloading disappears" + ); info("Click on the remove button for the temporary extension"); - const removeButton = target.querySelector(".qa-temporary-extension-remove-button"); + const removeButton = target.querySelector( + ".qa-temporary-extension-remove-button" + ); removeButton.click(); info("Wait until the debug target with the extension disappears"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_warnings.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_warnings.js index 7e4333fdb1a7..d0318911225b 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_warnings.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_addons_warnings.js @@ -14,24 +14,33 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - await installTemporaryExtensionFromXPI({ - id: EXTENSION_ID, - name: EXTENSION_NAME, - extraProperties: { - // This property is not expected in the manifest and should trigger a warning! - "wrongProperty": {}, + await installTemporaryExtensionFromXPI( + { + id: EXTENSION_ID, + name: EXTENSION_NAME, + extraProperties: { + // This property is not expected in the manifest and should trigger a warning! + wrongProperty: {}, + }, }, - }, document); + document + ); info("Wait until a debug target item appears"); await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document)); const target = findDebugTargetByText(EXTENSION_NAME, document); const warningMessage = target.querySelector(".qa-message"); - ok(!!warningMessage, "A warning message is displayed for the installed addon"); + ok( + !!warningMessage, + "A warning message is displayed for the installed addon" + ); const warningText = warningMessage.textContent; - ok(warningText.includes("wrongProperty"), "The warning message mentions wrongProperty"); + ok( + warningText.includes("wrongProperty"), + "The warning message mentions wrongProperty" + ); await removeTemporaryExtension(EXTENSION_NAME, document); await removeTab(tab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_networklocations.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_networklocations.js index 9651e53fd130..ee4f8e1b7ec6 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_networklocations.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_networklocations.js @@ -17,48 +17,66 @@ add_task(async function() { await selectConnectPage(document); let networkLocations = document.querySelectorAll(".qa-network-location"); - is(networkLocations.length, 0, "By default, no network locations are displayed"); + is( + networkLocations.length, + 0, + "By default, no network locations are displayed" + ); info("Check whether error message should show if the input value is invalid"); addNetworkLocation(TEST_NETWORK_LOCATION_INVALID, document); await waitUntil(() => - document.querySelector(".qa-connect-page__network-form__error-message")); + document.querySelector(".qa-connect-page__network-form__error-message") + ); info("Wait until the new network location is visible in the list"); addNetworkLocation(TEST_NETWORK_LOCATION, document); - await waitUntil(() => document.querySelectorAll(".qa-network-location").length === 1); - await waitUntil(() => - !document.querySelector(".qa-connect-page__network-form__error-message")); + await waitUntil( + () => document.querySelectorAll(".qa-network-location").length === 1 + ); + await waitUntil( + () => + !document.querySelector(".qa-connect-page__network-form__error-message") + ); networkLocations = document.querySelectorAll(".qa-network-location"); - const networkLocationValue = - networkLocations[0].querySelector(".qa-network-location-value"); - is(networkLocationValue.textContent, TEST_NETWORK_LOCATION, - "Added network location has the expected value"); + const networkLocationValue = networkLocations[0].querySelector( + ".qa-network-location-value" + ); + is( + networkLocationValue.textContent, + TEST_NETWORK_LOCATION, + "Added network location has the expected value" + ); - info("Check whether error message should show if the input value was duplicate"); + info( + "Check whether error message should show if the input value was duplicate" + ); addNetworkLocation(TEST_NETWORK_LOCATION, document); await waitUntil(() => - document.querySelector(".qa-connect-page__network-form__error-message")); + document.querySelector(".qa-connect-page__network-form__error-message") + ); info("Wait until the new network location is removed from the list"); removeNetworkLocation(TEST_NETWORK_LOCATION, document); - await waitUntil(() => document.querySelectorAll(".qa-network-location").length === 0); + await waitUntil( + () => document.querySelectorAll(".qa-network-location").length === 0 + ); await removeTab(tab); }); function addNetworkLocation(location, document) { info("Setting a value in the network form input"); - const networkLocationInput = - document.querySelector(".qa-network-form-input"); + const networkLocationInput = document.querySelector(".qa-network-form-input"); networkLocationInput.value = ""; networkLocationInput.focus(); EventUtils.sendString(location, networkLocationInput.ownerGlobal); info("Click on network form submit button"); - const networkLocationSubmitButton = - document.querySelector(".qa-network-form-submit-button"); + const networkLocationSubmitButton = document.querySelector( + ".qa-network-form-submit-button" + ); networkLocationSubmitButton.click(); } @@ -67,8 +85,9 @@ function removeNetworkLocation(location, document) { ok(networkLocation, "Network location container found."); info("Click on the remove button for the provided network location"); - const removeButton = - networkLocation.querySelector(".qa-network-location-remove-button"); + const removeButton = networkLocation.querySelector( + ".qa-network-location-remove-button" + ); removeButton.click(); } @@ -76,6 +95,9 @@ function getNetworkLocation(location, document) { info("Find the container for network location: " + location); const networkLocations = document.querySelectorAll(".qa-network-location"); return [...networkLocations].find(element => { - return element.querySelector(".qa-network-location-value").textContent === location; + return ( + element.querySelector(".qa-network-location-value").textContent === + location + ); }); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_toggle_usb_devices.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_toggle_usb_devices.js index f0747d186c07..c5666fbccd5b 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_toggle_usb_devices.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connect_toggle_usb_devices.js @@ -12,8 +12,10 @@ const { AddonManager } = require("resource://gre/modules/AddonManager.jsm"); * Check that USB Devices scanning can be enabled and disabled from the connect page. */ add_task(async function() { - await pushPref("devtools.remote.adb.extensionURL", - CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi"); + await pushPref( + "devtools.remote.adb.extensionURL", + CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi" + ); await checkAdbNotRunning(); const { document, tab } = await openAboutDebugging(); @@ -24,27 +26,40 @@ add_task(async function() { await waitUntil(() => document.querySelector(".qa-connect-page")); info("Check that by default USB devices are disabled"); - const usbDisabledMessage = document.querySelector(".qa-connect-usb-disabled-message"); + const usbDisabledMessage = document.querySelector( + ".qa-connect-usb-disabled-message" + ); ok(usbDisabledMessage, "A message about enabling USB devices is rendered"); - const usbToggleButton = document.querySelector(".qa-connect-usb-toggle-button"); + const usbToggleButton = document.querySelector( + ".qa-connect-usb-toggle-button" + ); ok(usbToggleButton, "The button to toggle USB devices debugging is rendered"); - ok(usbToggleButton.textContent.includes("Enable"), - "The text of the toggle USB button is correct"); + ok( + usbToggleButton.textContent.includes("Enable"), + "The text of the toggle USB button is correct" + ); info("Click on the toggle button"); usbToggleButton.click(); info("Wait until the toggle button text is updated"); await waitUntil(() => usbToggleButton.textContent.includes("Disable")); - ok(!document.querySelector(".qa-connect-usb-disabled-message"), - "The message about enabling USB devices is no longer rendered"); + ok( + !document.querySelector(".qa-connect-usb-disabled-message"), + "The message about enabling USB devices is no longer rendered" + ); info("Check that the addon was installed with the proper source"); - const adbExtensionId = Services.prefs.getCharPref("devtools.remote.adb.extensionID"); + const adbExtensionId = Services.prefs.getCharPref( + "devtools.remote.adb.extensionID" + ); const addon = await AddonManager.getAddonByID(adbExtensionId); - Assert.deepEqual(addon.installTelemetryInfo, { source: "about:debugging" }, - "Got the expected addon.installTelemetryInfo"); + Assert.deepEqual( + addon.installTelemetryInfo, + { source: "about:debugging" }, + "Got the expected addon.installTelemetryInfo" + ); // Right now we are resuming as soon as "USB enabled" is displayed, but ADB // might still be starting up. If we move to uninstall directly, the ADB startup will @@ -57,8 +72,10 @@ add_task(async function() { info("Wait until the toggle button text is updated"); await waitUntil(() => usbToggleButton.textContent.includes("Enable")); - ok(document.querySelector(".qa-connect-usb-disabled-message"), - "The message about enabling USB devices is rendered again"); + ok( + document.querySelector(".qa-connect-usb-disabled-message"), + "The message about enabling USB devices is rendered again" + ); await stopAdbProcess(); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connection_prompt_setting.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connection_prompt_setting.js index 5cfbeb4d4f0a..f5634a5d1ee3 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connection_prompt_setting.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_connection_prompt_setting.js @@ -30,28 +30,40 @@ add_task(async function() { await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document); info("Check whether connection prompt toggle button exists"); - let connectionPromptToggleButton = - document.querySelector(".qa-connection-prompt-toggle-button"); + let connectionPromptToggleButton = document.querySelector( + ".qa-connection-prompt-toggle-button" + ); ok(connectionPromptToggleButton, "Toggle button existed"); - ok(connectionPromptToggleButton.textContent.includes("Disable"), - "Toggle button shows 'Disable'"); + ok( + connectionPromptToggleButton.textContent.includes("Disable"), + "Toggle button shows 'Disable'" + ); info("Click on the toggle button"); - connectionPromptToggleButton = - document.querySelector(".qa-connection-prompt-toggle-button"); + connectionPromptToggleButton = document.querySelector( + ".qa-connection-prompt-toggle-button" + ); connectionPromptToggleButton.click(); info("Wait until the toggle button text is updated"); - await waitUntil(() => connectionPromptToggleButton.textContent.includes("Enable")); + await waitUntil(() => + connectionPromptToggleButton.textContent.includes("Enable") + ); info("Check the preference"); - const disabledPref = runtime.getPreference("devtools.debugger.prompt-connection"); + const disabledPref = runtime.getPreference( + "devtools.debugger.prompt-connection" + ); is(disabledPref, false, "The preference should be updated"); info("Click on the toggle button again"); connectionPromptToggleButton.click(); info("Wait until the toggle button text is updated"); - await waitUntil(() => connectionPromptToggleButton.textContent.includes("Disable")); + await waitUntil(() => + connectionPromptToggleButton.textContent.includes("Disable") + ); info("Check the preference"); - const enabledPref = runtime.getPreference("devtools.debugger.prompt-connection"); + const enabledPref = runtime.getPreference( + "devtools.debugger.prompt-connection" + ); is(enabledPref, true, "The preference should be updated"); await removeTab(tab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js index 79c9392bffe6..c2ce475aabd4 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test that collapsibilities of DebugTargetPane on RuntimePage by mouse clicking. @@ -37,8 +40,9 @@ async function assertDebugTargetCollapsed(paneEl, title) { is(targetEl.clientHeight, 0, "Height of list element is zero"); // check title const titleEl = paneEl.querySelector(".qa-debug-target-pane-title"); - const expectedTitle = - `${ title } (${ targetEl.querySelectorAll(".qa-debug-target-item").length })`; + const expectedTitle = `${title} (${ + targetEl.querySelectorAll(".qa-debug-target-item").length + })`; is(titleEl.textContent, expectedTitle, "Collapsed title is correct"); } @@ -51,7 +55,8 @@ async function assertDebugTargetExpanded(paneEl, title) { ok(true, "Height of list element is greater than zero"); // check title const titleEl = paneEl.querySelector(".qa-debug-target-pane-title"); - const expectedTitle = - `${ title } (${ targetEl.querySelectorAll(".qa-debug-target-item").length })`; + const expectedTitle = `${title} (${ + targetEl.querySelectorAll(".qa-debug-target-item").length + })`; is(titleEl.textContent, expectedTitle, "Expanded title is correct"); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js index cbe2d98ab613..736f4468d071 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test for preference of DebugTargetPane collapsibilities. @@ -28,6 +31,10 @@ add_task(async function() { await waitUntil(() => document.querySelector(".app") === null); for (const { pref } of TARGET_PANES) { - is(Services.prefs.getBoolPref(pref), true, `${ pref } preference should be true`); + is( + Services.prefs.getBoolPref(pref), + true, + `${pref} preference should be true` + ); } }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_empty.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_empty.js index 2250c3003b0b..d9305c243ba0 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_empty.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_empty.js @@ -6,7 +6,10 @@ /* import-globals-from helper-addons.js */ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test that an "empty" message is displayed when there are no debug targets in a debug @@ -23,37 +26,58 @@ add_task(async function() { await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Check that the temporary extensions pane is empty"); - const temporaryExtensionPane = getDebugTargetPane("Temporary Extensions", document); - ok(!temporaryExtensionPane.querySelector(".qa-debug-target-item"), - "Temporary Extensions pane contains no debug target"); + const temporaryExtensionPane = getDebugTargetPane( + "Temporary Extensions", + document + ); + ok( + !temporaryExtensionPane.querySelector(".qa-debug-target-item"), + "Temporary Extensions pane contains no debug target" + ); info("Check an empty target pane message is displayed"); - ok(temporaryExtensionPane.querySelector(".qa-debug-target-list-empty"), - "An empty target list message is displayed"); + ok( + temporaryExtensionPane.querySelector(".qa-debug-target-list-empty"), + "An empty target list message is displayed" + ); info("Install a temporary extension"); await installTemporaryExtension(EXTENSION_PATH, EXTENSION_NAME, document); info("Wait until a debug target item appears"); - await waitUntil(() => temporaryExtensionPane.querySelector(".qa-debug-target-item")); + await waitUntil(() => + temporaryExtensionPane.querySelector(".qa-debug-target-item") + ); info("Check the empty target pane message is no longer displayed"); - ok(!temporaryExtensionPane.querySelector(".qa-debug-target-list-empty"), - "The empty target list message is no longer displayed"); + ok( + !temporaryExtensionPane.querySelector(".qa-debug-target-list-empty"), + "The empty target list message is no longer displayed" + ); - const temporaryExtensionItem = - temporaryExtensionPane.querySelector(".qa-debug-target-item"); - ok(temporaryExtensionItem, "Temporary Extensions pane now shows debug target"); + const temporaryExtensionItem = temporaryExtensionPane.querySelector( + ".qa-debug-target-item" + ); + ok( + temporaryExtensionItem, + "Temporary Extensions pane now shows debug target" + ); info("Remove the temporary extension"); - temporaryExtensionItem.querySelector(".qa-temporary-extension-remove-button").click(); + temporaryExtensionItem + .querySelector(".qa-temporary-extension-remove-button") + .click(); info("Wait until the debug target item disappears"); - await waitUntil(() => !temporaryExtensionPane.querySelector(".qa-debug-target-item")); + await waitUntil( + () => !temporaryExtensionPane.querySelector(".qa-debug-target-item") + ); info("Check the empty target pane message is displayed again"); - ok(temporaryExtensionPane.querySelector(".qa-debug-target-list-empty"), - "An empty target list message is displayed again"); + ok( + temporaryExtensionPane.querySelector(".qa-debug-target-list-empty"), + "An empty target list message is displayed again" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_usb_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_usb_runtime.js index 95e7a1e29198..a53b4a2efb90 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_usb_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_usb_runtime.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); const RUNTIME_ID = "test-runtime-id"; const RUNTIME_DEVICE_NAME = "test device name"; @@ -15,13 +18,17 @@ add_task(async function() { const mocks = new Mocks(); await checkTargetPanes({ enableLocalTabs: false }, mocks); - info("Check that enableLocalTabs has no impact on the categories displayed for remote" + - " runtimes."); + info( + "Check that enableLocalTabs has no impact on the categories displayed for remote" + + " runtimes." + ); await checkTargetPanes({ enableLocalTabs: true }, mocks); }); async function checkTargetPanes({ enableLocalTabs }, mocks) { - const { document, tab, window } = await openAboutDebugging({ enableLocalTabs }); + const { document, tab, window } = await openAboutDebugging({ + enableLocalTabs, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); mocks.createUSBRuntime(RUNTIME_ID, { diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtools.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtools.js index be50110e0683..03a2085e790a 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtools.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtools.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Check that DevTools are not closed when leaving This Firefox runtime page. diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu.js index bc6488981083..1d931bc5bec7 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test context menu on about:devtools-toolbox page. @@ -15,13 +18,20 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsBrowser, devtoolsTab } = - await openAboutDevtoolsToolbox(document, tab, window); + const { devtoolsBrowser, devtoolsTab } = await openAboutDevtoolsToolbox( + document, + tab, + window + ); info("Check whether the menu item which opens devtools is disabled"); const rootDocument = devtoolsTab.ownerDocument; - await assertContextMenu(rootDocument, devtoolsBrowser, - ".debug-target-info", false); + await assertContextMenu( + rootDocument, + devtoolsBrowser, + ".debug-target-info", + false + ); info("Force to select about:debugging page"); gBrowser.selectedTab = tab; @@ -32,7 +42,12 @@ add_task(async function() { await removeTab(tab); }); -async function assertContextMenu(rootDocument, browser, targetSelector, shouldBeEnabled) { +async function assertContextMenu( + rootDocument, + browser, + targetSelector, + shouldBeEnabled +) { if (shouldBeEnabled) { await assertContextMenuEnabled(rootDocument, browser, targetSelector); } else { @@ -40,15 +55,22 @@ async function assertContextMenu(rootDocument, browser, targetSelector, shouldBe } } -async function assertContextMenuDisabled(rootDocument, browser, targetSelector) { +async function assertContextMenuDisabled( + rootDocument, + browser, + targetSelector +) { const contextMenu = rootDocument.getElementById("contentAreaContextMenu"); let isPopupShown = false; const listener = () => { isPopupShown = true; }; contextMenu.addEventListener("popupshown", listener); - BrowserTestUtils.synthesizeMouseAtCenter(targetSelector, - { type: "contextmenu" }, browser); + BrowserTestUtils.synthesizeMouseAtCenter( + targetSelector, + { type: "contextmenu" }, + browser + ); await wait(1000); ok(!isPopupShown, `Context menu should not be shown`); contextMenu.removeEventListener("popupshown", listener); @@ -57,14 +79,23 @@ async function assertContextMenuDisabled(rootDocument, browser, targetSelector) async function assertContextMenuEnabled(rootDocument, browser, targetSelector) { // Show content context menu. const contextMenu = rootDocument.getElementById("contentAreaContextMenu"); - const popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown"); - BrowserTestUtils.synthesizeMouseAtCenter(targetSelector, - { type: "contextmenu" }, browser); + const popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + BrowserTestUtils.synthesizeMouseAtCenter( + targetSelector, + { type: "contextmenu" }, + browser + ); await popupShownPromise; ok(true, `Context menu should be shown`); // Hide content context menu. - const popupHiddenPromise = BrowserTestUtils.waitForEvent(contextMenu, "popuphidden"); + const popupHiddenPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popuphidden" + ); contextMenu.hidePopup(); await popupHiddenPromise; } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu_markupview.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu_markupview.js index 73a3b987a845..881d4df11921 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu_markupview.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu_markupview.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test context menu of markup view on about:devtools-toolbox page. @@ -15,8 +18,11 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window + ); info("Select inspector tool"); const toolbox = getToolbox(devtoolsWindow); @@ -24,9 +30,11 @@ add_task(async function() { info("Show context menu of markup view"); const markupDocument = toolbox.getPanel("inspector").markup.doc; - EventUtils.synthesizeMouseAtCenter(markupDocument.body, - { type: "contextmenu" }, - markupDocument.ownerGlobal); + EventUtils.synthesizeMouseAtCenter( + markupDocument.body, + { type: "contextmenu" }, + markupDocument.ownerGlobal + ); info("Check whether proper context menu of markup view will be shown"); await waitUntil(() => toolbox.topDoc.querySelector("#node-menu-edithtml")); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_focus.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_focus.js index 75d9cc791b97..a48a3b2c1dd2 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_focus.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_focus.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test whether the focus transfers to a tab which is already inspected . @@ -13,39 +16,56 @@ add_task(async function() { info("Force all debug target panes to be expanded"); prepareCollapsibilitiesTest(); - info("Select 'performance' panel as the initial tool since the tool does not listen " + - "any changes of the document without user action"); + info( + "Select 'performance' panel as the initial tool since the tool does not listen " + + "any changes of the document without user action" + ); await pushPref("devtools.toolbox.selectedTool", "performance"); const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); const inspectionTarget = "about:debugging"; - info(`Open ${ inspectionTarget } as inspection target`); + info(`Open ${inspectionTarget} as inspection target`); await waitUntil(() => findDebugTargetByText(inspectionTarget, document)); - info(`Inspect ${ inspectionTarget } page in about:devtools-toolbox`); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, inspectionTarget); + info(`Inspect ${inspectionTarget} page in about:devtools-toolbox`); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + inspectionTarget + ); - info("Check the tab state after clicking inspect button " + - "when another tab was selected"); + info( + "Check the tab state after clicking inspect button " + + "when another tab was selected" + ); gBrowser.selectedTab = tab; clickInspectButton(inspectionTarget, document); const devtoolsURL = devtoolsWindow.location.href; assertDevtoolsToolboxTabState(devtoolsURL); - info("Check the tab state after clicking inspect button " + - "when the toolbox tab is in another window"); + info( + "Check the tab state after clicking inspect button " + + "when the toolbox tab is in another window" + ); const newNavigator = gBrowser.replaceTabWithWindow(devtoolsTab); - await waitUntil(() => - newNavigator.gBrowser && - newNavigator.gBrowser.selectedTab.linkedBrowser - .contentWindow.location.href === devtoolsURL); - info("Create a tab in the window and select the tab " + - "so that the about:devtools-toolbox tab loses focus"); - newNavigator.gBrowser.selectedTab = newNavigator.gBrowser.addTab("about:blank", { - triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), - }); + await waitUntil( + () => + newNavigator.gBrowser && + newNavigator.gBrowser.selectedTab.linkedBrowser.contentWindow.location + .href === devtoolsURL + ); + info( + "Create a tab in the window and select the tab " + + "so that the about:devtools-toolbox tab loses focus" + ); + newNavigator.gBrowser.selectedTab = newNavigator.gBrowser.addTab( + "about:blank", + { + triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), + } + ); clickInspectButton(inspectionTarget, document); assertDevtoolsToolboxTabState(devtoolsURL); @@ -71,14 +91,17 @@ function assertDevtoolsToolboxTabState(devtoolsURL) { for (const navigator of Services.wm.getEnumerator("navigator:browser")) { for (const browser of navigator.gBrowser.browsers) { - if (browser.contentWindow && browser.contentWindow.location.href === devtoolsURL) { + if ( + browser.contentWindow && + browser.contentWindow.location.href === devtoolsURL + ) { const tab = navigator.gBrowser.getTabForBrowser(browser); existingTabs.push(tab); } } } - is(existingTabs.length, 1, `Only one tab is opened for ${ devtoolsURL }`); + is(existingTabs.length, 1, `Only one tab is opened for ${devtoolsURL}`); const tab = existingTabs[0]; const navigator = tab.ownerGlobal; is(navigator.gBrowser.selectedTab, tab, "The tab is selected"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js index 7645b164890b..edf107b46152 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test the status of menu items when open about:devtools-toolbox. @@ -15,8 +18,11 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window + ); info("Check whether the menu items are disabled"); const rootDocument = devtoolsTab.ownerDocument; @@ -48,10 +54,14 @@ async function assertMenusItems(rootDocument, shouldBeEnabled) { const menuItem = rootDocument.getElementById("menu_devToolbox"); await waitUntil(() => menuItem.hidden === !shouldBeEnabled); - info("Check that the state of the Toggle Tools menu-item depends on the page"); + info( + "Check that the state of the Toggle Tools menu-item depends on the page" + ); assertMenuItem(rootDocument, "menu_devToolbox", shouldBeEnabled); - info("Check that the tools menu-items are always enabled regardless of the page"); + info( + "Check that the tools menu-items are always enabled regardless of the page" + ); for (const toolDefinition of gDevTools.getToolDefinitionArray()) { if (!toolDefinition.inMenu) { continue; @@ -63,6 +73,9 @@ async function assertMenusItems(rootDocument, shouldBeEnabled) { function assertMenuItem(rootDocument, menuItemId, shouldBeEnabled) { const menuItem = rootDocument.getElementById(menuItemId); - is(menuItem.hidden, !shouldBeEnabled, - `"hidden" attribute of menu item(${ menuItemId }) should be correct`); + is( + menuItem.hidden, + !shouldBeEnabled, + `"hidden" attribute of menu item(${menuItemId}) should be correct` + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_performance.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_performance.js index 6954d28fe28d..35ad18661de8 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_performance.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_performance.js @@ -7,7 +7,10 @@ requestLongerTimeout(2); /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Check that graphs used by the old performance panel are correctly displayed. @@ -21,20 +24,27 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window + ); info("Select performance panel"); const toolbox = getToolbox(devtoolsWindow); await toolbox.selectTool("performance"); // Retrieve shared helpers for the old performance panel. - const { startRecording, stopRecording } = - require("devtools/client/performance/test/helpers/actions"); + const { + startRecording, + stopRecording, + } = require("devtools/client/performance/test/helpers/actions"); const performancePanel = toolbox.getCurrentPanel(); await startRecording(performancePanel); - const { idleWait } = require("devtools/client/performance/test/helpers/wait-utils"); + const { + idleWait, + } = require("devtools/client/performance/test/helpers/wait-utils"); await idleWait(100); info("Stop recording"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_reload.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_reload.js index 0e406f5f1aab..cac0dab46834 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_reload.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_reload.js @@ -7,7 +7,10 @@ requestLongerTimeout(5); /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); const TOOLS = [ "inspector", @@ -36,8 +39,11 @@ add_task(async function() { async function testReloadAboutDevToolsToolbox(toolId) { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsBrowser, devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { + devtoolsBrowser, + devtoolsTab, + devtoolsWindow, + } = await openAboutDevtoolsToolbox(document, tab, window); info(`Select tool: ${toolId}`); const toolbox = getToolbox(devtoolsWindow); @@ -49,8 +55,10 @@ async function testReloadAboutDevToolsToolbox(toolId) { ok(true, "Toolbox is re-created again"); info("Check whether about:devtools-toolbox page displays correctly"); - ok(devtoolsBrowser.contentDocument.querySelector(".debug-target-info"), - "about:devtools-toolbox page displays correctly"); + ok( + devtoolsBrowser.contentDocument.querySelector(".debug-target-info"), + "about:devtools-toolbox page displays correctly" + ); await closeAboutDevtoolsToolbox(document, devtoolsTab, window); await removeTab(tab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_shortcuts.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_shortcuts.js index c3f1fe5f1740..c8b3289d4781 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_shortcuts.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_shortcuts.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test shortcut keys on about:devtools-toolbox page. @@ -15,8 +18,11 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsBrowser, devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { + devtoolsBrowser, + devtoolsTab, + devtoolsWindow, + } = await openAboutDevtoolsToolbox(document, tab, window); info("Check whether the shortcut keys which opens devtools is disabled"); await assertShortcutKeys(devtoolsBrowser, false); @@ -25,13 +31,19 @@ add_task(async function() { const toolbox = getToolbox(devtoolsWindow); await toolbox.selectTool("inspector"); - info("Use the Webconsole keyboard shortcut and wait for the panel to be selected"); + info( + "Use the Webconsole keyboard shortcut and wait for the panel to be selected" + ); const onToolReady = toolbox.once("webconsole-ready"); - EventUtils.synthesizeKey("K", { - accelKey: true, - shiftKey: !navigator.userAgent.match(/Mac/), - altKey: navigator.userAgent.match(/Mac/), - }, devtoolsWindow); + EventUtils.synthesizeKey( + "K", + { + accelKey: true, + shiftKey: !navigator.userAgent.match(/Mac/), + altKey: navigator.userAgent.match(/Mac/), + }, + devtoolsWindow + ); await onToolReady; info("Force to select about:debugging page"); @@ -45,15 +57,20 @@ add_task(async function() { async function assertShortcutKeys(browser, shouldBeEnabled) { await assertShortcutKey(browser.contentWindow, "VK_F12", {}, shouldBeEnabled); - await assertShortcutKey(browser.contentWindow, "I", { - accelKey: true, - shiftKey: !navigator.userAgent.match(/Mac/), - altKey: navigator.userAgent.match(/Mac/), - }, shouldBeEnabled); + await assertShortcutKey( + browser.contentWindow, + "I", + { + accelKey: true, + shiftKey: !navigator.userAgent.match(/Mac/), + altKey: navigator.userAgent.match(/Mac/), + }, + shouldBeEnabled + ); } async function assertShortcutKey(win, key, modifiers, shouldBeEnabled) { - info(`Assert shortcut key [${ key }]`); + info(`Assert shortcut key [${key}]`); if (shouldBeEnabled) { await assertShortcutKeyEnabled(win, key, modifiers); @@ -71,7 +88,7 @@ async function assertShortcutKeyDisabled(win, key, modifiers) { EventUtils.synthesizeKey(key, modifiers, win); await wait(1000); - ok(!isReadyCalled, `Devtools should not be opened by ${ key }`); + ok(!isReadyCalled, `Devtools should not be opened by ${key}`); gDevTools.off("toolbox-ready", toolboxListener); } @@ -81,11 +98,11 @@ async function assertShortcutKeyEnabled(win, key, modifiers) { const onToolboxReady = gDevTools.once("toolbox-ready"); EventUtils.synthesizeKey(key, modifiers, win); await onToolboxReady; - ok(true, `Devtools should be opened by ${ key }`); + ok(true, `Devtools should be opened by ${key}`); // Close devtools const onToolboxDestroyed = gDevTools.once("toolbox-destroyed"); EventUtils.synthesizeKey(key, modifiers, win); await onToolboxDestroyed; - ok(true, `Devtopls should be closed by ${ key }`); + ok(true, `Devtopls should be closed by ${key}`); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js index 9fbffafa318c..e70b95379f55 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test that the split console key shortcut works on about:devtools-toolbox. @@ -15,8 +18,11 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window + ); // Select any tool that is not the Webconsole, since we will assert the split-console. info("Select inspector tool"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_target_destroyed.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_target_destroyed.js index aede01025441..6d9d95281e31 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_target_destroyed.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_target_destroyed.js @@ -12,16 +12,25 @@ add_task(async function() { // go to This Firefox and inspect the new tab info("Inspecting a new tab in This Firefox"); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsDocument, devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, "about:home"); - const targetInfoHeader = devtoolsDocument.querySelector(".qa-debug-target-info"); - ok(targetInfoHeader.textContent.includes("about:home"), - "about:devtools-toolbox is open for the target"); + const { + devtoolsDocument, + devtoolsTab, + devtoolsWindow, + } = await openAboutDevtoolsToolbox(document, tab, window, "about:home"); + const targetInfoHeader = devtoolsDocument.querySelector( + ".qa-debug-target-info" + ); + ok( + targetInfoHeader.textContent.includes("about:home"), + "about:devtools-toolbox is open for the target" + ); // close the inspected tab and check that error page is shown info("removing the inspected tab"); await removeTab(targetTab); - await waitUntil(() => devtoolsWindow.document.querySelector(".qa-error-page")); + await waitUntil(() => + devtoolsWindow.document.querySelector(".qa-error-page") + ); info("closing the toolbox"); await removeTab(devtoolsTab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_tooltip_markupview.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_tooltip_markupview.js index fb4c6864aba9..0fc438f69a82 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_tooltip_markupview.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_tooltip_markupview.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Test tooltip of markup view on about:devtools-toolbox page. @@ -18,8 +21,11 @@ add_task(async function() { const { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); - const { devtoolsDocument, devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window); + const { + devtoolsDocument, + devtoolsTab, + devtoolsWindow, + } = await openAboutDevtoolsToolbox(document, tab, window); info("Select inspector tool"); const toolbox = getToolbox(devtoolsWindow); @@ -27,37 +33,67 @@ add_task(async function() { const inspector = toolbox.getPanel("inspector"); const markupDocument = inspector.markup.doc; - const eventBadge = markupDocument.querySelector(".inspector-badge.interactive"); + const eventBadge = markupDocument.querySelector( + ".inspector-badge.interactive" + ); - info("Check tooltip visibility after clicking on an element in the markup view"); + info( + "Check tooltip visibility after clicking on an element in the markup view" + ); await checkTooltipVisibility(inspector, eventBadge, markupDocument.body); - info("Check tooltip visibility after clicking on an element in the DevTools document"); + info( + "Check tooltip visibility after clicking on an element in the DevTools document" + ); await checkTooltipVisibility( - inspector, eventBadge, devtoolsDocument.querySelector(".debug-target-info")); + inspector, + eventBadge, + devtoolsDocument.querySelector(".debug-target-info") + ); - info("Check tooltip visibility after clicking on an element in the root document"); + info( + "Check tooltip visibility after clicking on an element in the root document" + ); const rootDocument = devtoolsWindow.windowRoot.ownerGlobal.document; await checkTooltipVisibility( - inspector, eventBadge, rootDocument.querySelector("#titlebar")); + inspector, + eventBadge, + rootDocument.querySelector("#titlebar") + ); await closeAboutDevtoolsToolbox(document, devtoolsTab, window); await removeTab(tab); }); -async function checkTooltipVisibility(inspector, elementForShowing, elementForHiding) { +async function checkTooltipVisibility( + inspector, + elementForShowing, + elementForHiding +) { info("Show event tooltip"); elementForShowing.click(); const tooltip = inspector.markup.eventDetailsTooltip; await tooltip.once("shown"); - is(tooltip.container.classList.contains("tooltip-visible"), true, - "The tooltip should be shown"); + is( + tooltip.container.classList.contains("tooltip-visible"), + true, + "The tooltip should be shown" + ); info("Hide event tooltip"); - EventUtils.synthesizeMouse(elementForHiding, 1, 1, {}, elementForHiding.ownerGlobal); + EventUtils.synthesizeMouse( + elementForHiding, + 1, + 1, + {}, + elementForHiding.ownerGlobal + ); await tooltip.once("hidden"); - is(tooltip.container.classList.contains("tooltip-visible"), false, - "Tooltip should be hidden"); + is( + tooltip.container.classList.contains("tooltip-visible"), + false, + "Tooltip should be hidden" + ); if (inspector._updateProgress) { info("Need to wait for the inspector to update"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_fenix_runtime_display.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_fenix_runtime_display.js index a3ded60cfbc0..2d89fe84cb81 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_fenix_runtime_display.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_fenix_runtime_display.js @@ -10,7 +10,8 @@ const ADB_RUNTIME_NAME = "Firefox Preview"; const SERVER_VERSION = "v7.3.31"; const ADB_VERSION = "v1.3.37"; -const FENIX_RELEASE_ICON_SRC = "chrome://devtools/skin/images/aboutdebugging-fenix.svg"; +const FENIX_RELEASE_ICON_SRC = + "chrome://devtools/skin/images/aboutdebugging-fenix.svg"; const FENIX_NIGHTLY_ICON_SRC = "chrome://devtools/skin/images/aboutdebugging-fenix-nightly.svg"; @@ -42,15 +43,23 @@ add_task(async function() { const runtimeInfoText = runtimeInfo.textContent; ok(runtimeInfoText.includes(ADB_RUNTIME_NAME), "Name is the ADB name"); - ok(!runtimeInfoText.includes(SERVER_RUNTIME_NAME), - "Name does not include the server name"); + ok( + !runtimeInfoText.includes(SERVER_RUNTIME_NAME), + "Name does not include the server name" + ); ok(runtimeInfoText.includes(ADB_VERSION), "Version contains the ADB version"); - ok(!runtimeInfoText.includes(SERVER_VERSION), - "Version does not contain the server version"); + ok( + !runtimeInfoText.includes(SERVER_VERSION), + "Version does not contain the server version" + ); const runtimeIcon = document.querySelector(".qa-runtime-icon"); - is(runtimeIcon.src, FENIX_RELEASE_ICON_SRC, "The runtime icon is the Fenix icon"); + is( + runtimeIcon.src, + FENIX_RELEASE_ICON_SRC, + "The runtime icon is the Fenix icon" + ); info("Remove USB runtime"); mocks.removeUSBRuntime(RUNTIME_ID); @@ -98,21 +107,33 @@ add_task(async function() { await connectToRuntime(DEVICE_NAME, document); await selectRuntime(DEVICE_NAME, ADB_RUNTIME_NAME, document); - info("Wait for requests to finish the USB runtime is backed by a real local client"); + info( + "Wait for requests to finish the USB runtime is backed by a real local client" + ); await onRequestSuccess; info("Wait for the about:debugging target to be available"); await waitUntil(() => findDebugTargetByText("about:debugging", document)); - const { devtoolsDocument, devtoolsTab } = - await openAboutDevtoolsToolbox(document, tab, window); + const { devtoolsDocument, devtoolsTab } = await openAboutDevtoolsToolbox( + document, + tab, + window + ); const runtimeInfo = devtoolsDocument.querySelector(".qa-runtime-info"); const runtimeInfoText = runtimeInfo.textContent; - ok(runtimeInfoText.includes(ADB_RUNTIME_NAME), "Name is the ADB runtime name"); + ok( + runtimeInfoText.includes(ADB_RUNTIME_NAME), + "Name is the ADB runtime name" + ); ok(runtimeInfoText.includes(ADB_VERSION), "Version is the ADB version"); const runtimeIcon = devtoolsDocument.querySelector(".qa-runtime-icon"); - is(runtimeIcon.src, FENIX_NIGHTLY_ICON_SRC, "The runtime icon is the Fenix icon"); + is( + runtimeIcon.src, + FENIX_NIGHTLY_ICON_SRC, + "The runtime icon is the Fenix icon" + ); info("Wait for all pending requests to settle on the DebuggerClient"); await clientWrapper.client.waitForRequestsToSettle(); @@ -132,8 +153,9 @@ async function createLocalClientWrapper() { info("Create a local DebuggerClient"); const { DebuggerServer } = require("devtools/server/main"); const { DebuggerClient } = require("devtools/shared/client/debugger-client"); - const { ClientWrapper } = - require("devtools/client/aboutdebugging-new/src/modules/client-wrapper"); + const { + ClientWrapper, + } = require("devtools/client/aboutdebugging-new/src/modules/client-wrapper"); DebuggerServer.init(); DebuggerServer.registerAllActors(); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_hidden_addons.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_hidden_addons.js index ad5bbfb26c55..57fbd1cb1bf5 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_hidden_addons.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_hidden_addons.js @@ -6,12 +6,24 @@ // Test that system and hidden addons are only displayed when the showSystemAddons // preferences is true. -const SYSTEM_ADDON = - createAddonData({ id: "system", name: "System Addon", isSystem: true, hidden: true }); -const HIDDEN_ADDON = - createAddonData({ id: "hidden", name: "Hidden Addon", isSystem: false, hidden: true }); -const NORMAL_ADDON = - createAddonData({ id: "normal", name: "Normal Addon", isSystem: false, hidden: false }); +const SYSTEM_ADDON = createAddonData({ + id: "system", + name: "System Addon", + isSystem: true, + hidden: true, +}); +const HIDDEN_ADDON = createAddonData({ + id: "hidden", + name: "Hidden Addon", + isSystem: false, + hidden: true, +}); +const NORMAL_ADDON = createAddonData({ + id: "normal", + name: "Normal Addon", + isSystem: false, + hidden: false, +}); add_task(async function testShowSystemAddonsTrue() { info("Test with showHiddenAddons set to true"); @@ -23,7 +35,11 @@ add_task(async function testShowSystemAddonsTrue() { async function testAddonsDisplay(showHidden) { const thisFirefoxClient = setupThisFirefoxMock(); - thisFirefoxClient.listAddons = () => ([SYSTEM_ADDON, HIDDEN_ADDON, NORMAL_ADDON]); + thisFirefoxClient.listAddons = () => [ + SYSTEM_ADDON, + HIDDEN_ADDON, + NORMAL_ADDON, + ]; info("Set showHiddenAddons to " + showHidden); await pushPref("devtools.aboutdebugging.showHiddenAddons", showHidden); @@ -34,10 +50,16 @@ async function testAddonsDisplay(showHidden) { const hasSystemAddon = !!findDebugTargetByText("System Addon", document); const hasHiddenAddon = !!findDebugTargetByText("Hidden Addon", document); const hasInstalledAddon = !!findDebugTargetByText("Normal Addon", document); - is(hasSystemAddon, showHidden, - "System addon display is correct when showHiddenAddons is " + showHidden); - is(hasHiddenAddon, showHidden, - "Hidden addon display is correct when showHiddenAddons is " + showHidden); + is( + hasSystemAddon, + showHidden, + "System addon display is correct when showHiddenAddons is " + showHidden + ); + is( + hasHiddenAddon, + showHidden, + "Hidden addon display is correct when showHiddenAddons is " + showHidden + ); ok(hasInstalledAddon, "Installed addon is always displayed"); await removeTab(tab); @@ -49,7 +71,9 @@ function setupThisFirefoxMock() { const runtimeClientFactoryMock = createRuntimeClientFactoryMock(); const thisFirefoxClient = createThisFirefoxClientMock(); runtimeClientFactoryMock.createClientForRuntime = runtime => { - const { RUNTIMES } = require("devtools/client/aboutdebugging-new/src/constants"); + const { + RUNTIMES, + } = require("devtools/client/aboutdebugging-new/src/constants"); if (runtime.id === RUNTIMES.THIS_FIREFOX) { return thisFirefoxClient; } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_message_close.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_message_close.js index 170105ed8aa6..9df0cb07a895 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_message_close.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_message_close.js @@ -28,7 +28,9 @@ add_task(async function() { }); async function testCloseMessageWithIcon(warningMessage, doc) { - const closeIcon = warningMessage.querySelector(".qa-message-button-close-icon"); + const closeIcon = warningMessage.querySelector( + ".qa-message-button-close-icon" + ); ok(!!closeIcon, "The warning message has a close icon"); info("Closing the message and waiting for it to disappear"); @@ -39,7 +41,9 @@ async function testCloseMessageWithIcon(warningMessage, doc) { } async function testCloseMessageWithButton(warningMessage, doc) { - const closeButton = warningMessage.querySelector(".qa-message-button-close-button"); + const closeButton = warningMessage.querySelector( + ".qa-message-button-close-button" + ); ok(!!closeButton, "The warning message has a close button"); info("Click on the button and wait for the message to disappear"); @@ -50,21 +54,27 @@ async function testCloseMessageWithButton(warningMessage, doc) { } async function installExtensionWithWarning(doc) { - await installTemporaryExtensionFromXPI({ - id: EXTENSION_ID, - name: EXTENSION_NAME, - extraProperties: { - // This property is not expected in the manifest and should trigger a warning! - "wrongProperty": {}, + await installTemporaryExtensionFromXPI( + { + id: EXTENSION_ID, + name: EXTENSION_NAME, + extraProperties: { + // This property is not expected in the manifest and should trigger a warning! + wrongProperty: {}, + }, }, - }, doc); + doc + ); info("Wait until a debug target item appears"); await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, doc)); const target = findDebugTargetByText(EXTENSION_NAME, doc); const warningMessage = target.querySelector(".qa-message"); - ok(!!warningMessage, "A warning message is displayed for the installed addon"); + ok( + !!warningMessage, + "A warning message is displayed for the installed addon" + ); return warningMessage; } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_navigate.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_navigate.js index c7b0586ac006..2aab4c699920 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_navigate.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_navigate.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); /** * Check that navigating from This Firefox to Connect and back to This Firefox works and @@ -27,11 +30,18 @@ add_task(async function() { ok(connectSidebarItem, "Found the Connect sidebar item"); const thisFirefoxString = getThisFirefoxString(window); - const thisFirefoxSidebarItem = findSidebarItemByText(thisFirefoxString, document); - const thisFirefoxLink = thisFirefoxSidebarItem.querySelector(".qa-sidebar-link"); + const thisFirefoxSidebarItem = findSidebarItemByText( + thisFirefoxString, + document + ); + const thisFirefoxLink = thisFirefoxSidebarItem.querySelector( + ".qa-sidebar-link" + ); ok(thisFirefoxSidebarItem, "Found the ThisFirefox sidebar item"); - ok(isSidebarItemSelected(thisFirefoxSidebarItem), - "ThisFirefox sidebar item is selected by default"); + ok( + isSidebarItemSelected(thisFirefoxSidebarItem), + "ThisFirefox sidebar item is selected by default" + ); info("Open a new background tab TAB1"); const backgroundTab1 = await addTab(TAB_URL_1, { background: true }); @@ -48,7 +58,10 @@ add_task(async function() { // we need to wait here because the sidebar isn't updated after mounting the page info("Wait until Connect sidebar item is selected"); await waitUntil(() => isSidebarItemSelected(connectSidebarItem)); - ok(!document.querySelector(".qa-runtime-page"), "Runtime page no longer rendered"); + ok( + !document.querySelector(".qa-runtime-page"), + "Runtime page no longer rendered" + ); info("Open a new tab which should be listed when we go back to This Firefox"); const backgroundTab2 = await addTab(TAB_URL_2, { background: true }); @@ -62,9 +75,14 @@ add_task(async function() { info("Wait until ThisFirefox page is displayed"); await waitUntil(() => document.querySelector(".qa-runtime-page")); - ok(isSidebarItemSelected(thisFirefoxSidebarItem), - "ThisFirefox sidebar item is selected again"); - ok(!document.querySelector(".qa-connect-page"), "Connect page no longer rendered"); + ok( + isSidebarItemSelected(thisFirefoxSidebarItem), + "ThisFirefox sidebar item is selected again" + ); + ok( + !document.querySelector(".qa-connect-page"), + "Connect page no longer rendered" + ); info("TAB2 should already be displayed in the debug targets"); await waitUntil(() => findDebugTargetByText("TAB2", document)); @@ -72,13 +90,17 @@ add_task(async function() { info("Remove first background tab"); await removeTab(backgroundTab1); - info("Check TAB1 disappears, meaning ThisFirefox client is correctly connected"); + info( + "Check TAB1 disappears, meaning ThisFirefox client is correctly connected" + ); await waitUntil(() => !findDebugTargetByText("TAB1", document)); info("Remove second background tab"); await removeTab(backgroundTab2); - info("Check TAB2 disappears, meaning ThisFirefox client is correctly connected"); + info( + "Check TAB2 disappears, meaning ThisFirefox client is correctly connected" + ); await waitUntil(() => !findDebugTargetByText("TAB2", document)); await waitForRequestsToSettle(AboutDebugging.store); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_persist_connection.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_persist_connection.js index 9c5b2307c148..66b7cd7dfcfd 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_persist_connection.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_persist_connection.js @@ -41,8 +41,10 @@ add_task(async function() { }); }); -async function testRemoteClientPersistConnection(mocks, - { client, id, runtimeName, sidebarName, type }) { +async function testRemoteClientPersistConnection( + mocks, + { client, id, runtimeName, sidebarName, type } +) { info("Open about:debugging and connect to the test runtime"); let { document, tab, window } = await openAboutDebugging(); await selectThisFirefoxPage(document, window.AboutDebugging.store); @@ -70,13 +72,18 @@ async function testRemoteClientPersistConnection(mocks, info("Remove the runtime from the list of remote runtimes"); mocks.removeRuntime(id); - info("Emit 'closed' on the client and wait for the sidebar item to disappear"); + info( + "Emit 'closed' on the client and wait for the sidebar item to disappear" + ); client._eventEmitter.emit("closed"); if (type === "usb") { await waitUntilUsbDeviceIsUnplugged(sidebarName, document); } else { - await waitUntil(() => !findSidebarItemByText(sidebarName, document) && - !findSidebarItemByText(runtimeName, document)); + await waitUntil( + () => + !findSidebarItemByText(sidebarName, document) && + !findSidebarItemByText(runtimeName, document) + ); } info("Remove the tab"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_category.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_category.js index 75d8b78d8c2e..baefbf52ad77 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_category.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_category.js @@ -27,14 +27,18 @@ add_task(async function() { mocks.emitUSBUpdate(); info("Check the process category existence for this firefox"); - ok(!getDebugTargetPane(CATEGORY_NAME, document), - "Process category should not display for this firefox"); + ok( + !getDebugTargetPane(CATEGORY_NAME, document), + "Process category should not display for this firefox" + ); info("Check the process category existence for USB runtime"); await connectToRuntime(RUNTIME_DEVICE_NAME, document); await selectRuntime(RUNTIME_DEVICE_NAME, RUNTIME_APP_NAME, document); - ok(getDebugTargetPane(CATEGORY_NAME, document), - "Process category should display for USB runtime"); + ok( + getDebugTargetPane(CATEGORY_NAME, document), + "Process category should display for USB runtime" + ); info("Remove USB runtime"); mocks.removeUSBRuntime(RUNTIME_ID); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_main.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_main.js index 29cfeaa1cca2..de2db6f9e88d 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_main.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_process_main.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); const MAIN_PROCESS_NAME = "Main Process"; const RUNTIME_ID = "test-runtime-id"; @@ -35,18 +38,25 @@ add_task(async function() { info("Check debug target item of the main process"); const mainProcessItem = findDebugTargetByText(MAIN_PROCESS_NAME, document); ok(mainProcessItem, "Debug target item of the main process should display"); - ok(mainProcessItem.textContent.includes("Main Process for the target browser"), - "Debug target item of the main process should contains the description"); + ok( + mainProcessItem.textContent.includes("Main Process for the target browser"), + "Debug target item of the main process should contains the description" + ); info("Inspect main process"); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, MAIN_PROCESS_NAME, false); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + MAIN_PROCESS_NAME, + false + ); const url = new window.URL(devtoolsWindow.location.href); const processID = url.searchParams.get("id"); is(processID, "0", "Correct process id"); const remoteID = url.searchParams.get("remoteId"); - is(remoteID, `${ RUNTIME_ID }-usb`, "Correct remote runtime id"); + is(remoteID, `${RUNTIME_ID}-usb`, "Correct remote runtime id"); info("Remove USB runtime"); mocks.removeUSBRuntime(RUNTIME_ID); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_profiler_dialog.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_profiler_dialog.js index 81dfccf82f07..e679a19f4a43 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_profiler_dialog.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_profiler_dialog.js @@ -63,5 +63,8 @@ function assertDialogVisible(doc) { function assertDialogHidden(doc) { ok(!document.querySelector(".qa-profiler-dialog"), "Dialog is removed"); - ok(!document.querySelector(".qa-profiler-dialog-mask"), "Dialog mask is removed"); + ok( + !document.querySelector(".qa-profiler-dialog-mask"), + "Dialog mask is removed" + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_runtime_page_runtime_info.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_runtime_page_runtime_info.js index 6dce46ba81db..a69bbe3d88c0 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_runtime_page_runtime_info.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_runtime_page_runtime_info.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-real-usb.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-real-usb.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-real-usb.js", + this +); // Test that runtime info of USB runtime appears on main pane. // Documentation for real usb tests in /documentation/TESTS_REAL_DEVICES.md @@ -23,25 +26,37 @@ add_task(async function() { await Promise.race([ connectToRuntime(sidebarInfo.deviceName, document), /* eslint-disable mozilla/no-arbitrary-setTimeout */ - new Promise(resolve => setTimeout(() => { - ok(false, - "Failed to connect, did you disable the connection prompt for this runtime?"); - resolve(); - }, 5000)), + new Promise(resolve => + setTimeout(() => { + ok( + false, + "Failed to connect, did you disable the connection prompt for this runtime?" + ); + resolve(); + }, 5000) + ), /* eslint-enable mozilla/no-arbitrary-setTimeout */ ]); info("Select a USB runtime"); - await selectRuntime(sidebarInfo.deviceName, runtimeDetails.info.name, document); + await selectRuntime( + sidebarInfo.deviceName, + runtimeDetails.info.name, + document + ); info("Check that runtime info is properly displayed"); const runtimeInfo = document.querySelector(".qa-runtime-name"); ok(runtimeInfo, "Runtime info is displayed"); const runtimeInfoText = runtimeInfo.textContent; - ok(runtimeInfoText.includes(runtimeDetails.info.name), - "Runtime info shows the correct runtime name: " + runtimeInfoText); - ok(runtimeInfoText.includes(runtimeDetails.info.version), - "Runtime info shows the correct version number: " + runtimeInfoText); + ok( + runtimeInfoText.includes(runtimeDetails.info.name), + "Runtime info shows the correct runtime name: " + runtimeInfoText + ); + ok( + runtimeInfoText.includes(runtimeDetails.info.version), + "Runtime info shows the correct version number: " + runtimeInfoText + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_sidebar.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_sidebar.js index eaac6c4ceb3f..be0253be0cb3 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_sidebar.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_real_usb_sidebar.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-real-usb.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-real-usb.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-real-usb.js", + this +); // Test that USB runtimes appear from the sidebar. // Documentation for real usb tests in /documentation/TESTS_REAL_DEVICES.md @@ -20,9 +23,11 @@ add_task(async function() { const { deviceName, shortName } = sidebarInfo; await waitUntil(() => findSidebarItemByText(deviceName, document)); const usbRuntimeSidebarItem = findSidebarItemByText(deviceName, document); - ok(usbRuntimeSidebarItem.textContent.includes(shortName), - "The device name and short name of the usb runtime are visible in sidebar item " + - `[${usbRuntimeSidebarItem.textContent}]`); + ok( + usbRuntimeSidebarItem.textContent.includes(shortName), + "The device name and short name of the usb runtime are visible in sidebar item " + + `[${usbRuntimeSidebarItem.textContent}]` + ); } await removeTab(tab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_routes.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_routes.js index 6ba34f5e9d75..0858edd33af9 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_routes.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_routes.js @@ -31,20 +31,16 @@ add_task(async function() { ok(infoLabel.includes("Firefox"), "Runtime is displayed as Firefox"); ok(!infoLabel.includes(" on "), "Runtime is not associated to any device"); is( - document.title, - "Debugging - Runtime / this-firefox", - "Checking title for 'runtime' page" + document.title, + "Debugging - Runtime / this-firefox", + "Checking title for 'runtime' page" ); info("Check 'Setup' page"); document.location.hash = "#/setup"; await waitUntil(() => document.querySelector(".qa-connect-page")); ok(true, "Setup page has been shown"); - is( - document.title, - "Debugging - Setup", - "Checking title for 'setup' page" - ); + is(document.title, "Debugging - Setup", "Checking title for 'setup' page"); info("Check 'USB device runtime' page"); // connect to a mocked USB runtime @@ -59,11 +55,14 @@ add_task(async function() { await waitUntil(() => document.querySelector(".qa-runtime-page")); const runtimeLabel = document.querySelector(".qa-runtime-name").textContent; is( - document.title, - "Debugging - Runtime / 1337id", - "Checking title for 'runtime' page with USB device" + document.title, + "Debugging - Runtime / 1337id", + "Checking title for 'runtime' page with USB device" + ); + ok( + runtimeLabel.includes("Lorem ipsum"), + "Runtime is displayed with the mocked name" ); - ok(runtimeLabel.includes("Lorem ipsum"), "Runtime is displayed with the mocked name"); await removeTab(tab); }); @@ -82,11 +81,7 @@ add_task(async function() { info("Update hash & wait for a redirect to root (connect page)"); document.location.hash = "#/lorem-ipsum"; await waitUntil(() => document.querySelector(".qa-connect-page")); - is( - document.title, - "Debugging - Setup", - "Checking title for 'setup' page" - ); + is(document.title, "Debugging - Setup", "Checking title for 'setup' page"); is(document.location.hash, "#/setup", "Redirected to root"); await removeTab(tab); @@ -108,8 +103,11 @@ add_task(async function testOldAboutDebuggingRoutes() { info(`Check that navigating to ${route} redirects to This Firefox`); document.location.hash = route; await waitUntil(() => document.querySelector(".qa-runtime-page")); - is(document.location.hash, "#/runtime/this-firefox", - `${route} was redirected to This Firefox`); + is( + document.location.hash, + "#/runtime/this-firefox", + `${route} was redirected to This Firefox` + ); } await removeTab(tab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js index 2cc4ff2f1c75..8b76aeeea2c2 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js @@ -13,17 +13,32 @@ const RECENT_RUNTIME = "Recent Runtime"; const RECENT_DEVICE = "Recent Device"; add_task(async function() { - const { COMPATIBILITY_STATUS } = - require("devtools/client/shared/remote-debugging/version-checker"); - const { COMPATIBLE, TOO_OLD, TOO_OLD_67_DEBUGGER, TOO_RECENT } = COMPATIBILITY_STATUS; + const { + COMPATIBILITY_STATUS, + } = require("devtools/client/shared/remote-debugging/version-checker"); + const { + COMPATIBLE, + TOO_OLD, + TOO_OLD_67_DEBUGGER, + TOO_RECENT, + } = COMPATIBILITY_STATUS; info("Create several mocked runtimes, with different compatibility reports"); const mocks = new Mocks(); - createRuntimeWithReport(mocks, COMPATIBLE_RUNTIME, COMPATIBLE_DEVICE, COMPATIBLE); + createRuntimeWithReport( + mocks, + COMPATIBLE_RUNTIME, + COMPATIBLE_DEVICE, + COMPATIBLE + ); createRuntimeWithReport(mocks, OLD_RUNTIME, OLD_DEVICE, TOO_OLD); createRuntimeWithReport(mocks, RECENT_RUNTIME, RECENT_DEVICE, TOO_RECENT); - createRuntimeWithReport(mocks, DEBUGGER_67_RUNTIME, DEBUGGER_67_DEVICE, - TOO_OLD_67_DEBUGGER); + createRuntimeWithReport( + mocks, + DEBUGGER_67_RUNTIME, + DEBUGGER_67_DEVICE, + TOO_OLD_67_DEBUGGER + ); const { document, tab } = await openAboutDebugging(); mocks.emitUSBUpdate(); @@ -36,21 +51,33 @@ add_task(async function() { info("Select the compatible runtime and check that no warning is displayed"); await selectRuntime(COMPATIBLE_DEVICE, COMPATIBLE_RUNTIME, document); - ok(!document.querySelector(".qa-compatibility-warning"), - "Compatibility warning is not displayed"); + ok( + !document.querySelector(".qa-compatibility-warning"), + "Compatibility warning is not displayed" + ); - info("Select the old runtime and check that the too-old warning is displayed"); + info( + "Select the old runtime and check that the too-old warning is displayed" + ); await selectRuntime(OLD_DEVICE, OLD_RUNTIME, document); - ok(document.querySelector(".qa-compatibility-warning-too-old"), - "Expected compatibility warning is displayed (too-old)"); + ok( + document.querySelector(".qa-compatibility-warning-too-old"), + "Expected compatibility warning is displayed (too-old)" + ); - info("Select the recent runtime and check that the too-recent warning is displayed"); + info( + "Select the recent runtime and check that the too-recent warning is displayed" + ); await selectRuntime(RECENT_DEVICE, RECENT_RUNTIME, document); - ok(document.querySelector(".qa-compatibility-warning-too-recent"), - "Expected compatibility warning is displayed (too-recent)"); + ok( + document.querySelector(".qa-compatibility-warning-too-recent"), + "Expected compatibility warning is displayed (too-recent)" + ); - info("Select the runtime incompatible with Fx 67 " + - "and check that the debugger 67 warning is displayed"); + info( + "Select the runtime incompatible with Fx 67 " + + "and check that the debugger 67 warning is displayed" + ); await selectRuntime(DEBUGGER_67_DEVICE, DEBUGGER_67_RUNTIME, document); ok(document.querySelector(".qa-compatibility-warning-too-old-67-debugger")); @@ -59,7 +86,10 @@ add_task(async function() { function createRuntimeWithReport(mocks, name, deviceName, status) { const runtimeId = [name, deviceName].join("-"); - const compatibleUsbClient = mocks.createUSBRuntime(runtimeId, { deviceName, name }); + const compatibleUsbClient = mocks.createUSBRuntime(runtimeId, { + deviceName, + name, + }); const report = { status }; compatibleUsbClient.checkVersionCompatibility = () => report; } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js index d5098677fc04..5695daccc03b 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_disconnect_remote_runtime.js @@ -28,12 +28,12 @@ add_task(async function() { await connectToRuntime(USB_DEVICE_NAME, document); await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document); - const disconnectRemoteRuntimeButton = - document.querySelector(".qa-runtime-info__action"); + const disconnectRemoteRuntimeButton = document.querySelector( + ".qa-runtime-info__action" + ); info("Check whether disconnect remote runtime button exists"); - ok(!!disconnectRemoteRuntimeButton, - "Runtime contains the disconnect button"); + ok(!!disconnectRemoteRuntimeButton, "Runtime contains the disconnect button"); info("Click on the disconnect button"); disconnectRemoteRuntimeButton.click(); @@ -41,8 +41,11 @@ add_task(async function() { info("Wait until the runtime is disconnected"); await waitUntil(() => document.querySelector(".qa-connect-button")); - is(document.location.hash, DEFAULT_PAGE, - "Redirection to the default page (this-firefox)"); + is( + document.location.hash, + DEFAULT_PAGE, + "Redirection to the default page (this-firefox)" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_remote_runtime_buttons.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_remote_runtime_buttons.js index 10f97e9fa3d9..831b34a514c2 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_remote_runtime_buttons.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_remote_runtime_buttons.js @@ -22,23 +22,35 @@ add_task(async function() { await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Checking This Firefox"); - ok(!document.querySelector(".qa-connection-prompt-toggle-button"), - "This Firefox does not contain the connection prompt button"); - ok(!document.querySelector(".qa-profile-runtime-button"), - "This Firefox does not contain the profile runtime button"); - ok(!document.querySelector(".qa-runtime-info__action"), - "This Firefox does not contain the disconnect button"); + ok( + !document.querySelector(".qa-connection-prompt-toggle-button"), + "This Firefox does not contain the connection prompt button" + ); + ok( + !document.querySelector(".qa-profile-runtime-button"), + "This Firefox does not contain the profile runtime button" + ); + ok( + !document.querySelector(".qa-runtime-info__action"), + "This Firefox does not contain the disconnect button" + ); info("Checking a USB runtime"); mocks.emitUSBUpdate(); await connectToRuntime(USB_DEVICE_NAME, document); await selectRuntime(USB_DEVICE_NAME, USB_APP_NAME, document); - ok(!!document.querySelector(".qa-connection-prompt-toggle-button"), - "Runtime contains the connection prompt button"); - ok(!!document.querySelector(".qa-profile-runtime-button"), - "Remote runtime contains the profile runtime button"); - ok(!!document.querySelector(".qa-runtime-info__action"), - "Runtime contains the disconnect button"); + ok( + !!document.querySelector(".qa-connection-prompt-toggle-button"), + "Runtime contains the connection prompt button" + ); + ok( + !!document.querySelector(".qa-profile-runtime-button"), + "Remote runtime contains the profile runtime button" + ); + ok( + !!document.querySelector(".qa-runtime-info__action"), + "Runtime contains the disconnect button" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js index d377e49a5451..9e9715a46b16 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_usbclient_closed.js @@ -31,8 +31,11 @@ add_task(async function testUsbDeviceUnplugged() { mocks.emitUSBUpdate(); await waitUntilUsbDeviceIsUnplugged(USB_DEVICE_NAME, document); - is(document.location.hash, `#/runtime/this-firefox`, - "Redirection to the default page (this-firefox)"); + is( + document.location.hash, + `#/runtime/this-firefox`, + "Redirection to the default page (this-firefox)" + ); await removeTab(tab); }); @@ -64,8 +67,11 @@ add_task(async function testUsbClientDisconnected() { return item && item.querySelector(".qa-connect-button"); }); - is(document.location.hash, `#/runtime/this-firefox`, - "Redirection to the default page (this-firefox)"); + is( + document.location.hash, + `#/runtime/this-firefox`, + "Redirection to the default page (this-firefox)" + ); await removeTab(tab); }); @@ -94,7 +100,10 @@ add_task(async function testNetworkClientDisconnected() { return item && item.querySelector(".qa-connect-button"); }); - is(document.location.hash, `#/runtime/this-firefox`, - "Redirection to the default page (this-firefox)"); + is( + document.location.hash, + `#/runtime/this-firefox`, + "Redirection to the default page (this-firefox)" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_network_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_network_runtime.js index a565fd4ddda3..8b16bc75550d 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_network_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_network_runtime.js @@ -33,13 +33,20 @@ add_task(async function() { info("Check that the network runtime mock is properly displayed"); const thisFirefoxRuntimeInfo = document.querySelector(".qa-runtime-name"); - ok(thisFirefoxRuntimeInfo, "Runtime info for this-firefox runtime is displayed"); + ok( + thisFirefoxRuntimeInfo, + "Runtime info for this-firefox runtime is displayed" + ); const runtimeInfoText = thisFirefoxRuntimeInfo.textContent; - ok(runtimeInfoText.includes(NETWORK_RUNTIME_APP_NAME), - "network runtime info shows the correct runtime name: " + runtimeInfoText); - ok(runtimeInfoText.includes(NETWORK_RUNTIME_VERSION), - "network runtime info shows the correct version number: " + runtimeInfoText); + ok( + runtimeInfoText.includes(NETWORK_RUNTIME_APP_NAME), + "network runtime info shows the correct runtime name: " + runtimeInfoText + ); + ok( + runtimeInfoText.includes(NETWORK_RUNTIME_VERSION), + "network runtime info shows the correct version number: " + runtimeInfoText + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_page_with_serviceworker.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_page_with_serviceworker.js index a910543067f1..909644930b2b 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_page_with_serviceworker.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_select_page_with_serviceworker.js @@ -15,8 +15,9 @@ const WORKER_NAME = "testserviceworker"; add_task(async function() { const mocks = new Mocks(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Prepare Network client mock"); @@ -31,10 +32,12 @@ add_task(async function() { info(`Add a service worker to the network client`); const workers = { otherWorkers: [], - serviceWorkers: [{ - name: WORKER_NAME, - workerTargetFront: { actorID: WORKER_NAME }, - }], + serviceWorkers: [ + { + name: WORKER_NAME, + workerTargetFront: { actorID: WORKER_NAME }, + }, + ], sharedWorkers: [], }; networkClient.listWorkers = () => workers; @@ -45,8 +48,13 @@ add_task(async function() { info("Go to This Firefox again"); const thisFirefoxString = getThisFirefoxString(window); - const thisFirefoxSidebarItem = findSidebarItemByText(thisFirefoxString, document); - const thisFirefoxLink = thisFirefoxSidebarItem.querySelector(".qa-sidebar-link"); + const thisFirefoxSidebarItem = findSidebarItemByText( + thisFirefoxString, + document + ); + const thisFirefoxLink = thisFirefoxSidebarItem.querySelector( + ".qa-sidebar-link" + ); info("Click on the ThisFirefox item in the sidebar"); const requestsSuccess = waitForRequestsSuccess(window.AboutDebugging.store); thisFirefoxLink.click(); @@ -56,11 +64,16 @@ add_task(async function() { info("Check that the runtime info is rendered for This Firefox"); const thisFirefoxRuntimeInfo = document.querySelector(".qa-runtime-name"); - ok(thisFirefoxRuntimeInfo, "Runtime info for this-firefox runtime is displayed"); + ok( + thisFirefoxRuntimeInfo, + "Runtime info for this-firefox runtime is displayed" + ); const text = thisFirefoxRuntimeInfo.textContent; - ok(text.includes("Firefox") && text.includes("63.0"), - "this-firefox runtime info shows the correct values"); + ok( + text.includes("Firefox") && text.includes("63.0"), + "this-firefox runtime info shows the correct values" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_fetch_flag.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_fetch_flag.js index 4bc7f27ae84b..f9b07e477be2 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_fetch_flag.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_fetch_flag.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const FETCH_SW_JS = URL_ROOT + "resources/service-workers/fetch-sw.js"; const FETCH_SW_HTML = URL_ROOT + "resources/service-workers/fetch-sw.html"; @@ -17,15 +20,26 @@ const EMPTY_SW_HTML = URL_ROOT + "resources/service-workers/empty-sw.html"; */ add_task(async function() { await enableServiceWorkerDebugging(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Test fetch status for a service worker listening to fetch events"); - await testServiceWorkerFetchStatus(document, FETCH_SW_HTML, FETCH_SW_JS, true); + await testServiceWorkerFetchStatus( + document, + FETCH_SW_HTML, + FETCH_SW_JS, + true + ); info("Test fetch status for a service worker not listening to fetch events"); - await testServiceWorkerFetchStatus(document, EMPTY_SW_HTML, EMPTY_SW_JS, false); + await testServiceWorkerFetchStatus( + document, + EMPTY_SW_HTML, + EMPTY_SW_JS, + false + ); await removeTab(tab); }); @@ -37,9 +51,9 @@ async function testServiceWorkerFetchStatus(doc, url, workerUrl, isListening) { info("Wait until the service worker appears and is running"); const targetElement = await waitForServiceWorkerRunning(workerUrl, doc); - const expectedClassName = isListening ? - ".qa-worker-fetch-listening" : - ".qa-worker-fetch-not-listening"; + const expectedClassName = isListening + ? ".qa-worker-fetch-listening" + : ".qa-worker-fetch-not-listening"; const fetchStatus = targetElement.querySelector(expectedClassName); ok(!!fetchStatus, "Found the expected fetch status: " + expectedClassName); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_multie10s.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_multie10s.js index eb62b4c889c7..4d7f3362a4a2 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_multie10s.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_multie10s.js @@ -6,7 +6,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SERVICE_WORKER = URL_ROOT + "resources/service-workers/push-sw.js"; const TAB_URL = URL_ROOT + "resources/service-workers/push-sw.html"; @@ -35,8 +38,9 @@ async function testDebuggingSW(enableMultiE10sFn, disableMultiE10sFn) { // enable service workers await pushPref("dom.serviceWorkers.testing.enabled", true); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); // If the test starts too quickly, the test will timeout on some platforms. // See Bug 1533111. @@ -54,7 +58,9 @@ async function testDebuggingSW(enableMultiE10sFn, disableMultiE10sFn) { info("Forward service worker messages to the test"); await forwardServiceWorkerMessage(swTab); - info("Wait for the service worker to claim the test window before proceeding."); + info( + "Wait for the service worker to claim the test window before proceeding." + ); await onTabMessage(swTab, "sw-claimed"); info("Wait until the service worker appears and is running"); @@ -67,7 +73,9 @@ async function testDebuggingSW(enableMultiE10sFn, disableMultiE10sFn) { let targetElement = findDebugTargetByText(SERVICE_WORKER, document); let pushButton = targetElement.querySelector(".qa-push-button"); ok(!pushButton.disabled, "Push button is not disabled"); - let inspectButton = targetElement.querySelector(".qa-debug-target-inspect-button"); + let inspectButton = targetElement.querySelector( + ".qa-debug-target-inspect-button" + ); ok(!inspectButton.disabled, "Inspect button is not disabled"); // enable multi e10s @@ -82,7 +90,9 @@ async function testDebuggingSW(enableMultiE10sFn, disableMultiE10sFn) { }); ok(pushButton.disabled, "Push button is disabled"); - inspectButton = targetElement.querySelector(".qa-debug-target-inspect-button"); + inspectButton = targetElement.querySelector( + ".qa-debug-target-inspect-button" + ); ok(inspectButton.disabled, "Inspect button is disabled"); info("Unregister the service worker"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_not_compatible.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_not_compatible.js index 0e5496fbda57..826fbe2b4bb4 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_not_compatible.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_not_compatible.js @@ -35,17 +35,24 @@ const TEST_DATA = [ */ add_task(async function testLocalRuntime() { for (const testData of TEST_DATA) { - const { serviceWorkersEnabled, privateBrowsingEnabled, expectedMessage } = testData; + const { + serviceWorkersEnabled, + privateBrowsingEnabled, + expectedMessage, + } = testData; - info(`Test warning message on this-firefox ` + - `with serviceWorkersEnabled: ${serviceWorkersEnabled} ` + - `and with privateBrowsingEnabled: ${privateBrowsingEnabled}`); + info( + `Test warning message on this-firefox ` + + `with serviceWorkersEnabled: ${serviceWorkersEnabled} ` + + `and with privateBrowsingEnabled: ${privateBrowsingEnabled}` + ); await pushPref("dom.serviceWorkers.enabled", serviceWorkersEnabled); await pushPref("browser.privatebrowsing.autostart", privateBrowsingEnabled); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); assertWarningMessage(document, expectedMessage); await removeTab(tab); @@ -53,8 +60,9 @@ add_task(async function testLocalRuntime() { }); add_task(async function testRemoteRuntime() { - const { remoteClientManager } = - require("devtools/client/shared/remote-debugging/remote-client-manager"); + const { + remoteClientManager, + } = require("devtools/client/shared/remote-debugging/remote-client-manager"); // enable USB devices mocks const mocks = new Mocks(); @@ -64,17 +72,27 @@ add_task(async function testRemoteRuntime() { }); for (const testData of TEST_DATA) { - const { serviceWorkersEnabled, privateBrowsingEnabled, expectedMessage } = testData; + const { + serviceWorkersEnabled, + privateBrowsingEnabled, + expectedMessage, + } = testData; - info(`Test warning message on mocked USB runtime ` + - `with serviceWorkersEnabled: ${serviceWorkersEnabled} ` + - `and with privateBrowsingEnabled: ${privateBrowsingEnabled}`); + info( + `Test warning message on mocked USB runtime ` + + `with serviceWorkersEnabled: ${serviceWorkersEnabled} ` + + `and with privateBrowsingEnabled: ${privateBrowsingEnabled}` + ); client.setPreference("dom.serviceWorkers.enabled", serviceWorkersEnabled); - client.setPreference("browser.privatebrowsing.autostart", privateBrowsingEnabled); + client.setPreference( + "browser.privatebrowsing.autostart", + privateBrowsingEnabled + ); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Checking a USB runtime"); @@ -95,6 +113,10 @@ add_task(async function testRemoteRuntime() { function assertWarningMessage(doc, expectedMessage) { const hasMessage = !!doc.querySelector(".qa-service-workers-warning"); - ok(hasMessage === expectedMessage, expectedMessage ? - "Warning message is displayed" : "Warning message is not displayed"); + ok( + hasMessage === expectedMessage, + expectedMessage + ? "Warning message is displayed" + : "Warning message is not displayed" + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_push.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_push.js index dd6c0218ece0..df01f4d74d5a 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_push.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_push.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SERVICE_WORKER = URL_ROOT + "resources/service-workers/push-sw.js"; const TAB_URL = URL_ROOT + "resources/service-workers/push-sw.html"; @@ -13,8 +16,9 @@ const TAB_URL = URL_ROOT + "resources/service-workers/push-sw.html"; // It should trigger a "push" notification in the worker. add_task(async function() { await enableServiceWorkerDebugging(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Open a tab that registers a push service worker. @@ -23,11 +27,16 @@ add_task(async function() { info("Forward service worker messages to the test"); await forwardServiceWorkerMessage(swTab); - info("Wait for the service worker to claim the test window before proceeding."); + info( + "Wait for the service worker to claim the test window before proceeding." + ); await onTabMessage(swTab, "sw-claimed"); info("Wait until the service worker appears and is running"); - const targetElement = await waitForServiceWorkerRunning(SERVICE_WORKER, document); + const targetElement = await waitForServiceWorkerRunning( + SERVICE_WORKER, + document + ); // Retrieve the Push button for the worker. const pushButton = targetElement.querySelector(".qa-push-button"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_pushservice_url.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_pushservice_url.js index 5daf762b0e3e..f18303dd348d 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_pushservice_url.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_pushservice_url.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SERVICE_WORKER = URL_ROOT + "resources/service-workers/push-sw.js"; const TAB_URL = URL_ROOT + "resources/service-workers/push-sw.html"; @@ -19,8 +22,9 @@ add_task(async function() { info("Mock the push service"); mockPushService(FAKE_ENDPOINT); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Open a tab that registers a push service worker. @@ -29,11 +33,16 @@ add_task(async function() { info("Forward service worker messages to the test"); await forwardServiceWorkerMessage(swTab); - info("Wait for the service worker to claim the test window before proceeding."); + info( + "Wait for the service worker to claim the test window before proceeding." + ); await onTabMessage(swTab, "sw-claimed"); info("Wait until the service worker appears and is running"); - const targetElement = await waitForServiceWorkerRunning(SERVICE_WORKER, document); + const targetElement = await waitForServiceWorkerRunning( + SERVICE_WORKER, + document + ); info("Subscribe from the push service"); ContentTask.spawn(swTab.linkedBrowser, {}, () => { @@ -41,7 +50,9 @@ add_task(async function() { }); info("Wait until the push service appears"); - await waitUntil(() => targetElement.querySelector(".qa-worker-push-service-value")); + await waitUntil(() => + targetElement.querySelector(".qa-worker-push-service-value") + ); const pushUrl = targetElement.querySelector(".qa-worker-push-service-value"); ok(!!pushUrl, "Push URL is displayed for the serviceworker"); @@ -53,7 +64,9 @@ add_task(async function() { }); info("Wait until the push service disappears"); - await waitUntil(() => !targetElement.querySelector(".qa-worker-push-service-value")); + await waitUntil( + () => !targetElement.querySelector(".qa-worker-push-service-value") + ); info("Unregister the service worker"); await unregisterServiceWorker(swTab); @@ -68,8 +81,9 @@ add_task(async function() { }); function mockPushService(endpoint) { - const PushService = Cc["@mozilla.org/push/Service;1"] - .getService(Ci.nsIPushService).wrappedJSObject; + const PushService = Cc["@mozilla.org/push/Service;1"].getService( + Ci.nsIPushService + ).wrappedJSObject; PushService.service = { _registrations: new Map(), @@ -77,7 +91,8 @@ function mockPushService(endpoint) { Services.obs.notifyObservers( null, PushService.subscriptionModifiedTopic, - scope); + scope + ); }, init() {}, register(pageRecord) { diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_runtime-page.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_runtime-page.js index 0a0c71fab092..7de869df0738 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_runtime-page.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_runtime-page.js @@ -4,9 +4,15 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); /* import-globals-from helper-collapsibilities.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); const SW_TAB_URL = URL_ROOT + "resources/service-workers/push-sw.html"; const SW_URL = URL_ROOT + "resources/service-workers/push-sw.js"; @@ -21,8 +27,9 @@ const SW_URL = URL_ROOT + "resources/service-workers/push-sw.js"; add_task(async function() { prepareCollapsibilitiesTest(); await enableServiceWorkerDebugging(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); const store = window.AboutDebugging.store; await selectThisFirefoxPage(document, store); @@ -30,8 +37,7 @@ add_task(async function() { // check that SW list is empty info("Check that the SW pane is empty"); let swPane = getDebugTargetPane("Service Workers", document); - ok(!swPane.querySelector(".qa-debug-target-item"), - "SW list is empty"); + ok(!swPane.querySelector(".qa-debug-target-item"), "SW list is empty"); // open a tab and register service worker info("Register a service worker"); @@ -42,10 +48,14 @@ add_task(async function() { await waitForServiceWorkerRunning(SW_URL, document); swPane = getDebugTargetPane("Service Workers", document); - ok(swPane.querySelectorAll(".qa-debug-target-item").length === 1, - "Service worker list has one element"); - ok(swPane.querySelector(".qa-debug-target-item").textContent.includes(SW_URL), - "Service worker list is the one we registered"); + ok( + swPane.querySelectorAll(".qa-debug-target-item").length === 1, + "Service worker list has one element" + ); + ok( + swPane.querySelector(".qa-debug-target-item").textContent.includes(SW_URL), + "Service worker list is the one we registered" + ); // unregister the service worker info("Unregister service worker"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_start.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_start.js index f5eeb3ac9fc0..65a4716b09c0 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_start.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_start.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SW_TAB_URL = URL_ROOT + "resources/service-workers/empty-sw.html"; const SW_URL = URL_ROOT + "resources/service-workers/empty-sw.js"; @@ -25,8 +28,9 @@ add_task(async function() { await pushPref("dom.serviceWorkers.idle_timeout", 1000); await pushPref("dom.serviceWorkers.idle_extended_timeout", 1000); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Open a tab that registers a basic service worker. @@ -43,13 +47,17 @@ add_task(async function() { const startButton = targetElement.querySelector(".qa-start-button"); ok(startButton, "Found its start button"); - info("Click on the start button and wait for the service worker to be running"); + info( + "Click on the start button and wait for the service worker to be running" + ); const onServiceWorkerRunning = waitForServiceWorkerRunning(SW_URL, document); startButton.click(); const updatedTarget = await onServiceWorkerRunning; // Check that the buttons are displayed as expected. - const hasInspectButton = updatedTarget.querySelector(".qa-debug-target-inspect-button"); + const hasInspectButton = updatedTarget.querySelector( + ".qa-debug-target-inspect-button" + ); const hasStartButton = updatedTarget.querySelector(".qa-start-button"); ok(hasInspectButton, "Service worker has an inspect button"); ok(!hasStartButton, "Service worker does not have a start button"); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_status.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_status.js index 5d01bc0fcd88..f9aa63677e41 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_status.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_status.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SW_TAB_URL = URL_ROOT + "resources/service-workers/controlled-sw.html"; const SW_URL = URL_ROOT + "resources/service-workers/controlled-sw.js"; @@ -16,8 +19,9 @@ const SW_URL = URL_ROOT + "resources/service-workers/controlled-sw.js"; add_task(async function() { await enableServiceWorkerDebugging(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Open tab with a service worker that never leaves `registering` status"); @@ -31,18 +35,25 @@ add_task(async function() { await waitForServiceWorkerRegistering(SW_URL, document); // Check that the buttons are displayed as expected. - checkButtons({ inspect: true, push: false, start: false, unregister: false }, - SW_URL, document); + checkButtons( + { inspect: true, push: false, start: false, unregister: false }, + SW_URL, + document + ); info("Install the service worker"); - ContentTask.spawn(swTab.linkedBrowser, {}, - () => content.wrappedJSObject.installServiceWorker()); + ContentTask.spawn(swTab.linkedBrowser, {}, () => + content.wrappedJSObject.installServiceWorker() + ); info("Wait until the service worker is running"); await waitForServiceWorkerRunning(SW_URL, document); - checkButtons({ inspect: true, push: true, start: false, unregister: true }, - SW_URL, document); + checkButtons( + { inspect: true, push: true, start: false, unregister: true }, + SW_URL, + document + ); info("Unregister service worker"); await unregisterServiceWorker(swTab); @@ -55,20 +66,38 @@ add_task(async function() { await removeTab(tab); }); -function checkButtons({ inspect, push, start, unregister }, workerText, document) { +function checkButtons( + { inspect, push, start, unregister }, + workerText, + document +) { const targetElement = findDebugTargetByText(SW_URL, document); - const inspectButton = targetElement.querySelector(".qa-debug-target-inspect-button"); + const inspectButton = targetElement.querySelector( + ".qa-debug-target-inspect-button" + ); const pushButton = targetElement.querySelector(".qa-push-button"); const startButton = targetElement.querySelector(".qa-start-button"); const unregisterButton = targetElement.querySelector(".qa-unregister-button"); - is(!!inspectButton, inspect, - "Inspect button should be " + (inspect ? "visible" : "hidden")); - is(!!pushButton, push, - "Push button should be " + (push ? "visible" : "hidden")); - is(!!startButton, start, - "Start button should be " + (start ? "visible" : "hidden")); - is(!!unregisterButton, unregister, - "Unregister button should be " + (unregister ? "visible" : "hidden")); + is( + !!inspectButton, + inspect, + "Inspect button should be " + (inspect ? "visible" : "hidden") + ); + is( + !!pushButton, + push, + "Push button should be " + (push ? "visible" : "hidden") + ); + is( + !!startButton, + start, + "Start button should be " + (start ? "visible" : "hidden") + ); + is( + !!unregisterButton, + unregister, + "Unregister button should be " + (unregister ? "visible" : "hidden") + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_timeout.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_timeout.js index f5829d197ad0..e739f11c6b5c 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_timeout.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_timeout.js @@ -8,7 +8,10 @@ requestLongerTimeout(3); /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SW_TAB_URL = URL_ROOT + "resources/service-workers/empty-sw.html"; const SW_URL = URL_ROOT + "resources/service-workers/empty-sw.js"; @@ -31,8 +34,9 @@ add_task(async function() { await pushPref("dom.serviceWorkers.idle_timeout", SW_TIMEOUT); await pushPref("dom.serviceWorkers.idle_extended_timeout", SW_TIMEOUT); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Open a tab that registers a basic service worker. @@ -45,7 +49,9 @@ add_task(async function() { info("Wait until the service worker stops"); await waitForServiceWorkerStopped(SW_URL, document); - info("Click on the start button and wait for the service worker to be running"); + info( + "Click on the start button and wait for the service worker to be running" + ); const onServiceWorkerRunning = waitForServiceWorkerRunning(SW_URL, document); const startButton = getStartButton(SW_URL, document); startButton.click(); @@ -95,5 +101,7 @@ function getStartButton(workerText, doc) { function getInspectButton(workerText, doc) { const target = findDebugTargetByText(workerText, doc); - return target ? target.querySelector(".qa-debug-target-inspect-button") : null; + return target + ? target.querySelector(".qa-debug-target-inspect-button") + : null; } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_unregister.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_unregister.js index ffb8446d8b29..b4c7e9675354 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_unregister.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_serviceworker_unregister.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-serviceworker.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-serviceworker.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-serviceworker.js", + this +); const SW_TAB_URL = URL_ROOT + "resources/service-workers/empty-sw.html"; const SW_URL = URL_ROOT + "resources/service-workers/empty-sw.js"; @@ -18,8 +21,9 @@ const SW_URL = URL_ROOT + "resources/service-workers/empty-sw.js"; add_task(async function() { await enableServiceWorkerDebugging(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Open a tab that registers a basic service worker. @@ -32,7 +36,9 @@ add_task(async function() { const unregisterButton = targetElement.querySelector(".qa-unregister-button"); ok(unregisterButton, "Found its unregister button"); - info("Click on the unregister button and wait for the service worker to disappear"); + info( + "Click on the unregister button and wait for the service worker to disappear" + ); unregisterButton.click(); await waitUntil(() => !findDebugTargetByText(SW_URL, document)); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_connection_state.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_connection_state.js index 5218a0d1d3ff..c352d3b32a06 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_connection_state.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_connection_state.js @@ -31,15 +31,22 @@ add_task(async function() { info("Wait until the USB sidebar item appears"); await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document)); - const usbRuntimeSidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document); - const connectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + const usbRuntimeSidebarItem = findSidebarItemByText( + RUNTIME_DEVICE_NAME, + document + ); + const connectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); info("Simulate to happen connection error"); - mocks.runtimeClientFactoryMock.createClientForRuntime = async (runtime) => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { throw new Error("Dummy connection error"); }; - info("Check whether the error message displayed after clicking connect button"); + info( + "Check whether the error message displayed after clicking connect button" + ); connectButton.click(); await waitUntil(() => document.querySelector(".qa-connection-error")); ok(true, "Error message displays when connection failed"); @@ -49,7 +56,7 @@ add_task(async function() { const resumeConnectionPromise = new Promise(r => { resumeConnection = r; }); - mocks.runtimeClientFactoryMock.createClientForRuntime = async (runtime) => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { await resumeConnectionPromise; return mocks._clients[runtime.type][runtime.id]; }; @@ -57,19 +64,35 @@ add_task(async function() { info("Click on the connect button and wait until it disappears"); connectButton.click(); info("Check whether a warning of connection not responding displays"); - await waitUntil(() => document.querySelector(".qa-connection-not-responding")); - ok(document.querySelector(".qa-connection-not-responding"), - "A warning of connection not responding displays"); + await waitUntil(() => + document.querySelector(".qa-connection-not-responding") + ); + ok( + document.querySelector(".qa-connection-not-responding"), + "A warning of connection not responding displays" + ); ok(connectButton.disabled, "Connect button is disabled"); - ok(connectButton.textContent.startsWith("Connecting"), - "Label of the connect button changes"); - ok(!document.querySelector(".qa-connection-error"), "Error message disappears"); + ok( + connectButton.textContent.startsWith("Connecting"), + "Label of the connect button changes" + ); + ok( + !document.querySelector(".qa-connection-error"), + "Error message disappears" + ); - info("Unblock the connection and check the message and connect button disappear"); + info( + "Unblock the connection and check the message and connect button disappear" + ); resumeConnection(); - await waitUntil(() => !usbRuntimeSidebarItem.querySelector(".qa-connect-button")); + await waitUntil( + () => !usbRuntimeSidebarItem.querySelector(".qa-connect-button") + ); ok(!document.querySelector(".qa-connection-error"), "Error disappears"); - ok(!document.querySelector(".qa-connection-not-responding"), "Warning disappears"); + ok( + !document.querySelector(".qa-connection-not-responding"), + "Warning disappears" + ); info("Remove a USB runtime"); mocks.removeUSBRuntime(RUNTIME_ID); @@ -97,28 +120,46 @@ add_task(async function() { info("Wait until the USB sidebar item appears"); await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document)); - const usbRuntimeSidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document); - const connectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + const usbRuntimeSidebarItem = findSidebarItemByText( + RUNTIME_DEVICE_NAME, + document + ); + const connectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); let resumeConnection; const resumeConnectionPromise = new Promise(r => { resumeConnection = r; }); - mocks.runtimeClientFactoryMock.createClientForRuntime = async (runtime) => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { await resumeConnectionPromise; return mocks._clients[runtime.type][runtime.id]; }; info("Click on the connect button and wait until it disappears"); connectButton.click(); - await waitUntil(() => document.querySelector(".qa-connection-not-responding")); + await waitUntil(() => + document.querySelector(".qa-connection-not-responding") + ); info("Check whether the all status will be reverted"); - await waitUntil(() => !document.querySelector(".qa-connection-not-responding")); - ok(document.querySelector(".qa-connection-timeout"), - "Connection timeout message displays"); + await waitUntil( + () => !document.querySelector(".qa-connection-not-responding") + ); + ok( + document.querySelector(".qa-connection-timeout"), + "Connection timeout message displays" + ); ok(!connectButton.disabled, "Connect button is enabled"); - is(connectButton.textContent, "Connect", "Label of the connect button reverted"); - ok(!document.querySelector(".qa-connection-error"), "Error message disappears"); + is( + connectButton.textContent, + "Connect", + "Label of the connect button reverted" + ); + ok( + !document.querySelector(".qa-connection-error"), + "Error message disappears" + ); info("Check whether the timeout message disappears"); resumeConnection(); @@ -135,8 +176,12 @@ add_task(async function() { }); async function setupPreferences() { - await pushPref("devtools.aboutdebugging.test-connection-timing-out-delay", - CONNECTION_TIMING_OUT_DELAY); - await pushPref("devtools.aboutdebugging.test-connection-cancel-delay", - CONNECTION_CANCEL_DELAY); + await pushPref( + "devtools.aboutdebugging.test-connection-timing-out-delay", + CONNECTION_TIMING_OUT_DELAY + ); + await pushPref( + "devtools.aboutdebugging.test-connection-cancel-delay", + CONNECTION_CANCEL_DELAY + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_network_runtimes.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_network_runtimes.js index 76d9063c3156..acb120548fcf 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_network_runtimes.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_network_runtimes.js @@ -3,8 +3,7 @@ "use strict"; -const networkLocationsModule = - require("devtools/client/aboutdebugging-new/src/modules/network-locations.js"); +const networkLocationsModule = require("devtools/client/aboutdebugging-new/src/modules/network-locations.js"); /** * Test the sidebar is updated correctly when network runtimes are added/removed. @@ -25,16 +24,20 @@ add_task(async function() { info("Wait for 'no devices' element to disappear"); waitUntil(() => !document.querySelector(".qa-sidebar-no-devices")); - ok(findSidebarItemByText("localhost:6080", document), - "Found a sidebar item for localhost:6080"); + ok( + findSidebarItemByText("localhost:6080", document), + "Found a sidebar item for localhost:6080" + ); info("Remove the network location"); networkLocationsModule.removeNetworkLocation("localhost:6080"); info("Wait for 'no devices' element to reappear"); waitUntil(() => document.querySelector(".qa-sidebar-no-devices")); - ok(!findSidebarItemByText("localhost:6080", document), - "Sidebar item for localhost:6080 removed"); + ok( + !findSidebarItemByText("localhost:6080", document), + "Sidebar item for localhost:6080 removed" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime.js index 5bf8175d7d97..57ac244b9734 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime.js @@ -21,9 +21,14 @@ add_task(async function() { info("Wait until the USB sidebar item appears"); await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document)); - const usbRuntimeSidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document); - ok(usbRuntimeSidebarItem.textContent.includes(RUNTIME_SHORT_NAME), - "The short name of the usb runtime is visible"); + const usbRuntimeSidebarItem = findSidebarItemByText( + RUNTIME_DEVICE_NAME, + document + ); + ok( + usbRuntimeSidebarItem.textContent.includes(RUNTIME_SHORT_NAME), + "The short name of the usb runtime is visible" + ); mocks.removeUSBRuntime(RUNTIME_ID); mocks.emitUSBUpdate(); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js index b2bebbc8644b..e78afd69f848 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_connect.js @@ -25,16 +25,26 @@ add_task(async function() { info("Wait until the USB sidebar item appears"); await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document)); - const usbRuntimeSidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document); - const connectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + const usbRuntimeSidebarItem = findSidebarItemByText( + RUNTIME_DEVICE_NAME, + document + ); + const connectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); ok(connectButton, "Connect button is displayed for the USB runtime"); info("Click on the connect button and wait until it disappears"); connectButton.click(); - await waitUntil(() => !usbRuntimeSidebarItem.querySelector(".qa-connect-button")); + await waitUntil( + () => !usbRuntimeSidebarItem.querySelector(".qa-connect-button") + ); info("Check whether the label of item is updated after connecting"); - ok(usbRuntimeSidebarItem.textContent.includes(RUNTIME_NAME), "Label of item updated"); + ok( + usbRuntimeSidebarItem.textContent.includes(RUNTIME_NAME), + "Label of item updated" + ); info("Remove all USB runtimes"); mocks.removeUSBRuntime(RUNTIME_ID); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_refresh.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_refresh.js index 740676f72696..277eb2f63cde 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_refresh.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_refresh.js @@ -36,11 +36,15 @@ add_task(async function() { document.querySelector(".qa-refresh-devices-button").click(); info(`Wait until the sidebar item for ${OTHER_RUNTIME_APP_NAME} appears`); - await waitUntil(() => findSidebarItemByText(OTHER_RUNTIME_APP_NAME, document)); + await waitUntil(() => + findSidebarItemByText(OTHER_RUNTIME_APP_NAME, document) + ); const sidebarItem = findSidebarItemByText(RUNTIME_DEVICE_NAME, document); - ok(!sidebarItem.querySelector(".qa-connect-button"), - "Original USB runtime is still connected"); + ok( + !sidebarItem.querySelector(".qa-connect-button"), + "Original USB runtime is still connected" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_select.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_select.js index 29f88d9da0e0..a88af3d8b93c 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_select.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_runtime_select.js @@ -12,7 +12,9 @@ add_task(async function() { const { document, tab } = await openAboutDebugging(); - mocks.createUSBRuntime(RUNTIME_DEVICE_ID, { deviceName: RUNTIME_DEVICE_NAME }); + mocks.createUSBRuntime(RUNTIME_DEVICE_ID, { + deviceName: RUNTIME_DEVICE_NAME, + }); mocks.emitUSBUpdate(); info("Wait until the USB sidebar item appears"); @@ -21,15 +23,22 @@ add_task(async function() { const connectButton = sidebarItem.querySelector(".qa-connect-button"); ok(connectButton, "Connect button is displayed for the USB runtime"); - info("Click on the connect button and wait until the sidebar displays a link"); + info( + "Click on the connect button and wait until the sidebar displays a link" + ); connectButton.click(); - await waitUntil(() => findSidebarItemLinkByText(RUNTIME_DEVICE_NAME, document)); + await waitUntil(() => + findSidebarItemLinkByText(RUNTIME_DEVICE_NAME, document) + ); info("Click on the runtime link"); const link = findSidebarItemLinkByText(RUNTIME_DEVICE_NAME, document); link.click(); - is(document.location.hash, `#/runtime/${RUNTIME_DEVICE_ID}`, - "Redirection to runtime page"); + is( + document.location.hash, + `#/runtime/${RUNTIME_DEVICE_ID}`, + "Redirection to runtime page" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js index 091f6500be8e..badd4993a89b 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_status.js @@ -12,14 +12,18 @@ const { adbAddon } = require("devtools/shared/adb/adb-addon"); add_task(async function() { const mocks = new Mocks(); - await pushPref("devtools.remote.adb.extensionURL", - CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi"); + await pushPref( + "devtools.remote.adb.extensionURL", + CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi" + ); const { document, tab } = await openAboutDebugging(); const usbStatusElement = document.querySelector(".qa-sidebar-usb-status"); ok(usbStatusElement, "Sidebar shows the USB status element"); - ok(usbStatusElement.textContent.includes("USB disabled"), - "USB status element has 'disabled' content"); + ok( + usbStatusElement.textContent.includes("USB disabled"), + "USB status element has 'disabled' content" + ); info("Install the adb extension and wait for the message to udpate"); // Use "internal" as the install source to avoid triggering telemetry. diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js index 4c5b50eb9119..4ec5c03a0264 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unavailable_runtime.js @@ -25,10 +25,14 @@ add_task(async function() { const usbRuntimeSidebarItem = findSidebarItemByText(DEVICE_NAME, document); - ok(usbRuntimeSidebarItem.querySelector(".qa-runtime-item-waiting-for-browser"), - "Sidebar item shows as `Waiting for browser`"); + ok( + usbRuntimeSidebarItem.querySelector(".qa-runtime-item-waiting-for-browser"), + "Sidebar item shows as `Waiting for browser`" + ); - const hasConnectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + const hasConnectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); ok(!hasConnectButton, "Connect button is not displayed"); const hasLink = usbRuntimeSidebarItem.querySelector(".qa-sidebar-link"); @@ -47,11 +51,16 @@ add_task(async function() { let updatedSidebarItem = null; await waitUntil(() => { updatedSidebarItem = findSidebarItemByText(DEVICE_NAME, document); - return updatedSidebarItem && updatedSidebarItem.querySelector(".qa-connect-button"); + return ( + updatedSidebarItem && + updatedSidebarItem.querySelector(".qa-connect-button") + ); }); - ok(updatedSidebarItem.querySelector(".qa-runtime-item-standard"), - "Sidebar item for the USB runtime is now a standard sidebar item"); + ok( + updatedSidebarItem.querySelector(".qa-runtime-item-standard"), + "Sidebar item for the USB runtime is now a standard sidebar item" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unplugged_device.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unplugged_device.js index 429eb3753328..68d00b19bf3c 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unplugged_device.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_sidebar_usb_unplugged_device.js @@ -30,21 +30,27 @@ add_task(async function() { info("Wait until the USB sidebar item appears"); await waitUntil(() => findSidebarItemByText(DEVICE_NAME, document)); const sidebarItem = findSidebarItemByText(DEVICE_NAME, document); - ok(sidebarItem.textContent.includes(RUNTIME_NAME), - "Sidebar item shows the runtime name"); + ok( + sidebarItem.textContent.includes(RUNTIME_NAME), + "Sidebar item shows the runtime name" + ); mocks.removeUSBRuntime(RUNTIME_ID); mocks.emitUSBUpdate(); await waitUntilUsbDeviceIsUnplugged(DEVICE_NAME, document); const unpluggedItem = findSidebarItemByText(DEVICE_NAME, document); - ok(unpluggedItem.querySelector(".qa-runtime-item-unplugged"), - "Sidebar item is shown as `Unplugged…`"); + ok( + unpluggedItem.querySelector(".qa-runtime-item-unplugged"), + "Sidebar item is shown as `Unplugged…`" + ); info("Reload about:debugging"); document = await reloadAboutDebugging(tab); - info("Add another mocked USB runtime, to make sure the sidebar items are rendered."); + info( + "Add another mocked USB runtime, to make sure the sidebar items are rendered." + ); mocks.createUSBRuntime(RUNTIME_ID_2, { deviceId: DEVICE_ID_2, deviceName: DEVICE_NAME_2, @@ -54,8 +60,10 @@ add_task(async function() { info("Wait until the other USB sidebar item appears"); await waitUntil(() => findSidebarItemByText(DEVICE_NAME_2, document)); - ok(!findSidebarItemByText(DEVICE_NAME, document), - "Unplugged device is no longer displayed after reloading aboutdebugging"); + ok( + !findSidebarItemByText(DEVICE_NAME, document), + "Unplugged device is no longer displayed after reloading aboutdebugging" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_tab_favicons.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_tab_favicons.js index 730196a0fa3b..29d1850bbfa4 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_tab_favicons.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_tab_favicons.js @@ -10,14 +10,16 @@ // PlaceUtils will not store any favicon for data: uris so we need to use a dedicated page // here. -const TAB_URL = "https://example.com/browser/devtools/client/aboutdebugging-new/" + - "test/browser/test-tab-favicons.html"; +const TAB_URL = + "https://example.com/browser/devtools/client/aboutdebugging-new/" + + "test/browser/test-tab-favicons.html"; // This is the same png data-url as the one used in test-tab-favicons.html. -const EXPECTED_FAVICON = "data:image/png;base64," + - "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AI" + - "BADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoH" + - "FHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"; +const EXPECTED_FAVICON = + "data:image/png;base64," + + "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AI" + + "BADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoH" + + "FHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"; add_task(async function() { const faviconTab = await addTab(TAB_URL, { background: true }); @@ -26,14 +28,19 @@ add_task(async function() { await waitUntil(() => findDebugTargetByText("Favicon tab", document)); const faviconTabTarget = findDebugTargetByText("Favicon tab", document); - const faviconTabIcon = faviconTabTarget.querySelector(".qa-debug-target-item-icon"); + const faviconTabIcon = faviconTabTarget.querySelector( + ".qa-debug-target-item-icon" + ); // Note this relies on PlaceUtils.promiseFaviconData returning the same data-url as the // one provided in the test page. If the implementation changes and PlaceUtils returns a // different base64 from the one we defined, we can instead load the image and check a // few pixels to verify it matches the expected icon. - is(faviconTabIcon.src, EXPECTED_FAVICON, - "The debug target item for the tab shows the favicon of the tab"); + is( + faviconTabIcon.src, + EXPECTED_FAVICON, + "The debug target item for the tab shows the favicon of the tab" + ); await removeTab(tab); await removeTab(faviconTab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_basic.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_basic.js index d84ac6c4e673..587c8caf0a77 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_basic.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_basic.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); /** * Check that telemetry events are recorded when opening and closing about debugging. @@ -14,15 +17,30 @@ add_task(async function() { const { tab } = await openAboutDebugging(); - const openEvents = readAboutDebuggingEvents().filter(e => e.method === "open_adbg"); - is(openEvents.length, 1, "Exactly one open event was logged for about:debugging"); + const openEvents = readAboutDebuggingEvents().filter( + e => e.method === "open_adbg" + ); + is( + openEvents.length, + 1, + "Exactly one open event was logged for about:debugging" + ); const sessionId = openEvents[0].extras.session_id; ok(!isNaN(sessionId), "Open event has a valid session id"); await removeTab(tab); - const closeEvents = readAboutDebuggingEvents().filter(e => e.method === "close_adbg"); - is(closeEvents.length, 1, "Exactly one close event was logged for about:debugging"); - is(closeEvents[0].extras.session_id, sessionId, - "Close event has the same session id as the open event"); + const closeEvents = readAboutDebuggingEvents().filter( + e => e.method === "close_adbg" + ); + is( + closeEvents.length, + 1, + "Exactly one close event was logged for about:debugging" + ); + is( + closeEvents[0].extras.session_id, + sessionId, + "Close event has the same session id as the open event" + ); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js index d8a32c3625d9..643226bb2534 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_connection_attempt.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const USB_RUNTIME = { id: "runtime-id-1", @@ -22,15 +25,30 @@ const USB_RUNTIME = { * - connection timeout */ add_task(async function testSuccessfulConnectionAttempt() { - const { doc, mocks, runtimeId, sessionId, tab } = await setupConnectionAttemptTest(); + const { + doc, + mocks, + runtimeId, + sessionId, + tab, + } = await setupConnectionAttemptTest(); await connectToRuntime(USB_RUNTIME.deviceName, doc); - const connectionEvents = checkTelemetryEvents([ - { method: "runtime_connected", extras: { runtime_id: runtimeId } }, - { method: "connection_attempt", extras: getEventExtras("start", runtimeId) }, - { method: "connection_attempt", extras: getEventExtras("success", runtimeId) }, - ], sessionId).filter(({method}) => method === "connection_attempt"); + const connectionEvents = checkTelemetryEvents( + [ + { method: "runtime_connected", extras: { runtime_id: runtimeId } }, + { + method: "connection_attempt", + extras: getEventExtras("start", runtimeId), + }, + { + method: "connection_attempt", + extras: getEventExtras("success", runtimeId), + }, + ], + sessionId + ).filter(({ method }) => method === "connection_attempt"); checkConnectionId(connectionEvents); @@ -39,21 +57,45 @@ add_task(async function testSuccessfulConnectionAttempt() { }); add_task(async function testFailedConnectionAttempt() { - const { doc, mocks, runtimeId, sessionId, tab } = await setupConnectionAttemptTest(); - mocks.runtimeClientFactoryMock.createClientForRuntime = async (runtime) => { + const { + doc, + mocks, + runtimeId, + sessionId, + tab, + } = await setupConnectionAttemptTest(); + mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { throw new Error("failed"); }; - info("Try to connect to the runtime and wait for the connection error message"); - const usbRuntimeSidebarItem = findSidebarItemByText(USB_RUNTIME.deviceName, doc); - const connectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + info( + "Try to connect to the runtime and wait for the connection error message" + ); + const usbRuntimeSidebarItem = findSidebarItemByText( + USB_RUNTIME.deviceName, + doc + ); + const connectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); connectButton.click(); - await waitUntil(() => usbRuntimeSidebarItem.querySelector(".qa-connection-error")); + await waitUntil(() => + usbRuntimeSidebarItem.querySelector(".qa-connection-error") + ); - const connectionEvents = checkTelemetryEvents([ - { method: "connection_attempt", extras: getEventExtras("start", runtimeId) }, - { method: "connection_attempt", extras: getEventExtras("failed", runtimeId) }, - ], sessionId).filter(({method}) => method === "connection_attempt"); + const connectionEvents = checkTelemetryEvents( + [ + { + method: "connection_attempt", + extras: getEventExtras("start", runtimeId), + }, + { + method: "connection_attempt", + extras: getEventExtras("failed", runtimeId), + }, + ], + sessionId + ).filter(({ method }) => method === "connection_attempt"); checkConnectionId(connectionEvents); @@ -63,37 +105,68 @@ add_task(async function testFailedConnectionAttempt() { add_task(async function testPendingConnectionAttempt() { info("Set timeout preferences to avoid cancelling the connection"); - await pushPref("devtools.aboutdebugging.test-connection-timing-out-delay", 100); - await pushPref("devtools.aboutdebugging.test-connection-cancel-delay", 100000); + await pushPref( + "devtools.aboutdebugging.test-connection-timing-out-delay", + 100 + ); + await pushPref( + "devtools.aboutdebugging.test-connection-cancel-delay", + 100000 + ); - const { doc, mocks, runtimeId, sessionId, tab } = await setupConnectionAttemptTest(); + const { + doc, + mocks, + runtimeId, + sessionId, + tab, + } = await setupConnectionAttemptTest(); info("Simulate a pending connection"); let resumeConnection; const resumeConnectionPromise = new Promise(r => { resumeConnection = r; }); - mocks.runtimeClientFactoryMock.createClientForRuntime = async (runtime) => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { await resumeConnectionPromise; return mocks._clients[runtime.type][runtime.id]; }; info("Click on the connect button and wait for the warning message"); - const usbRuntimeSidebarItem = findSidebarItemByText(USB_RUNTIME.deviceName, doc); - const connectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + const usbRuntimeSidebarItem = findSidebarItemByText( + USB_RUNTIME.deviceName, + doc + ); + const connectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); connectButton.click(); await waitUntil(() => doc.querySelector(".qa-connection-not-responding")); info("Resume the connection and wait for the connection to succeed"); resumeConnection(); - await waitUntil(() => !usbRuntimeSidebarItem.querySelector(".qa-connect-button")); + await waitUntil( + () => !usbRuntimeSidebarItem.querySelector(".qa-connect-button") + ); - const connectionEvents = checkTelemetryEvents([ - { method: "runtime_connected", extras: { runtime_id: runtimeId } }, - { method: "connection_attempt", extras: getEventExtras("start", runtimeId) }, - { method: "connection_attempt", extras: getEventExtras("not responding", runtimeId) }, - { method: "connection_attempt", extras: getEventExtras("success", runtimeId) }, - ], sessionId).filter(({method}) => method === "connection_attempt"); + const connectionEvents = checkTelemetryEvents( + [ + { method: "runtime_connected", extras: { runtime_id: runtimeId } }, + { + method: "connection_attempt", + extras: getEventExtras("start", runtimeId), + }, + { + method: "connection_attempt", + extras: getEventExtras("not responding", runtimeId), + }, + { + method: "connection_attempt", + extras: getEventExtras("success", runtimeId), + }, + ], + sessionId + ).filter(({ method }) => method === "connection_attempt"); checkConnectionId(connectionEvents); await removeUsbRuntime(USB_RUNTIME, mocks, doc); @@ -102,27 +175,55 @@ add_task(async function testPendingConnectionAttempt() { add_task(async function testCancelledConnectionAttempt() { info("Set timeout preferences to quickly cancel the connection"); - await pushPref("devtools.aboutdebugging.test-connection-timing-out-delay", 100); + await pushPref( + "devtools.aboutdebugging.test-connection-timing-out-delay", + 100 + ); await pushPref("devtools.aboutdebugging.test-connection-cancel-delay", 1000); - const { doc, mocks, runtimeId, sessionId, tab } = await setupConnectionAttemptTest(); + const { + doc, + mocks, + runtimeId, + sessionId, + tab, + } = await setupConnectionAttemptTest(); info("Simulate a connection timeout"); - mocks.runtimeClientFactoryMock.createClientForRuntime = async (runtime) => { + mocks.runtimeClientFactoryMock.createClientForRuntime = async runtime => { await new Promise(r => {}); }; info("Click on the connect button and wait for the error message"); - const usbRuntimeSidebarItem = findSidebarItemByText(USB_RUNTIME.deviceName, doc); - const connectButton = usbRuntimeSidebarItem.querySelector(".qa-connect-button"); + const usbRuntimeSidebarItem = findSidebarItemByText( + USB_RUNTIME.deviceName, + doc + ); + const connectButton = usbRuntimeSidebarItem.querySelector( + ".qa-connect-button" + ); connectButton.click(); - await waitUntil(() => usbRuntimeSidebarItem.querySelector(".qa-connection-timeout")); + await waitUntil(() => + usbRuntimeSidebarItem.querySelector(".qa-connection-timeout") + ); - const connectionEvents = checkTelemetryEvents([ - { method: "connection_attempt", extras: getEventExtras("start", runtimeId) }, - { method: "connection_attempt", extras: getEventExtras("not responding", runtimeId) }, - { method: "connection_attempt", extras: getEventExtras("cancelled", runtimeId) }, - ], sessionId).filter(({method}) => method === "connection_attempt"); + const connectionEvents = checkTelemetryEvents( + [ + { + method: "connection_attempt", + extras: getEventExtras("start", runtimeId), + }, + { + method: "connection_attempt", + extras: getEventExtras("not responding", runtimeId), + }, + { + method: "connection_attempt", + extras: getEventExtras("cancelled", runtimeId), + }, + ], + sessionId + ).filter(({ method }) => method === "connection_attempt"); checkConnectionId(connectionEvents); await removeUsbRuntime(USB_RUNTIME, mocks, doc); @@ -131,10 +232,16 @@ add_task(async function testCancelledConnectionAttempt() { function checkConnectionId(connectionEvents) { const connectionId = connectionEvents[0].extras.connection_id; - ok(!!connectionId, "Found a valid connection id in the first connection_attempt event"); + ok( + !!connectionId, + "Found a valid connection id in the first connection_attempt event" + ); for (const evt of connectionEvents) { - is(evt.extras.connection_id, connectionId, - "All connection_attempt events share the same connection id"); + is( + evt.extras.connection_id, + connectionId, + "All connection_attempt events share the same connection id" + ); } } @@ -166,18 +273,25 @@ async function setupConnectionAttemptTest() { info("Wait for the runtime to appear in the sidebar"); await waitUntil(() => findSidebarItemByText(USB_RUNTIME.shortName, document)); - const evts = checkTelemetryEvents([ - { method: "device_added", extras: {} }, - { method: "runtime_added", extras: {} }, - ], sessionId); + const evts = checkTelemetryEvents( + [ + { method: "device_added", extras: {} }, + { method: "runtime_added", extras: {} }, + ], + sessionId + ); - const runtimeId = evts.filter(e => e.method === "runtime_added")[0].extras.runtime_id; + const runtimeId = evts.filter(e => e.method === "runtime_added")[0].extras + .runtime_id; return { doc: document, mocks, runtimeId, sessionId, tab }; } async function removeUsbRuntime(runtime, mocks, doc) { mocks.removeRuntime(runtime.id); mocks.emitUSBUpdate(); - await waitUntil(() => !findSidebarItemByText(runtime.name, doc) && - !findSidebarItemByText(runtime.shortName, doc)); + await waitUntil( + () => + !findSidebarItemByText(runtime.name, doc) && + !findSidebarItemByText(runtime.shortName, doc) + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_inspect.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_inspect.js index 151bff4dab25..46182513aa9e 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_inspect.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_inspect.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const TAB_URL = "data:text/html,TEST_TAB"; @@ -27,22 +30,37 @@ add_task(async function() { await waitUntil(() => findDebugTargetByText("TEST_TAB", document)); const tabTarget = findDebugTargetByText("TEST_TAB", document); - const inspectButton = tabTarget.querySelector(".qa-debug-target-inspect-button"); + const inspectButton = tabTarget.querySelector( + ".qa-debug-target-inspect-button" + ); ok(inspectButton, "Inspect button for the tab is available"); info("Click on the inspect button for the test tab"); inspectButton.click(); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); const newTabUrl = gBrowser.selectedBrowser.currentURI.spec; - ok(newTabUrl.startsWith("about:devtools-toolbox"), - "about:devtools-toolbox opened in a new tab"); + ok( + newTabUrl.startsWith("about:devtools-toolbox"), + "about:devtools-toolbox opened in a new tab" + ); const evts = readAboutDebuggingEvents().filter(e => e.method === "inspect"); is(evts.length, 1, "Exactly one Inspect event found"); - is(evts[0].extras.target_type, "TAB", "Inspect event has the expected target type"); - is(evts[0].extras.runtime_type, "this-firefox", - "Inspect event has the expected runtime type"); - is(evts[0].extras.session_id, sessionId, "Inspect event has the expected session"); + is( + evts[0].extras.target_type, + "TAB", + "Inspect event has the expected target type" + ); + is( + evts[0].extras.runtime_type, + "this-firefox", + "Inspect event has the expected runtime type" + ); + is( + evts[0].extras.session_id, + sessionId, + "Inspect event has the expected session" + ); info("Close the about:devtools-toolbox tab"); await removeTab(gBrowser.selectedTab); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_navigate.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_navigate.js index c22db61e8b29..4c7251ef510f 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_navigate.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_navigate.js @@ -3,7 +3,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); /** * Check that telemetry events are recorded when navigating between different @@ -35,11 +38,20 @@ add_task(async function() { }); function checkSelectPageEvent(expectedType, expectedSessionId) { - const evts = readAboutDebuggingEvents().filter(e => e.method === "select_page"); + const evts = readAboutDebuggingEvents().filter( + e => e.method === "select_page" + ); is(evts.length, 1, "Exactly one select_page event recorded"); - is(evts[0].extras.page_type, expectedType, "Select page event has the expected type"); - is(evts[0].extras.session_id, expectedSessionId, - "Select page event has the expected session"); + is( + evts[0].extras.page_type, + expectedType, + "Select page event has the expected type" + ); + is( + evts[0].extras.session_id, + expectedSessionId, + "Select page event has the expected session" + ); } async function navigateToUSBRuntime(mocks, doc) { diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_actions.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_actions.js index 9ee00e829d73..92d07a3d9c45 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_actions.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_actions.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const RUNTIME_ID = "test-runtime-id"; const RUNTIME_NAME = "Test Runtime"; @@ -42,31 +45,48 @@ add_task(async function testUsbRuntimeUpdates() { const telemetryRuntimeId = runtimeAddedEvent.extras.runtime_id; info("Click on the toggle button and wait until the text is updated"); - const promptButton = document.querySelector(".qa-connection-prompt-toggle-button"); + const promptButton = document.querySelector( + ".qa-connection-prompt-toggle-button" + ); promptButton.click(); await waitUntil(() => promptButton.textContent.includes("Enable")); - checkTelemetryEvents([{ - method: "update_conn_prompt", - extras: { "prompt_enabled": "false", "runtime_id": telemetryRuntimeId }, - }], sessionId); + checkTelemetryEvents( + [ + { + method: "update_conn_prompt", + extras: { prompt_enabled: "false", runtime_id: telemetryRuntimeId }, + }, + ], + sessionId + ); info("Click on the toggle button again and check we log the correct value"); promptButton.click(); await waitUntil(() => promptButton.textContent.includes("Disable")); - checkTelemetryEvents([{ - method: "update_conn_prompt", - extras: { "prompt_enabled": "true", "runtime_id": telemetryRuntimeId }, - }], sessionId); + checkTelemetryEvents( + [ + { + method: "update_conn_prompt", + extras: { prompt_enabled: "true", runtime_id: telemetryRuntimeId }, + }, + ], + sessionId + ); info("Open the profiler dialog"); await openProfilerDialog(usbClient, document); - checkTelemetryEvents([{ - method: "show_profiler", - extras: { "runtime_id": telemetryRuntimeId }, - }], sessionId); + checkTelemetryEvents( + [ + { + method: "show_profiler", + extras: { runtime_id: telemetryRuntimeId }, + }, + ], + sessionId + ); info("Remove runtime"); mocks.removeRuntime(RUNTIME_ID); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_connected_details.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_connected_details.js index 6d880aaa386f..729eec9da7df 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_connected_details.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_connected_details.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const REMOTE_RUNTIME_ID = "remote-runtime"; const REMOTE_RUNTIME = "Remote Runtime"; @@ -36,9 +39,15 @@ add_task(async function() { mocks.emitUSBUpdate(); await connectToRuntime(REMOTE_DEVICE, document); - const evts = readAboutDebuggingEvents().filter(e => e.method === "runtime_connected"); + const evts = readAboutDebuggingEvents().filter( + e => e.method === "runtime_connected" + ); - is(evts.length, 1, "runtime_connected event logged when connecting to remote runtime"); + is( + evts.length, + 1, + "runtime_connected event logged when connecting to remote runtime" + ); const { connection_type, device_name, @@ -50,7 +59,11 @@ add_task(async function() { is(device_name, REMOTE_DEVICE, "Expected value for `device_name` extra"); is(runtime_name, REMOTE_RUNTIME, "Expected value for `runtime_name` extra"); is(runtime_os, REMOTE_OS, "Expected value for `runtime_os` extra"); - is(runtime_version, REMOTE_VERSION, "Expected value for `runtime_version` extra"); + is( + runtime_version, + REMOTE_VERSION, + "Expected value for `runtime_version` extra" + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates.js index 1783e8fd877b..51934550a837 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const DEVICE_A = "Device A"; const USB_RUNTIME_1 = { @@ -22,20 +25,20 @@ const USB_RUNTIME_2 = { }; const DEVICE_A_EXTRAS = { - "connection_type": "usb", - "device_name": DEVICE_A, + connection_type: "usb", + device_name: DEVICE_A, }; const RUNTIME_1_EXTRAS = { - "connection_type": "usb", - "device_name": USB_RUNTIME_1.deviceName, - "runtime_name": USB_RUNTIME_1.shortName, + connection_type: "usb", + device_name: USB_RUNTIME_1.deviceName, + runtime_name: USB_RUNTIME_1.shortName, }; const RUNTIME_2_EXTRAS = { - "connection_type": "usb", - "device_name": USB_RUNTIME_2.deviceName, - "runtime_name": USB_RUNTIME_2.shortName, + connection_type: "usb", + device_name: USB_RUNTIME_2.deviceName, + runtime_name: USB_RUNTIME_2.shortName, }; /** @@ -56,59 +59,74 @@ add_task(async function testUsbRuntimeUpdates() { await addUsbRuntime(USB_RUNTIME_1, mocks, document); - let evts = checkTelemetryEvents([ - { method: "device_added", extras: DEVICE_A_EXTRAS }, - { method: "runtime_added", extras: RUNTIME_1_EXTRAS }, - ], sessionId); + let evts = checkTelemetryEvents( + [ + { method: "device_added", extras: DEVICE_A_EXTRAS }, + { method: "runtime_added", extras: RUNTIME_1_EXTRAS }, + ], + sessionId + ); // Now that a first telemetry event has been logged for RUNTIME_1, retrieve the id // generated for telemetry, and check that we keep logging the same id for all events // related to runtime 1. - const runtime1Id = evts.filter(e => e.method === "runtime_added")[0].extras.runtime_id; + const runtime1Id = evts.filter(e => e.method === "runtime_added")[0].extras + .runtime_id; const runtime1Extras = Object.assign({}, RUNTIME_1_EXTRAS, { - "runtime_id": runtime1Id, + runtime_id: runtime1Id, }); // Same as runtime1Extras, but the runtime name should be the complete one. const runtime1ConnectedExtras = Object.assign({}, runtime1Extras, { - "runtime_name": USB_RUNTIME_1.name, + runtime_name: USB_RUNTIME_1.name, }); await connectToRuntime(USB_RUNTIME_1.deviceName, document); - checkTelemetryEvents([ - { method: "runtime_connected", extras: runtime1ConnectedExtras }, - { method: "connection_attempt", extras: { status: "start" } }, - { method: "connection_attempt", extras: { status: "success" } }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "runtime_connected", extras: runtime1ConnectedExtras }, + { method: "connection_attempt", extras: { status: "start" } }, + { method: "connection_attempt", extras: { status: "success" } }, + ], + sessionId + ); info("Add a second runtime"); await addUsbRuntime(USB_RUNTIME_2, mocks, document); - evts = checkTelemetryEvents([ - { method: "runtime_added", extras: RUNTIME_2_EXTRAS }, - ], sessionId); + evts = checkTelemetryEvents( + [{ method: "runtime_added", extras: RUNTIME_2_EXTRAS }], + sessionId + ); // Similar to what we did for RUNTIME_1,w e want to check we reuse the same telemetry id // for all the events related to RUNTIME_2. - const runtime2Id = evts.filter(e => e.method === "runtime_added")[0].extras.runtime_id; + const runtime2Id = evts.filter(e => e.method === "runtime_added")[0].extras + .runtime_id; const runtime2Extras = Object.assign({}, RUNTIME_2_EXTRAS, { - "runtime_id": runtime2Id, + runtime_id: runtime2Id, }); info("Remove runtime 1"); await removeUsbRuntime(USB_RUNTIME_1, mocks, document); - checkTelemetryEvents([ - { method: "runtime_disconnected", extras: runtime1ConnectedExtras }, - { method: "runtime_removed", extras: runtime1Extras }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "runtime_disconnected", extras: runtime1ConnectedExtras }, + { method: "runtime_removed", extras: runtime1Extras }, + ], + sessionId + ); info("Remove runtime 2"); await removeUsbRuntime(USB_RUNTIME_2, mocks, document); - checkTelemetryEvents([ - { method: "runtime_removed", extras: runtime2Extras }, - { method: "device_removed", extras: DEVICE_A_EXTRAS }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "runtime_removed", extras: runtime2Extras }, + { method: "device_removed", extras: DEVICE_A_EXTRAS }, + ], + sessionId + ); await removeTab(tab); }); @@ -128,6 +146,9 @@ async function addUsbRuntime(runtime, mocks, doc) { async function removeUsbRuntime(runtime, mocks, doc) { mocks.removeRuntime(runtime.id); mocks.emitUSBUpdate(); - await waitUntil(() => !findSidebarItemByText(runtime.name, doc) && - !findSidebarItemByText(runtime.shortName, doc)); + await waitUntil( + () => + !findSidebarItemByText(runtime.name, doc) && + !findSidebarItemByText(runtime.shortName, doc) + ); } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_multi.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_multi.js index e2ca597dc544..c1a121c493b4 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_multi.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_multi.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const DEVICE_A = "Device A"; const USB_RUNTIME_1 = { @@ -22,20 +25,20 @@ const USB_RUNTIME_2 = { }; const DEVICE_A_EXTRAS = { - "connection_type": "usb", - "device_name": DEVICE_A, + connection_type: "usb", + device_name: DEVICE_A, }; const RUNTIME_1_EXTRAS = { - "connection_type": "usb", - "device_name": USB_RUNTIME_1.deviceName, - "runtime_name": USB_RUNTIME_1.shortName, + connection_type: "usb", + device_name: USB_RUNTIME_1.deviceName, + runtime_name: USB_RUNTIME_1.shortName, }; const RUNTIME_2_EXTRAS = { - "connection_type": "usb", - "device_name": USB_RUNTIME_2.deviceName, - "runtime_name": USB_RUNTIME_2.shortName, + connection_type: "usb", + device_name: USB_RUNTIME_2.deviceName, + runtime_name: USB_RUNTIME_2.shortName, }; /** @@ -64,29 +67,45 @@ add_task(async function() { shortName: USB_RUNTIME_2.shortName, }); mocks.emitUSBUpdate(); - await waitUntil(() => findSidebarItemByText(USB_RUNTIME_1.shortName, document)); - await waitUntil(() => findSidebarItemByText(USB_RUNTIME_2.shortName, document)); + await waitUntil(() => + findSidebarItemByText(USB_RUNTIME_1.shortName, document) + ); + await waitUntil(() => + findSidebarItemByText(USB_RUNTIME_2.shortName, document) + ); - checkTelemetryEvents([ - { method: "device_added", extras: DEVICE_A_EXTRAS }, - { method: "runtime_added", extras: RUNTIME_1_EXTRAS }, - { method: "runtime_added", extras: RUNTIME_2_EXTRAS }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "device_added", extras: DEVICE_A_EXTRAS }, + { method: "runtime_added", extras: RUNTIME_1_EXTRAS }, + { method: "runtime_added", extras: RUNTIME_2_EXTRAS }, + ], + sessionId + ); info("Remove both runtimes at once to simulate a device disconnection"); mocks.removeRuntime(USB_RUNTIME_1.id); mocks.removeRuntime(USB_RUNTIME_2.id); mocks.emitUSBUpdate(); - await waitUntil(() => !findSidebarItemByText(USB_RUNTIME_1.name, document) && - !findSidebarItemByText(USB_RUNTIME_1.shortName, document)); - await waitUntil(() => !findSidebarItemByText(USB_RUNTIME_2.name, document) && - !findSidebarItemByText(USB_RUNTIME_2.shortName, document)); + await waitUntil( + () => + !findSidebarItemByText(USB_RUNTIME_1.name, document) && + !findSidebarItemByText(USB_RUNTIME_1.shortName, document) + ); + await waitUntil( + () => + !findSidebarItemByText(USB_RUNTIME_2.name, document) && + !findSidebarItemByText(USB_RUNTIME_2.shortName, document) + ); - checkTelemetryEvents([ - { method: "runtime_removed", extras: RUNTIME_1_EXTRAS }, - { method: "runtime_removed", extras: RUNTIME_2_EXTRAS }, - { method: "device_removed", extras: DEVICE_A_EXTRAS }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "runtime_removed", extras: RUNTIME_1_EXTRAS }, + { method: "runtime_removed", extras: RUNTIME_2_EXTRAS }, + { method: "device_removed", extras: DEVICE_A_EXTRAS }, + ], + sessionId + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_network.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_network.js index a13aab0afe13..d33810dc5994 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_network.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_telemetry_runtime_updates_network.js @@ -4,7 +4,10 @@ "use strict"; /* import-globals-from helper-telemetry.js */ -Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this); +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-telemetry.js", + this +); const NETWORK_RUNTIME = { host: "localhost:1234", @@ -31,37 +34,48 @@ add_task(async function testNetworkRuntimeUpdates() { // Before the connection, we don't have any information about the runtime. // Device information is also not available to network runtimes. const networkRuntimeExtras = { - "connection_type": "network", - "device_name": "", - "runtime_name": "", + connection_type: "network", + device_name: "", + runtime_name: "", }; // Once connected we should be able to log a valid runtime name. - const connectedNetworkRuntimeExtras = Object.assign({}, networkRuntimeExtras, { - "runtime_name": NETWORK_RUNTIME.name, - }); + const connectedNetworkRuntimeExtras = Object.assign( + {}, + networkRuntimeExtras, + { + runtime_name: NETWORK_RUNTIME.name, + } + ); // For network runtimes, we don't have any device information, so we shouldn't have any // device_added event. - checkTelemetryEvents([ - { method: "runtime_added", extras: networkRuntimeExtras }, - ], sessionId); + checkTelemetryEvents( + [{ method: "runtime_added", extras: networkRuntimeExtras }], + sessionId + ); await connectToRuntime(NETWORK_RUNTIME.host, document); - checkTelemetryEvents([ - { method: "runtime_connected", extras: connectedNetworkRuntimeExtras }, - { method: "connection_attempt", extras: { status: "start" } }, - { method: "connection_attempt", extras: { status: "success" } }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "runtime_connected", extras: connectedNetworkRuntimeExtras }, + { method: "connection_attempt", extras: { status: "start" } }, + { method: "connection_attempt", extras: { status: "success" } }, + ], + sessionId + ); info("Remove network runtime"); mocks.removeRuntime(NETWORK_RUNTIME.host); await waitUntil(() => !findSidebarItemByText(NETWORK_RUNTIME.host, document)); // Similarly we should not have any device removed event. - checkTelemetryEvents([ - { method: "runtime_disconnected", extras: connectedNetworkRuntimeExtras }, - { method: "runtime_removed", extras: networkRuntimeExtras }, - ], sessionId); + checkTelemetryEvents( + [ + { method: "runtime_disconnected", extras: connectedNetworkRuntimeExtras }, + { method: "runtime_removed", extras: networkRuntimeExtras }, + ], + sessionId + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox.js index 8f1f0c4fa3df..3f673df7585d 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox.js @@ -17,7 +17,9 @@ const EXPECTED_TARGET_PANES = [ * the preference to enable local tab debugging is true. */ add_task(async function testThisFirefoxWithLocalTab() { - const { document, tab, window } = await openAboutDebugging({ enableLocalTabs: true }); + const { document, tab, window } = await openAboutDebugging({ + enableLocalTabs: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Expect all target panes to be displayed including tabs. @@ -31,11 +33,15 @@ add_task(async function testThisFirefoxWithLocalTab() { * the preference to enable local tab debugging is false. */ add_task(async function testThisFirefoxWithoutLocalTab() { - const { document, tab, window } = await openAboutDebugging({ enableLocalTabs: false }); + const { document, tab, window } = await openAboutDebugging({ + enableLocalTabs: false, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); // Expect all target panes but tabs to be displayed. - const expectedTargetPanesWithoutTabs = EXPECTED_TARGET_PANES.filter(p => p !== "Tabs"); + const expectedTargetPanesWithoutTabs = EXPECTED_TARGET_PANES.filter( + p => p !== "Tabs" + ); await checkThisFirefoxTargetPanes(document, expectedTargetPanesWithoutTabs); await removeTab(tab); @@ -49,7 +55,9 @@ add_task(async function testThisFirefoxKeepDiscardedTab() { const blankTab = await addTab("about:blank"); targetTab.ownerGlobal.gBrowser.discardBrowser(targetTab); - const { document, tab, window } = await openAboutDebugging({ enableLocalTabs: false }); + const { document, tab, window } = await openAboutDebugging({ + enableLocalTabs: false, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); ok(!targetTab.linkedPanel, "The target tab is still discarded"); @@ -69,9 +77,13 @@ add_task(async function testThisFirefoxWithXpinstallDisabled() { await selectThisFirefoxPage(document, window.AboutDebugging.store); // Expect all target panes but temporary extensions to be displayed. - const expectedTargetPanesWithXpinstallDisabled = - EXPECTED_TARGET_PANES.filter(p => p !== "Temporary Extensions"); - await checkThisFirefoxTargetPanes(document, expectedTargetPanesWithXpinstallDisabled); + const expectedTargetPanesWithXpinstallDisabled = EXPECTED_TARGET_PANES.filter( + p => p !== "Temporary Extensions" + ); + await checkThisFirefoxTargetPanes( + document, + expectedTargetPanesWithXpinstallDisabled + ); await removeTab(tab); }); @@ -83,19 +95,27 @@ async function checkThisFirefoxTargetPanes(doc, expectedTargetPanes) { ok(selectedSidebarItem, "An item is selected in the sidebar"); const thisFirefoxString = getThisFirefoxString(win); - is(selectedSidebarItem.textContent, thisFirefoxString, - "The selected sidebar item is " + thisFirefoxString); + is( + selectedSidebarItem.textContent, + thisFirefoxString, + "The selected sidebar item is " + thisFirefoxString + ); const paneTitlesEls = doc.querySelectorAll(".qa-debug-target-pane-title"); - is(paneTitlesEls.length, expectedTargetPanes.length, - "This Firefox has the expected number of debug target categories"); + is( + paneTitlesEls.length, + expectedTargetPanes.length, + "This Firefox has the expected number of debug target categories" + ); const paneTitles = [...paneTitlesEls].map(el => el.textContent); for (let i = 0; i < expectedTargetPanes.length; i++) { const expectedPaneTitle = expectedTargetPanes[i]; const actualPaneTitle = paneTitles[i]; - ok(actualPaneTitle.startsWith(expectedPaneTitle), - `Expected debug target category found: ${ expectedPaneTitle }`); + ok( + actualPaneTitle.startsWith(expectedPaneTitle), + `Expected debug target category found: ${expectedPaneTitle}` + ); } } diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_runtime_info.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_runtime_info.js index 71dacf0b9696..fff9f3e17935 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_runtime_info.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_runtime_info.js @@ -14,7 +14,9 @@ add_task(async function() { const runtimeClientFactoryMock = createRuntimeClientFactoryMock(); const thisFirefoxClient = createThisFirefoxClientMock(); runtimeClientFactoryMock.createClientForRuntime = runtime => { - const { RUNTIMES } = require("devtools/client/aboutdebugging-new/src/constants"); + const { + RUNTIMES, + } = require("devtools/client/aboutdebugging-new/src/constants"); if (runtime.id === RUNTIMES.THIS_FIREFOX) { return thisFirefoxClient; } @@ -32,12 +34,21 @@ add_task(async function() { info("Check that the 'This Firefox' mock is properly displayed"); const thisFirefoxRuntimeInfo = document.querySelector(".qa-runtime-name"); - ok(thisFirefoxRuntimeInfo, "Runtime info for this-firefox runtime is displayed"); + ok( + thisFirefoxRuntimeInfo, + "Runtime info for this-firefox runtime is displayed" + ); const runtimeInfoText = thisFirefoxRuntimeInfo.textContent; - ok(runtimeInfoText.includes("Firefox"), - "this-firefox runtime info shows the correct runtime name: " + runtimeInfoText); - ok(runtimeInfoText.includes("63.0"), - "this-firefox runtime info shows the correct version number: " + runtimeInfoText); + ok( + runtimeInfoText.includes("Firefox"), + "this-firefox runtime info shows the correct runtime name: " + + runtimeInfoText + ); + ok( + runtimeInfoText.includes("63.0"), + "this-firefox runtime info shows the correct version number: " + + runtimeInfoText + ); await removeTab(tab); }); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_worker_inspection.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_worker_inspection.js index c7baa10119e3..e3933b3bfcae 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_worker_inspection.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox_worker_inspection.js @@ -3,7 +3,9 @@ "use strict"; -const { gDevToolsBrowser } = require("devtools/client/framework/devtools-browser"); +const { + gDevToolsBrowser, +} = require("devtools/client/framework/devtools-browser"); add_task(async function() { const thisFirefoxClient = createThisFirefoxClientMock(); @@ -29,7 +31,9 @@ add_task(async function() { const runtimeClientFactoryMock = createRuntimeClientFactoryMock(); runtimeClientFactoryMock.createClientForRuntime = runtime => { - const { RUNTIMES } = require("devtools/client/aboutdebugging-new/src/constants"); + const { + RUNTIMES, + } = require("devtools/client/aboutdebugging-new/src/constants"); if (runtime.id === RUNTIMES.THIS_FIREFOX) { return thisFirefoxClient; } @@ -38,7 +42,7 @@ add_task(async function() { info("Enable mocks"); enableRuntimeClientFactoryMock(runtimeClientFactoryMock); - const originalOpenWorkerForToolbox = gDevToolsBrowser.openWorkerToolbox; + const originalOpenWorkerForToolbox = gDevToolsBrowser.openWorkerToolbox; registerCleanupFunction(() => { disableRuntimeClientFactoryMock(); gDevToolsBrowser.openWorkerToolbox = originalOpenWorkerForToolbox; @@ -48,14 +52,24 @@ add_task(async function() { await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Open a toolbox to debug the worker"); - const { devtoolsTab, devtoolsWindow } = - await openAboutDevtoolsToolbox(document, tab, window, testWorker.name, false); + const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( + document, + tab, + window, + testWorker.name, + false + ); - info("Check whether the correct actor front will be opened in worker toolbox"); + info( + "Check whether the correct actor front will be opened in worker toolbox" + ); const url = new window.URL(devtoolsWindow.location.href); const workerID = url.searchParams.get("id"); - is(workerID, testWorker.id, - "Correct actor front will be opened in worker toolbox"); + is( + workerID, + testWorker.id, + "Correct actor front will be opened in worker toolbox" + ); await removeTab(devtoolsTab); await waitUntil(() => !findDebugTargetByText("Toolbox - ", document)); diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_workers_remote_runtime.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_workers_remote_runtime.js index 52396f71719c..5a8f377259e5 100644 --- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_workers_remote_runtime.js +++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_workers_remote_runtime.js @@ -14,11 +14,13 @@ const TESTS = [ category: "Other Workers", propertyName: "otherWorkers", workerName: "other/worker/script.js", - }, { + }, + { category: "Service Workers", propertyName: "serviceWorkers", workerName: "service/worker/script.js", - }, { + }, + { category: "Shared Workers", propertyName: "sharedWorkers", workerName: "shared/worker/script.js", @@ -35,8 +37,9 @@ const EMPTY_WORKERS_RESPONSE = { add_task(async function() { const mocks = new Mocks(); - const { document, tab, window } = - await openAboutDebugging({ enableWorkerUpdates: true }); + const { document, tab, window } = await openAboutDebugging({ + enableWorkerUpdates: true, + }); await selectThisFirefoxPage(document, window.AboutDebugging.store); info("Prepare USB client mock"); @@ -50,8 +53,12 @@ add_task(async function() { await connectToRuntime(USB_RUNTIME_DEVICE_NAME, document); await selectRuntime(USB_RUNTIME_DEVICE_NAME, USB_RUNTIME_APP_NAME, document); for (const testData of TESTS) { - await testWorkerOnMockedRemoteClient(testData, usbClient, mocks.thisFirefoxClient, - document); + await testWorkerOnMockedRemoteClient( + testData, + usbClient, + mocks.thisFirefoxClient, + document + ); } info("Prepare Network client mock"); @@ -64,8 +71,12 @@ add_task(async function() { await selectRuntime(NETWORK_RUNTIME_HOST, NETWORK_RUNTIME_APP_NAME, document); for (const testData of TESTS) { - await testWorkerOnMockedRemoteClient(testData, networkClient, mocks.thisFirefoxClient, - document); + await testWorkerOnMockedRemoteClient( + testData, + networkClient, + mocks.thisFirefoxClient, + document + ); } await removeTab(tab); @@ -74,30 +85,40 @@ add_task(async function() { /** * Check that workers are visible in the runtime page for a remote client. */ -async function testWorkerOnMockedRemoteClient(testData, remoteClient, firefoxClient, - document) { +async function testWorkerOnMockedRemoteClient( + testData, + remoteClient, + firefoxClient, + document +) { const { category, propertyName, workerName } = testData; info(`Test workers for category [${category}] in remote runtime`); const workersPane = getDebugTargetPane(category, document); info("Check an empty target pane message is displayed"); - ok(workersPane.querySelector(".qa-debug-target-list-empty"), - "Workers list is empty"); + ok( + workersPane.querySelector(".qa-debug-target-list-empty"), + "Workers list is empty" + ); info(`Add a worker of type [${propertyName}] to the remote client`); const workers = Object.assign({}, EMPTY_WORKERS_RESPONSE, { - [propertyName]: [{ - name: workerName, - workerTargetFront: { - actorID: workerName, + [propertyName]: [ + { + name: workerName, + workerTargetFront: { + actorID: workerName, + }, }, - }], + ], }); remoteClient.listWorkers = () => workers; remoteClient._eventEmitter.emit("workersUpdated"); info("Wait until the worker appears"); - await waitUntil(() => !workersPane.querySelector(".qa-debug-target-list-empty")); + await waitUntil( + () => !workersPane.querySelector(".qa-debug-target-list-empty") + ); const workerTarget = findDebugTargetByText(workerName, document); ok(workerTarget, "Worker target appeared for the remote runtime"); @@ -117,12 +138,18 @@ async function testWorkerOnMockedRemoteClient(testData, remoteClient, firefoxCli const testTab = { outerWindowID: 0, url: "http://some.random/url.com" }; remoteClient.listTabs = () => [testTab]; remoteClient._eventEmitter.emit("tabListChanged"); - await waitUntil(() => findDebugTargetByText("http://some.random/url.com", document)); + await waitUntil(() => + findDebugTargetByText("http://some.random/url.com", document) + ); - ok(findDebugTargetByText(workerName, document), - "The test worker is still visible"); + ok( + findDebugTargetByText(workerName, document), + "The test worker is still visible" + ); - info("Emit `workersUpdated` on remoteClient and wait for the target list to update"); + info( + "Emit `workersUpdated` on remoteClient and wait for the target list to update" + ); remoteClient._eventEmitter.emit("workersUpdated"); await waitUntil(() => !findDebugTargetByText(workerName, document)); } diff --git a/devtools/client/aboutdebugging-new/test/browser/head.js b/devtools/client/aboutdebugging-new/test/browser/head.js index 7c439224c0ba..73aa03b76f50 100644 --- a/devtools/client/aboutdebugging-new/test/browser/head.js +++ b/devtools/client/aboutdebugging-new/test/browser/head.js @@ -10,12 +10,14 @@ // Load the shared-head file first. Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", - this); + this +); // Load the shared Redux helpers into this compartment. Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/devtools/client/shared/test/shared-redux-head.js", - this); + this +); /* import-globals-from helper-mocks.js */ Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-mocks.js", this); @@ -31,8 +33,9 @@ registerCleanupFunction(async function() { const { adbProcess } = require("devtools/shared/adb/adb-process"); await adbProcess.kill(); - const { remoteClientManager } = - require("devtools/client/shared/remote-debugging/remote-client-manager"); + const { + remoteClientManager, + } = require("devtools/client/shared/remote-debugging/remote-client-manager"); await remoteClientManager.removeAllClients(); }); @@ -43,14 +46,20 @@ async function enableNewAboutDebugging() { await pushPref("devtools.aboutdebugging.new-enabled", true); } -async function openAboutDebugging({ enableWorkerUpdates, enableLocalTabs = true } = {}) { +async function openAboutDebugging({ + enableWorkerUpdates, + enableLocalTabs = true, +} = {}) { if (!enableWorkerUpdates) { silenceWorkerUpdates(); } // This preference changes value depending on the build type, tests need to use a // consistent value regarless of the build used. - await pushPref("devtools.aboutdebugging.local-tab-debugging", enableLocalTabs); + await pushPref( + "devtools.aboutdebugging.local-tab-debugging", + enableLocalTabs + ); await enableNewAboutDebugging(); @@ -67,18 +76,25 @@ async function openAboutDebugging({ enableWorkerUpdates, enableLocalTabs = true return { tab, document, window }; } -async function openAboutDevtoolsToolbox(doc, tab, win, targetText = "about:debugging", - shouldWaitToolboxReady = true) { +async function openAboutDevtoolsToolbox( + doc, + tab, + win, + targetText = "about:debugging", + shouldWaitToolboxReady = true +) { info("Open about:devtools-toolbox page"); const target = findDebugTargetByText(targetText, doc); - ok(target, `${ targetText } tab target appeared`); + ok(target, `${targetText} tab target appeared`); const inspectButton = target.querySelector(".qa-debug-target-inspect-button"); - ok(inspectButton, `Inspect button for ${ targetText } appeared`); + ok(inspectButton, `Inspect button for ${targetText} appeared`); inspectButton.click(); await Promise.all([ waitUntil(() => tab.nextElementSibling), waitForRequestsToSettle(win.AboutDebugging.store), - shouldWaitToolboxReady ? gDevTools.once("toolbox-ready") : Promise.resolve(), + shouldWaitToolboxReady + ? gDevTools.once("toolbox-ready") + : Promise.resolve(), ]); info("Wait for about:devtools-toolbox tab will be selected"); @@ -86,12 +102,16 @@ async function openAboutDevtoolsToolbox(doc, tab, win, targetText = "about:debug await waitUntil(() => gBrowser.selectedTab === devtoolsTab); const devtoolsBrowser = gBrowser.selectedBrowser; await waitUntil(() => - devtoolsBrowser.contentWindow.location.href.startsWith("about:devtools-toolbox?")); + devtoolsBrowser.contentWindow.location.href.startsWith( + "about:devtools-toolbox?" + ) + ); if (!shouldWaitToolboxReady) { // Wait for show error page. await waitUntil(() => - devtoolsBrowser.contentDocument.querySelector(".qa-error-page")); + devtoolsBrowser.contentDocument.querySelector(".qa-error-page") + ); } return { @@ -102,7 +122,11 @@ async function openAboutDevtoolsToolbox(doc, tab, win, targetText = "about:debug }; } -async function closeAboutDevtoolsToolbox(aboutDebuggingDocument, devtoolsTab, win) { +async function closeAboutDevtoolsToolbox( + aboutDebuggingDocument, + devtoolsTab, + win +) { info("Close about:devtools-toolbox page"); const onToolboxDestroyed = gDevTools.once("toolbox-destroyed"); @@ -119,7 +143,9 @@ async function closeAboutDevtoolsToolbox(aboutDebuggingDocument, devtoolsTab, wi // Wait for removing about:devtools-toolbox tab info from about:debugging. info("Wait until about:devtools-toolbox is removed from debug targets"); - await waitUntil(() => !findDebugTargetByText("Toolbox - ", aboutDebuggingDocument)); + await waitUntil( + () => !findDebugTargetByText("Toolbox - ", aboutDebuggingDocument) + ); await waitForRequestsToSettle(win.AboutDebugging.store); } @@ -230,12 +256,14 @@ async function selectConnectPage(doc) { function getDebugTargetPane(title, document) { // removes the suffix "()" in debug target pane's title, if needed - const sanitizeTitle = (x) => { + const sanitizeTitle = x => { return x.replace(/\s+\(\d+\)$/, ""); }; const targetTitle = sanitizeTitle(title); - for (const titleEl of document.querySelectorAll(".qa-debug-target-pane-title")) { + for (const titleEl of document.querySelectorAll( + ".qa-debug-target-pane-title" + )) { if (sanitizeTitle(titleEl.textContent) !== targetTitle) { continue; } @@ -270,7 +298,10 @@ async function connectToRuntime(deviceName, document) { await waitUntil(() => findSidebarItemByText(deviceName, document)); const sidebarItem = findSidebarItemByText(deviceName, document); const connectButton = sidebarItem.querySelector(".qa-connect-button"); - ok(connectButton, `Connect button is displayed for the runtime ${deviceName}`); + ok( + connectButton, + `Connect button is displayed for the runtime ${deviceName}` + ); info("Click on the connect button and wait until it disappears"); connectButton.click(); @@ -304,7 +335,9 @@ async function openProfilerDialog(client, doc) { const profileButton = doc.querySelector(".qa-profile-runtime-button"); profileButton.click(); - info("Wait for the loadPerformanceProfiler callback to be executed on client-wrapper"); + info( + "Wait for the loadPerformanceProfiler callback to be executed on client-wrapper" + ); return onProfilerLoaded; } @@ -314,14 +347,19 @@ async function openProfilerDialog(client, doc) { */ function getThisFirefoxString(aboutDebuggingWindow) { const loader = aboutDebuggingWindow.getBrowserLoaderForWindow(); - const { l10n } = loader.require("devtools/client/aboutdebugging-new/src/modules/l10n"); + const { l10n } = loader.require( + "devtools/client/aboutdebugging-new/src/modules/l10n" + ); return l10n.getString("about-debugging-this-firefox-runtime-name"); } function waitUntilUsbDeviceIsUnplugged(deviceName, aboutDebuggingDocument) { info("Wait until the USB sidebar item appears as unplugged"); return waitUntil(() => { - const sidebarItem = findSidebarItemByText(deviceName, aboutDebuggingDocument); + const sidebarItem = findSidebarItemByText( + deviceName, + aboutDebuggingDocument + ); return !!sidebarItem.querySelector(".qa-runtime-item-unplugged"); }); } diff --git a/devtools/client/aboutdebugging-new/test/browser/helper-adb.js b/devtools/client/aboutdebugging-new/test/browser/helper-adb.js index 139c5d800ff2..ed65b03fbdbf 100644 --- a/devtools/client/aboutdebugging-new/test/browser/helper-adb.js +++ b/devtools/client/aboutdebugging-new/test/browser/helper-adb.js @@ -10,8 +10,10 @@ async function checkAdbNotRunning() { const { check } = require("devtools/shared/adb/adb-running-checker"); const isAdbAlreadyRunning = await check(); if (isAdbAlreadyRunning) { - throw new Error("The ADB process is already running on this machine, it should be " + - "stopped before running this test"); + throw new Error( + "The ADB process is already running on this machine, it should be " + + "stopped before running this test" + ); } } /* exported checkAdbNotRunning */ diff --git a/devtools/client/aboutdebugging-new/test/browser/helper-addons.js b/devtools/client/aboutdebugging-new/test/browser/helper-addons.js index d2081792389d..8661db0523c1 100644 --- a/devtools/client/aboutdebugging-new/test/browser/helper-addons.js +++ b/devtools/client/aboutdebugging-new/test/browser/helper-addons.js @@ -6,8 +6,9 @@ /* import-globals-from head.js */ function _getSupportsFile(path) { - const cr = Cc["@mozilla.org/chrome/chrome-registry;1"] - .getService(Ci.nsIChromeRegistry); + const cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService( + Ci.nsIChromeRegistry + ); const uri = Services.io.newURI(CHROME_URL_ROOT + path); const fileurl = cr.convertChromeURL(uri); return fileurl.QueryInterface(Ci.nsIFileURL); @@ -49,7 +50,10 @@ function installRegularExtension(pathOrFile) { * Will use a mock file picker to select the file. */ async function installTemporaryExtension(pathOrFile, name, document) { - const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", null); + const { Management } = ChromeUtils.import( + "resource://gre/modules/Extension.jsm", + null + ); info("Install temporary extension named " + name); // Mock the file picker to select a test addon @@ -75,20 +79,30 @@ async function installTemporaryExtension(pathOrFile, name, document) { /* exported installTemporaryExtension */ function createTemporaryXPI(xpiData) { - const { ExtensionTestCommon } = - ChromeUtils.import("resource://testing-common/ExtensionTestCommon.jsm", {}); + const { ExtensionTestCommon } = ChromeUtils.import( + "resource://testing-common/ExtensionTestCommon.jsm", + {} + ); const { background, files, id, name, extraProperties } = xpiData; info("Generate XPI file for " + id); - const manifest = Object.assign({}, { - applications: { gecko: { id }}, - manifest_version: 2, - name, - version: "1.0", - }, extraProperties); + const manifest = Object.assign( + {}, + { + applications: { gecko: { id } }, + manifest_version: 2, + name, + version: "1.0", + }, + extraProperties + ); - const xpiFile = ExtensionTestCommon.generateXPI({ background, files, manifest }); + const xpiFile = ExtensionTestCommon.generateXPI({ + background, + files, + manifest, + }); registerCleanupFunction(() => xpiFile.exists() && xpiFile.remove(false)); return xpiFile; } @@ -110,7 +124,9 @@ function updateTemporaryXPI(xpiData, existingXPI) { const xpiFile = createTemporaryXPI(xpiData); // Check that the name of the new file is correct if (xpiFile.leafName !== existingName) { - throw new Error("New XPI created with unexpected name: " + xpiFile.leafName); + throw new Error( + "New XPI created with unexpected name: " + xpiFile.leafName + ); } return xpiFile; } @@ -147,7 +163,9 @@ async function removeTemporaryExtension(name, document) { /* exported removeTemporaryExtension */ async function removeExtension(id, name, document) { - info("Retrieve the extension instance from the addon manager, and uninstall it"); + info( + "Retrieve the extension instance from the addon manager, and uninstall it" + ); const extension = await AddonManager.getAddonByID(id); extension.uninstall(); diff --git a/devtools/client/aboutdebugging-new/test/browser/helper-mocks.js b/devtools/client/aboutdebugging-new/test/browser/helper-mocks.js index 27d5da773e9c..76796d6ec741 100644 --- a/devtools/client/aboutdebugging-new/test/browser/helper-mocks.js +++ b/devtools/client/aboutdebugging-new/test/browser/helper-mocks.js @@ -9,12 +9,19 @@ const MOCKS_ROOT = CHROME_URL_ROOT + "mocks/"; /* import-globals-from mocks/helper-adb-mock.js */ Services.scriptloader.loadSubScript(MOCKS_ROOT + "helper-adb-mock.js", this); /* import-globals-from mocks/helper-client-wrapper-mock.js */ -Services.scriptloader.loadSubScript(MOCKS_ROOT + "helper-client-wrapper-mock.js", this); +Services.scriptloader.loadSubScript( + MOCKS_ROOT + "helper-client-wrapper-mock.js", + this +); /* import-globals-from mocks/helper-runtime-client-factory-mock.js */ -Services.scriptloader.loadSubScript(MOCKS_ROOT + "helper-runtime-client-factory-mock.js", - this); +Services.scriptloader.loadSubScript( + MOCKS_ROOT + "helper-runtime-client-factory-mock.js", + this +); -const { RUNTIMES } = require("devtools/client/aboutdebugging-new/src/constants"); +const { + RUNTIMES, +} = require("devtools/client/aboutdebugging-new/src/constants"); /** * This wrapper around the mocks used in about:debugging tests provides helpers to @@ -62,7 +69,9 @@ class Mocks { // Add a client for THIS_FIREFOX, since about:debugging will start on the This Firefox // page. this._thisFirefoxClient = createThisFirefoxClientMock(); - this._clients[RUNTIMES.THIS_FIREFOX][RUNTIMES.THIS_FIREFOX] = this._thisFirefoxClient; + this._clients[RUNTIMES.THIS_FIREFOX][ + RUNTIMES.THIS_FIREFOX + ] = this._thisFirefoxClient; // Enable mocks and remove them after the test. this.enableMocks(); @@ -90,8 +99,9 @@ class Mocks { } createNetworkRuntime(host, runtimeInfo) { - const { addNetworkLocation } = - require("devtools/client/aboutdebugging-new/src/modules/network-locations"); + const { + addNetworkLocation, + } = require("devtools/client/aboutdebugging-new/src/modules/network-locations"); addNetworkLocation(host); // Add a valid client that can be returned for this particular runtime id. @@ -109,8 +119,9 @@ class Mocks { } removeNetworkRuntime(host) { - const { removeNetworkLocation } = - require("devtools/client/aboutdebugging-new/src/modules/network-locations"); + const { + removeNetworkLocation, + } = require("devtools/client/aboutdebugging-new/src/modules/network-locations"); removeNetworkLocation(host); delete this._clients[RUNTIMES.NETWORK][host]; @@ -198,8 +209,10 @@ class Mocks { /* exported Mocks */ const silenceWorkerUpdates = function() { - const { removeMockedModule, setMockedModule } = - require("devtools/client/shared/browser-loader-mocks"); + const { + removeMockedModule, + setMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); const mock = { WorkersListener: () => { @@ -209,8 +222,7 @@ const silenceWorkerUpdates = function() { }; }, }; - setMockedModule(mock, - "devtools/client/shared/workers-listener"); + setMockedModule(mock, "devtools/client/shared/workers-listener"); registerCleanupFunction(() => { removeMockedModule("devtools/client/shared/workers-listener"); diff --git a/devtools/client/aboutdebugging-new/test/browser/helper-real-usb.js b/devtools/client/aboutdebugging-new/test/browser/helper-real-usb.js index 2ba21d1d69ab..44fa7f0a109a 100644 --- a/devtools/client/aboutdebugging-new/test/browser/helper-real-usb.js +++ b/devtools/client/aboutdebugging-new/test/browser/helper-real-usb.js @@ -16,7 +16,7 @@ async function getExpectedRuntimeAll() { const runtimesPath = _getExpectedRuntimesPath(); const currentPath = env.get("PWD"); const path = `${currentPath}/${runtimesPath}`; - info(`Load ${ path }`); + info(`Load ${path}`); const buffer = await OS.File.read(path); const data = new TextDecoder().decode(buffer); return JSON.parse(data); @@ -31,8 +31,10 @@ function isAvailable() { async function openAboutDebuggingWithADB() { const { document, tab, window } = await openAboutDebugging(); - await pushPref("devtools.remote.adb.extensionURL", - CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi"); + await pushPref( + "devtools.remote.adb.extensionURL", + CHROME_URL_ROOT + "resources/test-adb-extension/adb-extension-#OS#.xpi" + ); await checkAdbNotRunning(); const { adbAddon } = require("devtools/shared/adb/adb-addon"); @@ -46,6 +48,8 @@ async function openAboutDebuggingWithADB() { /* exported openAboutDebuggingWithADB */ function _getExpectedRuntimesPath() { - const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); + const env = Cc["@mozilla.org/process/environment;1"].getService( + Ci.nsIEnvironment + ); return env.get("USB_RUNTIMES"); } diff --git a/devtools/client/aboutdebugging-new/test/browser/helper-serviceworker.js b/devtools/client/aboutdebugging-new/test/browser/helper-serviceworker.js index ac1602d421c1..8711e642d8a7 100644 --- a/devtools/client/aboutdebugging-new/test/browser/helper-serviceworker.js +++ b/devtools/client/aboutdebugging-new/test/browser/helper-serviceworker.js @@ -69,9 +69,11 @@ async function waitForServiceWorkerRegistering(workerText, document) { async function waitForRegistration(tab) { info("Wait until the registration appears on the window"); const swBrowser = tab.linkedBrowser; - await asyncWaitUntil(async () => ContentTask.spawn(swBrowser, {}, function() { - return content.wrappedJSObject.getRegistration(); - })); + await asyncWaitUntil(async () => + ContentTask.spawn(swBrowser, {}, function() { + return content.wrappedJSObject.getRegistration(); + }) + ); } /* exported waitForRegistration */ @@ -106,7 +108,11 @@ async function unregisterServiceWorker(tab) { return ContentTask.spawn(tab.linkedBrowser, {}, function() { const win = content.wrappedJSObject; // Check that the content page defines getRegistration. - is(typeof win.getRegistration, "function", "getRegistration is a valid function"); + is( + typeof win.getRegistration, + "function", + "getRegistration is a valid function" + ); win.getRegistration().unregister(); }); } diff --git a/devtools/client/aboutdebugging-new/test/browser/helper-telemetry.js b/devtools/client/aboutdebugging-new/test/browser/helper-telemetry.js index bee780b13fb8..4c6a3da6e9ac 100644 --- a/devtools/client/aboutdebugging-new/test/browser/helper-telemetry.js +++ b/devtools/client/aboutdebugging-new/test/browser/helper-telemetry.js @@ -36,18 +36,29 @@ function checkTelemetryEvents(expectedEvents, expectedSessionId) { } for (const expectedEvent of expectedEvents) { - const sameMethodEvents = evts.filter(e => e.method === expectedEvent.method); - ok(sameMethodEvents.length > 0, "Found event for method: " + expectedEvent.method); + const sameMethodEvents = evts.filter( + e => e.method === expectedEvent.method + ); + ok( + sameMethodEvents.length > 0, + "Found event for method: " + expectedEvent.method + ); - const sameExtrasEvents = - sameMethodEvents.filter(e => _eventHasExpectedExtras(e, expectedEvent)); - ok(sameExtrasEvents.length === 1, - "Found exactly one event matching the expected extras"); + const sameExtrasEvents = sameMethodEvents.filter(e => + _eventHasExpectedExtras(e, expectedEvent) + ); + ok( + sameExtrasEvents.length === 1, + "Found exactly one event matching the expected extras" + ); if (sameExtrasEvents.length === 0) { info(JSON.stringify(sameMethodEvents)); } - is(sameExtrasEvents[0].extras.session_id, expectedSessionId, - "Select page event has the expected session"); + is( + sameExtrasEvents[0].extras.session_id, + expectedSessionId, + "Select page event has the expected session" + ); } return evts; @@ -59,7 +70,9 @@ function checkTelemetryEvents(expectedEvents, expectedSessionId) { * Note that calling this will "clear" all the events. */ function getOpenEventSessionId() { - const openEvents = readAboutDebuggingEvents().filter(e => e.method === "open_adbg"); + const openEvents = readAboutDebuggingEvents().filter( + e => e.method === "open_adbg" + ); ok(!!openEvents[0], "Found an about:debugging open event"); return openEvents[0].extras.session_id; } diff --git a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-adb-mock.js b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-adb-mock.js index eea0a952df0b..ac3757c80a26 100644 --- a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-adb-mock.js +++ b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-adb-mock.js @@ -15,7 +15,9 @@ * - unregisterListener(listener) */ function enableAdbMock(mock) { - const { setMockedModule } = require("devtools/client/shared/browser-loader-mocks"); + const { + setMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); setMockedModule(mock, "devtools/shared/adb/adb"); } /* exported enableAdbMock */ @@ -24,7 +26,9 @@ function enableAdbMock(mock) { * Update the loader to clear the mock entry for the adb module. */ function disableAdbMock() { - const { removeMockedModule } = require("devtools/client/shared/browser-loader-mocks"); + const { + removeMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); removeMockedModule("devtools/shared/adb/adb"); } /* exported disableAdbMock */ @@ -114,13 +118,17 @@ function createAdbProcessMock() { /* exported createAdbProcessMock */ function enableAdbProcessMock(mock) { - const { setMockedModule } = require("devtools/client/shared/browser-loader-mocks"); + const { + setMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); setMockedModule(mock, "devtools/shared/adb/adb-process"); } /* exported enableAdbProcessMock */ function disableAdbProcessMock() { - const { removeMockedModule } = require("devtools/client/shared/browser-loader-mocks"); + const { + removeMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); removeMockedModule("devtools/shared/adb/adb-process"); } /* exported disableAdbProcessMock */ diff --git a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js index ffb0ee3ab8fd..784c2f9cc18a 100644 --- a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js +++ b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-client-wrapper-mock.js @@ -6,8 +6,9 @@ // This head file contains helpers to create mock versions of the ClientWrapper class // defined at devtools/client/aboutdebugging-new/src/modules/client-wrapper.js . -const { RUNTIME_PREFERENCE } = - require("devtools/client/aboutdebugging-new/src/constants"); +const { + RUNTIME_PREFERENCE, +} = require("devtools/client/aboutdebugging-new/src/constants"); // Sensible default values for runtime preferences that should be usable in most // situations @@ -90,12 +91,14 @@ function createClientMock() { setPreference: function(prefName, value) { this._preferences[prefName] = value; }, - getPerformancePanelUrl: () => "data:text/html;charset=UTF-8,fake_profiler_page", + getPerformancePanelUrl: () => + "data:text/html;charset=UTF-8,fake_profiler_page", loadPerformanceProfiler: () => {}, // Valid compatibility report checkVersionCompatibility: () => { - const { COMPATIBILITY_STATUS } = - require("devtools/client/shared/remote-debugging/version-checker"); + const { + COMPATIBILITY_STATUS, + } = require("devtools/client/shared/remote-debugging/version-checker"); return { status: COMPATIBILITY_STATUS.COMPATIBLE }; }, }; @@ -117,7 +120,7 @@ function createThisFirefoxClientMock() { }; const mockThisFirefoxClient = createClientMock(); - mockThisFirefoxClient.listTabs = () => ([mockAboutDebuggingTab]); + mockThisFirefoxClient.listTabs = () => [mockAboutDebuggingTab]; mockThisFirefoxClient.getDeviceDescription = () => mockThisFirefoxDescription; return mockThisFirefoxClient; diff --git a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-runtime-client-factory-mock.js b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-runtime-client-factory-mock.js index 82c39140118c..65f00b0366c0 100644 --- a/devtools/client/aboutdebugging-new/test/browser/mocks/helper-runtime-client-factory-mock.js +++ b/devtools/client/aboutdebugging-new/test/browser/mocks/helper-runtime-client-factory-mock.js @@ -12,9 +12,13 @@ * - createClientForRuntime(runtime) */ function enableRuntimeClientFactoryMock(mock) { - const { setMockedModule } = require("devtools/client/shared/browser-loader-mocks"); - setMockedModule(mock, - "devtools/client/aboutdebugging-new/src/modules/runtime-client-factory"); + const { + setMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); + setMockedModule( + mock, + "devtools/client/aboutdebugging-new/src/modules/runtime-client-factory" + ); } /* exported enableRuntimeClientFactoryMock */ @@ -22,9 +26,12 @@ function enableRuntimeClientFactoryMock(mock) { * Update the loader to clear the mock entry for the runtime-client-factory module. */ function disableRuntimeClientFactoryMock() { - const { removeMockedModule } = require("devtools/client/shared/browser-loader-mocks"); + const { + removeMockedModule, + } = require("devtools/client/shared/browser-loader-mocks"); removeMockedModule( - "devtools/client/aboutdebugging-new/src/modules/runtime-client-factory"); + "devtools/client/aboutdebugging-new/src/modules/runtime-client-factory" + ); } /* exported disableRuntimeClientFactoryMock */ diff --git a/devtools/client/aboutdebugging-new/test/browser/resources/service-workers/push-sw.js b/devtools/client/aboutdebugging-new/test/browser/resources/service-workers/push-sw.js index 0496b004b597..20710378c777 100644 --- a/devtools/client/aboutdebugging-new/test/browser/resources/service-workers/push-sw.js +++ b/devtools/client/aboutdebugging-new/test/browser/resources/service-workers/push-sw.js @@ -22,9 +22,11 @@ self.addEventListener("install", function(event) { // Claim control over the currently open test page when activating. self.addEventListener("activate", function(event) { - event.waitUntil(self.clients.claim().then(function() { - return postMessage("sw-claimed"); - })); + event.waitUntil( + self.clients.claim().then(function() { + return postMessage("sw-claimed"); + }) + ); }); // Forward all "push" events to the controlled window. diff --git a/devtools/client/aboutdebugging-new/test/jest/babel.config.js b/devtools/client/aboutdebugging-new/test/jest/babel.config.js index be196d307847..a9e47ba7fb39 100644 --- a/devtools/client/aboutdebugging-new/test/jest/babel.config.js +++ b/devtools/client/aboutdebugging-new/test/jest/babel.config.js @@ -4,5 +4,5 @@ "use strict"; module.exports = { - "plugins": ["@babel/plugin-proposal-async-generator-functions"], + plugins: ["@babel/plugin-proposal-async-generator-functions"], }; diff --git a/devtools/client/aboutdebugging-new/test/jest/components/shared-message.test.js b/devtools/client/aboutdebugging-new/test/jest/components/shared-message.test.js index 4c9bf9811d38..ae361f02b956 100644 --- a/devtools/client/aboutdebugging-new/test/jest/components/shared-message.test.js +++ b/devtools/client/aboutdebugging-new/test/jest/components/shared-message.test.js @@ -8,59 +8,70 @@ */ /** -* ============================================================ -* PLEASE NOTE: -* This test is failing due to https://bugzilla.mozilla.org/show_bug.cgi?id=1546370 -* The fix described in 1546370 is depending on try supporting a Node version >=10 -* ============================================================ -*/ + * ============================================================ + * PLEASE NOTE: + * This test is failing due to https://bugzilla.mozilla.org/show_bug.cgi?id=1546370 + * The fix described in 1546370 is depending on try supporting a Node version >=10 + * ============================================================ + */ const { shallow } = require("enzyme"); const React = require("react"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); -const { MESSAGE_LEVEL } = require("devtools/client/aboutdebugging-new/src/constants"); +const { + MESSAGE_LEVEL, +} = require("devtools/client/aboutdebugging-new/src/constants"); -const Message = React.createFactory(require("devtools/client/aboutdebugging-new/src/components/shared/Message")); +const Message = React.createFactory( + require("devtools/client/aboutdebugging-new/src/components/shared/Message") +); describe("Message component", () => { it("renders the expected snapshot for INFO level", () => { - const message = shallow(Message({ - children: dom.div({}, "Message content"), - className: "some-classname-1", - level: MESSAGE_LEVEL.INFO, - })); + const message = shallow( + Message({ + children: dom.div({}, "Message content"), + className: "some-classname-1", + level: MESSAGE_LEVEL.INFO, + }) + ); expect(message).toMatchSnapshot(); }); it("renders the expected snapshot for WARNING level", () => { - const message = shallow(Message({ - children: dom.div({}, "Message content"), - className: "some-classname-2", - level: MESSAGE_LEVEL.WARNING, - })); + const message = shallow( + Message({ + children: dom.div({}, "Message content"), + className: "some-classname-2", + level: MESSAGE_LEVEL.WARNING, + }) + ); expect(message).toMatchSnapshot(); }); it("renders the expected snapshot for ERROR level", () => { - const message = shallow(Message({ - children: dom.div({}, "Message content"), - className: "some-classname-3", - level: MESSAGE_LEVEL.ERROR, - })); + const message = shallow( + Message({ + children: dom.div({}, "Message content"), + className: "some-classname-3", + level: MESSAGE_LEVEL.ERROR, + }) + ); expect(message).toMatchSnapshot(); }); }); describe("Message component renders with closing button", () => { it("renders the expected snapshot for Message with closing button", () => { - const message = shallow(Message({ - children: dom.div({}, "Message content"), - className: "some-classname-1", - level: MESSAGE_LEVEL.INFO, - isCloseable: true, - })); + const message = shallow( + Message({ + children: dom.div({}, "Message content"), + className: "some-classname-1", + level: MESSAGE_LEVEL.INFO, + isCloseable: true, + }) + ); expect(message).toMatchSnapshot(); }); }); - diff --git a/devtools/client/aboutdebugging-new/test/jest/jest.config.js b/devtools/client/aboutdebugging-new/test/jest/jest.config.js index 1334a1a97f21..d15625ecd539 100644 --- a/devtools/client/aboutdebugging-new/test/jest/jest.config.js +++ b/devtools/client/aboutdebugging-new/test/jest/jest.config.js @@ -11,10 +11,6 @@ module.exports = { // Map all require("devtools/...") to the real devtools root. "^devtools\\/(.*)": `${__dirname}/../../../../$1`, }, - setupFiles: [ - "setup.js", - ], - snapshotSerializers: [ - "enzyme-to-json/serializer", - ], + setupFiles: ["setup.js"], + snapshotSerializers: ["enzyme-to-json/serializer"], }; diff --git a/devtools/client/aboutdebugging-new/test/unit/test_extensions_path.js b/devtools/client/aboutdebugging-new/test/unit/test_extensions_path.js index 390fb05cd082..c2e660cfb27b 100644 --- a/devtools/client/aboutdebugging-new/test/unit/test_extensions_path.js +++ b/devtools/client/aboutdebugging-new/test/unit/test_extensions_path.js @@ -2,22 +2,26 @@ "use strict"; -const { parseFileUri } = - require("devtools/client/aboutdebugging-new/src/modules/extensions-helper"); +const { + parseFileUri, +} = require("devtools/client/aboutdebugging-new/src/modules/extensions-helper"); add_task(async function testParseFileUri() { equal( parseFileUri("file:///home/me/my-extension/"), "/home/me/my-extension/", - "UNIX paths are supported"); + "UNIX paths are supported" + ); equal( parseFileUri("file:///C:/Documents/my-extension/"), "C:/Documents/my-extension/", - "Windows paths are supported"); + "Windows paths are supported" + ); equal( parseFileUri("file://home/Documents/my-extension/"), "home/Documents/my-extension/", - "Windows network paths are supported"); + "Windows network paths are supported" + ); }); diff --git a/devtools/client/aboutdebugging/components/Aboutdebugging.js b/devtools/client/aboutdebugging/components/Aboutdebugging.js index 010b6f7cbcd0..b0badc0293b5 100644 --- a/devtools/client/aboutdebugging/components/Aboutdebugging.js +++ b/devtools/client/aboutdebugging/components/Aboutdebugging.js @@ -6,44 +6,58 @@ "use strict"; -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); const PanelMenu = createFactory(require("./PanelMenu")); -loader.lazyGetter(this, "AddonsPanel", - () => createFactory(require("./addons/Panel"))); -loader.lazyGetter(this, "TabsPanel", - () => createFactory(require("./tabs/Panel"))); -loader.lazyGetter(this, "WorkersPanel", - () => createFactory(require("./workers/Panel"))); +loader.lazyGetter(this, "AddonsPanel", () => + createFactory(require("./addons/Panel")) +); +loader.lazyGetter(this, "TabsPanel", () => + createFactory(require("./tabs/Panel")) +); +loader.lazyGetter(this, "WorkersPanel", () => + createFactory(require("./workers/Panel")) +); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); -loader.lazyRequireGetter(this, "Telemetry", - "devtools/client/shared/telemetry"); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); +loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry"); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); -const panels = [{ - id: "addons", - name: Strings.GetStringFromName("addons"), - icon: "chrome://devtools/skin/images/debugging-addons.svg", - component: AddonsPanel, -}, { - id: "tabs", - name: Strings.GetStringFromName("tabs"), - icon: "chrome://devtools/skin/images/debugging-tabs.svg", - component: TabsPanel, -}, { - id: "workers", - name: Strings.GetStringFromName("workers"), - icon: "chrome://devtools/skin/images/debugging-workers.svg", - component: WorkersPanel, -}]; +const panels = [ + { + id: "addons", + name: Strings.GetStringFromName("addons"), + icon: "chrome://devtools/skin/images/debugging-addons.svg", + component: AddonsPanel, + }, + { + id: "tabs", + name: Strings.GetStringFromName("tabs"), + icon: "chrome://devtools/skin/images/debugging-tabs.svg", + component: TabsPanel, + }, + { + id: "workers", + name: Strings.GetStringFromName("workers"), + icon: "chrome://devtools/skin/images/debugging-workers.svg", + component: WorkersPanel, + }, +]; const defaultPanelId = "addons"; @@ -101,20 +115,27 @@ class AboutDebuggingApp extends Component { let panel; if (selectedPanel) { - panel = selectedPanel.component({ client, connect, id: selectedPanel.id }); + panel = selectedPanel.component({ + client, + connect, + id: selectedPanel.id, + }); } else { - panel = ( - dom.div({ className: "error-page" }, - dom.h1({ className: "header-name" }, - Strings.GetStringFromName("pageNotFound") - ), - dom.h4({ className: "error-page-details" }, - Strings.formatStringFromName("doesNotExist", [selectedPanelId])) + panel = dom.div( + { className: "error-page" }, + dom.h1( + { className: "header-name" }, + Strings.GetStringFromName("pageNotFound") + ), + dom.h4( + { className: "error-page-details" }, + Strings.formatStringFromName("doesNotExist", [selectedPanelId]) ) ); } - return dom.div({ className: "app" }, + return dom.div( + { className: "app" }, PanelMenu({ panels, selectedPanelId, selectPanel }), dom.div({ className: "main-content" }, panel) ); diff --git a/devtools/client/aboutdebugging/components/PanelHeader.js b/devtools/client/aboutdebugging/components/PanelHeader.js index 7c1ebf3b5fe5..d54c34953dce 100644 --- a/devtools/client/aboutdebugging/components/PanelHeader.js +++ b/devtools/client/aboutdebugging/components/PanelHeader.js @@ -19,8 +19,10 @@ class PanelHeader extends Component { render() { const { name, id } = this.props; - return dom.div({ className: "header" }, - dom.h1({ id, className: "header-name" }, name)); + return dom.div( + { className: "header" }, + dom.h1({ id, className: "header-name" }, name) + ); } } diff --git a/devtools/client/aboutdebugging/components/PanelMenu.js b/devtools/client/aboutdebugging/components/PanelMenu.js index 1025f560e0c7..2f4bbbb8b860 100644 --- a/devtools/client/aboutdebugging/components/PanelMenu.js +++ b/devtools/client/aboutdebugging/components/PanelMenu.js @@ -4,7 +4,10 @@ "use strict"; -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const PanelMenuEntry = createFactory(require("./PanelMenuEntry")); @@ -12,12 +15,14 @@ const PanelMenuEntry = createFactory(require("./PanelMenuEntry")); class PanelMenu extends Component { static get propTypes() { return { - panels: PropTypes.arrayOf(PropTypes.shape({ - id: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - icon: PropTypes.string.isRequired, - component: PropTypes.func.isRequired, - })).isRequired, + panels: PropTypes.arrayOf( + PropTypes.shape({ + id: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + icon: PropTypes.string.isRequired, + component: PropTypes.func.isRequired, + }) + ).isRequired, selectPanel: PropTypes.func.isRequired, selectedPanelId: PropTypes.string, }; diff --git a/devtools/client/aboutdebugging/components/PanelMenuEntry.js b/devtools/client/aboutdebugging/components/PanelMenuEntry.js index 7fae2ff0305c..f1dc6b5036e7 100644 --- a/devtools/client/aboutdebugging/components/PanelMenuEntry.js +++ b/devtools/client/aboutdebugging/components/PanelMenuEntry.js @@ -34,15 +34,18 @@ class PanelMenuEntry extends Component { // Here .category, .category-icon, .category-name classnames are used to // apply common styles defined. const className = "category" + (selected ? " selected" : ""); - return dom.button({ - "aria-selected": selected, - "aria-controls": id + "-panel", - className, - onClick: this.onClick, - tabIndex: "0", - role: "tab" }, - dom.img({ className: "category-icon", src: icon, role: "presentation" }), - dom.div({ className: "category-name" }, name)); + return dom.button( + { + "aria-selected": selected, + "aria-controls": id + "-panel", + className, + onClick: this.onClick, + tabIndex: "0", + role: "tab", + }, + dom.img({ className: "category-icon", src: icon, role: "presentation" }), + dom.div({ className: "category-name" }, name) + ); } } diff --git a/devtools/client/aboutdebugging/components/TargetList.js b/devtools/client/aboutdebugging/components/TargetList.js index 33f21a64c74f..5a222781e2b9 100644 --- a/devtools/client/aboutdebugging/components/TargetList.js +++ b/devtools/client/aboutdebugging/components/TargetList.js @@ -9,11 +9,16 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); const LocaleCompare = (a, b) => { return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); @@ -67,8 +72,11 @@ class TargetList extends Component { content = dom.p(null, Strings.GetStringFromName("nothing")); } - return dom.div({ id: this.props.id, className: "targets" }, - dom.h2(null, this.props.name), content); + return dom.div( + { id: this.props.id, className: "targets" }, + dom.h2(null, this.props.name), + content + ); } } diff --git a/devtools/client/aboutdebugging/components/addons/Controls.js b/devtools/client/aboutdebugging/components/addons/Controls.js index 6234e1379c15..ec5fefbf948e 100644 --- a/devtools/client/aboutdebugging/components/addons/Controls.js +++ b/devtools/client/aboutdebugging/components/addons/Controls.js @@ -7,21 +7,31 @@ "use strict"; -loader.lazyImporter(this, "AddonManager", - "resource://gre/modules/AddonManager.jsm"); +loader.lazyImporter( + this, + "AddonManager", + "resource://gre/modules/AddonManager.jsm" +); -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); -const { openTemporaryExtension } = require("devtools/client/aboutdebugging/modules/addon"); +const { + openTemporaryExtension, +} = require("devtools/client/aboutdebugging/modules/addon"); const Services = require("Services"); const AddonsInstallError = createFactory(require("./InstallError")); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); -const MORE_INFO_URL = "https://developer.mozilla.org/docs/Tools" + - "/about:debugging#Enabling_add-on_debugging"; +const MORE_INFO_URL = + "https://developer.mozilla.org/docs/Tools" + + "/about:debugging#Enabling_add-on_debugging"; class AddonsControls extends Component { static get propTypes() { @@ -37,7 +47,9 @@ class AddonsControls extends Component { installError: null, }; - this.onEnableAddonDebuggingChange = this.onEnableAddonDebuggingChange.bind(this); + this.onEnableAddonDebuggingChange = this.onEnableAddonDebuggingChange.bind( + this + ); this.loadAddonFromFile = this.loadAddonFromFile.bind(this); this.retryInstall = this.retryInstall.bind(this); this.installAddon = this.installAddon.bind(this); @@ -73,11 +85,17 @@ class AddonsControls extends Component { render() { const { debugDisabled } = this.props; - const isXpinstallEnabled = Services.prefs.getBoolPref("xpinstall.enabled", true); + const isXpinstallEnabled = Services.prefs.getBoolPref( + "xpinstall.enabled", + true + ); - return dom.div({ className: "addons-top" }, - dom.div({ className: "addons-controls" }, - dom.div({ className: "addons-options toggle-container-with-text" }, + return dom.div( + { className: "addons-top" }, + dom.div( + { className: "addons-controls" }, + dom.div( + { className: "addons-options toggle-container-with-text" }, dom.input({ id: "enable-addon-debugging", type: "checkbox", @@ -85,24 +103,34 @@ class AddonsControls extends Component { onChange: this.onEnableAddonDebuggingChange, role: "checkbox", }), - dom.label({ - className: "addons-debugging-label", - htmlFor: "enable-addon-debugging", - title: Strings.GetStringFromName("addonDebugging.tooltip"), - }, Strings.GetStringFromName("addonDebugging.label")), - dom.a({ href: MORE_INFO_URL, target: "_blank" }, - Strings.GetStringFromName("addonDebugging.learnMore") + dom.label( + { + className: "addons-debugging-label", + htmlFor: "enable-addon-debugging", + title: Strings.GetStringFromName("addonDebugging.tooltip"), + }, + Strings.GetStringFromName("addonDebugging.label") ), + dom.a( + { href: MORE_INFO_URL, target: "_blank" }, + Strings.GetStringFromName("addonDebugging.learnMore") + ) ), - isXpinstallEnabled ? dom.button({ - id: "load-addon-from-file", - onClick: this.loadAddonFromFile, - }, Strings.GetStringFromName("loadTemporaryAddon2")) : null, + isXpinstallEnabled + ? dom.button( + { + id: "load-addon-from-file", + onClick: this.loadAddonFromFile, + }, + Strings.GetStringFromName("loadTemporaryAddon2") + ) + : null ), AddonsInstallError({ error: this.state.installError, retryInstall: this.retryInstall, - })); + }) + ); } } diff --git a/devtools/client/aboutdebugging/components/addons/InstallError.js b/devtools/client/aboutdebugging/components/addons/InstallError.js index 732aef85330c..1cacc23321bd 100644 --- a/devtools/client/aboutdebugging/components/addons/InstallError.js +++ b/devtools/client/aboutdebugging/components/addons/InstallError.js @@ -12,7 +12,8 @@ const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); class AddonsInstallError extends Component { static get propTypes() { @@ -27,13 +28,16 @@ class AddonsInstallError extends Component { if (!this.props.error) { return null; } - const text = Strings.formatStringFromName("addonInstallError", [error.message]); + const text = Strings.formatStringFromName("addonInstallError", [ + error.message, + ]); - const additionalErrors = Array.isArray(error.additionalErrors) ? - dom.div( - { className: "addons-install-error__additional-errors" }, - error.additionalErrors.join(" ") - ) : null; + const additionalErrors = Array.isArray(error.additionalErrors) + ? dom.div( + { className: "addons-install-error__additional-errors" }, + error.additionalErrors.join(" ") + ) + : null; return dom.div( { className: "addons-install-error" }, @@ -45,7 +49,9 @@ class AddonsInstallError extends Component { ), dom.button( { className: "addons-install-retry", onClick: this.props.retryInstall }, - Strings.GetStringFromName("retryTemporaryInstall"))); + Strings.GetStringFromName("retryTemporaryInstall") + ) + ); } } diff --git a/devtools/client/aboutdebugging/components/addons/Panel.js b/devtools/client/aboutdebugging/components/addons/Panel.js index 2dee40c81292..5b5b93d62e22 100644 --- a/devtools/client/aboutdebugging/components/addons/Panel.js +++ b/devtools/client/aboutdebugging/components/addons/Panel.js @@ -5,8 +5,14 @@ "use strict"; const { AddonManager } = require("resource://gre/modules/AddonManager.jsm"); -const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", null); -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); +const { Management } = ChromeUtils.import( + "resource://gre/modules/Extension.jsm", + null +); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); @@ -16,18 +22,24 @@ const AddonTarget = createFactory(require("./Target")); const PanelHeader = createFactory(require("../PanelHeader")); const TargetList = createFactory(require("../TargetList")); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); const ExtensionIcon = "chrome://mozapps/skin/extensions/extensionGeneric.svg"; const CHROME_ENABLED_PREF = "devtools.chrome.enabled"; const REMOTE_ENABLED_PREF = "devtools.debugger.remote-enabled"; const SYSTEM_ENABLED_PREF = "devtools.aboutdebugging.showHiddenAddons"; -const WEB_EXT_URL = "https://developer.mozilla.org/Add-ons" + - "/WebExtensions/Getting_started_with_web-ext"; +const WEB_EXT_URL = + "https://developer.mozilla.org/Add-ons" + + "/WebExtensions/Getting_started_with_web-ext"; class AddonsPanel extends Component { static get propTypes() { @@ -62,12 +74,12 @@ class AddonsPanel extends Component { // get populated on the extension. Management.on("startup", this.updateAddonsList); - Services.prefs.addObserver(CHROME_ENABLED_PREF, - this.updateDebugStatus); - Services.prefs.addObserver(REMOTE_ENABLED_PREF, - this.updateDebugStatus); - Services.prefs.addObserver(SYSTEM_ENABLED_PREF, - this.updateShowSystemStatus); + Services.prefs.addObserver(CHROME_ENABLED_PREF, this.updateDebugStatus); + Services.prefs.addObserver(REMOTE_ENABLED_PREF, this.updateDebugStatus); + Services.prefs.addObserver( + SYSTEM_ENABLED_PREF, + this.updateShowSystemStatus + ); this.updateDebugStatus(); this.updateShowSystemStatus(); @@ -78,12 +90,12 @@ class AddonsPanel extends Component { AddonManager.removeAddonListener(this); Management.off("startup", this.updateAddonsList); - Services.prefs.removeObserver(CHROME_ENABLED_PREF, - this.updateDebugStatus); - Services.prefs.removeObserver(REMOTE_ENABLED_PREF, - this.updateDebugStatus); - Services.prefs.removeObserver(SYSTEM_ENABLED_PREF, - this.updateShowSystemStatus); + Services.prefs.removeObserver(CHROME_ENABLED_PREF, this.updateDebugStatus); + Services.prefs.removeObserver(REMOTE_ENABLED_PREF, this.updateDebugStatus); + Services.prefs.removeObserver( + SYSTEM_ENABLED_PREF, + this.updateShowSystemStatus + ); } updateDebugStatus() { @@ -95,34 +107,41 @@ class AddonsPanel extends Component { } updateShowSystemStatus() { - const showSystemAddons = Services.prefs.getBoolPref(SYSTEM_ENABLED_PREF, false); + const showSystemAddons = Services.prefs.getBoolPref( + SYSTEM_ENABLED_PREF, + false + ); this.setState({ showSystemAddons }); } updateAddonsList() { - this.props.client.mainRoot.listAddons() - .then(addons => { - const extensions = addons.filter(addon => addon.debuggable).map(addon => { - return { - addonTargetFront: addon, - addonID: addon.id, - icon: addon.iconURL || ExtensionIcon, - isSystem: addon.isSystem, - manifestURL: addon.manifestURL, - name: addon.name, - temporarilyInstalled: addon.temporarilyInstalled, - url: addon.url, - warnings: addon.warnings, - }; - }); + this.props.client.mainRoot.listAddons().then( + addons => { + const extensions = addons + .filter(addon => addon.debuggable) + .map(addon => { + return { + addonTargetFront: addon, + addonID: addon.id, + icon: addon.iconURL || ExtensionIcon, + isSystem: addon.isSystem, + manifestURL: addon.manifestURL, + name: addon.name, + temporarilyInstalled: addon.temporarilyInstalled, + url: addon.url, + warnings: addon.warnings, + }; + }); this.setState({ extensions }); const { AboutDebugging } = window; AboutDebugging.emit("addons-updated"); - }, error => { + }, + error => { throw new Error("Client error while listing addons: " + error); - }); + } + ); } /** @@ -162,70 +181,89 @@ class AddonsPanel extends Component { const targetClass = AddonTarget; const installedTargets = targets.filter( - (target) => !target.isSystem && !target.temporarilyInstalled); - const temporaryTargets = targets.filter((target) => target.temporarilyInstalled); - const systemTargets = showSystemAddons && targets.filter((target) => target.isSystem); + target => !target.isSystem && !target.temporarilyInstalled + ); + const temporaryTargets = targets.filter( + target => target.temporarilyInstalled + ); + const systemTargets = + showSystemAddons && targets.filter(target => target.isSystem); // Don't show the temporary addons category if users can't install addons. - const isXpinstallEnabled = Services.prefs.getBoolPref("xpinstall.enabled", true); + const isXpinstallEnabled = Services.prefs.getBoolPref( + "xpinstall.enabled", + true + ); - return dom.div({ - id: id + "-panel", - className: "panel", - role: "tabpanel", - "aria-labelledby": id + "-header", - }, - PanelHeader({ - id: id + "-header", - name: Strings.GetStringFromName("addons"), - }), - AddonsControls({ debugDisabled }), - isXpinstallEnabled ? dom.div({ id: "temporary-addons" }, - TargetList({ - id: "temporary-extensions", - name: temporaryName, - targets: temporaryTargets, - client, - connect, - debugDisabled, - targetClass, - sort: true, + return dom.div( + { + id: id + "-panel", + className: "panel", + role: "tabpanel", + "aria-labelledby": id + "-header", + }, + PanelHeader({ + id: id + "-header", + name: Strings.GetStringFromName("addons"), }), - dom.div({ className: "addons-tip"}, - dom.div({ className: "addons-tip-icon"}), - dom.span({ - className: "addons-web-ext-tip", - }, Strings.GetStringFromName("webExtTip")), - dom.a({ href: WEB_EXT_URL, target: "_blank" }, - Strings.GetStringFromName("webExtTip.learnMore") - ) - ) - ) : null, - dom.div({ id: "addons" }, - TargetList({ - id: "extensions", - name: installedName, - targets: installedTargets, - client, - connect, - debugDisabled, - targetClass, - sort: true, - }) - ), - showSystemAddons ? - dom.div({ id: "system-addons" }, + AddonsControls({ debugDisabled }), + isXpinstallEnabled + ? dom.div( + { id: "temporary-addons" }, + TargetList({ + id: "temporary-extensions", + name: temporaryName, + targets: temporaryTargets, + client, + connect, + debugDisabled, + targetClass, + sort: true, + }), + dom.div( + { className: "addons-tip" }, + dom.div({ className: "addons-tip-icon" }), + dom.span( + { + className: "addons-web-ext-tip", + }, + Strings.GetStringFromName("webExtTip") + ), + dom.a( + { href: WEB_EXT_URL, target: "_blank" }, + Strings.GetStringFromName("webExtTip.learnMore") + ) + ) + ) + : null, + dom.div( + { id: "addons" }, TargetList({ - id: "system-extensions", - name: systemName, - targets: systemTargets, + id: "extensions", + name: installedName, + targets: installedTargets, client, connect, debugDisabled, targetClass, sort: true, }) - ) : null, + ), + showSystemAddons + ? dom.div( + { id: "system-addons" }, + TargetList({ + id: "system-extensions", + name: systemName, + targets: systemTargets, + client, + connect, + debugDisabled, + targetClass, + sort: true, + }) + ) + : null ); } } diff --git a/devtools/client/aboutdebugging/components/addons/Target.js b/devtools/client/aboutdebugging/components/addons/Target.js index 92bb312da3a3..ede4c4560467 100644 --- a/devtools/client/aboutdebugging/components/addons/Target.js +++ b/devtools/client/aboutdebugging/components/addons/Target.js @@ -18,31 +18,43 @@ const { } = require("../../modules/addon"); const Services = require("Services"); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); -const TEMP_ID_URL = "https://developer.mozilla.org/Add-ons" + - "/WebExtensions/WebExtensions_and_the_Add-on_ID"; -const LEGACY_WARNING_URL = "https://wiki.mozilla.org/Add-ons/Future_of_Bootstrap"; +const TEMP_ID_URL = + "https://developer.mozilla.org/Add-ons" + + "/WebExtensions/WebExtensions_and_the_Add-on_ID"; +const LEGACY_WARNING_URL = + "https://wiki.mozilla.org/Add-ons/Future_of_Bootstrap"; function filePathForTarget(target) { // Only show file system paths, and only for temporarily installed add-ons. - if (!target.temporarilyInstalled || !target.url || !target.url.startsWith("file://")) { + if ( + !target.temporarilyInstalled || + !target.url || + !target.url.startsWith("file://") + ) { return []; } const path = parseFileUri(target.url); return [ dom.dt( { className: "addon-target-info-label" }, - Strings.GetStringFromName("location")), + Strings.GetStringFromName("location") + ), // Wrap the file path in a span so we can do some RTL/LTR swapping to get // the ellipsis on the left. dom.dd( { className: "addon-target-info-content file-path" }, - dom.span({ className: "file-path-inner", title: path }, path), + dom.span({ className: "file-path-inner", title: path }, path) ), ]; } @@ -51,14 +63,11 @@ function addonIDforTarget(target) { return [ dom.dt( { className: "addon-target-info-label" }, - Strings.GetStringFromName("extensionID"), + Strings.GetStringFromName("extensionID") ), dom.dd( { className: "addon-target-info-content extension-id" }, - dom.span( - { title: target.addonID }, - target.addonID - ) + dom.span({ title: target.addonID }, target.addonID) ), ]; } @@ -72,34 +81,30 @@ function internalIDForTarget(target) { return [ dom.dt( { className: "addon-target-info-label" }, - Strings.GetStringFromName("internalUUID"), + Strings.GetStringFromName("internalUUID") ), dom.dd( { className: "addon-target-info-content internal-uuid" }, - dom.span( - { title: uuid }, - uuid - ), + dom.span({ title: uuid }, uuid), dom.span( { className: "addon-target-info-more" }, dom.a( - { href: target.manifestURL, target: "_blank", className: "manifest-url" }, - Strings.GetStringFromName("manifestURL"), - ), + { + href: target.manifestURL, + target: "_blank", + className: "manifest-url", + }, + Strings.GetStringFromName("manifestURL") + ) ) ), ]; } function showMessages(target) { - const messages = [ - ...warningMessages(target), - ...infoMessages(target), - ]; + const messages = [...warningMessages(target), ...infoMessages(target)]; if (messages.length > 0) { - return dom.ul( - { className: "addon-target-messages" }, - ...messages); + return dom.ul({ className: "addon-target-messages" }, ...messages); } return null; } @@ -107,13 +112,21 @@ function showMessages(target) { function infoMessages(target) { const messages = []; if (isTemporaryID(target.addonID)) { - messages.push(dom.li( - { className: "addon-target-info-message addon-target-message" }, - Strings.GetStringFromName("temporaryID"), - " ", - dom.a({ href: TEMP_ID_URL, className: "temporary-id-url", target: "_blank" }, - Strings.GetStringFromName("temporaryID.learnMore") - ))); + messages.push( + dom.li( + { className: "addon-target-info-message addon-target-message" }, + Strings.GetStringFromName("temporaryID"), + " ", + dom.a( + { + href: TEMP_ID_URL, + className: "temporary-id-url", + target: "_blank", + }, + Strings.GetStringFromName("temporaryID.learnMore") + ) + ) + ); } return messages; @@ -123,27 +136,33 @@ function warningMessages(target) { let messages = []; if (target.addonTargetFront.isLegacyTemporaryExtension()) { - messages.push(dom.li( - { - className: "addon-target-warning-message addon-target-message", - }, - Strings.GetStringFromName("legacyExtensionWarning"), - " ", - dom.a( + messages.push( + dom.li( { - href: LEGACY_WARNING_URL, - target: "_blank", + className: "addon-target-warning-message addon-target-message", }, - Strings.GetStringFromName("legacyExtensionWarning.learnMore")) - )); + Strings.GetStringFromName("legacyExtensionWarning"), + " ", + dom.a( + { + href: LEGACY_WARNING_URL, + target: "_blank", + }, + Strings.GetStringFromName("legacyExtensionWarning.learnMore") + ) + ) + ); } const warnings = target.warnings || []; - messages = messages.concat(warnings.map((warning) => { - return dom.li( - { className: "addon-target-warning-message addon-target-message" }, - warning); - })); + messages = messages.concat( + warnings.map(warning => { + return dom.li( + { className: "addon-target-warning-message addon-target-message" }, + warning + ); + }) + ); return messages; } @@ -190,7 +209,9 @@ class AddonTarget extends Component { await target.addonTargetFront.reload(); AboutDebugging.emit("addon-reload"); } catch (e) { - throw new Error("Error reloading addon " + target.addonID + ": " + e.message); + throw new Error( + "Error reloading addon " + target.addonID + ": " + e.message + ); } } @@ -198,8 +219,12 @@ class AddonTarget extends Component { const { target, debugDisabled } = this.props; return dom.li( - { className: "card addon-target-container", "data-addon-id": target.addonID }, - dom.div({ className: "target-card-heading target" }, + { + className: "card addon-target-container", + "data-addon-id": target.addonID, + }, + dom.div( + { className: "target-card-heading target" }, dom.img({ className: "target-icon addon-target-icon", role: "presentation", @@ -207,34 +232,48 @@ class AddonTarget extends Component { }), dom.span( { className: "target-name addon-target-name", title: target.name }, - target.name) + target.name + ) ), showMessages(target), dom.dl( { className: "addon-target-info" }, ...filePathForTarget(target), ...addonIDforTarget(target), - ...internalIDForTarget(target), + ...internalIDForTarget(target) ), - dom.div({className: "target-card-actions"}, - dom.button({ - className: "target-card-action-link debug-button addon-target-button", - onClick: this.debug, - disabled: debugDisabled, - }, Strings.GetStringFromName("debug")), + dom.div( + { className: "target-card-actions" }, + dom.button( + { + className: + "target-card-action-link debug-button addon-target-button", + onClick: this.debug, + disabled: debugDisabled, + }, + Strings.GetStringFromName("debug") + ), target.temporarilyInstalled - ? dom.button({ - className: "target-card-action-link reload-button addon-target-button", - onClick: this.reload, - }, Strings.GetStringFromName("reload")) + ? dom.button( + { + className: + "target-card-action-link reload-button addon-target-button", + onClick: this.reload, + }, + Strings.GetStringFromName("reload") + ) : null, target.temporarilyInstalled - ? dom.button({ - className: "target-card-action-link uninstall-button addon-target-button", - onClick: this.uninstall, - }, Strings.GetStringFromName("remove")) - : null, - ), + ? dom.button( + { + className: + "target-card-action-link uninstall-button addon-target-button", + onClick: this.uninstall, + }, + Strings.GetStringFromName("remove") + ) + : null + ) ); } } diff --git a/devtools/client/aboutdebugging/components/tabs/Panel.js b/devtools/client/aboutdebugging/components/tabs/Panel.js index 8138d9377031..715eccdf24e0 100644 --- a/devtools/client/aboutdebugging/components/tabs/Panel.js +++ b/devtools/client/aboutdebugging/components/tabs/Panel.js @@ -6,7 +6,10 @@ "use strict"; -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); @@ -15,11 +18,16 @@ const PanelHeader = createFactory(require("../PanelHeader")); const TargetList = createFactory(require("../TargetList")); const TabTarget = createFactory(require("./Target")); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); class TabsPanel extends Component { static get propTypes() { @@ -56,10 +64,13 @@ class TabsPanel extends Component { for (const tab of tabs) { if (tab.favicon) { - const base64Favicon = btoa(String.fromCharCode.apply(String, tab.favicon)); + const base64Favicon = btoa( + String.fromCharCode.apply(String, tab.favicon) + ); tab.icon = "data:image/png;base64," + base64Favicon; } else { - tab.icon = "chrome://devtools/skin/images/aboutdebugging-globe-icon.svg"; + tab.icon = + "chrome://devtools/skin/images/aboutdebugging-globe-icon.svg"; } } @@ -70,27 +81,30 @@ class TabsPanel extends Component { const { client, connect, id } = this.props; const { tabs } = this.state; - return dom.div({ - id: id + "-panel", - className: "panel", - role: "tabpanel", - "aria-labelledby": id + "-header", - }, - PanelHeader({ - id: id + "-header", - name: Strings.GetStringFromName("tabs"), - }), - dom.div({}, - TargetList({ - client, - connect, - id: "tabs", + return dom.div( + { + id: id + "-panel", + className: "panel", + role: "tabpanel", + "aria-labelledby": id + "-header", + }, + PanelHeader({ + id: id + "-header", name: Strings.GetStringFromName("tabs"), - sort: false, - targetClass: TabTarget, - targets: tabs, - }) - )); + }), + dom.div( + {}, + TargetList({ + client, + connect, + id: "tabs", + name: Strings.GetStringFromName("tabs"), + sort: false, + targetClass: TabTarget, + targets: tabs, + }) + ) + ); } } diff --git a/devtools/client/aboutdebugging/components/tabs/Target.js b/devtools/client/aboutdebugging/components/tabs/Target.js index b4b7f486aa09..a633045d7d4f 100644 --- a/devtools/client/aboutdebugging/components/tabs/Target.js +++ b/devtools/client/aboutdebugging/components/tabs/Target.js @@ -13,7 +13,8 @@ const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); class TabTarget extends Component { static get propTypes() { @@ -37,8 +38,10 @@ class TabTarget extends Component { const { target, connect } = this.props; let url = "about:devtools-toolbox?type=tab&id=" + target.outerWindowID; if (connect.type == "REMOTE") { - const {host, port} = connect.params; - url += `&host=${encodeURIComponent(host)}&port=${encodeURIComponent(port)}`; + const { host, port } = connect.params; + url += `&host=${encodeURIComponent(host)}&port=${encodeURIComponent( + port + )}`; } window.open(url); } @@ -46,21 +49,28 @@ class TabTarget extends Component { render() { const { target } = this.props; - return dom.div({ className: "target-container" }, + return dom.div( + { className: "target-container" }, dom.img({ className: "target-icon", role: "presentation", src: target.icon, }), - dom.div({ className: "target" }, + dom.div( + { className: "target" }, // If the title is empty, display the url instead. - dom.div({ className: "target-name", title: target.url }, - target.title || target.url) + dom.div( + { className: "target-name", title: target.url }, + target.title || target.url + ) ), - dom.button({ - className: "debug-button", - onClick: this.debug, - }, Strings.GetStringFromName("debug")) + dom.button( + { + className: "debug-button", + onClick: this.debug, + }, + Strings.GetStringFromName("debug") + ) ); } } diff --git a/devtools/client/aboutdebugging/components/workers/MultiE10sWarning.js b/devtools/client/aboutdebugging/components/workers/MultiE10sWarning.js index 9d2d9733465f..02c39bba27b2 100644 --- a/devtools/client/aboutdebugging/components/workers/MultiE10sWarning.js +++ b/devtools/client/aboutdebugging/components/workers/MultiE10sWarning.js @@ -11,7 +11,9 @@ const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); const { Ci } = require("chrome"); -const Strings = Services.strings.createBundle("chrome://devtools/locale/aboutdebugging.properties"); +const Strings = Services.strings.createBundle( + "chrome://devtools/locale/aboutdebugging.properties" +); const MULTI_OPT_OUT_PREF = "dom.ipc.multiOptOut"; class multiE10SWarning extends Component { @@ -21,13 +23,19 @@ class multiE10SWarning extends Component { } onUpdatePreferenceClick() { - const message = Strings.GetStringFromName("multiProcessWarningConfirmUpdate2"); + const message = Strings.GetStringFromName( + "multiProcessWarningConfirmUpdate2" + ); if (window.confirm(message)) { // Disable multi until at least the next experiment. - Services.prefs.setIntPref(MULTI_OPT_OUT_PREF, - Services.appinfo.E10S_MULTI_EXPERIMENT); + Services.prefs.setIntPref( + MULTI_OPT_OUT_PREF, + Services.appinfo.E10S_MULTI_EXPERIMENT + ); // Restart the browser. - Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); + Services.startup.quit( + Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart + ); } } @@ -41,10 +49,7 @@ class multiE10SWarning extends Component { dom.div({ className: "warning" }), dom.b({}, Strings.GetStringFromName("multiProcessWarningTitle")) ), - dom.div( - {}, - Strings.GetStringFromName("multiProcessWarningMessage2") - ), + dom.div({}, Strings.GetStringFromName("multiProcessWarningMessage2")), dom.button( { className: "update-button", diff --git a/devtools/client/aboutdebugging/components/workers/Panel.js b/devtools/client/aboutdebugging/components/workers/Panel.js index 3681030847d5..9e0ee166f976 100644 --- a/devtools/client/aboutdebugging/components/workers/Panel.js +++ b/devtools/client/aboutdebugging/components/workers/Panel.js @@ -4,10 +4,16 @@ /* globals window */ "use strict"; -loader.lazyImporter(this, "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm"); +loader.lazyImporter( + this, + "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm" +); -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); @@ -23,18 +29,27 @@ const WorkerTarget = createFactory(require("./Target")); const MultiE10SWarning = createFactory(require("./MultiE10sWarning")); const ServiceWorkerTarget = createFactory(require("./ServiceWorkerTarget")); -loader.lazyImporter(this, "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm"); +loader.lazyImporter( + this, + "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm" +); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); const WorkerIcon = "chrome://devtools/skin/images/debugging-workers.svg"; -const MORE_INFO_URL = "https://developer.mozilla.org/en-US/docs/Tools/about%3Adebugging" + - "#Service_workers_not_compatible"; +const MORE_INFO_URL = + "https://developer.mozilla.org/en-US/docs/Tools/about%3Adebugging" + + "#Service_workers_not_compatible"; class WorkersPanel extends Component { static get propTypes() { @@ -70,7 +85,10 @@ class WorkersPanel extends Component { }); client.mainRoot.on("workerListChanged", this.updateWorkers); - client.mainRoot.on("serviceWorkerRegistrationListChanged", this.updateWorkers); + client.mainRoot.on( + "serviceWorkerRegistrationListChanged", + this.updateWorkers + ); client.mainRoot.on("processListChanged", this.updateWorkers); addMultiE10sListener(this.updateMultiE10S); @@ -82,7 +100,10 @@ class WorkersPanel extends Component { componentWillUnmount() { const client = this.props.client; client.mainRoot.off("processListChanged", this.updateWorkers); - client.mainRoot.off("serviceWorkerRegistrationListChanged", this.updateWorkers); + client.mainRoot.off( + "serviceWorkerRegistrationListChanged", + this.updateWorkers + ); client.mainRoot.off("workerListChanged", this.updateWorkers); for (const front of this.state.contentProcessFronts) { front.off("workerListChanged", this.updateWorkers); @@ -118,17 +139,23 @@ class WorkersPanel extends Component { updateWorkers() { const workers = this.initialState.workers; - this.props.client.mainRoot.listAllWorkers().then(({service, other, shared}) => { - workers.service = service.map(f => Object.assign({ icon: WorkerIcon }, f)); - workers.other = other.map(f => Object.assign({ icon: WorkerIcon }, f)); - workers.shared = shared.map(f => Object.assign({ icon: WorkerIcon }, f)); + this.props.client.mainRoot + .listAllWorkers() + .then(({ service, other, shared }) => { + workers.service = service.map(f => + Object.assign({ icon: WorkerIcon }, f) + ); + workers.other = other.map(f => Object.assign({ icon: WorkerIcon }, f)); + workers.shared = shared.map(f => + Object.assign({ icon: WorkerIcon }, f) + ); - // XXX: Filter out the service worker registrations for which we couldn't - // find the scriptSpec. - workers.service = workers.service.filter(reg => !!reg.url); + // XXX: Filter out the service worker registrations for which we couldn't + // find the scriptSpec. + workers.service = workers.service.filter(reg => !!reg.url); - this.setState({ workers }); - }); + this.setState({ workers }); + }); } isE10S() { @@ -138,8 +165,9 @@ class WorkersPanel extends Component { renderServiceWorkersError() { const isWindowPrivate = PrivateBrowsingUtils.isContentWindowPrivate(window); const isPrivateBrowsingMode = PrivateBrowsingUtils.permanentPrivateBrowsing; - const isServiceWorkerDisabled = !Services.prefs - .getBoolPref("dom.serviceWorkers.enabled"); + const isServiceWorkerDisabled = !Services.prefs.getBoolPref( + "dom.serviceWorkers.enabled" + ); const isDisabled = isWindowPrivate || isPrivateBrowsingMode || isServiceWorkerDisabled; @@ -163,7 +191,7 @@ class WorkersPanel extends Component { target: "_blank", }, Strings.GetStringFromName("configurationIsNotCompatible.learnMore") - ), + ) ); } diff --git a/devtools/client/aboutdebugging/components/workers/ServiceWorkerTarget.js b/devtools/client/aboutdebugging/components/workers/ServiceWorkerTarget.js index dc4ef88e26d3..33f590b2d56f 100644 --- a/devtools/client/aboutdebugging/components/workers/ServiceWorkerTarget.js +++ b/devtools/client/aboutdebugging/components/workers/ServiceWorkerTarget.js @@ -11,13 +11,22 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); -loader.lazyRequireGetter(this, "gDevToolsBrowser", - "devtools/client/framework/devtools-browser", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); +loader.lazyRequireGetter( + this, + "gDevToolsBrowser", + "devtools/client/framework/devtools-browser", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); class ServiceWorkerTarget extends Component { static get propTypes() { @@ -141,23 +150,32 @@ class ServiceWorkerTarget extends Component { } renderButtons() { - const pushButton = dom.button({ - className: "push-button", - onClick: this.push, - disabled: this.props.debugDisabled, - }, Strings.GetStringFromName("push")); + const pushButton = dom.button( + { + className: "push-button", + onClick: this.push, + disabled: this.props.debugDisabled, + }, + Strings.GetStringFromName("push") + ); - const debugButton = dom.button({ - className: "debug-button", - onClick: this.debug, - disabled: this.props.debugDisabled, - }, Strings.GetStringFromName("debug")); + const debugButton = dom.button( + { + className: "debug-button", + onClick: this.debug, + disabled: this.props.debugDisabled, + }, + Strings.GetStringFromName("debug") + ); - const startButton = dom.button({ - className: "start-button", - onClick: this.start, - disabled: this.props.debugDisabled, - }, Strings.GetStringFromName("start")); + const startButton = dom.button( + { + className: "start-button", + onClick: this.start, + disabled: this.props.debugDisabled, + }, + Strings.GetStringFromName("start") + ); if (this.isRunning()) { if (this.isActive()) { @@ -175,10 +193,13 @@ class ServiceWorkerTarget extends Component { return null; } - return dom.a({ - onClick: this.unregister, - className: "unregister-link", - }, Strings.GetStringFromName("unregister")); + return dom.a( + { + onClick: this.unregister, + className: "unregister-link", + }, + Strings.GetStringFromName("unregister") + ); } render() { @@ -186,41 +207,60 @@ class ServiceWorkerTarget extends Component { const { pushSubscription } = this.state; const status = this.getServiceWorkerStatus(); - const fetch = target.fetch ? Strings.GetStringFromName("listeningForFetchEvents") : - Strings.GetStringFromName("notListeningForFetchEvents"); + const fetch = target.fetch + ? Strings.GetStringFromName("listeningForFetchEvents") + : Strings.GetStringFromName("notListeningForFetchEvents"); - return dom.div({ className: "target-container" }, + return dom.div( + { className: "target-container" }, dom.img({ className: "target-icon", role: "presentation", src: target.icon, }), - dom.span({ className: `target-status target-status-${status}` }, - Strings.GetStringFromName(status)), - dom.div({ className: "target" }, + dom.span( + { className: `target-status target-status-${status}` }, + Strings.GetStringFromName(status) + ), + dom.div( + { className: "target" }, dom.div({ className: "target-name", title: target.name }, target.name), - dom.ul({ className: "target-details" }, - (pushSubscription ? - dom.li({ className: "target-detail" }, - dom.strong(null, Strings.GetStringFromName("pushService")), - dom.span({ - className: "service-worker-push-url", - title: pushSubscription.endpoint, - }, pushSubscription.endpoint)) : - null - ), - dom.li({ className: "target-detail" }, + dom.ul( + { className: "target-details" }, + pushSubscription + ? dom.li( + { className: "target-detail" }, + dom.strong(null, Strings.GetStringFromName("pushService")), + dom.span( + { + className: "service-worker-push-url", + title: pushSubscription.endpoint, + }, + pushSubscription.endpoint + ) + ) + : null, + dom.li( + { className: "target-detail" }, dom.strong(null, Strings.GetStringFromName("fetch")), - dom.span({ - className: "service-worker-fetch-flag", - title: fetch, - }, fetch)), - dom.li({ className: "target-detail" }, + dom.span( + { + className: "service-worker-fetch-flag", + title: fetch, + }, + fetch + ) + ), + dom.li( + { className: "target-detail" }, dom.strong(null, Strings.GetStringFromName("scope")), - dom.span({ - className: "service-worker-scope", - title: target.scope, - }, target.scope), + dom.span( + { + className: "service-worker-scope", + title: target.scope, + }, + target.scope + ), this.renderUnregisterLink() ) ) diff --git a/devtools/client/aboutdebugging/components/workers/Target.js b/devtools/client/aboutdebugging/components/workers/Target.js index 99c3261116ab..ec18fd32a06c 100644 --- a/devtools/client/aboutdebugging/components/workers/Target.js +++ b/devtools/client/aboutdebugging/components/workers/Target.js @@ -11,13 +11,22 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const dom = require("devtools/client/shared/vendor/react-dom-factories"); const Services = require("Services"); -loader.lazyRequireGetter(this, "DebuggerClient", - "devtools/shared/client/debugger-client", true); -loader.lazyRequireGetter(this, "gDevToolsBrowser", - "devtools/client/framework/devtools-browser", true); +loader.lazyRequireGetter( + this, + "DebuggerClient", + "devtools/shared/client/debugger-client", + true +); +loader.lazyRequireGetter( + this, + "gDevToolsBrowser", + "devtools/client/framework/devtools-browser", + true +); const Strings = Services.strings.createBundle( - "chrome://devtools/locale/aboutdebugging.properties"); + "chrome://devtools/locale/aboutdebugging.properties" +); class WorkerTarget extends Component { static get propTypes() { @@ -45,20 +54,25 @@ class WorkerTarget extends Component { render() { const { target, debugDisabled } = this.props; - return dom.li({ className: "target-container" }, + return dom.li( + { className: "target-container" }, dom.img({ className: "target-icon", role: "presentation", src: target.icon, }), - dom.div({ className: "target" }, + dom.div( + { className: "target" }, dom.div({ className: "target-name", title: target.name }, target.name) ), - dom.button({ - className: "debug-button", - onClick: this.debug, - disabled: debugDisabled, - }, Strings.GetStringFromName("debug")) + dom.button( + { + className: "debug-button", + onClick: this.debug, + disabled: debugDisabled, + }, + Strings.GetStringFromName("debug") + ) ); } } diff --git a/devtools/client/aboutdebugging/initializer.js b/devtools/client/aboutdebugging/initializer.js index 01f85b8cbb3d..bc11005f2b73 100644 --- a/devtools/client/aboutdebugging/initializer.js +++ b/devtools/client/aboutdebugging/initializer.js @@ -8,11 +8,12 @@ "use strict"; const { loader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm"); -const { BrowserLoader } = ChromeUtils.import("resource://devtools/client/shared/browser-loader.js"); +const { BrowserLoader } = ChromeUtils.import( + "resource://devtools/client/shared/browser-loader.js" +); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -loader.lazyRequireGetter(this, "Telemetry", - "devtools/client/shared/telemetry"); +loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry"); const { require } = BrowserLoader({ baseURI: "resource://devtools/client/aboutdebugging/", @@ -20,7 +21,10 @@ const { require } = BrowserLoader({ }); const { createFactory } = require("devtools/client/shared/vendor/react"); -const { render, unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom"); +const { + render, + unmountComponentAtNode, +} = require("devtools/client/shared/vendor/react-dom"); const EventEmitter = require("devtools/shared/event-emitter"); const AboutDebuggingApp = createFactory(require("./components/Aboutdebugging")); @@ -34,15 +38,17 @@ var AboutDebugging = { return; } - const {connect, client} = await createClient(); + const { connect, client } = await createClient(); this.client = client; await this.client.connect(); const telemetry = new Telemetry(); - render(AboutDebuggingApp({ client, connect, telemetry }), - document.querySelector("#root")); + render( + AboutDebuggingApp({ client, connect, telemetry }), + document.querySelector("#root") + ); }, destroy() { @@ -58,10 +64,18 @@ var AboutDebugging = { // Used to track async requests in tests. See bug 1444424 for better ideas. EventEmitter.decorate(AboutDebugging); -window.addEventListener("DOMContentLoaded", function() { - AboutDebugging.init(); -}, {once: true}); +window.addEventListener( + "DOMContentLoaded", + function() { + AboutDebugging.init(); + }, + { once: true } +); -window.addEventListener("unload", function() { - AboutDebugging.destroy(); -}, {once: true}); +window.addEventListener( + "unload", + function() { + AboutDebugging.destroy(); + }, + { once: true } +); diff --git a/devtools/client/aboutdebugging/modules/addon.js b/devtools/client/aboutdebugging/modules/addon.js index 5618cbf0b079..3f93a25c9512 100644 --- a/devtools/client/aboutdebugging/modules/addon.js +++ b/devtools/client/aboutdebugging/modules/addon.js @@ -4,7 +4,11 @@ "use strict"; -loader.lazyImporter(this, "AddonManagerPrivate", "resource://gre/modules/AddonManager.jsm"); +loader.lazyImporter( + this, + "AddonManagerPrivate", + "resource://gre/modules/AddonManager.jsm" +); const { debugAddon, diff --git a/devtools/client/aboutdebugging/modules/connect.js b/devtools/client/aboutdebugging/modules/connect.js index 596430391d4c..a4fc2cc5f275 100644 --- a/devtools/client/aboutdebugging/modules/connect.js +++ b/devtools/client/aboutdebugging/modules/connect.js @@ -42,7 +42,7 @@ function createDescriptorFromURL(url) { if (host && port) { descriptor = { type: TYPE.REMOTE, - params: {host, port}, + params: { host, port }, }; } else { descriptor = { @@ -71,5 +71,5 @@ exports.createClient = async function() { DebuggerServer.allowChromeProcess = true; - return {client, connect}; + return { client, connect }; }; diff --git a/devtools/client/aboutdebugging/test/browser_addons_debug_info.js b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js index 485fc7c0e8fe..6d143c039a22 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_debug_info.js +++ b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js @@ -1,6 +1,8 @@ "use strict"; -const { Preferences } = ChromeUtils.import("resource://gre/modules/Preferences.jsm"); +const { Preferences } = ChromeUtils.import( + "resource://gre/modules/Preferences.jsm" +); const UUID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/; const SHOW_SYSTEM_ADDONS_PREF = "devtools.aboutdebugging.showHiddenAddons"; @@ -9,8 +11,15 @@ function testFilePath(container, expectedFilePath) { // Verify that the path to the install location is shown next to its label. const filePath = container.querySelector(".file-path"); ok(filePath, "file path is in DOM"); - ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly"); - is(filePath.previousElementSibling.textContent, "Location", "file path has label"); + ok( + filePath.textContent.endsWith(expectedFilePath), + "file path is set correctly" + ); + is( + filePath.previousElementSibling.textContent, + "Location", + "file path has label" + ); } add_task(async function testWebExtension() { @@ -24,7 +33,7 @@ add_task(async function testWebExtension() { manifest: { name: addonName, applications: { - gecko: {id: addonId}, + gecko: { id: addonId }, }, }, }); @@ -47,9 +56,12 @@ add_task(async function testWebExtension() { ok(internalUUID.textContent.match(UUID_REGEX), "internalUUID is correct"); const manifestURL = container.querySelector(".manifest-url"); - ok(manifestURL.href.startsWith("moz-extension://"), "href for manifestURL exists"); + ok( + manifestURL.href.startsWith("moz-extension://"), + "href for manifestURL exists" + ); - await uninstallAddon({document, id: addonId, name: addonName}); + await uninstallAddon({ document, id: addonId, name: addonName }); await closeAboutDebugging(tab); }); @@ -73,8 +85,9 @@ add_task(async function testTemporaryWebExtension() { name: addonName, }); - const addons = - document.querySelectorAll("#temporary-extensions .addon-target-container"); + const addons = document.querySelectorAll( + "#temporary-extensions .addon-target-container" + ); // Assuming that our temporary add-on is now at the top. const container = addons[addons.length - 1]; const addonId = container.dataset.addonId; @@ -85,7 +98,7 @@ add_task(async function testTemporaryWebExtension() { const temporaryID = container.querySelector(".temporary-id-url"); ok(temporaryID, "Temporary ID message does appear"); - await uninstallAddon({document, id: addonId, name: addonName}); + await uninstallAddon({ document, id: addonId, name: addonName }); await closeAboutDebugging(tab); }); @@ -101,10 +114,9 @@ add_task(async function testUnknownManifestProperty() { manifest: { name: addonName, applications: { - gecko: {id: addonId}, - }, - wrong_manifest_property_name: { + gecko: { id: addonId }, }, + wrong_manifest_property_name: {}, }, }); registerCleanupFunction(() => addonFile.remove(false)); @@ -123,12 +135,18 @@ add_task(async function testUnknownManifestProperty() { const messages = container.querySelectorAll(".addon-target-message"); ok(messages.length === 1, "there is one message"); - ok(messages[0].textContent.match(/Error processing wrong_manifest_property_name/), - "the message is helpful"); - ok(messages[0].classList.contains("addon-target-warning-message"), - "the message is a warning"); + ok( + messages[0].textContent.match( + /Error processing wrong_manifest_property_name/ + ), + "the message is helpful" + ); + ok( + messages[0].classList.contains("addon-target-warning-message"), + "the message is a warning" + ); - await uninstallAddon({document, id: addonId, name: addonName}); + await uninstallAddon({ document, id: addonId, name: addonName }); await closeAboutDebugging(tab); }); @@ -137,7 +155,8 @@ add_task(async function testSystemAddonsHidden() { await pushPref(SHOW_SYSTEM_ADDONS_PREF, false); const { document } = await openAboutDebugging("addons"); - const systemAddonsShown = () => !!document.getElementById("system-extensions"); + const systemAddonsShown = () => + !!document.getElementById("system-extensions"); await waitForInitialAddonList(document); diff --git a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js index 34940a2fd428..17871da6238b 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js +++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js @@ -5,7 +5,9 @@ // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -23,22 +25,25 @@ add_task(async function testWebExtensionsToolboxWebConsole() { const addonFile = ExtensionTestCommon.generateXPI({ background: function() { window.myWebExtensionAddonFunction = function() { - console.log("Background page function called", - this.browser.runtime.getManifest()); + console.log( + "Background page function called", + this.browser.runtime.getManifest() + ); }; }, manifest: { name: ADDON_NAME, applications: { - gecko: {id: ADDON_ID}, + gecko: { id: ADDON_ID }, }, }, }); registerCleanupFunction(() => addonFile.remove(false)); - const { - tab, document, debugBtn, - } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, addonFile); + const { tab, document, debugBtn } = await setupTestAboutDebuggingWebExtension( + ADDON_NAME, + addonFile + ); const onToolboxReady = gDevTools.once("toolbox-ready"); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -49,16 +54,15 @@ add_task(async function testWebExtensionsToolboxWebConsole() { await onToolboxClose; ok(true, "Addon toolbox closed"); - await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME}); + await uninstallAddon({ document, id: ADDON_ID, name: ADDON_NAME }); await closeAboutDebugging(tab); }); const testScript = function(toolbox) { function findMessages(hud, text, selector = ".message") { const messages = hud.ui.outputNode.querySelectorAll(selector); - const elements = Array.prototype.filter.call( - messages, - (el) => el.textContent.includes(text) + const elements = Array.prototype.filter.call(messages, el => + el.textContent.includes(text) ); return elements; } @@ -69,16 +73,17 @@ const testScript = function(toolbox) { } } - toolbox.selectTool("webconsole") - .then(async console => { - const { hud } = console; - const { jsterm } = hud; - const onMessage = waitFor(() => { - return findMessages(hud, "Background page function called").length > 0; - }); - await jsterm.execute("myWebExtensionAddonFunction()"); - await onMessage; - await toolbox.destroy(); - }) - .catch(e => dump("Exception from browser toolbox process: " + e + "\n")); + toolbox + .selectTool("webconsole") + .then(async console => { + const { hud } = console; + const { jsterm } = hud; + const onMessage = waitFor(() => { + return findMessages(hud, "Background page function called").length > 0; + }); + await jsterm.execute("myWebExtensionAddonFunction()"); + await onMessage; + await toolbox.destroy(); + }) + .catch(e => dump("Exception from browser toolbox process: " + e + "\n")); }; diff --git a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js index 44298261dea2..9bce786622b2 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js +++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js @@ -4,7 +4,9 @@ // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -26,15 +28,16 @@ add_task(async function testWebExtensionsToolboxInspector() { manifest: { name: ADDON_NAME, applications: { - gecko: {id: ADDON_ID}, + gecko: { id: ADDON_ID }, }, }, }); registerCleanupFunction(() => addonFile.remove(false)); - const { - tab, document, debugBtn, - } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, addonFile); + const { tab, document, debugBtn } = await setupTestAboutDebuggingWebExtension( + ADDON_NAME, + addonFile + ); const onToolboxReady = gDevTools.once("toolbox-ready"); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -45,44 +48,45 @@ add_task(async function testWebExtensionsToolboxInspector() { await onToolboxClose; ok(true, "Addon toolbox closed"); - await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME}); + await uninstallAddon({ document, id: ADDON_ID, name: ADDON_NAME }); await closeAboutDebugging(tab); }); const testScript = function(toolbox) { - toolbox.selectTool("inspector") - .then(inspector => { - return inspector.walker.querySelector(inspector.walker.rootNode, "body"); - }) - .then((nodeActor) => { - if (!nodeActor) { - throw new Error("nodeActor not found"); - } + toolbox + .selectTool("inspector") + .then(inspector => { + return inspector.walker.querySelector(inspector.walker.rootNode, "body"); + }) + .then(nodeActor => { + if (!nodeActor) { + throw new Error("nodeActor not found"); + } - dump("Got a nodeActor\n"); + dump("Got a nodeActor\n"); - if (!(nodeActor.inlineTextChild)) { - throw new Error("inlineTextChild not found"); - } + if (!nodeActor.inlineTextChild) { + throw new Error("inlineTextChild not found"); + } - dump("Got a nodeActor with an inline text child\n"); + dump("Got a nodeActor with an inline text child\n"); - const expectedValue = "Background Page Body Test Content"; - const actualValue = nodeActor.inlineTextChild._form.nodeValue; + const expectedValue = "Background Page Body Test Content"; + const actualValue = nodeActor.inlineTextChild._form.nodeValue; - if (String(actualValue).trim() !== String(expectedValue).trim()) { - throw new Error( - `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"` - ); - } + if (String(actualValue).trim() !== String(expectedValue).trim()) { + throw new Error( + `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"` + ); + } - dump("Got the expected inline text content in the selected node\n"); - return Promise.resolve(); - }) - .then(() => toolbox.destroy()) - .catch((error) => { - dump("Error while running code in the browser toolbox process:\n"); - dump(error + "\n"); - dump("stack:\n" + error.stack + "\n"); - }); + dump("Got the expected inline text content in the selected node\n"); + return Promise.resolve(); + }) + .then(() => toolbox.destroy()) + .catch(error => { + dump("Error while running code in the browser toolbox process:\n"); + dump(error + "\n"); + dump("stack:\n" + error.stack + "\n"); + }); }; diff --git a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js index 1594257e4a64..eed34dcea0fa 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js +++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_nobg.js @@ -4,7 +4,9 @@ // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -25,15 +27,16 @@ add_task(async function testWebExtensionsToolboxNoBackgroundPage() { manifest: { name: ADDON_NOBG_NAME, applications: { - gecko: {id: ADDON_NOBG_ID}, + gecko: { id: ADDON_NOBG_ID }, }, }, }); registerCleanupFunction(() => addonFile.remove(false)); - const { - tab, document, debugBtn, - } = await setupTestAboutDebuggingWebExtension(ADDON_NOBG_NAME, addonFile); + const { tab, document, debugBtn } = await setupTestAboutDebuggingWebExtension( + ADDON_NOBG_NAME, + addonFile + ); const onToolboxReady = gDevTools.once("toolbox-ready"); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -44,36 +47,42 @@ add_task(async function testWebExtensionsToolboxNoBackgroundPage() { await onToolboxClose; ok(true, "Addon toolbox closed"); - await uninstallAddon({document, id: ADDON_NOBG_ID, name: ADDON_NOBG_NAME}); + await uninstallAddon({ document, id: ADDON_NOBG_ID, name: ADDON_NOBG_NAME }); await closeAboutDebugging(tab); }); const testScript = function(toolbox) { - toolbox.selectTool("inspector").then(async inspector => { - let nodeActor; + toolbox + .selectTool("inspector") + .then(async inspector => { + let nodeActor; - dump(`Wait the fallback window to be fully loaded\n`); - await asyncWaitUntil(async () => { - nodeActor = await inspector.walker.querySelector(inspector.walker.rootNode, "h1"); - return nodeActor && nodeActor.inlineTextChild; + dump(`Wait the fallback window to be fully loaded\n`); + await asyncWaitUntil(async () => { + nodeActor = await inspector.walker.querySelector( + inspector.walker.rootNode, + "h1" + ); + return nodeActor && nodeActor.inlineTextChild; + }); + + dump("Got a nodeActor with an inline text child\n"); + const expectedValue = "Your addon does not have any document opened yet."; + const actualValue = nodeActor.inlineTextChild._form.nodeValue; + + if (actualValue !== expectedValue) { + throw new Error( + `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"` + ); + } + + dump("Got the expected inline text content in the selected node\n"); + + await toolbox.destroy(); + }) + .catch(error => { + dump("Error while running code in the browser toolbox process:\n"); + dump(error + "\n"); + dump("stack:\n" + error.stack + "\n"); }); - - dump("Got a nodeActor with an inline text child\n"); - const expectedValue = "Your addon does not have any document opened yet."; - const actualValue = nodeActor.inlineTextChild._form.nodeValue; - - if (actualValue !== expectedValue) { - throw new Error( - `mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"` - ); - } - - dump("Got the expected inline text content in the selected node\n"); - - await toolbox.destroy(); - }).catch((error) => { - dump("Error while running code in the browser toolbox process:\n"); - dump(error + "\n"); - dump("stack:\n" + error.stack + "\n"); - }); }; diff --git a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js index 8612d01068ab..12bbe8220325 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js +++ b/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_popup.js @@ -4,7 +4,9 @@ // There are shutdown issues for which multiple rejections are left uncaught. // See bug 1018184 for resolving these issues. -const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm"); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/PromiseTestUtils.jsm" +); PromiseTestUtils.whitelistRejectionsGlobally(/File closed/); // Avoid test timeouts that can occur while waiting for the "addon-console-works" message. @@ -39,7 +41,7 @@ function makeWidgetId(id) { add_task(async function testWebExtensionsToolboxSwitchToPopup() { const addonFile = ExtensionTestCommon.generateXPI({ background: function() { - const {browser} = this; + const { browser } = this; window.myWebExtensionShowPopup = function() { browser.test.sendMessage("readyForOpenPopup"); }; @@ -47,7 +49,7 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() { manifest: { name: ADDON_NAME, applications: { - gecko: {id: ADDON_ID}, + gecko: { id: ADDON_ID }, }, browser_action: { default_title: "WebExtension Popup Debugging", @@ -67,10 +69,12 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() { `, "popup.js": function() { - const {browser} = this; + const { browser } = this; window.myWebExtensionPopupAddonFunction = function() { - browser.test.sendMessage("popupPageFunctionCalled", - browser.runtime.getManifest()); + browser.test.sendMessage( + "popupPageFunctionCalled", + browser.runtime.getManifest() + ); }; }, }, @@ -80,8 +84,11 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() { let onReadyForOpenPopup; let onPopupCustomMessage; - is(Services.prefs.getBoolPref("ui.popup.disable_autohide"), false, - "disable_autohide shoult be initially false"); + is( + Services.prefs.getBoolPref("ui.popup.disable_autohide"), + false, + "disable_autohide shoult be initially false" + ); Management.on("startup", function listener(event, extension) { if (extension.name != ADDON_NAME) { @@ -93,7 +100,7 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() { function waitForExtensionTestMessage(expectedMessage) { return new Promise(done => { extension.on("test-message", function testLogListener(evt, ...args) { - const [message ] = args; + const [message] = args; if (message !== expectedMessage) { return; @@ -111,12 +118,15 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() { // Wait for a notification sent by a script evaluated the test addon via // the web console. - onPopupCustomMessage = waitForExtensionTestMessage("popupPageFunctionCalled"); + onPopupCustomMessage = waitForExtensionTestMessage( + "popupPageFunctionCalled" + ); }); - const { - tab, document, debugBtn, - } = await setupTestAboutDebuggingWebExtension(ADDON_NAME, addonFile); + const { tab, document, debugBtn } = await setupTestAboutDebuggingWebExtension( + ADDON_NAME, + addonFile + ); const onToolboxReady = gDevTools.once("toolbox-ready"); const onToolboxClose = gDevTools.once("toolbox-destroyed"); @@ -136,16 +146,22 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() { const args = await onPopupCustomMessage; ok(true, "Received console message from the popup page function as expected"); is(args[0], "popupPageFunctionCalled", "Got the expected console message"); - is(args[1] && args[1].name, ADDON_NAME, - "Got the expected manifest from WebExtension API"); + is( + args[1] && args[1].name, + ADDON_NAME, + "Got the expected manifest from WebExtension API" + ); await onToolboxClose; info("Addon toolbox closed"); - is(Services.prefs.getBoolPref("ui.popup.disable_autohide"), false, - "disable_autohide should be reset to false when the toolbox is closed"); + is( + Services.prefs.getBoolPref("ui.popup.disable_autohide"), + false, + "disable_autohide should be reset to false when the toolbox is closed" + ); - await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME}); + await uninstallAddon({ document, id: ADDON_ID, name: ADDON_NAME }); await closeAboutDebugging(tab); }); @@ -153,7 +169,7 @@ const testScript = function(toolbox) { let jsterm; const popupFramePromise = new Promise(resolve => { const listener = data => { - if (data.frames.some(({url}) => url && url.endsWith("popup.html"))) { + if (data.frames.some(({ url }) => url && url.endsWith("popup.html"))) { toolbox.target.off("frame-update", listener); resolve(); } @@ -163,67 +179,80 @@ const testScript = function(toolbox) { const waitForFrameListUpdate = toolbox.target.once("frame-update"); - toolbox.selectTool("webconsole") - .then(async (console) => { - const clickNoAutoHideMenu = () => { - return new Promise(resolve => { - toolbox.doc.getElementById("toolbox-meatball-menu-button").click(); - toolbox.doc.addEventListener("popupshown", () => { - const menuItem = - toolbox.doc.getElementById("toolbox-meatball-menu-noautohide"); - menuItem.click(); - resolve(); - }, { once: true }); - }); - }; + toolbox + .selectTool("webconsole") + .then(async console => { + const clickNoAutoHideMenu = () => { + return new Promise(resolve => { + toolbox.doc.getElementById("toolbox-meatball-menu-button").click(); + toolbox.doc.addEventListener( + "popupshown", + () => { + const menuItem = toolbox.doc.getElementById( + "toolbox-meatball-menu-noautohide" + ); + menuItem.click(); + resolve(); + }, + { once: true } + ); + }); + }; - dump(`Clicking the menu button\n`); - await clickNoAutoHideMenu(); - dump(`Clicked the menu button\n`); + dump(`Clicking the menu button\n`); + await clickNoAutoHideMenu(); + dump(`Clicked the menu button\n`); - jsterm = console.hud.jsterm; - jsterm.execute("myWebExtensionShowPopup()"); + jsterm = console.hud.jsterm; + jsterm.execute("myWebExtensionShowPopup()"); - await Promise.all([ - // Wait the initial frame update (which list the background page). - waitForFrameListUpdate, - // Wait the new frame update (once the extension popup has been opened). - popupFramePromise, - ]); + await Promise.all([ + // Wait the initial frame update (which list the background page). + waitForFrameListUpdate, + // Wait the new frame update (once the extension popup has been opened). + popupFramePromise, + ]); - dump(`Clicking the frame list button\n`); - const btn = toolbox.doc.getElementById("command-button-frames"); - btn.click(); + dump(`Clicking the frame list button\n`); + const btn = toolbox.doc.getElementById("command-button-frames"); + btn.click(); - const menuList = toolbox.doc.getElementById("toolbox-frame-menu"); - const frames = Array.from(menuList.querySelectorAll(".command")); + const menuList = toolbox.doc.getElementById("toolbox-frame-menu"); + const frames = Array.from(menuList.querySelectorAll(".command")); - if (frames.length != 2) { - throw Error(`Number of frames found is wrong: ${frames.length} != 2`); - } + if (frames.length != 2) { + throw Error(`Number of frames found is wrong: ${frames.length} != 2`); + } - const popupFrameBtn = frames.filter((frame) => { - return frame.querySelector(".label").textContent.endsWith("popup.html"); - }).pop(); + const popupFrameBtn = frames + .filter(frame => { + return frame + .querySelector(".label") + .textContent.endsWith("popup.html"); + }) + .pop(); - if (!popupFrameBtn) { - throw Error("Extension Popup frame not found in the listed frames"); - } + if (!popupFrameBtn) { + throw Error("Extension Popup frame not found in the listed frames"); + } - const waitForNavigated = toolbox.target.once("navigate"); - popupFrameBtn.click(); - // Clicking the menu item may do highlighting. - await waitUntil(() => toolbox.highlighter); - await Promise.race([toolbox.highlighter.once("node-highlight"), wait(1000)]); - await waitForNavigated; + const waitForNavigated = toolbox.target.once("navigate"); + popupFrameBtn.click(); + // Clicking the menu item may do highlighting. + await waitUntil(() => toolbox.highlighter); + await Promise.race([ + toolbox.highlighter.once("node-highlight"), + wait(1000), + ]); + await waitForNavigated; - await jsterm.execute("myWebExtensionPopupAddonFunction()"); + await jsterm.execute("myWebExtensionPopupAddonFunction()"); - await toolbox.destroy(); - }) - .catch((error) => { - dump("Error while running code in the browser toolbox process:\n"); - dump(error + "\n"); - dump("stack:\n" + error.stack + "\n"); - }); + await toolbox.destroy(); + }) + .catch(error => { + dump("Error while running code in the browser toolbox process:\n"); + dump(error + "\n"); + dump("stack:\n" + error.stack + "\n"); + }); }; diff --git a/devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js b/devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js index 153a4cc82ada..6318a601fd16 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js +++ b/devtools/client/aboutdebugging/test/browser_addons_debugging_initial_state.js @@ -15,15 +15,18 @@ const TEST_DATA = [ chromeEnabled: false, debuggerRemoteEnable: false, expected: false, - }, { + }, + { chromeEnabled: false, debuggerRemoteEnable: true, expected: false, - }, { + }, + { chromeEnabled: true, debuggerRemoteEnable: false, expected: false, - }, { + }, + { chromeEnabled: true, debuggerRemoteEnable: true, expected: true, @@ -39,10 +42,12 @@ add_task(async function() { async function testCheckboxState(testData) { info("Set preferences as defined by the current test data."); await new Promise(resolve => { - const options = {"set": [ - ["devtools.chrome.enabled", testData.chromeEnabled], - ["devtools.debugger.remote-enabled", testData.debuggerRemoteEnable], - ]}; + const options = { + set: [ + ["devtools.chrome.enabled", testData.chromeEnabled], + ["devtools.debugger.remote-enabled", testData.debuggerRemoteEnable], + ], + }; SpecialPowers.pushPrefEnv(options, resolve); }); @@ -58,16 +63,21 @@ async function testCheckboxState(testData) { info("Test checkbox checked state."); const addonDebugCheckbox = document.querySelector("#enable-addon-debugging"); - is(addonDebugCheckbox.checked, testData.expected, - "Addons debugging checkbox should be in expected state."); + is( + addonDebugCheckbox.checked, + testData.expected, + "Addons debugging checkbox should be in expected state." + ); info("Test debug buttons disabled state."); const debugButtons = [...document.querySelectorAll("#addons .debug-button")]; - ok(debugButtons.every(b => b.disabled != testData.expected), - "Debug buttons should be in the expected state"); + ok( + debugButtons.every(b => b.disabled != testData.expected), + "Debug buttons should be in the expected state" + ); info("Uninstall test addon installed earlier."); - await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME}); + await uninstallAddon({ document, id: ADDON_ID, name: ADDON_NAME }); await closeAboutDebugging(tab); } diff --git a/devtools/client/aboutdebugging/test/browser_addons_install.js b/devtools/client/aboutdebugging/test/browser_addons_install.js index 694fa32cc18c..112077138071 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_install.js +++ b/devtools/client/aboutdebugging/test/browser_addons_install.js @@ -2,8 +2,11 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -loader.lazyImporter(this, "AddonTestUtils", - "resource://testing-common/AddonTestUtils.jsm"); +loader.lazyImporter( + this, + "AddonTestUtils", + "resource://testing-common/AddonTestUtils.jsm" +); AddonTestUtils.initMochitest(this); @@ -28,7 +31,11 @@ function promiseWriteWebManifestForExtension(manifest, dir) { "manifest.json": JSON.stringify(manifest), }; return AddonTestUtils.promiseWriteFilesToExtension( - dir.path, manifest.applications.gecko.id, files, true); + dir.path, + manifest.applications.gecko.id, + files, + true + ); } add_task(async function testWebextensionInstallSuccess() { @@ -105,10 +112,12 @@ add_task(async function testWebextensionInstallErrorRetry() { // Fix the manifest so the add-on will install. // eslint-disable-next-line camelcase - manifest.content_scripts = [{ - matches: ["http://*/"], - js: ["foo.js"], - }]; + manifest.content_scripts = [ + { + matches: ["http://*/"], + js: ["foo.js"], + }, + ]; await promiseWriteWebManifestForExtension(manifest, tempdir); const addonEl = document.querySelector(`[data-addon-id="${addonId}"]`); @@ -123,7 +132,7 @@ add_task(async function testWebextensionInstallErrorRetry() { info("Addon is installed"); // Install the add-on, and verify that it disappears in the about:debugging UI - await uninstallAddon({document, id: addonId, name: addonName}); + await uninstallAddon({ document, id: addonId, name: addonName }); await closeAboutDebugging(tab); }); diff --git a/devtools/client/aboutdebugging/test/browser_addons_reload.js b/devtools/client/aboutdebugging/test/browser_addons_reload.js index 28aef2941171..af849b8adf7a 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_reload.js +++ b/devtools/client/aboutdebugging/test/browser_addons_reload.js @@ -31,8 +31,10 @@ class TempWebExt { this.sourceDir = this.tmpDir.clone(); this.sourceDir.append(this.addonId); if (!this.sourceDir.exists()) { - this.sourceDir.create(Ci.nsIFile.DIRECTORY_TYPE, - FileUtils.PERMS_DIRECTORY); + this.sourceDir.create( + Ci.nsIFile.DIRECTORY_TYPE, + FileUtils.PERMS_DIRECTORY + ); } } @@ -42,12 +44,15 @@ class TempWebExt { if (manifest.exists()) { manifest.remove(true); } - const fos = Cc["@mozilla.org/network/file-output-stream;1"] - .createInstance(Ci.nsIFileOutputStream); - fos.init(manifest, - FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | - FileUtils.MODE_TRUNCATE, - FileUtils.PERMS_FILE, 0); + const fos = Cc["@mozilla.org/network/file-output-stream;1"].createInstance( + Ci.nsIFileOutputStream + ); + fos.init( + manifest, + FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE, + FileUtils.PERMS_FILE, + 0 + ); const manifestString = JSON.stringify(manifestData); fos.write(manifestString, manifestString.length); @@ -86,8 +91,11 @@ add_task(async function reloadButtonReloadsAddon() { await onListUpdated; const [reloadedAddon] = await onInstalled; - is(reloadedAddon.name, ADDON_NAME, - "Add-on was reloaded: " + reloadedAddon.name); + is( + reloadedAddon.name, + ADDON_NAME, + "Add-on was reloaded: " + reloadedAddon.name + ); await tearDownAddon(AboutDebugging, reloadedAddon); await closeAboutDebugging(tab); @@ -99,12 +107,12 @@ add_task(async function reloadButtonRefreshesMetadata() { await waitForInitialAddonList(document); const manifestBase = { - "manifest_version": 2, - "name": "Temporary web extension", - "version": "1.0", - "applications": { - "gecko": { - "id": ADDON_ID, + manifest_version: 2, + name: "Temporary web extension", + version: "1.0", + applications: { + gecko: { + id: ADDON_ID, }, }, }; @@ -127,7 +135,7 @@ add_task(async function reloadButtonRefreshesMetadata() { await waitUntilAddonContainer("Temporary web extension", document); const newName = "Temporary web extension (updated)"; - tempExt.writeManifest(Object.assign({}, manifestBase, {name: newName})); + tempExt.writeManifest(Object.assign({}, manifestBase, { name: newName })); // List updated twice: // - AddonManager's onInstalled event diff --git a/devtools/client/aboutdebugging/test/browser_addons_remove.js b/devtools/client/aboutdebugging/test/browser_addons_remove.js index 93f4dbda55a8..00b537511a7a 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_remove.js +++ b/devtools/client/aboutdebugging/test/browser_addons_remove.js @@ -23,7 +23,7 @@ add_task(async function removeWebextension() { manifest: { name: addonName, applications: { - gecko: {id: addonID}, + gecko: { id: addonID }, }, }, }); @@ -38,7 +38,9 @@ add_task(async function removeWebextension() { ok(getTargetEl(document, addonID), "add-on is shown"); - info("Click on the remove button and wait until the addon container is removed"); + info( + "Click on the remove button and wait until the addon container is removed" + ); getRemoveButton(document, addonID).click(); await waitUntil(() => !getTargetEl(document, addonID), 100); diff --git a/devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js b/devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js index ad83d9c11dd8..769b57a44346 100644 --- a/devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js +++ b/devtools/client/aboutdebugging/test/browser_addons_toggle_debug.js @@ -12,10 +12,12 @@ const ADDON_NAME = "test-devtools"; add_task(async function() { info("Turn off addon debugging."); await new Promise(resolve => { - const options = {"set": [ - ["devtools.chrome.enabled", false], - ["devtools.debugger.remote-enabled", false], - ]}; + const options = { + set: [ + ["devtools.chrome.enabled", false], + ["devtools.debugger.remote-enabled", false], + ], + }; SpecialPowers.pushPrefEnv(options, resolve); }); @@ -40,7 +42,10 @@ add_task(async function() { addonDebugCheckbox.click(); info("Wait until all debug buttons are enabled."); - waitUntil(() => addonDebugCheckbox.checked && areDebugButtonsEnabled(document), 100); + waitUntil( + () => addonDebugCheckbox.checked && areDebugButtonsEnabled(document), + 100 + ); info("Addons debugging should be enabled and debug buttons are enabled"); info("Click again on 'Enable addons debugging' checkbox."); @@ -51,7 +56,7 @@ add_task(async function() { info("All debug buttons are disabled again."); info("Uninstall addon installed earlier."); - await uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME}); + await uninstallAddon({ document, id: ADDON_ID, name: ADDON_NAME }); await closeAboutDebugging(tab); }); diff --git a/devtools/client/aboutdebugging/test/browser_service_workers.js b/devtools/client/aboutdebugging/test/browser_service_workers.js index d1607514bea2..1960b921afa6 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers.js @@ -35,8 +35,10 @@ add_task(async function() { // Check that the service worker disappeared from the UI let names = [...document.querySelectorAll("#service-workers .target-name")]; names = names.map(element => element.textContent); - ok(!names.includes(SERVICE_WORKER), - "The service worker url is no longer in the list: " + names); + ok( + !names.includes(SERVICE_WORKER), + "The service worker url is no longer in the list: " + names + ); await removeTab(swTab); await closeAboutDebugging(tab); diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_fetch_flag.js b/devtools/client/aboutdebugging/test/browser_service_workers_fetch_flag.js index d1b28834b306..be079a75ef75 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_fetch_flag.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_fetch_flag.js @@ -18,8 +18,11 @@ async function testBody(url, expecting) { info("Wait for fetch flag."); await waitUntil(() => { - let fetchFlags = - [...document.querySelectorAll("#service-workers .service-worker-fetch-flag")]; + let fetchFlags = [ + ...document.querySelectorAll( + "#service-workers .service-worker-fetch-flag" + ), + ]; fetchFlags = fetchFlags.map(element => element.textContent); return fetchFlags.includes(expecting); }, 100); diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_multi_content_process.js b/devtools/client/aboutdebugging/test/browser_service_workers_multi_content_process.js index 3ee15775bc33..17b40faedaee 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_multi_content_process.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_multi_content_process.js @@ -17,7 +17,9 @@ add_task(async function() { const { tab, document } = await openAboutDebugging("workers"); - const warningSection = document.querySelector(".service-worker-multi-process"); + const warningSection = document.querySelector( + ".service-worker-multi-process" + ); const img = warningSection.querySelector(".warning"); ok(img, "warning message is rendered"); @@ -27,8 +29,10 @@ add_task(async function() { info("Wait for service worker to appear in the list"); // Check that the service worker appears in the UI - const serviceWorkerContainer = - await waitUntilServiceWorkerContainer(SERVICE_WORKER, document); + const serviceWorkerContainer = await waitUntilServiceWorkerContainer( + SERVICE_WORKER, + document + ); info("Wait until the service worker is running and the Debug button appears"); await waitUntil(() => { diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_not_compatible.js b/devtools/client/aboutdebugging/test/browser_service_workers_not_compatible.js index ea81e15f6ac1..07ee9ec337a4 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_not_compatible.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_not_compatible.js @@ -14,9 +14,7 @@ var imgClass = ".service-worker-disabled .warning"; add_task(async function() { await new Promise(done => { info("disable service workers"); - const options = {"set": [ - ["dom.serviceWorkers.enabled", false], - ]}; + const options = { set: [["dom.serviceWorkers.enabled", false]] }; SpecialPowers.pushPrefEnv(options, done); }); @@ -31,9 +29,7 @@ add_task(async function() { add_task(async function() { await new Promise(done => { info("set private browsing mode as default"); - const options = {"set": [ - ["browser.privatebrowsing.autostart", true], - ]}; + const options = { set: [["browser.privatebrowsing.autostart", true]] }; SpecialPowers.pushPrefEnv(options, done); }); @@ -47,7 +43,7 @@ add_task(async function() { add_task(async function() { info("Opening a new private window"); - const win = OpenBrowserWindow({private: true}); + const win = OpenBrowserWindow({ private: true }); await waitForDelayedStartupFinished(win); const { tab, document } = await openAboutDebugging("workers", win); diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_push.js b/devtools/client/aboutdebugging/test/browser_service_workers_push.js index 66b1a7a91e34..63450a4f67b2 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_push.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_push.js @@ -39,21 +39,30 @@ add_task(async function() { info("Wait until the service worker appears in the UI"); await waitUntilServiceWorkerContainer(SERVICE_WORKER, document); - info("Ensure that the registration resolved before trying to interact with " + - "the service worker."); + info( + "Ensure that the registration resolved before trying to interact with " + + "the service worker." + ); await waitForServiceWorkerRegistered(swTab); ok(true, "Service worker registration resolved"); await waitForServiceWorkerActivation(SERVICE_WORKER, document); info("Wait until the service worker is running"); - const container = await waitUntilServiceWorkerContainer(SERVICE_WORKER, document); + const container = await waitUntilServiceWorkerContainer( + SERVICE_WORKER, + document + ); await waitUntil( - () => container.querySelector(".target-status").textContent === "Running", 100); + () => container.querySelector(".target-status").textContent === "Running", + 100 + ); // Retrieve the Push button for the worker. const names = [...document.querySelectorAll("#service-workers .target-name")]; - const name = names.filter(element => element.textContent === SERVICE_WORKER)[0]; + const name = names.filter( + element => element.textContent === SERVICE_WORKER + )[0]; ok(name, "Found the service worker in the list"); const targetElement = name.parentNode.parentNode; @@ -61,11 +70,15 @@ add_task(async function() { const pushBtn = targetElement.querySelector(".push-button"); ok(pushBtn, "Found its push button"); - info("Wait for the service worker to claim the test window before proceeding."); + info( + "Wait for the service worker to claim the test window before proceeding." + ); await onClaimed; - info("Click on the Push button and wait for the service worker to receive " + - "a push notification"); + info( + "Click on the Push button and wait for the service worker to receive " + + "a push notification" + ); const onPushNotification = onTabMessage(swTab, "sw-pushed"); pushBtn.click(); diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_push_service.js b/devtools/client/aboutdebugging/test/browser_service_workers_push_service.js index fff706824ae5..20aeb50f4cd2 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_push_service.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_push_service.js @@ -13,8 +13,9 @@ const TAB_URL = URL_ROOT + "service-workers/push-sw.html"; const FAKE_ENDPOINT = "https://fake/endpoint"; -const PushService = Cc["@mozilla.org/push/Service;1"] - .getService(Ci.nsIPushService).wrappedJSObject; +const PushService = Cc["@mozilla.org/push/Service;1"].getService( + Ci.nsIPushService +).wrappedJSObject; add_task(async function() { info("Turn on workers via mochitest http."); @@ -27,7 +28,8 @@ add_task(async function() { Services.obs.notifyObservers( null, PushService.subscriptionModifiedTopic, - scope); + scope + ); }, init() {}, register(pageRecord) { @@ -65,14 +67,19 @@ add_task(async function() { // Wait for the service worker details to update. const names = [...document.querySelectorAll("#service-workers .target-name")]; - const name = names.filter(element => element.textContent === SERVICE_WORKER)[0]; + const name = names.filter( + element => element.textContent === SERVICE_WORKER + )[0]; ok(name, "Found the service worker in the list"); const targetContainer = name.closest(".target-container"); // Retrieve the push subscription endpoint URL, and verify it looks good. info("Wait for the push URL"); - const pushURL = await waitUntilElement(".service-worker-push-url", targetContainer); + const pushURL = await waitUntilElement( + ".service-worker-push-url", + targetContainer + ); info("Found the push service URL in the service worker details"); is(pushURL.textContent, FAKE_ENDPOINT, "The push service URL looks correct"); @@ -85,7 +92,10 @@ add_task(async function() { // Wait for the service worker details to update again info("Wait until the push URL is removed from the UI"); - await waitUntil(() => !targetContainer.querySelector(".service-worker-push-url"), 100); + await waitUntil( + () => !targetContainer.querySelector(".service-worker-push-url"), + 100 + ); info("The push service URL should be removed"); // Finally, unregister the service worker itself. diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_start.js b/devtools/client/aboutdebugging/test/browser_service_workers_start.js index 19f88ceac955..74d596ee50d2 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_start.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_start.js @@ -31,8 +31,10 @@ add_task(async function() { info("Wait until the service worker appears in about:debugging"); await waitUntilServiceWorkerContainer(SERVICE_WORKER, document); - info("Ensure that the registration resolved before trying to interact with " + - "the service worker."); + info( + "Ensure that the registration resolved before trying to interact with " + + "the service worker." + ); await waitForServiceWorkerRegistered(swTab); ok(true, "Service worker registration resolved"); @@ -40,7 +42,9 @@ add_task(async function() { // Retrieve the Target element corresponding to the service worker. const names = [...document.querySelectorAll("#service-workers .target-name")]; - const name = names.filter(element => element.textContent === SERVICE_WORKER)[0]; + const name = names.filter( + element => element.textContent === SERVICE_WORKER + )[0]; ok(name, "Found the service worker in the list"); const targetElement = name.parentNode.parentNode; diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_status.js b/devtools/client/aboutdebugging/test/browser_service_workers_status.js index 51f840993838..2713daa311b7 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_status.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_status.js @@ -24,7 +24,10 @@ add_task(async function() { const swTab = await addTab(TAB_URL); info("Wait until the service worker appears in about:debugging"); - const container = await waitUntilServiceWorkerContainer(SERVICE_WORKER, document); + const container = await waitUntilServiceWorkerContainer( + SERVICE_WORKER, + document + ); // We should ideally check that the service worker registration goes through the // "registering" and "running" steps, but it is difficult to workaround race conditions @@ -44,8 +47,10 @@ add_task(async function() { // Check that the service worker disappeared from the UI let names = [...document.querySelectorAll("#service-workers .target-name")]; names = names.map(element => element.textContent); - ok(!names.includes(SERVICE_WORKER), - "The service worker url is no longer in the list: " + names); + ok( + !names.includes(SERVICE_WORKER), + "The service worker url is no longer in the list: " + names + ); await removeTab(swTab); await closeAboutDebugging(tab); diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_timeout.js b/devtools/client/aboutdebugging/test/browser_service_workers_timeout.js index f64119dfb0c8..98c3b419ce01 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_timeout.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_timeout.js @@ -31,7 +31,9 @@ add_task(async function() { // Retrieve the DEBUG button for the worker const names = [...document.querySelectorAll("#service-workers .target-name")]; - const name = names.filter(element => element.textContent === SERVICE_WORKER)[0]; + const name = names.filter( + element => element.textContent === SERVICE_WORKER + )[0]; ok(name, "Found the service worker in the list"); const targetElement = name.parentNode.parentNode; const debugBtn = targetElement.querySelector(".debug-button"); @@ -55,8 +57,10 @@ add_task(async function() { }); assertHasTarget(true, document, "service-workers", SERVICE_WORKER); - ok(targetElement.querySelector(".debug-button"), - "The debug button is still there"); + ok( + targetElement.querySelector(".debug-button"), + "The debug button is still there" + ); await toolbox.destroy(); toolbox = null; diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_unregister.js b/devtools/client/aboutdebugging/test/browser_service_workers_unregister.js index 90f079e1e625..17ec28798385 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_unregister.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_unregister.js @@ -27,8 +27,10 @@ add_task(async function() { await waitForServiceWorkerActivation(SERVICE_WORKER, document); - info("Ensure that the registration resolved before trying to interact with " + - "the service worker."); + info( + "Ensure that the registration resolved before trying to interact with " + + "the service worker." + ); await waitForServiceWorkerRegistered(swTab); ok(true, "Service worker registration resolved"); @@ -41,8 +43,11 @@ add_task(async function() { info("Check the scope displayed scope is correct"); const scope = target.querySelector(".service-worker-scope"); - is(scope.textContent, SCOPE, - "The expected scope is displayed in the service worker info."); + is( + scope.textContent, + SCOPE, + "The expected scope is displayed in the service worker info." + ); info("Unregister the service worker via the unregister link."); const unregisterLink = target.querySelector(".unregister-link"); diff --git a/devtools/client/aboutdebugging/test/browser_tabs.js b/devtools/client/aboutdebugging/test/browser_tabs.js index 700cc630700e..2b89756d9137 100644 --- a/devtools/client/aboutdebugging/test/browser_tabs.js +++ b/devtools/client/aboutdebugging/test/browser_tabs.js @@ -61,7 +61,9 @@ add_task(async function() { function getTabContainer(name, document) { const nameElements = [...document.querySelectorAll("#tabs .target-name")]; - const nameElement = nameElements.filter(element => element.textContent === name)[0]; + const nameElement = nameElements.filter( + element => element.textContent === name + )[0]; if (nameElement) { return nameElement.closest(".target-container"); } diff --git a/devtools/client/aboutdebugging/test/head.js b/devtools/client/aboutdebugging/test/head.js index 75f0c884f7ea..e4faaf893a4f 100644 --- a/devtools/client/aboutdebugging/test/head.js +++ b/devtools/client/aboutdebugging/test/head.js @@ -10,11 +10,19 @@ // Load the shared-head file first. Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", - this); + this +); -const { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm"); -const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", null); -const { ExtensionTestCommon } = ChromeUtils.import("resource://testing-common/ExtensionTestCommon.jsm"); +const { AddonManager } = ChromeUtils.import( + "resource://gre/modules/AddonManager.jsm" +); +const { Management } = ChromeUtils.import( + "resource://gre/modules/Extension.jsm", + null +); +const { ExtensionTestCommon } = ChromeUtils.import( + "resource://testing-common/ExtensionTestCommon.jsm" +); async function openAboutDebugging(page, win) { info("Turn off the new about:debugging for the test"); @@ -43,8 +51,9 @@ function closeAboutDebugging(tab) { } function getSupportsFile(path) { - const cr = Cc["@mozilla.org/chrome/chrome-registry;1"] - .getService(Ci.nsIChromeRegistry); + const cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService( + Ci.nsIChromeRegistry + ); const uri = Services.io.newURI(CHROME_URL_ROOT + path); const fileurl = cr.convertChromeURL(uri); return fileurl.QueryInterface(Ci.nsIFileURL); @@ -57,8 +66,10 @@ function getSupportsFile(path) { * @return {DOMNode} target list or container element */ function getAddonList(document) { - return document.querySelector("#addons .target-list") || - document.querySelector("#addons .targets"); + return ( + document.querySelector("#addons .target-list") || + document.querySelector("#addons .targets") + ); } /** @@ -68,8 +79,10 @@ function getAddonList(document) { * @return {DOMNode} target list or container element */ function getTemporaryAddonList(document) { - return document.querySelector("#temporary-addons .target-list") || - document.querySelector("#temporary-addons .targets"); + return ( + document.querySelector("#temporary-addons .target-list") || + document.querySelector("#temporary-addons .targets") + ); } /** @@ -99,8 +112,10 @@ function getInstalledAddonNames(document) { * @return {DOMNode} target list or container element */ function getServiceWorkerList(document) { - return document.querySelector("#service-workers .target-list") || - document.querySelector("#service-workers.targets"); + return ( + document.querySelector("#service-workers .target-list") || + document.querySelector("#service-workers.targets") + ); } /** @@ -114,8 +129,12 @@ function getServiceWorkerList(document) { * @return {DOMNode} container element */ function getServiceWorkerContainer(name, document) { - const nameElements = [...document.querySelectorAll("#service-workers .target-name")]; - const nameElement = nameElements.filter(element => element.textContent === name)[0]; + const nameElements = [ + ...document.querySelectorAll("#service-workers .target-name"), + ]; + const nameElement = nameElements.filter( + element => element.textContent === name + )[0]; if (nameElement) { return nameElement.closest(".target-container"); } @@ -165,11 +184,13 @@ async function waitUntilElement(selector, parent) { * @return {DOMNode} target list or container element */ function getTabList(document) { - return document.querySelector("#tabs .target-list") || - document.querySelector("#tabs.targets"); + return ( + document.querySelector("#tabs .target-list") || + document.querySelector("#tabs.targets") + ); } -async function installAddon({document, path, file, name}) { +async function installAddon({ document, path, file, name }) { // Mock the file picker to select a test addon const MockFilePicker = SpecialPowers.MockFilePicker; MockFilePicker.init(window); @@ -208,7 +229,7 @@ async function installAddon({document, path, file, name}) { await waitUntilAddonContainer(name, document); } -async function uninstallAddon({document, id, name}) { +async function uninstallAddon({ document, id, name }) { // Now uninstall this addon await new Promise(async done => { const addon = await AddonManager.getAddonByID(id); @@ -243,13 +264,20 @@ function getAddonCount(document) { * @return {Promise} */ function waitForInitialAddonList(document) { - info("Waiting for add-ons to load. Current add-on count: " + getAddonCount(document)); + info( + "Waiting for add-ons to load. Current add-on count: " + + getAddonCount(document) + ); return waitUntil(() => getAddonCount(document) > 0, 100); } function getAddonContainer(name, document) { - const nameElements = [...document.querySelectorAll("#addons-panel .target-name")]; - const nameElement = nameElements.filter(element => element.textContent === name)[0]; + const nameElements = [ + ...document.querySelectorAll("#addons-panel .target-name"), + ]; + const nameElement = nameElements.filter( + element => element.textContent === name + )[0]; if (nameElement) { return nameElement.closest(".addon-target-container"); } @@ -275,8 +303,11 @@ async function waitUntilAddonContainer(name, document) { function assertHasTarget(expected, document, type, name) { let names = [...document.querySelectorAll("#" + type + " .target-name")]; names = names.map(element => element.textContent); - is(names.includes(name), expected, - "The " + type + " url appears in the list: " + names); + is( + names.includes(name), + expected, + "The " + type + " url appears in the list: " + names + ); } /** @@ -304,7 +335,9 @@ function waitForServiceWorkerRegistered(tab) { */ async function unregisterServiceWorker(tab, serviceWorkersElement) { // Get the initial count of service worker registrations. - let registrations = serviceWorkersElement.querySelectorAll(".target-container"); + let registrations = serviceWorkersElement.querySelectorAll( + ".target-container" + ); const registrationCount = registrations.length; // Wait until the registration count is decreased by one. @@ -346,15 +379,17 @@ function waitForDelayedStartupFinished(win) { */ async function setupTestAboutDebuggingWebExtension(name, file) { await new Promise(resolve => { - const options = {"set": [ - // Force enabling of addons debugging - ["devtools.chrome.enabled", true], - ["devtools.debugger.remote-enabled", true], - // Disable security prompt - ["devtools.debugger.prompt-connection", false], - // Enable Browser toolbox test script execution via env variable - ["devtools.browser-toolbox.allow-unsafe-script", true], - ]}; + const options = { + set: [ + // Force enabling of addons debugging + ["devtools.chrome.enabled", true], + ["devtools.debugger.remote-enabled", true], + // Disable security prompt + ["devtools.debugger.prompt-connection", false], + // Enable Browser toolbox test script execution via env variable + ["devtools.browser-toolbox.allow-unsafe-script", true], + ], + }; SpecialPowers.pushPrefEnv(options, resolve); }); @@ -398,14 +433,16 @@ async function waitForServiceWorkerActivation(swUrl, document) { * Set all preferences needed to enable service worker debugging and testing. */ async function enableServiceWorkerDebugging() { - const options = { "set": [ - // Enable service workers. - ["dom.serviceWorkers.enabled", true], - // Accept workers from mochitest's http. - ["dom.serviceWorkers.testing.enabled", true], - // Force single content process. - ["dom.ipc.processCount", 1], - ]}; + const options = { + set: [ + // Enable service workers. + ["dom.serviceWorkers.enabled", true], + // Accept workers from mochitest's http. + ["dom.serviceWorkers.testing.enabled", true], + // Force single content process. + ["dom.ipc.processCount", 1], + ], + }; // Wait for dom.ipc.processCount to be updated before releasing processes. await new Promise(done => { @@ -465,6 +502,9 @@ async function tearDownAddon(AboutDebugging, addon) { addon.uninstall(); await onListUpdated; const [uninstalledAddon] = await onUninstalled; - is(uninstalledAddon.id, addon.id, - `Add-on was uninstalled: ${uninstalledAddon.id}`); + is( + uninstalledAddon.id, + addon.id, + `Add-on was uninstalled: ${uninstalledAddon.id}` + ); } diff --git a/devtools/client/aboutdebugging/test/service-workers/push-sw.js b/devtools/client/aboutdebugging/test/service-workers/push-sw.js index 0496b004b597..20710378c777 100644 --- a/devtools/client/aboutdebugging/test/service-workers/push-sw.js +++ b/devtools/client/aboutdebugging/test/service-workers/push-sw.js @@ -22,9 +22,11 @@ self.addEventListener("install", function(event) { // Claim control over the currently open test page when activating. self.addEventListener("activate", function(event) { - event.waitUntil(self.clients.claim().then(function() { - return postMessage("sw-claimed"); - })); + event.waitUntil( + self.clients.claim().then(function() { + return postMessage("sw-claimed"); + }) + ); }); // Forward all "push" events to the controlled window. diff --git a/devtools/client/accessibility/accessibility-startup.js b/devtools/client/accessibility/accessibility-startup.js index f5cefa75a8f4..dbfa89432dfe 100644 --- a/devtools/client/accessibility/accessibility-startup.js +++ b/devtools/client/accessibility/accessibility-startup.js @@ -48,11 +48,13 @@ class AccessibilityStartup { this._walker = await this._accessibility.getWalker(); this._supports = {}; // Only works with FF61+ targets - this._supports.enableDisable = - await this.target.actorHasMethod("accessibility", "enable"); + this._supports.enableDisable = await this.target.actorHasMethod( + "accessibility", + "enable" + ); if (this._supports.enableDisable) { - ([ + [ this._supports.relations, this._supports.snapshot, this._supports.audit, @@ -62,7 +64,7 @@ class AccessibilityStartup { this.target.actorHasMethod("accessible", "snapshot"), this.target.actorHasMethod("accessible", "audit"), this.target.actorHasMethod("accessible", "hydrate"), - ])); + ]); await this._accessibility.bootstrap(); } @@ -82,7 +84,7 @@ class AccessibilityStartup { */ initAccessibility() { if (!this._initAccessibility) { - this._initAccessibility = (async function() { + this._initAccessibility = async function() { await Promise.race([ this.toolbox.isOpen, this.toolbox.once("accessibility-init"), @@ -105,7 +107,7 @@ class AccessibilityStartup { this._accessibility.on("init", this._updateToolHighlight); this._accessibility.on("shutdown", this._updateToolHighlight); - }.bind(this))(); + }.bind(this)(); } return this._initAccessibility; @@ -122,7 +124,7 @@ class AccessibilityStartup { return this._destroyingAccessibility; } - this._destroyingAccessibility = (async function() { + this._destroyingAccessibility = async function() { if (!this._accessibility) { return; } @@ -137,7 +139,7 @@ class AccessibilityStartup { await this._walker.destroy(); this._accessibility = null; this._walker = null; - }.bind(this))(); + }.bind(this)(); return this._destroyingAccessibility; } diff --git a/devtools/client/accessibility/accessibility-view.js b/devtools/client/accessibility/accessibility-view.js index bbb939ee3caf..243acc351885 100644 --- a/devtools/client/accessibility/accessibility-view.js +++ b/devtools/client/accessibility/accessibility-view.js @@ -8,15 +8,19 @@ const nodeConstants = require("devtools/shared/dom-node-constants"); // React & Redux -const { createFactory, createElement } = require("devtools/client/shared/vendor/react"); +const { + createFactory, + createElement, +} = require("devtools/client/shared/vendor/react"); const ReactDOM = require("devtools/client/shared/vendor/react-dom"); const { Provider } = require("devtools/client/shared/vendor/react-redux"); const { combineReducers } = require("devtools/client/shared/vendor/redux"); // Accessibility Panel const MainFrame = createFactory(require("./components/MainFrame")); -const OldVersionDescription = - createFactory(require("./components/Description").OldVersionDescription); +const OldVersionDescription = createFactory( + require("./components/Description").OldVersionDescription +); // Store const createStore = require("devtools/client/shared/redux/create-store")(); diff --git a/devtools/client/accessibility/actions/accessibles.js b/devtools/client/accessibility/actions/accessibles.js index f756a6b1f2fa..d568266d502a 100644 --- a/devtools/client/accessibility/actions/accessibles.js +++ b/devtools/client/accessibility/actions/accessibles.js @@ -3,26 +3,33 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { FETCH_CHILDREN, SELECT, HIGHLIGHT, UNHIGHLIGHT } = require("../constants"); +const { + FETCH_CHILDREN, + SELECT, + HIGHLIGHT, + UNHIGHLIGHT, +} = require("../constants"); /** * Fetch child accessibles for a given accessible object. * @param {Object} accessible front */ -exports.fetchChildren = accessible => - dispatch => accessible.children() +exports.fetchChildren = accessible => dispatch => + accessible + .children() .then(response => dispatch({ accessible, type: FETCH_CHILDREN, response })) .catch(error => dispatch({ accessible, type: FETCH_CHILDREN, error })); -exports.select = (walker, accessible) => - dispatch => walker.getAncestry(accessible) +exports.select = (walker, accessible) => dispatch => + walker + .getAncestry(accessible) .then(response => dispatch({ accessible, type: SELECT, response })) .catch(error => dispatch({ accessible, type: SELECT, error })); -exports.highlight = (walker, accessible) => - dispatch => walker.getAncestry(accessible) +exports.highlight = (walker, accessible) => dispatch => + walker + .getAncestry(accessible) .then(response => dispatch({ accessible, type: HIGHLIGHT, response })) .catch(error => dispatch({ accessible, type: HIGHLIGHT, error })); -exports.unhighlight = () => - dispatch => dispatch({ type: UNHIGHLIGHT }); +exports.unhighlight = () => dispatch => dispatch({ type: UNHIGHLIGHT }); diff --git a/devtools/client/accessibility/actions/audit.js b/devtools/client/accessibility/actions/audit.js index 7edd1bd15ad8..9973eee0d9d1 100644 --- a/devtools/client/accessibility/actions/audit.js +++ b/devtools/client/accessibility/actions/audit.js @@ -4,20 +4,27 @@ "use strict"; -const { accessibility: { AUDIT_TYPE } } = require("devtools/shared/constants"); -const { AUDIT, AUDIT_PROGRESS, AUDITING, FILTER_TOGGLE, FILTERS } = require("../constants"); +const { + accessibility: { AUDIT_TYPE }, +} = require("devtools/shared/constants"); +const { + AUDIT, + AUDIT_PROGRESS, + AUDITING, + FILTER_TOGGLE, + FILTERS, +} = require("../constants"); -exports.filterToggle = filter => - dispatch => dispatch({ filter, type: FILTER_TOGGLE }); +exports.filterToggle = filter => dispatch => + dispatch({ filter, type: FILTER_TOGGLE }); -exports.auditing = filter => - dispatch => { - const auditing = filter === FILTERS.ALL ? Object.values(FILTERS) : [filter]; - return dispatch({ auditing, type: AUDITING }); - }; +exports.auditing = filter => dispatch => { + const auditing = filter === FILTERS.ALL ? Object.values(FILTERS) : [filter]; + return dispatch({ auditing, type: AUDITING }); +}; -exports.audit = (walker, filter) => - dispatch => new Promise(resolve => { +exports.audit = (walker, filter) => dispatch => + new Promise(resolve => { const types = filter === FILTERS.ALL ? Object.values(AUDIT_TYPE) : [filter]; const auditEventHandler = ({ type, ancestries, progress }) => { switch (type) { diff --git a/devtools/client/accessibility/actions/details.js b/devtools/client/accessibility/actions/details.js index 4021ede22c08..a7ceede70318 100644 --- a/devtools/client/accessibility/actions/details.js +++ b/devtools/client/accessibility/actions/details.js @@ -12,11 +12,15 @@ const { UPDATE_DETAILS } = require("../constants"); * @param {Object} accessible front * @param {Object} list of supported serverside features. */ -exports.updateDetails = (domWalker, accessible, supports) => - dispatch => Promise.all([ - domWalker.getNodeFromActor(accessible.actorID, ["rawAccessible", "DOMNode"]), +exports.updateDetails = (domWalker, accessible, supports) => dispatch => + Promise.all([ + domWalker.getNodeFromActor(accessible.actorID, [ + "rawAccessible", + "DOMNode", + ]), supports.relations ? accessible.getRelations() : [], supports.audit ? accessible.audit() : {}, supports.hydration ? accessible.hydrate() : null, - ]).then(response => dispatch({ accessible, type: UPDATE_DETAILS, response })) + ]) + .then(response => dispatch({ accessible, type: UPDATE_DETAILS, response })) .catch(error => dispatch({ accessible, type: UPDATE_DETAILS, error })); diff --git a/devtools/client/accessibility/actions/ui.js b/devtools/client/accessibility/actions/ui.js index 1108d9dc4d3d..c66fd90fab2b 100644 --- a/devtools/client/accessibility/actions/ui.js +++ b/devtools/client/accessibility/actions/ui.js @@ -14,33 +14,35 @@ const { /** * Reset accessibility panel UI. */ -exports.reset = (accessibility, supports) => - dispatch => dispatch({ accessibility, supports, type: RESET }); +exports.reset = (accessibility, supports) => dispatch => + dispatch({ accessibility, supports, type: RESET }); /** * Update a "canBeDisabled" flag for accessibility service. */ -exports.updateCanBeDisabled = canBeDisabled => - dispatch => dispatch({ canBeDisabled, type: UPDATE_CAN_BE_DISABLED }); +exports.updateCanBeDisabled = canBeDisabled => dispatch => + dispatch({ canBeDisabled, type: UPDATE_CAN_BE_DISABLED }); /** * Update a "canBeEnabled" flag for accessibility service. */ -exports.updateCanBeEnabled = canBeEnabled => - dispatch => dispatch({ canBeEnabled, type: UPDATE_CAN_BE_ENABLED }); +exports.updateCanBeEnabled = canBeEnabled => dispatch => + dispatch({ canBeEnabled, type: UPDATE_CAN_BE_ENABLED }); /** * Enable accessibility services in order to view accessible tree. */ -exports.enable = accessibility => - dispatch => accessibility.enable() +exports.enable = accessibility => dispatch => + accessibility + .enable() .then(() => dispatch({ type: ENABLE })) .catch(error => dispatch({ error, type: ENABLE })); /** * Enable accessibility services in order to view accessible tree. */ -exports.disable = accessibility => - dispatch => accessibility.disable() +exports.disable = accessibility => dispatch => + accessibility + .disable() .then(() => dispatch({ type: DISABLE })) .catch(error => dispatch({ type: DISABLE, error })); diff --git a/devtools/client/accessibility/components/AccessibilityRow.js b/devtools/client/accessibility/components/AccessibilityRow.js index a6911139883d..a22470f7fd9c 100644 --- a/devtools/client/accessibility/components/AccessibilityRow.js +++ b/devtools/client/accessibility/components/AccessibilityRow.js @@ -6,7 +6,10 @@ /* global gTelemetry, gToolbox, EVENTS */ // React & Redux -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { findDOMNode } = require("devtools/client/shared/vendor/react-dom"); const { connect } = require("devtools/client/shared/vendor/react-redux"); @@ -16,10 +19,15 @@ const AuditFilter = createFactory(require("./AuditFilter")); const AuditController = createFactory(require("./AuditController")); // Utils -const {flashElementOn, flashElementOff} = - require("devtools/client/inspector/markup/utils"); +const { + flashElementOn, + flashElementOff, +} = require("devtools/client/inspector/markup/utils"); const { openDocLink } = require("devtools/client/shared/link"); -const { VALUE_FLASHING_DURATION, VALUE_HIGHLIGHT_DURATION } = require("../constants"); +const { + VALUE_FLASHING_DURATION, + VALUE_HIGHLIGHT_DURATION, +} = require("../constants"); // Actions const { updateDetails } = require("../actions/details"); @@ -28,7 +36,11 @@ const { unhighlight } = require("../actions/accessibles"); const { L10N } = require("../utils/l10n"); loader.lazyRequireGetter(this, "Menu", "devtools/client/framework/menu"); -loader.lazyRequireGetter(this, "MenuItem", "devtools/client/framework/menu-item"); +loader.lazyRequireGetter( + this, + "MenuItem", + "devtools/client/framework/menu-item" +); const { scrollIntoView } = require("devtools/client/shared/scroll"); @@ -46,8 +58,10 @@ class HighlightableTreeRowClass extends TreeRow { return shouldTreeRowUpdate; } - if (nextProps.highlighted !== this.props.highlighted || - nextProps.filtered !== this.props.filtered) { + if ( + nextProps.highlighted !== this.props.highlighted || + nextProps.filtered !== this.props.filtered + ) { return true; } @@ -116,7 +130,11 @@ class AccessibilityRow extends Component { } update() { - const { dispatch, member: { object }, supports } = this.props; + const { + dispatch, + member: { object }, + supports, + } = this.props; if (!gToolbox || !object.actorID) { return; } @@ -153,8 +171,9 @@ class AccessibilityRow extends Component { return; } - walker.highlightAccessible(accessible, options).catch(error => - console.warn(error)); + walker + .highlightAccessible(accessible, options) + .catch(error => console.warn(error)); } unhighlight() { @@ -176,12 +195,17 @@ class AccessibilityRow extends Component { } if (gTelemetry) { - gTelemetry.keyedScalarAdd(TELEMETRY_ACCESSIBLE_CONTEXT_MENU_ITEM_ACTIVATED, - "print-to-json", 1); + gTelemetry.keyedScalarAdd( + TELEMETRY_ACCESSIBLE_CONTEXT_MENU_ITEM_ACTIVATED, + "print-to-json", + 1 + ); } const snapshot = await member.object.snapshot(); - openDocLink(`${JSON_URL_PREFIX}${encodeURIComponent(JSON.stringify(snapshot))}`); + openDocLink( + `${JSON_URL_PREFIX}${encodeURIComponent(JSON.stringify(snapshot))}` + ); } onContextMenu(e) { @@ -196,11 +220,13 @@ class AccessibilityRow extends Component { const { supports } = this.props; if (supports.snapshot) { - menu.append(new MenuItem({ - id: "menu-printtojson", - label: L10N.getStr("accessibility.tree.menu.printToJSON"), - click: () => this.printToJSON(), - })); + menu.append( + new MenuItem({ + id: "menu-printtojson", + label: L10N.getStr("accessibility.tree.menu.printToJSON"), + click: () => this.printToJSON(), + }) + ); } menu.popup(e.screenX, e.screenY, gToolbox.doc); @@ -224,11 +250,12 @@ class AccessibilityRow extends Component { key: `${member.path}-${member.active ? "active" : "inactive"}`, }; - return AuditController({ - accessible: member.object, - }, - AuditFilter({}, - HighlightableTreeRow(props))); + return AuditController( + { + accessible: member.object, + }, + AuditFilter({}, HighlightableTreeRow(props)) + ); } } @@ -236,5 +263,9 @@ const mapStateToProps = ({ ui }) => ({ supports: ui.supports, }); -module.exports = - connect(mapStateToProps, null, null, { withRef: true })(AccessibilityRow); +module.exports = connect( + mapStateToProps, + null, + null, + { withRef: true } +)(AccessibilityRow); diff --git a/devtools/client/accessibility/components/AccessibilityRowValue.js b/devtools/client/accessibility/components/AccessibilityRowValue.js index f5f12a0db4c2..93d74ed031da 100644 --- a/devtools/client/accessibility/components/AccessibilityRowValue.js +++ b/devtools/client/accessibility/components/AccessibilityRowValue.js @@ -4,7 +4,10 @@ "use strict"; -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { span } = require("devtools/client/shared/vendor/react-dom-factories"); @@ -28,20 +31,27 @@ class AccessibilityRowValue extends Component { } render() { - const { member, supports: { audit } } = this.props; + const { + member, + supports: { audit }, + } = this.props; - return span({ - role: "presentation", - }, + return span( + { + role: "presentation", + }, Rep({ ...this.props, defaultRep: Grip, cropLimit: 50, }), - audit && AuditController({ - accessible: member.object, - }, - Badges()), + audit && + AuditController( + { + accessible: member.object, + }, + Badges() + ) ); } } diff --git a/devtools/client/accessibility/components/AccessibilityTree.js b/devtools/client/accessibility/components/AccessibilityTree.js index 0354111e2d9b..2231096a18ed 100644 --- a/devtools/client/accessibility/components/AccessibilityTree.js +++ b/devtools/client/accessibility/components/AccessibilityTree.js @@ -6,11 +6,16 @@ /* global EVENTS */ // React & Redux -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { connect } = require("devtools/client/shared/vendor/react-redux"); -const TreeView = createFactory(require("devtools/client/shared/components/tree/TreeView")); +const TreeView = createFactory( + require("devtools/client/shared/components/tree/TreeView") +); // Reps const { MODE } = require("devtools/client/shared/components/reps/reps"); @@ -112,8 +117,10 @@ class AccessibilityTree extends Component { const { accessibles, walker, dispatch } = this.props; parent = parent || walker; - if (accessibles.has(accessible.actorID) || - accessibles.has(parent.actorID)) { + if ( + accessibles.has(accessible.actorID) || + accessibles.has(parent.actorID) + ) { dispatch(fetchChildren(parent)); } } @@ -141,13 +148,16 @@ class AccessibilityTree extends Component { * Render Accessibility panel content */ render() { - const columns = [{ - "id": "default", - "title": L10N.getStr("accessibility.role"), - }, { - "id": "value", - "title": L10N.getStr("accessibility.name"), - }]; + const columns = [ + { + id: "default", + title: L10N.getStr("accessibility.role"), + }, + { + id: "value", + title: L10N.getStr("accessibility.name"), + }, + ]; const { accessibles, @@ -167,42 +177,46 @@ class AccessibilityTree extends Component { const renderRow = rowProps => { const { object } = rowProps.member; const highlighted = object === highlightedItem; - return AccessibilityRow(Object.assign({}, rowProps, { - walker, - hasContextMenu, - highlighted, - decorator: { - getRowClass: function() { - return highlighted ? ["highlighted"] : []; + return AccessibilityRow( + Object.assign({}, rowProps, { + walker, + hasContextMenu, + highlighted, + decorator: { + getRowClass: function() { + return highlighted ? ["highlighted"] : []; + }, }, - }, - })); + }) + ); }; const className = filtered ? "filtered" : undefined; - return ( - TreeView({ - object: walker, - mode: MODE.SHORT, - provider: new Provider(accessibles, filtered, dispatch), - columns: columns, - className, - renderValue: this.renderValue, - renderRow, - label: L10N.getStr("accessibility.treeName"), - header: true, - expandedNodes: expanded, - selected, - onClickRow(nodePath, event) { - if (event.target.classList.contains("theme-twisty")) { - this.toggle(nodePath); - } + return TreeView({ + object: walker, + mode: MODE.SHORT, + provider: new Provider(accessibles, filtered, dispatch), + columns: columns, + className, + renderValue: this.renderValue, + renderRow, + label: L10N.getStr("accessibility.treeName"), + header: true, + expandedNodes: expanded, + selected, + onClickRow(nodePath, event) { + if (event.target.classList.contains("theme-twisty")) { + this.toggle(nodePath); + } - this.selectRow( - this.rows.find(row => row.props.member.path === nodePath), - { preventAutoScroll: true }); - }, - onContextMenuTree: hasContextMenu && function(e) { + this.selectRow( + this.rows.find(row => row.props.member.path === nodePath), + { preventAutoScroll: true } + ); + }, + onContextMenuTree: + hasContextMenu && + function(e) { // If context menu event is triggered on (or bubbled to) the TreeView, it was // done via keyboard. Open context menu for currently selected row. let row = this.getSelectedRow(); @@ -213,8 +227,7 @@ class AccessibilityTree extends Component { row = row.getWrappedInstance(); row.onContextMenu(e); }, - }) - ); + }); } } diff --git a/devtools/client/accessibility/components/AccessibilityTreeFilter.js b/devtools/client/accessibility/components/AccessibilityTreeFilter.js index bdbcd9da975c..183836244cce 100644 --- a/devtools/client/accessibility/components/AccessibilityTreeFilter.js +++ b/devtools/client/accessibility/components/AccessibilityTreeFilter.js @@ -6,8 +6,14 @@ /* global gTelemetry */ // React -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); -const { div, span } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); +const { + div, + span, +} = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { L10N } = require("../utils/l10n"); const ToggleButton = createFactory(require("./Button").ToggleButton); @@ -86,17 +92,22 @@ class AccessibilityTreeFilter extends Component { onClick: this.onClick.bind(this, filterKey), onKeyDown: this.onKeyDown.bind(this, filterKey), busy: auditing.includes(filterKey), - })); + }) + ); - return div({ - role: "toolbar", - className: "accessibility-tree-filters", - "aria-labelledby": toolbarLabelID, - "aria-describedby": describedby, - }, - span({ id: toolbarLabelID, role: "presentation" }, - L10N.getStr("accessibility.tree.filters")), - ...filterButtons); + return div( + { + role: "toolbar", + className: "accessibility-tree-filters", + "aria-labelledby": toolbarLabelID, + "aria-describedby": describedby, + }, + span( + { id: toolbarLabelID, role: "presentation" }, + L10N.getStr("accessibility.tree.filters") + ), + ...filterButtons + ); } } diff --git a/devtools/client/accessibility/components/Accessible.js b/devtools/client/accessibility/components/Accessible.js index e7db2d5a52e6..b2d43ca6523f 100644 --- a/devtools/client/accessibility/components/Accessible.js +++ b/devtools/client/accessibility/components/Accessible.js @@ -6,30 +6,52 @@ /* global EVENTS, gTelemetry, gToolbox */ // React & Redux -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); -const { div, span } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); +const { + div, + span, +} = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { findDOMNode } = require("devtools/client/shared/vendor/react-dom"); const { connect } = require("devtools/client/shared/vendor/react-redux"); -const { TREE_ROW_HEIGHT, ORDERED_PROPS, ACCESSIBLE_EVENTS, VALUE_FLASHING_DURATION } = - require("../constants"); +const { + TREE_ROW_HEIGHT, + ORDERED_PROPS, + ACCESSIBLE_EVENTS, + VALUE_FLASHING_DURATION, +} = require("../constants"); const { L10N } = require("../utils/l10n"); -const {flashElementOn, flashElementOff} = - require("devtools/client/inspector/markup/utils"); +const { + flashElementOn, + flashElementOff, +} = require("devtools/client/inspector/markup/utils"); const { updateDetails } = require("../actions/details"); const { select, unhighlight } = require("../actions/accessibles"); -const Tree = createFactory(require("devtools/client/shared/components/VirtualizedTree")); +const Tree = createFactory( + require("devtools/client/shared/components/VirtualizedTree") +); // Reps const { REPS, MODE } = require("devtools/client/shared/components/reps/reps"); const { Rep, ElementNode, Accessible: AccessibleRep, Obj } = REPS; -const { translateNodeFrontToGrip } = require("devtools/client/inspector/shared/utils"); +const { + translateNodeFrontToGrip, +} = require("devtools/client/inspector/shared/utils"); -loader.lazyRequireGetter(this, "openContentLink", "devtools/client/shared/link", true); +loader.lazyRequireGetter( + this, + "openContentLink", + "devtools/client/shared/link", + true +); -const TELEMETRY_NODE_INSPECTED_COUNT = "devtools.accessibility.node_inspected_count"; +const TELEMETRY_NODE_INSPECTED_COUNT = + "devtools.accessibility.node_inspected_count"; const TREE_DEPTH_PADDING_INCREMENT = 20; @@ -46,8 +68,12 @@ class AccessiblePropertyClass extends Component { componentDidUpdate({ object: prevObject, accessible: prevAccessible }) { const { accessible, object, focused } = this.props; // Fast check if row is focused or if the value did not update. - if (focused || accessible !== prevAccessible || prevObject === object || - (object && prevObject && typeof object === "object")) { + if ( + focused || + accessible !== prevAccessible || + prevObject === object || + (object && prevObject && typeof object === "object") + ) { return; } @@ -103,7 +129,10 @@ class Accessible extends Component { } componentWillMount() { - window.on(EVENTS.NEW_ACCESSIBLE_FRONT_INSPECTED, this.onAccessibleInspected); + window.on( + EVENTS.NEW_ACCESSIBLE_FRONT_INSPECTED, + this.onAccessibleInspected + ); } componentWillReceiveProps({ accessible }) { @@ -122,7 +151,10 @@ class Accessible extends Component { } componentWillUnmount() { - window.off(EVENTS.NEW_ACCESSIBLE_FRONT_INSPECTED, this.onAccessibleInspected); + window.off( + EVENTS.NEW_ACCESSIBLE_FRONT_INSPECTED, + this.onAccessibleInspected + ); const { accessible } = this.props; if (accessible) { @@ -217,8 +249,9 @@ class Accessible extends Component { return; } - gToolbox.selectTool("inspector").then(() => - gToolbox.selection.setNodeFront(nodeFront, reason)); + gToolbox + .selectTool("inspector") + .then(() => gToolbox.selection.setNodeFront(nodeFront, reason)); } async selectAccessible(accessible) { @@ -254,13 +287,15 @@ class Accessible extends Component { if (isNode(object)) { valueProps.defaultRep = ElementNode; valueProps.onDOMNodeMouseOut = () => this.hideHighlighter(); - valueProps.onDOMNodeMouseOver = () => this.showHighlighter(this.props.DOMNode); + valueProps.onDOMNodeMouseOver = () => + this.showHighlighter(this.props.DOMNode); valueProps.onInspectIconClick = () => this.selectNode(this.props.DOMNode); } else if (isAccessible(object)) { const target = findAccessibleTarget(this.props.relations, object.actor); valueProps.defaultRep = AccessibleRep; valueProps.onAccessibleMouseOut = () => this.hideAccessibleHighlighter(); - valueProps.onAccessibleMouseOver = () => this.showAccessibleHighlighter(target); + valueProps.onAccessibleMouseOver = () => + this.showAccessibleHighlighter(target); valueProps.onInspectIconClick = (obj, e) => { e.stopPropagation(); this.selectAccessible(target); @@ -272,7 +307,7 @@ class Accessible extends Component { valueProps.noGrip = true; } - const classList = [ "node", "object-node" ]; + const classList = ["node", "object-node"]; if (focused) { classList.push("focused"); } @@ -281,24 +316,25 @@ class Accessible extends Component { return AccessibleProperty( { object, focused, accessible: this.props.accessible.actorID }, - () => div({ - className: classList.join(" "), - style: { - paddingInlineStart: depthPadding, - inlineSize: - `calc(var(--accessibility-properties-item-width) - ${depthPadding}px)`, - }, - onClick: e => { - if (e.target.classList.contains("theme-twisty")) { - this.setExpanded(item, !expanded); - } - }, - }, - arrow, - span({ className: "object-label" }, item.name), - span({ className: "object-delimiter" }, ":"), - span({ className: "object-value" }, Rep(valueProps) || "") - ) + () => + div( + { + className: classList.join(" "), + style: { + paddingInlineStart: depthPadding, + inlineSize: `calc(var(--accessibility-properties-item-width) - ${depthPadding}px)`, + }, + onClick: e => { + if (e.target.classList.contains("theme-twisty")) { + this.setExpanded(item, !expanded); + } + }, + }, + arrow, + span({ className: "object-label" }, item.name), + span({ className: "object-delimiter" }, ":"), + span({ className: "object-value" }, Rep(valueProps) || "") + ) ); } @@ -337,8 +373,10 @@ class Accessible extends Component { }); } - return div({ className: "info" }, - L10N.getStr("accessibility.accessible.notAvailable")); + return div( + { className: "info" }, + L10N.getStr("accessibility.accessible.notAvailable") + ); } } @@ -449,7 +487,7 @@ const makeItemsForDetails = (props, parentPath) => return { name, path, contents, children }; }); -const makeParentMap = (items) => { +const makeParentMap = items => { const map = new WeakMap(); function _traverse(item) { @@ -472,19 +510,22 @@ const mapStateToProps = ({ details, ui }) => { return {}; } - const items = makeItemsForDetails(ORDERED_PROPS.reduce((props, key) => { - if (key === "DOMNode") { - props.DOMNode = DOMNode; - } else if (key === "relations") { - if (supports.relations) { - props.relations = relations; + const items = makeItemsForDetails( + ORDERED_PROPS.reduce((props, key) => { + if (key === "DOMNode") { + props.DOMNode = DOMNode; + } else if (key === "relations") { + if (supports.relations) { + props.relations = relations; + } + } else { + props[key] = accessible[key]; } - } else { - props[key] = accessible[key]; - } - return props; - }, {}), ""); + return props; + }, {}), + "" + ); const parents = makeParentMap(items); return { accessible, DOMNode, items, parents, relations, supports }; diff --git a/devtools/client/accessibility/components/AuditController.js b/devtools/client/accessibility/components/AuditController.js index 5a8d35cde269..8c70b86daf07 100644 --- a/devtools/client/accessibility/components/AuditController.js +++ b/devtools/client/accessibility/components/AuditController.js @@ -18,7 +18,9 @@ class AuditController extends React.Component { constructor(props) { super(props); - const { accessible: { checks } } = props; + const { + accessible: { checks }, + } = props; this.state = { checks, }; diff --git a/devtools/client/accessibility/components/AuditFilter.js b/devtools/client/accessibility/components/AuditFilter.js index b55663c3b0c0..663ab51fdbe3 100644 --- a/devtools/client/accessibility/components/AuditFilter.js +++ b/devtools/client/accessibility/components/AuditFilter.js @@ -23,8 +23,8 @@ function validateCheck({ error, score }) { const AUDIT_TYPE_TO_FILTER = { [AUDIT_TYPE.CONTRAST]: { - filterKey: FILTERS.CONTRAST, - validator: validateCheck, + filterKey: FILTERS.CONTRAST, + validator: validateCheck, }, [AUDIT_TYPE.TEXT_LABEL]: { filterKey: FILTERS.TEXT_LABEL, @@ -56,9 +56,12 @@ class AuditFilter extends React.Component { } for (const type in checks) { - if (AUDIT_TYPE_TO_FILTER[type] && checks[type] && - filters[AUDIT_TYPE_TO_FILTER[type].filterKey] && - AUDIT_TYPE_TO_FILTER[type].validator(checks[type])) { + if ( + AUDIT_TYPE_TO_FILTER[type] && + checks[type] && + filters[AUDIT_TYPE_TO_FILTER[type].filterKey] && + AUDIT_TYPE_TO_FILTER[type].validator(checks[type]) + ) { return false; } } diff --git a/devtools/client/accessibility/components/AuditProgressOverlay.js b/devtools/client/accessibility/components/AuditProgressOverlay.js index 66ac2048a1f4..17269d74df9c 100644 --- a/devtools/client/accessibility/components/AuditProgressOverlay.js +++ b/devtools/client/accessibility/components/AuditProgressOverlay.js @@ -20,13 +20,15 @@ const { L10N } = require("../utils/l10n"); */ function TextProgressBar({ id, textStringKey }) { const text = L10N.getStr(textStringKey); - return ReactDOM.span({ - id, - key: id, - role: "progressbar", - "aria-valuetext": text, - }, - text); + return ReactDOM.span( + { + id, + key: id, + role: "progressbar", + "aria-valuetext": text, + }, + text + ); } class AuditProgressOverlay extends React.Component { @@ -47,31 +49,41 @@ class AuditProgressOverlay extends React.Component { const id = "audit-progress-container"; if (total == null) { - return TextProgressBar({id, textStringKey: "accessibility.progress.initializing"}); + return TextProgressBar({ + id, + textStringKey: "accessibility.progress.initializing", + }); } if (percentage === 100) { - return TextProgressBar({id, textStringKey: "accessibility.progress.finishing"}); + return TextProgressBar({ + id, + textStringKey: "accessibility.progress.finishing", + }); } - const progressbarString = PluralForm.get(total, - L10N.getStr("accessibility.progress.progressbar")); + const progressbarString = PluralForm.get( + total, + L10N.getStr("accessibility.progress.progressbar") + ); - return ReactDOM.span({ - id, - key: id, - }, + return ReactDOM.span( + { + id, + key: id, + }, progressbarString.replace("#1", total), ReactDOM.progress({ max: 100, value: percentage, className: "audit-progress-progressbar", "aria-labelledby": id, - })); + }) + ); } } -const mapStateToProps = ({ audit: { auditing, progress }}) => { +const mapStateToProps = ({ audit: { auditing, progress } }) => { const { total, percentage } = progress || {}; return { auditing, total, percentage }; }; diff --git a/devtools/client/accessibility/components/Badges.js b/devtools/client/accessibility/components/Badges.js index 034491d6eddd..31d3bbf40df5 100644 --- a/devtools/client/accessibility/components/Badges.js +++ b/devtools/client/accessibility/components/Badges.js @@ -4,19 +4,26 @@ "use strict"; // React -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { span } = require("devtools/client/shared/vendor/react-dom-factories"); const { L10N } = require("../utils/l10n"); -const { accessibility: { AUDIT_TYPE } } = require("devtools/shared/constants"); +const { + accessibility: { AUDIT_TYPE }, +} = require("devtools/shared/constants"); -loader.lazyGetter(this, "ContrastBadge", - () => createFactory(require("./ContrastBadge"))); +loader.lazyGetter(this, "ContrastBadge", () => + createFactory(require("./ContrastBadge")) +); -loader.lazyGetter(this, "TextLabelBadge", - () => createFactory(require("./TextLabelBadge"))); +loader.lazyGetter(this, "TextLabelBadge", () => + createFactory(require("./TextLabelBadge")) +); function getComponentForAuditType(type) { const auditTypeToComponentMap = { @@ -52,13 +59,13 @@ class Badges extends Component { return null; } - return ( - span({ + return span( + { className: "badges", role: "group", "aria-label": L10N.getStr("accessibility.badges"), }, - items) + items ); } } diff --git a/devtools/client/accessibility/components/Button.js b/devtools/client/accessibility/components/Button.js index bd8d3f4c5e0a..894db69c2242 100644 --- a/devtools/client/accessibility/components/Button.js +++ b/devtools/client/accessibility/components/Button.js @@ -6,7 +6,10 @@ const { Component } = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); -const { button, span } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + button, + span, +} = require("devtools/client/shared/vendor/react-dom-factories"); const defaultProps = { disabled: false, @@ -53,10 +56,16 @@ class Button extends Component { classList.push("devtools-throbber"); } - return (button(props, span({ - className: classList.join(" "), - tabIndex: -1, - }, this.props.children))); + return button( + props, + span( + { + className: classList.join(" "), + tabIndex: -1, + }, + this.props.children + ) + ); } } @@ -71,10 +80,7 @@ function ToggleButton(props) { onKeyDown, tooltip, } = props; - const classList = [ - ...className.split(" "), - "toggle-button", - ]; + const classList = [...className.split(" "), "toggle-button"]; if (active) { classList.push("checked"); @@ -84,15 +90,18 @@ function ToggleButton(props) { classList.push("devtools-throbber"); } - return button({ - disabled, - "aria-pressed": active === true, - "aria-busy": busy, - className: classList.join(" "), - onClick, - onKeyDown, - title: tooltip, - }, label); + return button( + { + disabled, + "aria-pressed": active === true, + "aria-busy": busy, + className: classList.join(" "), + onClick, + onKeyDown, + title: tooltip, + }, + label + ); } module.exports = { diff --git a/devtools/client/accessibility/components/Checks.js b/devtools/client/accessibility/components/Checks.js index b866c57dfd68..b85b50e24e75 100644 --- a/devtools/client/accessibility/components/Checks.js +++ b/devtools/client/accessibility/components/Checks.js @@ -4,25 +4,34 @@ "use strict"; // React -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const { connect } = require("devtools/client/shared/vendor/react-redux"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { div } = require("devtools/client/shared/vendor/react-dom-factories"); -const List = createFactory(require("devtools/client/shared/components/List").List); -const ColorContrastCheck = - createFactory(require("./ColorContrastAccessibility").ColorContrastCheck); +const List = createFactory( + require("devtools/client/shared/components/List").List +); +const ColorContrastCheck = createFactory( + require("./ColorContrastAccessibility").ColorContrastCheck +); const TextLabelCheck = createFactory(require("./TextLabelCheck")); const { L10N } = require("../utils/l10n"); -const { accessibility: { AUDIT_TYPE } } = require("devtools/shared/constants"); +const { + accessibility: { AUDIT_TYPE }, +} = require("devtools/shared/constants"); function EmptyChecks() { - return ( - div({ + return div( + { className: "checks-empty", role: "presentation", - }, L10N.getStr("accessibility.checks.empty2")) + }, + L10N.getStr("accessibility.checks.empty2") ); } @@ -68,11 +77,12 @@ class Checks extends Component { return EmptyChecks(); } - return ( - div({ + return div( + { className: "checks", role: "presentation", - }, List({ items, labelledby })) + }, + List({ items, labelledby }) ); } } diff --git a/devtools/client/accessibility/components/ColorContrastAccessibility.js b/devtools/client/accessibility/components/ColorContrastAccessibility.js index 6bbf7aa45506..5a4ee943e38f 100644 --- a/devtools/client/accessibility/components/ColorContrastAccessibility.js +++ b/devtools/client/accessibility/components/ColorContrastAccessibility.js @@ -4,9 +4,16 @@ "use strict"; -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); -const { div, span, h3 } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + div, + span, + h3, +} = require("devtools/client/shared/vendor/react-dom-factories"); const LearnMoreLink = createFactory(require("./LearnMoreLink")); const { A11Y_CONTRAST_LEARN_MORE_LINK } = require("../constants"); @@ -27,27 +34,20 @@ class ContrastValueClass extends Component { } render() { - const { - backgroundColor, - color, - value, - score, - } = this.props; + const { backgroundColor, color, value, score } = this.props; - const className = [ - "accessibility-contrast-value", - score, - ].join(" "); + const className = ["accessibility-contrast-value", score].join(" "); - return ( - span({ + return span( + { className, role: "presentation", style: { "--accessibility-contrast-color": `rgba(${color})`, "--accessibility-contrast-bg": `rgba(${backgroundColor})`, }, - }, value.toFixed(2)) + }, + value.toFixed(2) ); } } @@ -81,63 +81,88 @@ class ColorContrastAccessibilityClass extends Component { error, isLargeText, color, - value, backgroundColor, score, - min, backgroundColorMin, scoreMin, - max, backgroundColorMax, scoreMax, + value, + backgroundColor, + score, + min, + backgroundColorMin, + scoreMin, + max, + backgroundColorMax, + scoreMax, } = this.props; const children = []; if (error) { - children.push(span({ - className: "accessibility-color-contrast-error", - role: "presentation", - }, L10N.getStr("accessibility.contrast.error"))); + children.push( + span( + { + className: "accessibility-color-contrast-error", + role: "presentation", + }, + L10N.getStr("accessibility.contrast.error") + ) + ); - return (div({ - role: "presentation", - className: "accessibility-color-contrast", - }, ...children)); + return div( + { + role: "presentation", + className: "accessibility-color-contrast", + }, + ...children + ); } if (value) { children.push(ContrastValue({ score, color, backgroundColor, value })); } else { children.push( - ContrastValue( - { score: scoreMin, color, backgroundColor: backgroundColorMin, value: min }), + ContrastValue({ + score: scoreMin, + color, + backgroundColor: backgroundColorMin, + value: min, + }), div({ role: "presentation", className: "accessibility-color-contrast-separator", }), - ContrastValue( - { score: scoreMax, color, backgroundColor: backgroundColorMax, value: max }), + ContrastValue({ + score: scoreMax, + color, + backgroundColor: backgroundColorMax, + value: max, + }) ); } if (isLargeText) { children.push( - span({ - className: "accessibility-color-contrast-large-text", - role: "presentation", - title: L10N.getStr("accessibility.contrast.large.title"), - }, L10N.getStr("accessibility.contrast.large.text")) + span( + { + className: "accessibility-color-contrast-large-text", + role: "presentation", + title: L10N.getStr("accessibility.contrast.large.title"), + }, + L10N.getStr("accessibility.contrast.large.text") + ) ); } - return ( - div( - { - role: "presentation", - className: "accessibility-color-contrast", - }, - ...children - ) + return div( + { + role: "presentation", + className: "accessibility-color-contrast", + }, + ...children ); } } -const ColorContrastAccessibility = createFactory(ColorContrastAccessibilityClass); +const ColorContrastAccessibility = createFactory( + ColorContrastAccessibilityClass +); class ContrastAnnotationClass extends Component { static get propTypes() { @@ -149,17 +174,13 @@ class ContrastAnnotationClass extends Component { render() { const { score } = this.props; - return ( - LearnMoreLink( - { - className: "accessibility-check-annotation", - href: A11Y_CONTRAST_LEARN_MORE_LINK, - learnMoreStringKey: "accessibility.learnMore", - l10n: L10N, - messageStringKey: `accessibility.contrast.annotation.${score}`, - } - ) - ); + return LearnMoreLink({ + className: "accessibility-check-annotation", + href: A11Y_CONTRAST_LEARN_MORE_LINK, + learnMoreStringKey: "accessibility.learnMore", + l10n: L10N, + messageStringKey: `accessibility.contrast.annotation.${score}`, + }); } } @@ -175,17 +196,19 @@ class ColorContrastCheck extends Component { render() { const { error } = this.props; - return ( - div({ + return div( + { role: "presentation", className: "accessibility-check", }, - h3({ + h3( + { className: "accessibility-check-header", - }, L10N.getStr("accessibility.contrast.header")), - ColorContrastAccessibility(this.props), - !error && ContrastAnnotation(this.props) - ) + }, + L10N.getStr("accessibility.contrast.header") + ), + ColorContrastAccessibility(this.props), + !error && ContrastAnnotation(this.props) ); } } diff --git a/devtools/client/accessibility/components/ContrastBadge.js b/devtools/client/accessibility/components/ContrastBadge.js index 1adc6a0a2673..7b37c30f502f 100644 --- a/devtools/client/accessibility/components/ContrastBadge.js +++ b/devtools/client/accessibility/components/ContrastBadge.js @@ -4,20 +4,25 @@ "use strict"; // React -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { L10N } = require("../utils/l10n"); -const { accessibility: { SCORES } } = require("devtools/shared/constants"); +const { + accessibility: { SCORES }, +} = require("devtools/shared/constants"); loader.lazyGetter(this, "Badge", () => createFactory(require("./Badge"))); /** -* Component for rendering a badge for contrast accessibliity check -* failures association with a given accessibility object in the accessibility -* tree. -*/ + * Component for rendering a badge for contrast accessibliity check + * failures association with a given accessibility object in the accessibility + * tree. + */ class ContrastBadge extends Component { static get propTypes() { return { diff --git a/devtools/client/accessibility/components/Description.js b/devtools/client/accessibility/components/Description.js index d420c1737b70..9bfceaffe85b 100644 --- a/devtools/client/accessibility/components/Description.js +++ b/devtools/client/accessibility/components/Description.js @@ -6,8 +6,15 @@ /* global gTelemetry */ // React & Redux -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); -const { div, p, img } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); +const { + div, + p, + img, +} = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { connect } = require("devtools/client/shared/vendor/react-redux"); @@ -18,17 +25,23 @@ const { enable, updateCanBeEnabled } = require("../actions/ui"); // Localization const { L10N } = require("../utils/l10n"); -const { A11Y_LEARN_MORE_LINK, A11Y_SERVICE_ENABLED_COUNT } = require("../constants"); +const { + A11Y_LEARN_MORE_LINK, + A11Y_SERVICE_ENABLED_COUNT, +} = require("../constants"); class OldVersionDescription extends Component { render() { - return ( - div({ className: "description" }, - p({ className: "general" }, - img({ - src: "chrome://devtools/skin/images/accessibility.svg", - alt: L10N.getStr("accessibility.logo"), - }), L10N.getStr("accessibility.description.oldVersion"))) + return div( + { className: "description" }, + p( + { className: "general" }, + img({ + src: "chrome://devtools/skin/images/accessibility.svg", + alt: L10N.getStr("accessibility.logo"), + }), + L10N.getStr("accessibility.description.oldVersion") + ) ); } } @@ -58,13 +71,17 @@ class Description extends Component { } componentWillMount() { - this.props.accessibility.on("can-be-enabled-change", - this.onCanBeEnabledChange); + this.props.accessibility.on( + "can-be-enabled-change", + this.onCanBeEnabledChange + ); } componentWillUnmount() { - this.props.accessibility.off("can-be-enabled-change", - this.onCanBeEnabledChange); + this.props.accessibility.off( + "can-be-enabled-change", + this.onCanBeEnabledChange + ); } onEnable() { @@ -87,7 +104,9 @@ class Description extends Component { render() { const { canBeEnabled } = this.props; const { enabling } = this.state; - const enableButtonStr = enabling ? "accessibility.enabling" : "accessibility.enable"; + const enableButtonStr = enabling + ? "accessibility.enabling" + : "accessibility.enable"; let title; let disableButton = false; @@ -99,32 +118,37 @@ class Description extends Component { title = L10N.getStr("accessibility.enable.disabledTitle"); } - return ( - div({ className: "description", role: "presentation" }, - div({ className: "general", role: "presentation" }, - img({ - src: "chrome://devtools/skin/images/accessibility.svg", - alt: L10N.getStr("accessibility.logo"), + return div( + { className: "description", role: "presentation" }, + div( + { className: "general", role: "presentation" }, + img({ + src: "chrome://devtools/skin/images/accessibility.svg", + alt: L10N.getStr("accessibility.logo"), + }), + div( + { role: "presentation" }, + LearnMoreLink({ + href: + A11Y_LEARN_MORE_LINK + + "?utm_source=devtools&utm_medium=a11y-panel-description", + learnMoreStringKey: "accessibility.learnMore", + l10n: L10N, + messageStringKey: "accessibility.description.general.p1", }), - div({ role: "presentation" }, - LearnMoreLink({ - href: A11Y_LEARN_MORE_LINK + - "?utm_source=devtools&utm_medium=a11y-panel-description", - learnMoreStringKey: "accessibility.learnMore", - l10n: L10N, - messageStringKey: "accessibility.description.general.p1", - }), - p({}, L10N.getStr("accessibility.description.general.p2")) - ) - ), - Button({ + p({}, L10N.getStr("accessibility.description.general.p2")) + ) + ), + Button( + { id: "accessibility-enable-button", onClick: this.onEnable, disabled: enabling || disableButton, busy: enabling, "data-standalone": true, title, - }, L10N.getStr(enableButtonStr)) + }, + L10N.getStr(enableButtonStr) ) ); } diff --git a/devtools/client/accessibility/components/LearnMoreLink.js b/devtools/client/accessibility/components/LearnMoreLink.js index c4cbbe9a8db8..7ff2200b811c 100644 --- a/devtools/client/accessibility/components/LearnMoreLink.js +++ b/devtools/client/accessibility/components/LearnMoreLink.js @@ -42,8 +42,14 @@ class LearnMoreLink extends Component { } render() { - const { className, href, learnMoreStringKey, l10n, messageStringKey, onClick } = - this.props; + const { + className, + href, + learnMoreStringKey, + l10n, + messageStringKey, + onClick, + } = this.props; const learnMoreString = l10n.getStr(learnMoreStringKey); const messageString = l10n.getFormatStr(messageStringKey, learnMoreString); @@ -53,10 +59,11 @@ class LearnMoreLink extends Component { const contents = messageString.split(re); contents[1] = a({ className: "link", href, onClick }, contents[1]); - return ( - p({ + return p( + { className, - }, ...contents) + }, + ...contents ); } } diff --git a/devtools/client/accessibility/components/MainFrame.js b/devtools/client/accessibility/components/MainFrame.js index 1c072e83c358..eae4a55c289e 100644 --- a/devtools/client/accessibility/components/MainFrame.js +++ b/devtools/client/accessibility/components/MainFrame.js @@ -6,8 +6,14 @@ /* global gToolbox */ // React & Redux -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); -const { span, div } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); +const { + span, + div, +} = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { connect } = require("devtools/client/shared/vendor/react-redux"); const { reset } = require("../actions/ui"); @@ -25,7 +31,9 @@ const AuditProgressOverlay = createFactory(require("./AuditProgressOverlay")); const Description = createFactory(require("./Description").Description); const RightSidebar = createFactory(require("./RightSidebar")); const Toolbar = createFactory(require("./Toolbar")); -const SplitBox = createFactory(require("devtools/client/shared/components/splitter/SplitBox")); +const SplitBox = createFactory( + require("devtools/client/shared/components/splitter/SplitBox") +); /** * Renders basic layout of the Accessibility panel. The Accessibility panel @@ -96,7 +104,13 @@ class MainFrame extends Component { * Render Accessibility panel content */ render() { - const { accessibility, walker, fluentBundles, enabled, auditing } = this.props; + const { + accessibility, + walker, + fluentBundles, + enabled, + auditing, + } = this.props; if (!enabled) { return Description({ accessibility }); @@ -105,15 +119,18 @@ class MainFrame extends Component { // Audit is currently running. const isAuditing = auditing.length > 0; - return LocalizationProvider({ messages: fluentBundles }, - div({ className: "mainFrame", role: "presentation" }, + return LocalizationProvider( + { messages: fluentBundles }, + div( + { className: "mainFrame", role: "presentation" }, Toolbar({ accessibility, walker }), isAuditing && AuditProgressOverlay(), - span({ - "aria-hidden": isAuditing, - role: "presentation", - style: { display: "contents" }, - }, + span( + { + "aria-hidden": isAuditing, + role: "presentation", + style: { display: "contents" }, + }, SplitBox({ ref: "splitBox", initialSize: SIDEBAR_WIDTH, @@ -121,14 +138,17 @@ class MainFrame extends Component { maxSize: "80%", splitterSize: 1, endPanelControl: true, - startPanel: div({ - className: "main-panel", - role: "presentation", - }, AccessibilityTree({ walker })), + startPanel: div( + { + className: "main-panel", + role: "presentation", + }, + AccessibilityTree({ walker }) + ), endPanel: RightSidebar({ walker }), vert: this.useLandscapeMode, }) - ), + ) ) ); } diff --git a/devtools/client/accessibility/components/RightSidebar.js b/devtools/client/accessibility/components/RightSidebar.js index cff55021d9f4..bdfd220cc301 100644 --- a/devtools/client/accessibility/components/RightSidebar.js +++ b/devtools/client/accessibility/components/RightSidebar.js @@ -4,13 +4,18 @@ "use strict"; // React -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { div } = require("devtools/client/shared/vendor/react-dom-factories"); const { L10N } = require("../utils/l10n"); const Accessible = createFactory(require("./Accessible")); -const Accordion = createFactory(require("devtools/client/shared/components/Accordion")); +const Accordion = createFactory( + require("devtools/client/shared/components/Accordion") +); const Checks = createFactory(require("./Checks")); // Component that is responsible for rendering accessible panel's sidebar. @@ -29,27 +34,29 @@ class RightSidebar extends Component { const propertiesHeaderID = "accessibility-properties-header"; const checksHeaderID = "accessibility-checks-header"; const { walker } = this.props; - return ( - div({ + return div( + { className: "right-sidebar", role: "presentation", }, - Accordion({ - items: [{ + Accordion({ + items: [ + { className: "checks", component: Checks({ labelledby: checksHeaderID }), header: L10N.getStr("accessibility.checks"), labelledby: checksHeaderID, opened: true, - }, { + }, + { className: "accessible", component: Accessible({ walker, labelledby: propertiesHeaderID }), header: L10N.getStr("accessibility.properties"), labelledby: propertiesHeaderID, opened: true, - }], - }) - ) + }, + ], + }) ); } } diff --git a/devtools/client/accessibility/components/TextLabelBadge.js b/devtools/client/accessibility/components/TextLabelBadge.js index ef2f47913569..8d061bbd4252 100644 --- a/devtools/client/accessibility/components/TextLabelBadge.js +++ b/devtools/client/accessibility/components/TextLabelBadge.js @@ -5,7 +5,10 @@ "use strict"; // React -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { L10N } = require("../utils/l10n"); @@ -19,10 +22,10 @@ const { loader.lazyGetter(this, "Badge", () => createFactory(require("./Badge"))); /** -* Component for rendering a badge for text alternative accessibliity check -* failures association with a given accessibility object in the accessibility -* tree. -*/ + * Component for rendering a badge for text alternative accessibliity check + * failures association with a given accessibility object in the accessibility + * tree. + */ class TextLabelBadge extends Component { static get propTypes() { return { diff --git a/devtools/client/accessibility/components/TextLabelCheck.js b/devtools/client/accessibility/components/TextLabelCheck.js index 59c7c8e48b0a..59f70a7350a1 100644 --- a/devtools/client/accessibility/components/TextLabelCheck.js +++ b/devtools/client/accessibility/components/TextLabelCheck.js @@ -4,7 +4,10 @@ "use strict"; // React -const { Component, createFactory } = require("devtools/client/shared/vendor/react"); +const { + Component, + createFactory, +} = require("devtools/client/shared/vendor/react"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const ReactDOM = require("devtools/client/shared/vendor/react-dom-factories"); @@ -205,7 +208,6 @@ const SCORE_TO_ICON_MAP = { [BEST_PRACTICES]: { l10nId: "accessibility-best-practices", src: "chrome://devtools/skin/images/info.svg", - }, [FAIL]: { l10nId: "accessibility-fail", @@ -262,7 +264,8 @@ const LearnMore = createFactory(LearnMoreClass); function Icon({ score }) { const { l10nId, src } = SCORE_TO_ICON_MAP[score]; - return Localized({ id: l10nId, attrs: { alt: true } }, + return Localized( + { id: l10nId, attrs: { alt: true } }, ReactDOM.img({ src, className: `icon ${score}` }) ); } @@ -278,11 +281,12 @@ function Icon({ score }) { function Annotation({ issue }) { const { args, href, l10nId } = ISSUE_TO_ANNOTATION_MAP[issue]; - return Localized({ - id: l10nId, - a: LearnMore({ l10nId: "accessibility-learn-more", href }), - ...args, - }, + return Localized( + { + id: l10nId, + a: LearnMore({ l10nId: "accessibility-learn-more", href }), + ...args, + }, ReactDOM.p({ className: "accessibility-check-annotation" }) ); } @@ -303,18 +307,22 @@ class TextLabelCheck extends Component { render() { const { issue, score } = this.props; - return ReactDOM.div({ - role: "presentation", - className: "accessibility-check", - }, - Localized({ - id: "accessibility-text-label-header", - }, - ReactDOM.h3({ className: "accessibility-check-header" })), - ReactDOM.div({ + return ReactDOM.div( + { role: "presentation", - className: "accessibility-text-label-check", + className: "accessibility-check", }, + Localized( + { + id: "accessibility-text-label-header", + }, + ReactDOM.h3({ className: "accessibility-check-header" }) + ), + ReactDOM.div( + { + role: "presentation", + className: "accessibility-text-label-check", + }, Icon({ score }), Annotation({ issue }) ) diff --git a/devtools/client/accessibility/components/Toolbar.js b/devtools/client/accessibility/components/Toolbar.js index 136c3f0a3c49..16ee360cf02f 100644 --- a/devtools/client/accessibility/components/Toolbar.js +++ b/devtools/client/accessibility/components/Toolbar.js @@ -4,12 +4,20 @@ "use strict"; // React -const { createFactory, Component } = require("devtools/client/shared/vendor/react"); -const { div, span } = require("devtools/client/shared/vendor/react-dom-factories"); +const { + createFactory, + Component, +} = require("devtools/client/shared/vendor/react"); +const { + div, + span, +} = require("devtools/client/shared/vendor/react-dom-factories"); const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { L10N } = require("../utils/l10n"); const Button = createFactory(require("./Button").Button); -const AccessibilityTreeFilter = createFactory(require("./AccessibilityTreeFilter")); +const AccessibilityTreeFilter = createFactory( + require("./AccessibilityTreeFilter") +); const { connect } = require("devtools/client/shared/vendor/react-redux"); const { disable, updateCanBeDisabled } = require("../actions/ui"); @@ -39,13 +47,17 @@ class Toolbar extends Component { } componentWillMount() { - this.props.accessibility.on("can-be-disabled-change", - this.onCanBeDisabledChange); + this.props.accessibility.on( + "can-be-disabled-change", + this.onCanBeDisabledChange + ); } componentWillUnmount() { - this.props.accessibility.off("can-be-disabled-change", - this.onCanBeDisabledChange); + this.props.accessibility.off( + "can-be-disabled-change", + this.onCanBeDisabledChange + ); } onCanBeDisabledChange(canBeDisabled) { @@ -62,15 +74,18 @@ class Toolbar extends Component { } onLearnMoreClick() { - openDocLink(A11Y_LEARN_MORE_LINK + - "?utm_source=devtools&utm_medium=a11y-panel-toolbar"); + openDocLink( + A11Y_LEARN_MORE_LINK + + "?utm_source=devtools&utm_medium=a11y-panel-toolbar" + ); } render() { const { canBeDisabled, walker } = this.props; const { disabling } = this.state; - const disableButtonStr = disabling ? - "accessibility.disabling" : "accessibility.disable"; + const disableButtonStr = disabling + ? "accessibility.disabling" + : "accessibility.disable"; const betaID = "beta"; let title; let isDisabled = false; @@ -82,35 +97,41 @@ class Toolbar extends Component { title = L10N.getStr("accessibility.disable.disabledTitle"); } - return ( - div({ + return div( + { className: "devtools-toolbar", role: "toolbar", - }, Button({ - className: "disable", - id: "accessibility-disable-button", - onClick: this.onDisable, - disabled: disabling || isDisabled, - busy: disabling, - title, - }, L10N.getStr(disableButtonStr)), - div({ - role: "separator", - className: "devtools-separator", - }), - // @remove after release 68 (See Bug 1551574) - span({ + }, + Button( + { + className: "disable", + id: "accessibility-disable-button", + onClick: this.onDisable, + disabled: disabling || isDisabled, + busy: disabling, + title, + }, + L10N.getStr(disableButtonStr) + ), + div({ + role: "separator", + className: "devtools-separator", + }), + // @remove after release 68 (See Bug 1551574) + span( + { className: "beta", role: "presentation", id: betaID, }, - L10N.getStr("accessibility.beta")), - AccessibilityTreeFilter({ walker, describedby: betaID }), - Button({ - className: "help", - title: L10N.getStr("accessibility.learnMore"), - onClick: this.onLearnMoreClick, - })) + L10N.getStr("accessibility.beta") + ), + AccessibilityTreeFilter({ walker, describedby: betaID }), + Button({ + className: "help", + title: L10N.getStr("accessibility.learnMore"), + onClick: this.onLearnMoreClick, + }) ); } } diff --git a/devtools/client/accessibility/constants.js b/devtools/client/accessibility/constants.js index f0f7670ca68c..49466dca5a19 100644 --- a/devtools/client/accessibility/constants.js +++ b/devtools/client/accessibility/constants.js @@ -101,8 +101,10 @@ exports.ACCESSIBLE_EVENTS = [ ]; // Telemetry name constants. -exports.A11Y_SERVICE_DURATION = "DEVTOOLS_ACCESSIBILITY_SERVICE_TIME_ACTIVE_SECONDS"; -exports.A11Y_SERVICE_ENABLED_COUNT = "devtools.accessibility.service_enabled_count"; +exports.A11Y_SERVICE_DURATION = + "DEVTOOLS_ACCESSIBILITY_SERVICE_TIME_ACTIVE_SECONDS"; +exports.A11Y_SERVICE_ENABLED_COUNT = + "devtools.accessibility.service_enabled_count"; // URL constants exports.A11Y_LEARN_MORE_LINK = @@ -127,20 +129,24 @@ const A11Y_TEXT_LABEL_LINK_IDS = { "Use__element_to_label_
_elements", [FORM_NO_NAME]: "Form_elements_must_be_labeled", [FORM_NO_VISIBLE_NAME]: "Form_elements_should_have_a_visible_text_label", - [FORM_OPTGROUP_NO_NAME_FROM_LABEL]: "Use_label_attribute_to_label__elements", + [FORM_OPTGROUP_NO_NAME_FROM_LABEL]: + "Use_label_attribute_to_label__elements", [FRAME_NO_NAME]: "_elements_must_be_labeled", [HEADING_NO_NAME]: "Headings_must_be_labeled", [HEADING_NO_CONTENT]: "Headings_should_have_visible_text_content", - [IFRAME_NO_NAME_FROM_TITLE]: "Use_title_attribute_to_describe_"; +TEST_URL += ''; -var doc = null, toolbox = null, panelWin = null, modifiedPrefs = []; +var doc = null, + toolbox = null, + panelWin = null, + modifiedPrefs = []; function test() { - addTab(TEST_URL).then(async (tab) => { + addTab(TEST_URL).then(async tab => { const target = await TargetFactory.forTab(tab); - gDevTools.showToolbox(target) + gDevTools + .showToolbox(target) .then(testSelectTool) .then(testToggleToolboxButtons) .then(testPrefsAreRespectedWhenReopeningToolbox) @@ -33,7 +38,8 @@ async function testPrefsAreRespectedWhenReopeningToolbox() { info("Closing toolbox to test after reopening"); gDevTools.closeToolbox(target).then(async () => { const tabTarget = await TargetFactory.forTab(gBrowser.selectedTab); - gDevTools.showToolbox(tabTarget) + gDevTools + .showToolbox(tabTarget) .then(testSelectTool) .then(() => { info("Toolbox has been reopened. Checking UI state."); @@ -61,21 +67,28 @@ function testSelectTool(devtoolsToolbox) { } function testPreferenceAndUIStateIsConsistent() { - const checkNodes = [...panelWin.document.querySelectorAll( - "#enabled-toolbox-buttons-box input[type=checkbox]")]; + const checkNodes = [ + ...panelWin.document.querySelectorAll( + "#enabled-toolbox-buttons-box input[type=checkbox]" + ), + ]; const toolboxButtonNodes = [...doc.querySelectorAll(".command-button")]; for (const tool of toolbox.toolbarButtons) { const isVisible = getBoolPref(tool.visibilityswitch); - const button = toolboxButtonNodes.find(toolboxButton => toolboxButton.id === tool.id); - is(!!button, isVisible, - "Button visibility matches pref for " + tool.id); + const button = toolboxButtonNodes.find( + toolboxButton => toolboxButton.id === tool.id + ); + is(!!button, isVisible, "Button visibility matches pref for " + tool.id); const check = checkNodes.filter(node => node.id === tool.id)[0]; if (check) { - is(check.checked, isVisible, - "Checkbox should be selected based on current pref for " + tool.id); + is( + check.checked, + isVisible, + "Checkbox should be selected based on current pref for " + tool.id + ); } } } @@ -89,47 +102,81 @@ async function testButtonStateOnClick() { button.click(); await isChecked; - ok(button.classList.contains("checked"), - `Button for ${toolboxButton} can be toggled on`); + ok( + button.classList.contains("checked"), + `Button for ${toolboxButton} can be toggled on` + ); - const isUnchecked = waitUntil(() => !button.classList.contains("checked")); + const isUnchecked = waitUntil( + () => !button.classList.contains("checked") + ); button.click(); await isUnchecked; - ok(!button.classList.contains("checked"), - `Button for ${toolboxButton} can be toggled off`); + ok( + !button.classList.contains("checked"), + `Button for ${toolboxButton} can be toggled off` + ); } } } function testToggleToolboxButtons() { - const checkNodes = [...panelWin.document.querySelectorAll( - "#enabled-toolbox-buttons-box input[type=checkbox]")]; + const checkNodes = [ + ...panelWin.document.querySelectorAll( + "#enabled-toolbox-buttons-box input[type=checkbox]" + ), + ]; - const visibleToolbarButtons = toolbox.toolbarButtons.filter(tool => tool.isVisible); + const visibleToolbarButtons = toolbox.toolbarButtons.filter( + tool => tool.isVisible + ); const toolbarButtonNodes = [...doc.querySelectorAll(".command-button")]; // NOTE: the web-replay buttons are not checkboxes - is(checkNodes.length + 2, toolbox.toolbarButtons.length, - "All of the buttons are toggleable."); - is(visibleToolbarButtons.length, toolbarButtonNodes.length, - "All of the DOM buttons are toggleable."); + is( + checkNodes.length + 2, + toolbox.toolbarButtons.length, + "All of the buttons are toggleable." + ); + is( + visibleToolbarButtons.length, + toolbarButtonNodes.length, + "All of the DOM buttons are toggleable." + ); for (const tool of toolbox.toolbarButtons) { const id = tool.id; const matchedCheckboxes = checkNodes.filter(node => node.id === id); - const matchedButtons = toolbarButtonNodes.filter(button => button.id === id); + const matchedButtons = toolbarButtonNodes.filter( + button => button.id === id + ); if (tool.isVisible) { - is(matchedCheckboxes.length, 1, - "There should be a single toggle checkbox for: " + id); - is(matchedCheckboxes[0].nextSibling.textContent, tool.description, - "The label for checkbox matches the tool definition."); - is(matchedButtons.length, 1, - "There should be a DOM button for the visible: " + id); - is(matchedButtons[0].getAttribute("title"), tool.description, - "The tooltip for button matches the tool definition."); + is( + matchedCheckboxes.length, + 1, + "There should be a single toggle checkbox for: " + id + ); + is( + matchedCheckboxes[0].nextSibling.textContent, + tool.description, + "The label for checkbox matches the tool definition." + ); + is( + matchedButtons.length, + 1, + "There should be a DOM button for the visible: " + id + ); + is( + matchedButtons[0].getAttribute("title"), + tool.description, + "The tooltip for button matches the tool definition." + ); } else { - is(matchedButtons.length, 0, - "There should not be a DOM button for the invisible: " + id); + is( + matchedButtons.length, + 0, + "There should not be a DOM button for the invisible: " + id + ); } } @@ -142,7 +189,8 @@ function testToggleToolboxButtons() { // Try checking each checkbox, making sure that it changes the preference for (const node of checkNodes) { const tool = toolbox.toolbarButtons.filter( - commandButton => commandButton.id === node.id)[0]; + commandButton => commandButton.id === node.id + )[0]; const isVisible = getBoolPref(tool.visibilityswitch); testPreferenceAndUIStateIsConsistent(); @@ -151,9 +199,12 @@ function testToggleToolboxButtons() { const isVisibleAfterClick = getBoolPref(tool.visibilityswitch); - is(isVisible, !isVisibleAfterClick, + is( + isVisible, + !isVisibleAfterClick, "Clicking on the node should have toggled visibility preference for " + - tool.visibilityswitch); + tool.visibilityswitch + ); } return promise.resolve(); diff --git a/devtools/client/framework/test/browser_toolbox_options_disable_js.js b/devtools/client/framework/test/browser_toolbox_options_disable_js.js index ee8b866fba61..8101cab0e939 100644 --- a/devtools/client/framework/test/browser_toolbox_options_disable_js.js +++ b/devtools/client/framework/test/browser_toolbox_options_disable_js.js @@ -45,7 +45,11 @@ async function testJSEnabled() { const doc = content.document; const output = doc.getElementById("output"); doc.querySelector("#logJSEnabled").click(); - is(output.textContent, "JavaScript Enabled", 'Output is "JavaScript Enabled"'); + is( + output.textContent, + "JavaScript Enabled", + 'Output is "JavaScript Enabled"' + ); }); } @@ -58,8 +62,11 @@ async function testJSEnabledIframe() { const iframeDoc = iframe.contentDocument; const output = iframeDoc.getElementById("output"); iframeDoc.querySelector("#logJSEnabled").click(); - is(output.textContent, "JavaScript Enabled", - 'Output is "JavaScript Enabled" in iframe'); + is( + output.textContent, + "JavaScript Enabled", + 'Output is "JavaScript Enabled" in iframe' + ); }); } @@ -74,16 +81,24 @@ async function toggleJS(toolbox) { } let { javascriptEnabled } = toolbox.target.configureOptions; - is(javascriptEnabled, !cbx.checked, - "BrowsingContextTargetFront's configureOptions is correct before the toggle"); + is( + javascriptEnabled, + !cbx.checked, + "BrowsingContextTargetFront's configureOptions is correct before the toggle" + ); - const browserLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); + const browserLoaded = BrowserTestUtils.browserLoaded( + gBrowser.selectedBrowser + ); cbx.click(); await browserLoaded; ({ javascriptEnabled } = toolbox.target.configureOptions); - is(javascriptEnabled, !cbx.checked, - "BrowsingContextTargetFront's configureOptions is correctly updated"); + is( + javascriptEnabled, + !cbx.checked, + "BrowsingContextTargetFront's configureOptions is correctly updated" + ); } async function testJSDisabled() { @@ -94,8 +109,10 @@ async function testJSDisabled() { const output = doc.getElementById("output"); doc.querySelector("#logJSDisabled").click(); - ok(output.textContent !== "JavaScript Disabled", - 'output is not "JavaScript Disabled"'); + ok( + output.textContent !== "JavaScript Disabled", + 'output is not "JavaScript Disabled"' + ); }); } @@ -108,7 +125,9 @@ async function testJSDisabledIframe() { const iframeDoc = iframe.contentDocument; const output = iframeDoc.getElementById("output"); iframeDoc.querySelector("#logJSDisabled").click(); - ok(output.textContent !== "JavaScript Disabled", - 'output is not "JavaScript Disabled" in iframe'); + ok( + output.textContent !== "JavaScript Disabled", + 'output is not "JavaScript Disabled" in iframe' + ); }); } diff --git a/devtools/client/framework/test/browser_toolbox_options_enable_serviceworkers_testing.js b/devtools/client/framework/test/browser_toolbox_options_enable_serviceworkers_testing.js index 41bb7952329f..2c17b2ae2e12 100644 --- a/devtools/client/framework/test/browser_toolbox_options_enable_serviceworkers_testing.js +++ b/devtools/client/framework/test/browser_toolbox_options_enable_serviceworkers_testing.js @@ -6,13 +6,12 @@ // Test that enabling Service Workers testing option enables the // mServiceWorkersTestingEnabled attribute added to nsPIDOMWindow. -const ROOT_TEST_DIR = - getRootDirectory(gTestPath); +const ROOT_TEST_DIR = getRootDirectory(gTestPath); const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "browser_toolbox_options_enable_serviceworkers_testing_frame_script.js"; -const TEST_URI = URL_ROOT + - "browser_toolbox_options_enable_serviceworkers_testing.html"; +const TEST_URI = + URL_ROOT + "browser_toolbox_options_enable_serviceworkers_testing.html"; const ELEMENT_ID = "devtools-enable-serviceWorkersTesting"; @@ -21,11 +20,16 @@ var toolbox; function test() { // Note: Pref dom.serviceWorkers.testing.enabled is false since we are testing // the same capabilities are enabled with the devtool pref. - SpecialPowers.pushPrefEnv({"set": [ - ["dom.serviceWorkers.exemptFromPerDomainMax", true], - ["dom.serviceWorkers.enabled", true], - ["dom.serviceWorkers.testing.enabled", false], - ]}, init); + SpecialPowers.pushPrefEnv( + { + set: [ + ["dom.serviceWorkers.exemptFromPerDomainMax", true], + ["dom.serviceWorkers.enabled", true], + ["dom.serviceWorkers.testing.enabled", false], + ], + }, + init + ); } function init() { @@ -109,7 +113,8 @@ function start() { .then(testRegisterFails) .catch(function(e) { ok(false, "Some test failed with error " + e); - }).then(finishUp); + }) + .then(finishUp); } function finishUp() { diff --git a/devtools/client/framework/test/browser_toolbox_options_frames_button.js b/devtools/client/framework/test/browser_toolbox_options_frames_button.js index b96c1870044b..9959cb48160b 100644 --- a/devtools/client/framework/test/browser_toolbox_options_frames_button.js +++ b/devtools/client/framework/test/browser_toolbox_options_frames_button.js @@ -8,7 +8,8 @@ // Test that the button is enabled otherwise. const TEST_URL = "data:text/html;charset=utf8,test frames button visibility"; -const TEST_URL_FRAMES = TEST_URL + ""; +const TEST_URL_FRAMES = + TEST_URL + ''; const FRAME_BUTTON_PREF = "devtools.command-button-frames.enabled"; add_task(async function() { @@ -28,7 +29,9 @@ add_task(async function() { ok(!framesButton, "Frames button is not rendered."); const optionsDoc = optionsPanel.panelWin.document; - const framesButtonCheckbox = optionsDoc.getElementById("command-button-frames"); + const framesButtonCheckbox = optionsDoc.getElementById( + "command-button-frames" + ); framesButtonCheckbox.click(); framesButton = doc.getElementById("command-button-frames"); diff --git a/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js b/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js index 48a41205976f..49e034f6abc4 100644 --- a/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js +++ b/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js @@ -3,8 +3,9 @@ "use strict"; -const URL = "data:text/html;charset=utf8,test for dynamically registering " + - "and unregistering tools across multiple tabs"; +const URL = + "data:text/html;charset=utf8,test for dynamically registering " + + "and unregistering tools across multiple tabs"; let tab1, tab2, modifiedPref; @@ -23,7 +24,8 @@ async function openToolboxOptionsInNewTab() { const doc = toolbox.doc; const panel = await toolbox.selectTool("options"); const { id } = panel.panelDoc.querySelector( - "#default-tools-box input[type=checkbox]:not([data-unsupported]):not([checked])"); + "#default-tools-box input[type=checkbox]:not([data-unsupported]):not([checked])" + ); return { tab, @@ -71,7 +73,8 @@ async function toggleTool({ doc, panelWin, checkbox, tab }, toolId) { (prevChecked ? checkRegistered : checkUnregistered)(toolId); const onToggleTool = gDevTools.once( - `tool-${prevChecked ? "unregistered" : "registered"}`); + `tool-${prevChecked ? "unregistered" : "registered"}` + ); EventUtils.sendMouseEvent({ type: "click" }, checkbox, panelWin); const id = await onToggleTool; @@ -81,25 +84,41 @@ async function toggleTool({ doc, panelWin, checkbox, tab }, toolId) { } async function checkUnregistered(toolId) { - ok(!tab1.doc.getElementById("toolbox-tab-" + toolId), - `Tab for unregistered tool ${toolId} is not present in first toolbox`); - ok(!tab1.checkbox.checked, - `Checkbox for unregistered tool ${toolId} is not checked in first toolbox`); - ok(!tab2.doc.getElementById("toolbox-tab-" + toolId), - `Tab for unregistered tool ${toolId} is not present in second toolbox`); - ok(!tab2.checkbox.checked, - `Checkbox for unregistered tool ${toolId} is not checked in second toolbox`); + ok( + !tab1.doc.getElementById("toolbox-tab-" + toolId), + `Tab for unregistered tool ${toolId} is not present in first toolbox` + ); + ok( + !tab1.checkbox.checked, + `Checkbox for unregistered tool ${toolId} is not checked in first toolbox` + ); + ok( + !tab2.doc.getElementById("toolbox-tab-" + toolId), + `Tab for unregistered tool ${toolId} is not present in second toolbox` + ); + ok( + !tab2.checkbox.checked, + `Checkbox for unregistered tool ${toolId} is not checked in second toolbox` + ); } function checkRegistered(toolId) { - ok(tab1.doc.getElementById("toolbox-tab-" + toolId), - `Tab for registered tool ${toolId} is present in first toolbox`); - ok(tab1.checkbox.checked, - `Checkbox for registered tool ${toolId} is checked in first toolbox`); - ok(tab2.doc.getElementById("toolbox-tab-" + toolId), - `Tab for registered tool ${toolId} is present in second toolbox`); - ok(tab2.checkbox.checked, - `Checkbox for registered tool ${toolId} is checked in second toolbox`); + ok( + tab1.doc.getElementById("toolbox-tab-" + toolId), + `Tab for registered tool ${toolId} is present in first toolbox` + ); + ok( + tab1.checkbox.checked, + `Checkbox for registered tool ${toolId} is checked in first toolbox` + ); + ok( + tab2.doc.getElementById("toolbox-tab-" + toolId), + `Tab for registered tool ${toolId} is present in second toolbox` + ); + ok( + tab2.checkbox.checked, + `Checkbox for registered tool ${toolId} is checked in second toolbox` + ); } async function cleanup() { diff --git a/devtools/client/framework/test/browser_toolbox_options_panel_toggle.js b/devtools/client/framework/test/browser_toolbox_options_panel_toggle.js index b2e741b4e259..0204708c2c2c 100644 --- a/devtools/client/framework/test/browser_toolbox_options_panel_toggle.js +++ b/devtools/client/framework/test/browser_toolbox_options_panel_toggle.js @@ -9,7 +9,11 @@ const { Toolbox } = require("devtools/client/framework/toolbox"); add_task(async function() { const tab = await addTab("about:blank"); - const toolbox = await openToolboxForTab(tab, "webconsole", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "webconsole", + Toolbox.HostType.BOTTOM + ); info("Check the option panel was selected after sending F1 key event"); await sendOptionsKeyEvent(toolbox); @@ -17,23 +21,41 @@ add_task(async function() { info("Check the last selected panel was selected after sending F1 key event"); await sendOptionsKeyEvent(toolbox); - is(toolbox.currentToolId, "webconsole", "The webconsole panel should be selected"); + is( + toolbox.currentToolId, + "webconsole", + "The webconsole panel should be selected" + ); info("Check the option panel was selected after clicking 'Settings' menu"); await clickSettingsMenu(toolbox); is(toolbox.currentToolId, "options", "The options panel should be selected"); - info("Check the last selected panel was selected after clicking 'Settings' menu"); + info( + "Check the last selected panel was selected after clicking 'Settings' menu" + ); await sendOptionsKeyEvent(toolbox); - is(toolbox.currentToolId, "webconsole", "The webconsole panel should be selected"); + is( + toolbox.currentToolId, + "webconsole", + "The webconsole panel should be selected" + ); info("Check the combination of key event and 'Settings' menu"); await sendOptionsKeyEvent(toolbox); await clickSettingsMenu(toolbox); - is(toolbox.currentToolId, "webconsole", "The webconsole panel should be selected"); + is( + toolbox.currentToolId, + "webconsole", + "The webconsole panel should be selected" + ); await clickSettingsMenu(toolbox); await sendOptionsKeyEvent(toolbox); - is(toolbox.currentToolId, "webconsole", "The webconsole panel should be selected"); + is( + toolbox.currentToolId, + "webconsole", + "The webconsole panel should be selected" + ); }); async function sendOptionsKeyEvent(toolbox) { @@ -45,7 +67,9 @@ async function sendOptionsKeyEvent(toolbox) { async function clickSettingsMenu(toolbox) { const onPopupShown = () => { toolbox.doc.removeEventListener("popupshown", onPopupShown); - const menuItem = toolbox.doc.getElementById("toolbox-meatball-menu-settings"); + const menuItem = toolbox.doc.getElementById( + "toolbox-meatball-menu-settings" + ); EventUtils.synthesizeMouseAtCenter(menuItem, {}, menuItem.ownerGlobal); }; toolbox.doc.addEventListener("popupshown", onPopupShown); diff --git a/devtools/client/framework/test/browser_toolbox_races.js b/devtools/client/framework/test/browser_toolbox_races.js index 572de2e264ff..38a8278cbcbf 100644 --- a/devtools/client/framework/test/browser_toolbox_races.js +++ b/devtools/client/framework/test/browser_toolbox_races.js @@ -11,7 +11,9 @@ requestLongerTimeout(2); // Test toggling the toolbox quickly and see if there is any race breaking it. const URL = "data:text/html;charset=utf-8,Toggling devtools quickly"; -const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser"); +const { + gDevToolsBrowser, +} = require("devtools/client/framework/devtools-browser"); add_task(async function() { // Make sure this test starts with the selectedTool pref cleared. Previous @@ -20,7 +22,10 @@ add_task(async function() { await addTab(URL); - let created = 0, ready = 0, destroy = 0, destroyed = 0; + let created = 0, + ready = 0, + destroy = 0, + destroyed = 0; const onCreated = () => { created++; }; diff --git a/devtools/client/framework/test/browser_toolbox_raise.js b/devtools/client/framework/test/browser_toolbox_raise.js index 886fe8bff4e7..9501b5e078f7 100644 --- a/devtools/client/framework/test/browser_toolbox_raise.js +++ b/devtools/client/framework/test/browser_toolbox_raise.js @@ -5,17 +5,18 @@ const TEST_URL = "data:text/html,test for opening toolbox in different hosts"; -var {Toolbox} = require("devtools/client/framework/toolbox"); +var { Toolbox } = require("devtools/client/framework/toolbox"); var toolbox, tab1, tab2; function test() { - addTab(TEST_URL).then(async (tab) => { + addTab(TEST_URL).then(async tab => { tab2 = BrowserTestUtils.addTab(gBrowser); const target = await TargetFactory.forTab(tab); - gDevTools.showToolbox(target) - .then(testBottomHost, console.error) - .catch(console.error); + gDevTools + .showToolbox(target) + .then(testBottomHost, console.error) + .catch(console.error); }); } @@ -25,12 +26,23 @@ function testBottomHost(aToolbox) { // switch to another tab and test toolbox.raise() gBrowser.selectedTab = tab2; executeSoon(function() { - is(gBrowser.selectedTab, tab2, "Correct tab is selected before calling raise"); + is( + gBrowser.selectedTab, + tab2, + "Correct tab is selected before calling raise" + ); toolbox.raise(); executeSoon(function() { - is(gBrowser.selectedTab, tab1, "Correct tab was selected after calling raise"); + is( + gBrowser.selectedTab, + tab1, + "Correct tab was selected after calling raise" + ); - toolbox.switchHost(Toolbox.HostType.WINDOW).then(testWindowHost).catch(console.error); + toolbox + .switchHost(Toolbox.HostType.WINDOW) + .then(testWindowHost) + .catch(console.error); }); }); } @@ -57,7 +69,10 @@ function onFocus() { // Check if toolbox window got focus. const onToolboxFocusAgain = () => { toolbox.win.parent.removeEventListener("focus", onToolboxFocusAgain); - ok(true, "Toolbox window is the focused window after calling toolbox.raise()"); + ok( + true, + "Toolbox window is the focused window after calling toolbox.raise()" + ); cleanup(); }; toolbox.win.parent.addEventListener("focus", onToolboxFocusAgain); diff --git a/devtools/client/framework/test/browser_toolbox_remoteness_change.js b/devtools/client/framework/test/browser_toolbox_remoteness_change.js index 5c8523fbdc61..94ed5cbb0ab2 100644 --- a/devtools/client/framework/test/browser_toolbox_remoteness_change.js +++ b/devtools/client/framework/test/browser_toolbox_remoteness_change.js @@ -2,14 +2,23 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ const URL_1 = "about:robots"; -const URL_2 = "data:text/html;charset=UTF-8," + - encodeURIComponent("
foo
"); +const URL_2 = + "data:text/html;charset=UTF-8," + + encodeURIComponent('
foo
'); add_task(async function() { info("Open a tab on a URL supporting only running in parent process"); const tab = await addTab(URL_1); - is(tab.linkedBrowser.currentURI.spec, URL_1, "We really are on the expected document"); - is(tab.linkedBrowser.getAttribute("remote"), "", "And running in parent process"); + is( + tab.linkedBrowser.currentURI.spec, + URL_1, + "We really are on the expected document" + ); + is( + tab.linkedBrowser.getAttribute("remote"), + "", + "And running in parent process" + ); let toolbox = await openToolboxForTab(tab); @@ -21,7 +30,11 @@ add_task(async function() { BrowserTestUtils.loadURI(gBrowser, URL_2); await onLoaded; - is(tab.linkedBrowser.getAttribute("remote"), "true", "Navigated to a data: URI and switching to remote"); + is( + tab.linkedBrowser.getAttribute("remote"), + "true", + "Navigated to a data: URI and switching to remote" + ); info("Waiting for the toolbox to be destroyed"); await onToolboxDestroyed; @@ -37,5 +50,8 @@ add_task(async function() { const { jsterm } = console.hud; const url = await jsterm.execute("document.location.href"); // Uses includes as the old console frontend prints a timestamp - ok(url.textContent.includes(URL_2), "The console inspects the second document"); + ok( + url.textContent.includes(URL_2), + "The console inspects the second document" + ); }); diff --git a/devtools/client/framework/test/browser_toolbox_select_event.js b/devtools/client/framework/test/browser_toolbox_select_event.js index 14b70ccdad4f..5c5e40913ee3 100644 --- a/devtools/client/framework/test/browser_toolbox_select_event.js +++ b/devtools/client/framework/test/browser_toolbox_select_event.js @@ -98,4 +98,3 @@ add_task(async function() { await toolbox.destroy(); } }); - diff --git a/devtools/client/framework/test/browser_toolbox_selected_tool_unavailable.js b/devtools/client/framework/test/browser_toolbox_selected_tool_unavailable.js index 51d1323d31a1..7d73cf69d749 100644 --- a/devtools/client/framework/test/browser_toolbox_selected_tool_unavailable.js +++ b/devtools/client/framework/test/browser_toolbox_selected_tool_unavailable.js @@ -16,11 +16,11 @@ const testToolDefinition = { label: "someLabel", build: (iframeWindow, toolbox) => { return { - target: toolbox.target, - toolbox: toolbox, - isReady: true, - destroy: () => {}, - panelDoc: iframeWindow.document, + target: toolbox.target, + toolbox: toolbox, + isReady: true, + destroy: () => {}, + panelDoc: iframeWindow.document, }; }, }; diff --git a/devtools/client/framework/test/browser_toolbox_selectionchanged_event.js b/devtools/client/framework/test/browser_toolbox_selectionchanged_event.js index 72e13422b698..ab12babb6611 100644 --- a/devtools/client/framework/test/browser_toolbox_selectionchanged_event.js +++ b/devtools/client/framework/test/browser_toolbox_selectionchanged_event.js @@ -31,11 +31,18 @@ add_task(async function() { // Listen to cleared selection changed const onClearSelectionChanged = toolbox.once("selection-changed"); - info("Clear the selection and wait for the selection-changed event to be fired."); - inspector.selection.setNodeFront(undefined, { reason: "browser-context-menu" }); + info( + "Clear the selection and wait for the selection-changed event to be fired." + ); + inspector.selection.setNodeFront(undefined, { + reason: "browser-context-menu", + }); await onClearSelectionChanged; - is(inspector.selection.nodeFront, undefined, "The selection is undefined as expected"); + is( + inspector.selection.nodeFront, + undefined, + "The selection is undefined as expected" + ); }); - diff --git a/devtools/client/framework/test/browser_toolbox_show_toolbox_tool_ready.js b/devtools/client/framework/test/browser_toolbox_show_toolbox_tool_ready.js index f8dcc2fc7544..841826190993 100644 --- a/devtools/client/framework/test/browser_toolbox_show_toolbox_tool_ready.js +++ b/devtools/client/framework/test/browser_toolbox_show_toolbox_tool_ready.js @@ -5,7 +5,8 @@ "use strict"; -const URL = "data:text/html;charset=utf8,test for showToolbox called while tool is opened"; +const URL = + "data:text/html;charset=utf8,test for showToolbox called while tool is opened"; const lazyToolId = "testtool1"; registerCleanupFunction(() => { @@ -36,7 +37,9 @@ function isPanelReady(toolbox, toolId) { * returning. See Bug 1543907. */ add_task(async function automaticallyBindTexbox() { - info("Registering a tool with an input field and making sure the context menu works"); + info( + "Registering a tool with an input field and making sure the context menu works" + ); gDevTools.registerTool({ id: lazyToolId, @@ -58,7 +61,10 @@ add_task(async function automaticallyBindTexbox() { ok(!isPanelReady(toolbox, lazyToolId), "lazyTool should not be ready yet"); await gDevTools.showToolbox(toolbox.target, lazyToolId); - ok(isPanelReady(toolbox, lazyToolId), "lazyTool should not ready after showToolbox"); + ok( + isPanelReady(toolbox, lazyToolId), + "lazyTool should not ready after showToolbox" + ); // Make sure lazyTool is ready before leaving the test. await onLazyToolReady; diff --git a/devtools/client/framework/test/browser_toolbox_sidebar.js b/devtools/client/framework/test/browser_toolbox_sidebar.js index 1ad7cfb435ae..f86854b34812 100644 --- a/devtools/client/framework/test/browser_toolbox_sidebar.js +++ b/devtools/client/framework/test/browser_toolbox_sidebar.js @@ -4,7 +4,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ function test() { - const {ToolSidebar} = require("devtools/client/framework/sidebar"); + const { ToolSidebar } = require("devtools/client/framework/sidebar"); const tab1URL = "data:text/html;charset=utf8,1

1

"; const tab2URL = "data:text/html;charset=utf8,2

2

"; @@ -39,52 +39,60 @@ function test() { addTab("about:blank").then(async function(aTab) { const target = await TargetFactory.forTab(aTab); - gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) { - const panel = toolbox.getPanel(toolDefinition.id); - panel.toolbox = toolbox; - ok(true, "Tool open"); + gDevTools + .showToolbox(target, toolDefinition.id) + .then(function(toolbox) { + const panel = toolbox.getPanel(toolDefinition.id); + panel.toolbox = toolbox; + ok(true, "Tool open"); - const tabbox = panel.panelDoc.getElementById("sidebar"); - panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true); + const tabbox = panel.panelDoc.getElementById("sidebar"); + panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true); - panel.sidebar.on("new-tab-registered", function(id) { - registeredTabs[id] = true; - }); + panel.sidebar.on("new-tab-registered", function(id) { + registeredTabs[id] = true; + }); - panel.sidebar.once("tab1-ready", function() { - info("tab1-ready"); - readyTabs.tab1 = true; - allTabsReady(panel); - }); + panel.sidebar.once("tab1-ready", function() { + info("tab1-ready"); + readyTabs.tab1 = true; + allTabsReady(panel); + }); - panel.sidebar.once("tab2-ready", function() { - info("tab2-ready"); - readyTabs.tab2 = true; - allTabsReady(panel); - }); + panel.sidebar.once("tab2-ready", function() { + info("tab2-ready"); + readyTabs.tab2 = true; + allTabsReady(panel); + }); - panel.sidebar.once("tab3-ready", function() { - info("tab3-ready"); - readyTabs.tab3 = true; - allTabsReady(panel); - }); + panel.sidebar.once("tab3-ready", function() { + info("tab3-ready"); + readyTabs.tab3 = true; + allTabsReady(panel); + }); - panel.sidebar.once("tab1-selected", function() { - info("tab1-selected"); - tab1Selected = true; - allTabsReady(panel); - }); + panel.sidebar.once("tab1-selected", function() { + info("tab1-selected"); + tab1Selected = true; + allTabsReady(panel); + }); - panel.sidebar.addTab("tab1", tab1URL, {selected: true}); - panel.sidebar.addTab("tab2", tab2URL); - panel.sidebar.addTab("tab3", tab3URL); + panel.sidebar.addTab("tab1", tab1URL, { selected: true }); + panel.sidebar.addTab("tab2", tab2URL); + panel.sidebar.addTab("tab3", tab3URL); - panel.sidebar.show(); - }).catch(console.error); + panel.sidebar.show(); + }) + .catch(console.error); }); function allTabsReady(panel) { - if (!tab1Selected || !readyTabs.tab1 || !readyTabs.tab2 || !readyTabs.tab3) { + if ( + !tab1Selected || + !readyTabs.tab1 || + !readyTabs.tab2 || + !readyTabs.tab3 + ) { return; } @@ -111,13 +119,27 @@ function test() { panel.sidebar.once("tab2-selected", function() { ok(true, "received 'selected' event"); tabs[1].focus(); - is(panel.sidebar._panelDoc.activeElement, tabs[1], - "Focus is set to second tab"); + is( + panel.sidebar._panelDoc.activeElement, + tabs[1], + "Focus is set to second tab" + ); panel.sidebar.hide(); - isnot(panel.sidebar._panelDoc.activeElement, tabs[1], - "Focus is reset for sidebar"); - is(panel.sidebar._tabbox.getAttribute("hidden"), "true", "Sidebar hidden"); - is(panel.sidebar.getWindowForTab("tab1").location.href, tab1URL, "Window is accessible"); + isnot( + panel.sidebar._panelDoc.activeElement, + tabs[1], + "Focus is reset for sidebar" + ); + is( + panel.sidebar._tabbox.getAttribute("hidden"), + "true", + "Sidebar hidden" + ); + is( + panel.sidebar.getWindowForTab("tab1").location.href, + tab1URL, + "Window is accessible" + ); testRemoval(panel); }); }); diff --git a/devtools/client/framework/test/browser_toolbox_sidebar_events.js b/devtools/client/framework/test/browser_toolbox_sidebar_events.js index ad5d076df16e..1bc6a984e87d 100644 --- a/devtools/client/framework/test/browser_toolbox_sidebar_events.js +++ b/devtools/client/framework/test/browser_toolbox_sidebar_events.js @@ -35,33 +35,36 @@ function test() { addTab("about:blank").then(async function(aTab) { const target = await TargetFactory.forTab(aTab); - gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) { - const panel = toolbox.getPanel(toolDefinition.id); - ok(true, "Tool open"); + gDevTools + .showToolbox(target, toolDefinition.id) + .then(function(toolbox) { + const panel = toolbox.getPanel(toolDefinition.id); + ok(true, "Tool open"); - panel.once("sidebar-created", function() { - collectedEvents.push("sidebar-created"); - }); + panel.once("sidebar-created", function() { + collectedEvents.push("sidebar-created"); + }); - panel.once("sidebar-destroyed", function() { - collectedEvents.push("sidebar-destroyed"); - }); + panel.once("sidebar-destroyed", function() { + collectedEvents.push("sidebar-destroyed"); + }); - const tabbox = panel.panelDoc.getElementById("sidebar"); - panel.sidebar = new ToolSidebar(tabbox, panel, "testbug1072208", true); + const tabbox = panel.panelDoc.getElementById("sidebar"); + panel.sidebar = new ToolSidebar(tabbox, panel, "testbug1072208", true); - panel.sidebar.once("show", function() { - collectedEvents.push("show"); - }); + panel.sidebar.once("show", function() { + collectedEvents.push("show"); + }); - panel.sidebar.once("hide", function() { - collectedEvents.push("hide"); - }); + panel.sidebar.once("hide", function() { + collectedEvents.push("hide"); + }); - panel.sidebar.once("tab1-selected", () => finishUp(panel)); - panel.sidebar.addTab("tab1", tab1URL, {selected: true}); - panel.sidebar.show(); - }).catch(console.error); + panel.sidebar.once("tab1-selected", () => finishUp(panel)); + panel.sidebar.addTab("tab1", tab1URL, { selected: true }); + panel.sidebar.show(); + }) + .catch(console.error); }); function finishUp(panel) { @@ -69,8 +72,11 @@ function test() { panel.sidebar.destroy(); const events = collectedEvents.join(":"); - is(events, "sidebar-created:show:hide:sidebar-destroyed", - "Found the right amount of collected events."); + is( + events, + "sidebar-created:show:hide:sidebar-destroyed", + "Found the right amount of collected events." + ); panel.toolbox.destroy().then(function() { gDevTools.unregisterTool(toolDefinition.id); @@ -82,4 +88,3 @@ function test() { }); } } - diff --git a/devtools/client/framework/test/browser_toolbox_sidebar_existing_tabs.js b/devtools/client/framework/test/browser_toolbox_sidebar_existing_tabs.js index 11e42cadf171..ec8514689965 100644 --- a/devtools/client/framework/test/browser_toolbox_sidebar_existing_tabs.js +++ b/devtools/client/framework/test/browser_toolbox_sidebar_existing_tabs.js @@ -7,7 +7,7 @@ // Test that the sidebar widget auto-registers existing tabs. -const {ToolSidebar} = require("devtools/client/framework/sidebar"); +const { ToolSidebar } = require("devtools/client/framework/sidebar"); const testToolDefinition = { id: "testTool", @@ -48,14 +48,24 @@ add_task(async function() { info("Checking that the sidebar API works with existing tabs"); sidebar.select("tab2"); - is(tabbox.selectedTab, tabbox.querySelector("#tab2"), - "Existing tabs can be selected"); + is( + tabbox.selectedTab, + tabbox.querySelector("#tab2"), + "Existing tabs can be selected" + ); sidebar.select("tab1"); - is(tabbox.selectedTab, tabbox.querySelector("#tab1"), - "Existing tabs can be selected"); + is( + tabbox.selectedTab, + tabbox.querySelector("#tab1"), + "Existing tabs can be selected" + ); - is(sidebar.getCurrentTabID(), "tab1", "getCurrentTabID returns the expected id"); + is( + sidebar.getCurrentTabID(), + "tab1", + "getCurrentTabID returns the expected id" + ); info("Removing a tab"); sidebar.removeTab("tab2", "tabpanel2"); diff --git a/devtools/client/framework/test/browser_toolbox_sidebar_overflow_menu.js b/devtools/client/framework/test/browser_toolbox_sidebar_overflow_menu.js index b94eda0e78d5..c0c578fcc90f 100644 --- a/devtools/client/framework/test/browser_toolbox_sidebar_overflow_menu.js +++ b/devtools/client/framework/test/browser_toolbox_sidebar_overflow_menu.js @@ -8,7 +8,7 @@ // Test that the sidebar widget correctly displays the "all tabs..." button // when the tabs overflow. -const {ToolSidebar} = require("devtools/client/framework/sidebar"); +const { ToolSidebar } = require("devtools/client/framework/sidebar"); const testToolDefinition = { id: "testTool", @@ -41,14 +41,16 @@ add_task(async function() { showAllTabsMenu: true, }); - const allTabsMenu = toolPanel.panelDoc.querySelector(".devtools-sidebar-alltabs"); + const allTabsMenu = toolPanel.panelDoc.querySelector( + ".devtools-sidebar-alltabs" + ); ok(allTabsMenu, "The all-tabs menu is available"); is(allTabsMenu.getAttribute("hidden"), "true", "The menu is hidden for now"); info("Adding 10 tabs to the sidebar widget"); for (let nb = 0; nb < 10; nb++) { const url = `data:text/html;charset=utf8,tab ${nb}

Test tab ${nb}

`; - sidebar.addTab("tab" + nb, url, {selected: nb === 0}); + sidebar.addTab("tab" + nb, url, { selected: nb === 0 }); } info("Fake an overflow event so that the all-tabs menu is visible"); @@ -63,10 +65,17 @@ add_task(async function() { const item = allTabsMenu.querySelector("#sidebar-alltabs-item-" + id); info("Click on the tab"); - EventUtils.sendMouseEvent({type: "click"}, item, toolPanel.panelDoc.defaultView); + EventUtils.sendMouseEvent( + { type: "click" }, + item, + toolPanel.panelDoc.defaultView + ); - is(tabbox.selectedTab.id, "sidebar-tab-" + id, - "The selected tab is now nb " + nb); + is( + tabbox.selectedTab.id, + "sidebar-tab-" + id, + "The selected tab is now nb " + nb + ); } info("Fake an underflow event so that the all-tabs menu gets hidden"); diff --git a/devtools/client/framework/test/browser_toolbox_split_console.js b/devtools/client/framework/test/browser_toolbox_split_console.js index 7dd42750f294..e564875d4ce0 100644 --- a/devtools/client/framework/test/browser_toolbox_split_console.js +++ b/devtools/client/framework/test/browser_toolbox_split_console.js @@ -41,9 +41,13 @@ function testUseKeyWithSplitConsole() { let commandCalled = false; info("useKeyWithSplitConsole on debugger while debugger is focused"); - gToolbox.useKeyWithSplitConsole("F3", () => { - commandCalled = true; - }, "jsdebugger"); + gToolbox.useKeyWithSplitConsole( + "F3", + () => { + commandCalled = true; + }, + "jsdebugger" + ); info("synthesizeKey with the console focused"); focusConsoleInput(); @@ -57,9 +61,13 @@ function testUseKeyWithSplitConsoleWrongTool() { let commandCalled = false; info("useKeyWithSplitConsole on inspector while debugger is focused"); - gToolbox.useKeyWithSplitConsole("F4", () => { - commandCalled = true; - }, "inspector"); + gToolbox.useKeyWithSplitConsole( + "F4", + () => { + commandCalled = true; + }, + "inspector" + ); info("synthesizeKey with the console focused"); focusConsoleInput(); diff --git a/devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js b/devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js index 71dfd636768c..60d0c31254b8 100644 --- a/devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js +++ b/devtools/client/framework/test/browser_toolbox_tabsswitch_shortcuts.js @@ -7,24 +7,27 @@ requestLongerTimeout(2); -var {Toolbox} = require("devtools/client/framework/toolbox"); +var { Toolbox } = require("devtools/client/framework/toolbox"); -const {LocalizationHelper} = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); add_task(async function() { const tab = await addTab("about:blank"); const target = await TargetFactory.forTab(tab); - const toolIDs = gDevTools.getToolDefinitionArray() - .filter( - def => - def.isTargetSupported(target) && - def.id !== "options" - ) - .map(def => def.id); + const toolIDs = gDevTools + .getToolDefinitionArray() + .filter(def => def.isTargetSupported(target) && def.id !== "options") + .map(def => def.id); - const toolbox = await gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.BOTTOM); + const toolbox = await gDevTools.showToolbox( + target, + toolIDs[0], + Toolbox.HostType.BOTTOM + ); const nextShortcut = L10N.getStr("toolbox.nextTool.key"); const prevShortcut = L10N.getStr("toolbox.previousTool.key"); @@ -57,8 +60,14 @@ add_task(async function() { }); async function testShortcuts(toolbox, index, shortcut, toolIDs) { - info("Testing shortcut to switch to tool " + index + ":" + toolIDs[index] + - " using shortcut " + shortcut); + info( + "Testing shortcut to switch to tool " + + index + + ":" + + toolIDs[index] + + " using shortcut " + + shortcut + ); const onToolSelected = toolbox.once("select"); synthesizeKeyShortcut(shortcut); @@ -66,6 +75,9 @@ async function testShortcuts(toolbox, index, shortcut, toolIDs) { info("toolbox-select event from " + id); - is(toolIDs.indexOf(id), index, - "Correct tool is selected on pressing the shortcut for " + id); + is( + toolIDs.indexOf(id), + index, + "Correct tool is selected on pressing the shortcut for " + id + ); } diff --git a/devtools/client/framework/test/browser_toolbox_target.js b/devtools/client/framework/test/browser_toolbox_target.js index 3e748b9a7f96..6c1f350d7a8f 100644 --- a/devtools/client/framework/test/browser_toolbox_target.js +++ b/devtools/client/framework/test/browser_toolbox_target.js @@ -38,8 +38,11 @@ add_task(async function() { info("Waiting for toolbox-ready"); const toolbox = await onToolboxReady; - is(toolbox.hostType, Toolbox.HostType.PAGE, - "Host type of this toolbox shuld be Toolbox.HostType.PAGE"); + is( + toolbox.hostType, + Toolbox.HostType.PAGE, + "Host type of this toolbox shuld be Toolbox.HostType.PAGE" + ); const onToolboxDestroyed = gDevTools.once("toolbox-destroyed"); const onTabDetached = toolbox.target.once("tabDetached"); diff --git a/devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js b/devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js index 16c4263192ae..6e89794dd1fd 100644 --- a/devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js +++ b/devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js @@ -17,7 +17,8 @@ const DATA = [ host: "bottom", width: "1300", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "deactivate", @@ -27,7 +28,8 @@ const DATA = [ host: "bottom", width: "1300", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "activate", @@ -37,7 +39,8 @@ const DATA = [ host: "bottom", width: "1300", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "deactivate", @@ -80,13 +83,14 @@ add_task(async function() { async function checkResults() { const snapshot = Services.telemetry.snapshotEvents(ALL_CHANNELS, true); - const events = snapshot.parent.filter(event => event[1] === "devtools.main" && - (event[2] === "activate" || - event[2] === "deactivate") + const events = snapshot.parent.filter( + event => + event[1] === "devtools.main" && + (event[2] === "activate" || event[2] === "deactivate") ); for (const i in DATA) { - const [ timestamp, category, method, object, value, extra ] = events[i]; + const [timestamp, category, method, object, value, extra] = events[i]; const expected = DATA[i]; // ignore timestamp diff --git a/devtools/client/framework/test/browser_toolbox_telemetry_close.js b/devtools/client/framework/test/browser_toolbox_telemetry_close.js index f0d3753c26ea..65fffa8d8c8c 100644 --- a/devtools/client/framework/test/browser_toolbox_telemetry_close.js +++ b/devtools/client/framework/test/browser_toolbox_telemetry_close.js @@ -4,7 +4,9 @@ "use strict"; const { Toolbox } = require("devtools/client/framework/toolbox"); -const { TelemetryTestUtils } = ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm"); +const { TelemetryTestUtils } = ChromeUtils.import( + "resource://testing-common/TelemetryTestUtils.jsm" +); const URL = "data:text/html;charset=utf8,browser_toolbox_telemetry_close.js"; const { RIGHT, BOTTOM } = Toolbox.HostType; @@ -54,5 +56,9 @@ async function openAndCloseToolbox(toolId, host) { } function checkResults() { - TelemetryTestUtils.assertEvents(DATA, {category: "devtools.main", method: "close", object: "tools"}); + TelemetryTestUtils.assertEvents(DATA, { + category: "devtools.main", + method: "close", + object: "tools", + }); } diff --git a/devtools/client/framework/test/browser_toolbox_telemetry_enter.js b/devtools/client/framework/test/browser_toolbox_telemetry_enter.js index f3a60f06f460..426daa863cab 100644 --- a/devtools/client/framework/test/browser_toolbox_telemetry_enter.js +++ b/devtools/client/framework/test/browser_toolbox_telemetry_enter.js @@ -19,7 +19,8 @@ const DATA = [ panel_name: "inspector", cold: "true", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "enter", @@ -32,7 +33,8 @@ const DATA = [ panel_name: "jsdebugger", cold: "true", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "enter", @@ -45,7 +47,8 @@ const DATA = [ panel_name: "styleeditor", cold: "true", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "enter", @@ -58,7 +61,8 @@ const DATA = [ panel_name: "netmonitor", cold: "true", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "enter", @@ -71,7 +75,8 @@ const DATA = [ panel_name: "storage", cold: "true", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "enter", @@ -122,13 +127,13 @@ add_task(async function() { async function checkResults() { const snapshot = Services.telemetry.snapshotEvents(ALL_CHANNELS, true); - const events = snapshot.parent.filter(event => event[1] === "devtools.main" && - event[2] === "enter" && - event[4] === null + const events = snapshot.parent.filter( + event => + event[1] === "devtools.main" && event[2] === "enter" && event[4] === null ); for (const i in DATA) { - const [ timestamp, category, method, object, value, extra ] = events[i]; + const [timestamp, category, method, object, value, extra] = events[i]; const expected = DATA[i]; // ignore timestamp diff --git a/devtools/client/framework/test/browser_toolbox_telemetry_exit.js b/devtools/client/framework/test/browser_toolbox_telemetry_exit.js index 08d88ddfab2c..69bbe635f147 100644 --- a/devtools/client/framework/test/browser_toolbox_telemetry_exit.js +++ b/devtools/client/framework/test/browser_toolbox_telemetry_exit.js @@ -19,7 +19,8 @@ const DATA = [ next_panel: "jsdebugger", reason: "toolbox_show", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "exit", @@ -32,7 +33,8 @@ const DATA = [ next_panel: "styleeditor", reason: "toolbox_show", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "exit", @@ -45,7 +47,8 @@ const DATA = [ next_panel: "netmonitor", reason: "toolbox_show", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "exit", @@ -58,7 +61,8 @@ const DATA = [ next_panel: "storage", reason: "toolbox_show", }, - }, { + }, + { timestamp: null, category: "devtools.main", method: "exit", @@ -100,13 +104,13 @@ add_task(async function() { async function checkResults() { const snapshot = Services.telemetry.snapshotEvents(ALL_CHANNELS, true); - const events = snapshot.parent.filter(event => event[1] === "devtools.main" && - event[2] === "exit" && - event[4] === null + const events = snapshot.parent.filter( + event => + event[1] === "devtools.main" && event[2] === "exit" && event[4] === null ); for (const i in DATA) { - const [ timestamp, category, method, object, value, extra ] = events[i]; + const [timestamp, category, method, object, value, extra] = events[i]; const expected = DATA[i]; // ignore timestamp diff --git a/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js b/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js index 0356144bd622..7b62c36087c5 100644 --- a/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js +++ b/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js @@ -60,7 +60,9 @@ add_task(async function checkMenuEntryStates() { }); add_task(async function automaticallyBindTexbox() { - info("Registering a tool with an input field and making sure the context menu works"); + info( + "Registering a tool with an input field and making sure the context menu works" + ); gDevTools.registerTool({ id: textboxToolId, isTargetSupported: () => true, @@ -88,9 +90,13 @@ async function checkNonTextInput(input, toolbox) { let textboxContextMenu = toolbox.getTextBoxContextMenu(); ok(!textboxContextMenu, "The menu is closed"); - info("Simulating context click on the non text input and expecting no menu to open"); + info( + "Simulating context click on the non text input and expecting no menu to open" + ); const eventBubbledUp = new Promise(resolve => { - input.ownerDocument.addEventListener("contextmenu", resolve, { once: true }); + input.ownerDocument.addEventListener("contextmenu", resolve, { + once: true, + }); }); synthesizeContextMenuEvent(input); info("Waiting for event"); @@ -104,7 +110,9 @@ async function checkTextBox(textBox, toolbox) { let textboxContextMenu = toolbox.getTextBoxContextMenu(); ok(!textboxContextMenu, "The menu is closed"); - info("Simulating context click on the textbox and expecting the menu to open"); + info( + "Simulating context click on the textbox and expecting the menu to open" + ); const onContextMenu = toolbox.once("menu-open"); synthesizeContextMenuEvent(textBox); await onContextMenu; diff --git a/devtools/client/framework/test/browser_toolbox_theme.js b/devtools/client/framework/test/browser_toolbox_theme.js index 6737da4fe6bd..947ffbb8ef7d 100644 --- a/devtools/client/framework/test/browser_toolbox_theme.js +++ b/devtools/client/framework/test/browser_toolbox_theme.js @@ -13,14 +13,23 @@ registerCleanupFunction(() => { add_task(async function testDevtoolsTheme() { info("Checking stylesheet and :root attributes based on devtools theme."); Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light"); - is(document.getElementById("appcontent").getAttribute("devtoolstheme"), "light", - "The element has an attribute based on devtools theme."); + is( + document.getElementById("appcontent").getAttribute("devtoolstheme"), + "light", + "The element has an attribute based on devtools theme." + ); Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark"); - is(document.getElementById("appcontent").getAttribute("devtoolstheme"), "dark", - "The element has an attribute based on devtools theme."); + is( + document.getElementById("appcontent").getAttribute("devtoolstheme"), + "dark", + "The element has an attribute based on devtools theme." + ); Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "unknown"); - is(document.getElementById("appcontent").getAttribute("devtoolstheme"), "light", - "The element has 'light' as a default for the devtoolstheme attribute."); + is( + document.getElementById("appcontent").getAttribute("devtoolstheme"), + "light", + "The element has 'light' as a default for the devtoolstheme attribute." + ); }); diff --git a/devtools/client/framework/test/browser_toolbox_theme_registration.js b/devtools/client/framework/test/browser_toolbox_theme_registration.js index 8c12e6989bd3..2193f80d4309 100644 --- a/devtools/client/framework/test/browser_toolbox_theme_registration.js +++ b/devtools/client/framework/test/browser_toolbox_theme_registration.js @@ -6,7 +6,8 @@ "use strict"; // Test for dynamically registering and unregistering themes -const CHROME_URL = "chrome://mochitests/content/browser/devtools/client/framework/test/"; +const CHROME_URL = + "chrome://mochitests/content/browser/devtools/client/framework/test/"; const TEST_THEME_NAME = "test-theme"; const LIGHT_THEME_NAME = "light"; @@ -40,7 +41,8 @@ add_task(async function themeInOptionsPanel() { const doc = panelWin.frameElement.contentDocument; const themeBox = doc.getElementById("devtools-theme-box"); const testThemeOption = themeBox.querySelector( - `input[type=radio][value=${TEST_THEME_NAME}]`); + `input[type=radio][value=${TEST_THEME_NAME}]` + ); const eventsRecorded = []; function onThemeChanged(theme) { @@ -51,7 +53,8 @@ add_task(async function themeInOptionsPanel() { ok(testThemeOption, "new theme exists in the Options panel"); const lightThemeOption = themeBox.querySelector( - `input[type=radio][value=${LIGHT_THEME_NAME}]`); + `input[type=radio][value=${LIGHT_THEME_NAME}]` + ); let color = panelWin.getComputedStyle(themeBox).color; isnot(color, "rgb(255, 0, 0)", "style unapplied"); @@ -64,8 +67,16 @@ add_task(async function themeInOptionsPanel() { info("Waiting for theme to finish loading"); await onThemeSwithComplete; - is(gDevTools.getTheme(), TEST_THEME_NAME, "getTheme returns the expected theme"); - is(eventsRecorded.pop(), TEST_THEME_NAME, "theme-changed fired with the expected theme"); + is( + gDevTools.getTheme(), + TEST_THEME_NAME, + "getTheme returns the expected theme" + ); + is( + eventsRecorded.pop(), + TEST_THEME_NAME, + "theme-changed fired with the expected theme" + ); color = panelWin.getComputedStyle(themeBox).color; is(color, "rgb(255, 0, 0)", "style applied"); @@ -78,8 +89,16 @@ add_task(async function themeInOptionsPanel() { info("Waiting for theme to finish loading"); await onThemeSwithComplete; - is(gDevTools.getTheme(), LIGHT_THEME_NAME, "getTheme returns the expected theme"); - is(eventsRecorded.pop(), LIGHT_THEME_NAME, "theme-changed fired with the expected theme"); + is( + gDevTools.getTheme(), + LIGHT_THEME_NAME, + "getTheme returns the expected theme" + ); + is( + eventsRecorded.pop(), + LIGHT_THEME_NAME, + "theme-changed fired with the expected theme" + ); color = panelWin.getComputedStyle(themeBox).color; isnot(color, "rgb(255, 0, 0)", "style unapplied"); @@ -88,8 +107,16 @@ add_task(async function themeInOptionsPanel() { // Select test theme again. testThemeOption.click(); await onThemeSwithComplete; - is(gDevTools.getTheme(), TEST_THEME_NAME, "getTheme returns the expected theme"); - is(eventsRecorded.pop(), TEST_THEME_NAME, "theme-changed fired with the expected theme"); + is( + gDevTools.getTheme(), + TEST_THEME_NAME, + "getTheme returns the expected theme" + ); + is( + eventsRecorded.pop(), + TEST_THEME_NAME, + "theme-changed fired with the expected theme" + ); gDevTools.off("theme-changed", onThemeChanged); }); @@ -109,17 +136,31 @@ add_task(async function themeUnregistration() { await onUnRegisteredTheme; await onThemeSwitchComplete; - is(gDevTools.getTheme(), LIGHT_THEME_NAME, "getTheme returns the expected theme"); - is(eventsRecorded.pop(), LIGHT_THEME_NAME, "theme-changed fired with the expected theme"); - ok(!gDevTools.getThemeDefinitionMap().has(TEST_THEME_NAME), - "theme removed from map"); + is( + gDevTools.getTheme(), + LIGHT_THEME_NAME, + "getTheme returns the expected theme" + ); + is( + eventsRecorded.pop(), + LIGHT_THEME_NAME, + "theme-changed fired with the expected theme" + ); + ok( + !gDevTools.getThemeDefinitionMap().has(TEST_THEME_NAME), + "theme removed from map" + ); const doc = panelWin.frameElement.contentDocument; const themeBox = doc.getElementById("devtools-theme-box"); // The default light theme must be selected now. - is(themeBox.querySelector(`#devtools-theme-box [value=${LIGHT_THEME_NAME}]`).checked, true, - `${LIGHT_THEME_NAME} theme must be selected`); + is( + themeBox.querySelector(`#devtools-theme-box [value=${LIGHT_THEME_NAME}]`) + .checked, + true, + `${LIGHT_THEME_NAME} theme must be selected` + ); gDevTools.off("theme-changed", onThemeChanged); }); diff --git a/devtools/client/framework/test/browser_toolbox_toggle.js b/devtools/client/framework/test/browser_toolbox_toggle.js index e5af912f4628..2f1879447a17 100644 --- a/devtools/client/framework/test/browser_toolbox_toggle.js +++ b/devtools/client/framework/test/browser_toolbox_toggle.js @@ -10,7 +10,7 @@ const URL = "data:text/html;charset=utf-8,Toggling devtools using shortcuts"; -var {Toolbox} = require("devtools/client/framework/toolbox"); +var { Toolbox } = require("devtools/client/framework/toolbox"); add_task(async function() { // Make sure this test starts with the selectedTool pref cleared. Previous @@ -46,8 +46,11 @@ async function testToggle(key, modifiers) { async function testToggleDockedToolbox(tab, key, modifiers) { const toolbox = await getToolboxForTab(tab); - isnot(toolbox.hostType, Toolbox.HostType.WINDOW, - "Toolbox is docked in the main window"); + isnot( + toolbox.hostType, + Toolbox.HostType.WINDOW, + "Toolbox is docked in the main window" + ); info("verify docked toolbox is destroyed when using toggle key"); const onToolboxDestroyed = gDevTools.once("toolbox-destroyed"); @@ -68,8 +71,11 @@ async function testToggleDetachedToolbox(tab, key, modifiers) { info("change the toolbox hostType to WINDOW"); await toolbox.switchHost(Toolbox.HostType.WINDOW); - is(toolbox.hostType, Toolbox.HostType.WINDOW, - "Toolbox opened on separate window"); + is( + toolbox.hostType, + Toolbox.HostType.WINDOW, + "Toolbox opened on separate window" + ); info("Wait for focus on the toolbox window"); await new Promise(res => waitForFocus(res, toolbox.win)); @@ -81,16 +87,20 @@ async function testToggleDetachedToolbox(tab, key, modifiers) { await onMainWindowFocus; ok(true, "Main window focused"); - info("Verify windowed toolbox is focused instead of closed when using " + - "toggle key from the main window"); + info( + "Verify windowed toolbox is focused instead of closed when using " + + "toggle key from the main window" + ); const toolboxWindow = toolbox.topWindow; const onToolboxWindowFocus = once(toolboxWindow, "focus", true); EventUtils.synthesizeKey(key, modifiers); await onToolboxWindowFocus; ok(true, "Toolbox focused and not destroyed"); - info("Verify windowed toolbox is destroyed when using toggle key from its " + - "own window"); + info( + "Verify windowed toolbox is destroyed when using toggle key from its " + + "own window" + ); const onToolboxDestroyed = gDevTools.once("toolbox-destroyed"); EventUtils.synthesizeKey(key, modifiers, toolboxWindow); diff --git a/devtools/client/framework/test/browser_toolbox_tool_ready.js b/devtools/client/framework/test/browser_toolbox_tool_ready.js index 41cd523b8993..f38ad9598bc5 100644 --- a/devtools/client/framework/test/browser_toolbox_tool_ready.js +++ b/devtools/client/framework/test/browser_toolbox_tool_ready.js @@ -9,9 +9,10 @@ requestLongerTimeout(5); function performChecks(target) { return (async function() { - const toolIds = gDevTools.getToolDefinitionArray() - .filter(def => def.isTargetSupported(target)) - .map(def => def.id); + const toolIds = gDevTools + .getToolDefinitionArray() + .filter(def => def.isTargetSupported(target)) + .map(def => def.id); let toolbox; for (let index = 0; index < toolIds.length; index++) { diff --git a/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js b/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js index a59ca298390f..1c2a119c2fcc 100644 --- a/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js +++ b/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js @@ -38,9 +38,10 @@ requestLongerTimeout(2); function runTools(target) { return (async function() { - const toolIds = gDevTools.getToolDefinitionArray() - .filter(def => def.isTargetSupported(target)) - .map(def => def.id); + const toolIds = gDevTools + .getToolDefinitionArray() + .filter(def => def.isTargetSupported(target)) + .map(def => def.id); let toolbox; for (let index = 0; index < toolIds.length; index++) { diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_minimum_width.js b/devtools/client/framework/test/browser_toolbox_toolbar_minimum_width.js index 92b176f281aa..f14e40a6d469 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_minimum_width.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_minimum_width.js @@ -20,14 +20,20 @@ add_task(async function(pickerEnable, commandsEnable) { const tab = await addTab("about:blank"); info("Open devtools on the Inspector in a side dock"); - const toolbox = await openToolboxForTab(tab, "inspector", Toolbox.HostType.RIGHT); + const toolbox = await openToolboxForTab( + tab, + "inspector", + Toolbox.HostType.RIGHT + ); await waitUntil(() => toolbox.doc.querySelector(".tools-chevron-menu")); await openChevronMenu(toolbox); // Check that all of tools is overflowed. - toolbox.panelDefinitions.forEach(({id}) => { - const menuItem = toolbox.doc.getElementById("tools-chevron-menupopup-" + id); + toolbox.panelDefinitions.forEach(({ id }) => { + const menuItem = toolbox.doc.getElementById( + "tools-chevron-menupopup-" + id + ); const tab = toolbox.doc.getElementById("toolbox-tab-" + id); ok(menuItem, id + " is in the overflowed menu"); ok(!tab, id + " tab does not exist"); diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_overflow.js b/devtools/client/framework/test/browser_toolbox_toolbar_overflow.js index 68c1e0e75efd..e55d5e79e482 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_overflow.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_overflow.js @@ -13,20 +13,28 @@ add_task(async function() { const tab = await addTab("about:blank"); info("Open devtools on the Inspector in a bottom dock"); - const toolbox = await openToolboxForTab(tab, "inspector", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "inspector", + Toolbox.HostType.BOTTOM + ); const hostWindow = toolbox.win.parent; const originalWidth = hostWindow.outerWidth; const originalHeight = hostWindow.outerHeight; - info("Resize devtools window to a width that should not trigger any overflow"); + info( + "Resize devtools window to a width that should not trigger any overflow" + ); let onResize = once(hostWindow, "resize"); hostWindow.resizeTo(1350, 300); await onResize; waitUntil(() => { // Wait for all buttons are displayed. - return toolbox.panelDefinitions.length !== - toolbox.doc.querySelectorAll(".devtools-tab").length; + return ( + toolbox.panelDefinitions.length !== + toolbox.doc.querySelectorAll(".devtools-tab").length + ); }); let chevronMenuButton = toolbox.doc.querySelector(".tools-chevron-menu"); @@ -44,16 +52,24 @@ add_task(async function() { chevronMenuButton = toolbox.doc.querySelector(".tools-chevron-menu"); ok(chevronMenuButton, "The chevron menu button is displayed"); - info("Open the tools-chevron-menupopup and verify that the inspector button is checked"); + info( + "Open the tools-chevron-menupopup and verify that the inspector button is checked" + ); await openChevronMenu(toolbox); - const inspectorButton = toolbox.doc.querySelector("#tools-chevron-menupopup-inspector"); + const inspectorButton = toolbox.doc.querySelector( + "#tools-chevron-menupopup-inspector" + ); ok(!inspectorButton, "The chevron menu doesn't have the inspector button."); - const consoleButton = toolbox.doc.querySelector("#tools-chevron-menupopup-webconsole"); + const consoleButton = toolbox.doc.querySelector( + "#tools-chevron-menupopup-webconsole" + ); ok(!consoleButton, "The chevron menu doesn't have the console button."); - const storageButton = toolbox.doc.querySelector("#tools-chevron-menupopup-storage"); + const storageButton = toolbox.doc.querySelector( + "#tools-chevron-menupopup-storage" + ); ok(storageButton, "The chevron menu has the storage button."); info("Switch to the performance using the tools-chevron-menupopup popup"); diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_overflow_button_visibility.js b/devtools/client/framework/test/browser_toolbox_toolbar_overflow_button_visibility.js index 899fbbe8c298..38e3c0a6f369 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_overflow_button_visibility.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_overflow_button_visibility.js @@ -11,12 +11,20 @@ const { Toolbox } = require("devtools/client/framework/toolbox"); add_task(async function() { const tab = await addTab("about:blank"); - const toolbox = await openToolboxForTab(tab, "options", Toolbox.HostType.BOTTOM); - const toolboxButtonPreferences = - toolbox.toolbarButtons.map(button => button.visibilityswitch); + const toolbox = await openToolboxForTab( + tab, + "options", + Toolbox.HostType.BOTTOM + ); + const toolboxButtonPreferences = toolbox.toolbarButtons.map( + button => button.visibilityswitch + ); const win = getWindow(toolbox); - const { outerWidth: originalWindowWidth, outerHeight: originalWindowHeight } = win; + const { + outerWidth: originalWindowWidth, + outerHeight: originalWindowHeight, + } = win; registerCleanupFunction(() => { for (const preference of toolboxButtonPreferences) { Services.prefs.clearUserPref(preference); @@ -26,11 +34,13 @@ add_task(async function() { }); const optionsTool = toolbox.getCurrentPanel(); - const checkButtons = - optionsTool.panelWin.document - .querySelectorAll("#enabled-toolbox-buttons-box input[type=checkbox]"); + const checkButtons = optionsTool.panelWin.document.querySelectorAll( + "#enabled-toolbox-buttons-box input[type=checkbox]" + ); - info("Test the count of shown devtools tab after making all buttons to be visible"); + info( + "Test the count of shown devtools tab after making all buttons to be visible" + ); await resizeWindow(toolbox, 800); // Once, make all toolbox button to be invisible. setToolboxButtonsVisibility(checkButtons, false); @@ -38,13 +48,20 @@ add_task(async function() { const initialTabCount = toolbox.doc.querySelectorAll(".devtools-tab").length; // Make all toolbox button to be visible. setToolboxButtonsVisibility(checkButtons, true); - ok(toolbox.doc.querySelectorAll(".devtools-tab").length < initialTabCount, - "Count of shown devtools tab should decreased"); + ok( + toolbox.doc.querySelectorAll(".devtools-tab").length < initialTabCount, + "Count of shown devtools tab should decreased" + ); - info("Test the count of shown devtools tab after making all buttons to be invisible"); + info( + "Test the count of shown devtools tab after making all buttons to be invisible" + ); setToolboxButtonsVisibility(checkButtons, false); - is(toolbox.doc.querySelectorAll(".devtools-tab").length, initialTabCount, - "Count of shown devtools tab should be same to 1st count"); + is( + toolbox.doc.querySelectorAll(".devtools-tab").length, + initialTabCount, + "Count of shown devtools tab should be same to 1st count" + ); }); function setToolboxButtonsVisibility(checkButtons, doVisible) { diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_dnd.js b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_dnd.js index ed2005f28dc2..190aec5e3420 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_dnd.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_dnd.js @@ -25,61 +25,134 @@ const { Toolbox } = require("devtools/client/framework/toolbox"); -const TEST_STARTING_ORDER = ["inspector", "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", - "accessibility"]; +const TEST_STARTING_ORDER = [ + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", +]; const TEST_DATA = [ { description: "DragAndDrop the target component to back", dragTarget: "webconsole", dropTarget: "jsdebugger", - expectedOrder: ["inspector", "jsdebugger", "webconsole", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + expectedOrder: [ + "inspector", + "jsdebugger", + "webconsole", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], }, { description: "DragAndDrop the target component to front", dragTarget: "webconsole", dropTarget: "inspector", - expectedOrder: ["webconsole", "inspector", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + expectedOrder: [ + "webconsole", + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], }, { - description: "DragAndDrop the target component over the starting of the tab", + description: + "DragAndDrop the target component over the starting of the tab", dragTarget: "netmonitor", - passedTargets: ["memory", "performance", "styleeditor", - "jsdebugger", "webconsole", "inspector"], + passedTargets: [ + "memory", + "performance", + "styleeditor", + "jsdebugger", + "webconsole", + "inspector", + ], dropTarget: "#toolbox-buttons-start", - expectedOrder: ["netmonitor", "inspector", "webconsole", "jsdebugger", - "styleeditor", "performance", "memory", "storage", "accessibility"], + expectedOrder: [ + "netmonitor", + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "storage", + "accessibility", + ], }, { description: "DragAndDrop the target component over the ending of the tab", dragTarget: "webconsole", - passedTargets: ["jsdebugger", "styleeditor", "performance", - "memory", "netmonitor", "storage"], + passedTargets: [ + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + ], dropTarget: "#toolbox-buttons-end", - expectedOrder: ["inspector", "jsdebugger", "styleeditor", "performance", - "memory", "netmonitor", "storage", "accessibility", "webconsole"], + expectedOrder: [ + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + "webconsole", + ], }, ]; add_task(async function() { const tab = await addTab("about:blank"); - const toolbox = await openToolboxForTab(tab, "inspector", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "inspector", + Toolbox.HostType.BOTTOM + ); - const originalPreference = Services.prefs.getCharPref("devtools.toolbox.tabsOrder"); + const originalPreference = Services.prefs.getCharPref( + "devtools.toolbox.tabsOrder" + ); const win = getWindow(toolbox); - const { outerWidth: originalWindowWidth, outerHeight: originalWindowHeight } = win; + const { + outerWidth: originalWindowWidth, + outerHeight: originalWindowHeight, + } = win; registerCleanupFunction(() => { - Services.prefs.setCharPref("devtools.toolbox.tabsOrder", originalPreference); + Services.prefs.setCharPref( + "devtools.toolbox.tabsOrder", + originalPreference + ); win.resizeTo(originalWindowWidth, originalWindowHeight); }); for (const testData of TEST_DATA) { - info(`Test for '${ testData.description }'`); + info(`Test for '${testData.description}'`); prepareToolTabReorderTest(toolbox, TEST_STARTING_ORDER); - await dndToolTab(toolbox, testData.dragTarget, - testData.dropTarget, testData.passedTargets); + await dndToolTab( + toolbox, + testData.dragTarget, + testData.dropTarget, + testData.passedTargets + ); assertToolTabOrder(toolbox, testData.expectedOrder); assertToolTabSelected(toolbox, testData.dragTarget); assertToolTabPreferenceOrder(testData.expectedOrder); @@ -91,9 +164,17 @@ add_task(async function() { await toolbox.selectTool("storage"); const dragTarget = "storage"; const dropTarget = "inspector"; - const expectedOrder = ["storage", "inspector", "webconsole", "jsdebugger", - "styleeditor", "performance", "memory", "netmonitor", - "accessibility"]; + const expectedOrder = [ + "storage", + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "accessibility", + ]; await dndToolTab(toolbox, dragTarget, dropTarget); assertToolTabSelected(toolbox, dragTarget); assertToolTabPreferenceOrder(expectedOrder); diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_width.js b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_width.js index 088d2c03e66a..8dbb442e8943 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_width.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_by_width.js @@ -20,10 +20,17 @@ add_task(async function() { const tab = await addTab("about:blank"); info("Open devtools on the Storage in a sidebar."); - const toolbox = await openToolboxForTab(tab, "storage", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "storage", + Toolbox.HostType.BOTTOM + ); const win = getWindow(toolbox); - const { outerWidth: originalWindowWidth, outerHeight: originalWindowHeight } = win; + const { + outerWidth: originalWindowWidth, + outerHeight: originalWindowHeight, + } = win; registerCleanupFunction(() => { win.resizeTo(originalWindowWidth, originalWindowHeight); }); @@ -49,7 +56,11 @@ add_task(async function() { const tab = await addTab("about:blank"); info("Open devtools on the Storage in a sidebar."); - const toolbox = await openToolboxForTab(tab, "storage", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "storage", + Toolbox.HostType.BOTTOM + ); info("Resize devtools window to a width that should trigger an overflow"); await resizeWindow(toolbox, 800); @@ -69,7 +80,9 @@ add_task(async function() { await openChevronMenu(toolbox); info("The registered new tool tab should be in the tools menu."); - let testToolsButton = toolbox.doc.querySelector("#tools-chevron-menupopup-test-tools"); + let testToolsButton = toolbox.doc.querySelector( + "#tools-chevron-menupopup-test-tools" + ); ok(testToolsButton, "The tools menu has a registered new tool button."); await closeChevronMenu(toolbox); @@ -83,8 +96,13 @@ add_task(async function() { await openChevronMenu(toolbox); info("An unregistered new tool tab should not be in the tools menu."); - testToolsButton = toolbox.doc.querySelector("#tools-chevron-menupopup-test-tools"); - ok(!testToolsButton, "The tools menu doesn't have a unregistered new tool button."); + testToolsButton = toolbox.doc.querySelector( + "#tools-chevron-menupopup-test-tools" + ); + ok( + !testToolsButton, + "The tools menu doesn't have a unregistered new tool button." + ); await closeChevronMenu(toolbox); }); diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_extension.js b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_extension.js index 61df9ab31c6d..3edf3a3616dc 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_extension.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_extension.js @@ -11,9 +11,18 @@ const { Toolbox } = require("devtools/client/framework/toolbox"); const EXTENSION = "@reorder.test"; -const TEST_STARTING_ORDER = ["inspector", "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", - "accessibility", EXTENSION]; +const TEST_STARTING_ORDER = [ + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + EXTENSION, +]; add_task(async function() { const extension = ExtensionTestUtils.loadExtension({ @@ -47,22 +56,44 @@ add_task(async function() { await extension.startup(); const tab = await addTab("about:blank"); - const toolbox = await openToolboxForTab(tab, "webconsole", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "webconsole", + Toolbox.HostType.BOTTOM + ); await extension.awaitMessage("devtools-page-ready"); - const originalPreference = Services.prefs.getCharPref("devtools.toolbox.tabsOrder"); + const originalPreference = Services.prefs.getCharPref( + "devtools.toolbox.tabsOrder" + ); const win = getWindow(toolbox); - const { outerWidth: originalWindowWidth, outerHeight: originalWindowHeight } = win; + const { + outerWidth: originalWindowWidth, + outerHeight: originalWindowHeight, + } = win; registerCleanupFunction(() => { - Services.prefs.setCharPref("devtools.toolbox.tabsOrder", originalPreference); + Services.prefs.setCharPref( + "devtools.toolbox.tabsOrder", + originalPreference + ); win.resizeTo(originalWindowWidth, originalWindowHeight); }); info("Test for DragAndDrop the extension tab"); let dragTarget = EXTENSION; let dropTarget = "webconsole"; - let expectedOrder = ["inspector", EXTENSION, "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"]; + let expectedOrder = [ + "inspector", + EXTENSION, + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ]; prepareToolTabReorderTest(toolbox, TEST_STARTING_ORDER); await dndToolTab(toolbox, dragTarget, dropTarget); assertToolTabOrder(toolbox, expectedOrder); @@ -75,8 +106,18 @@ add_task(async function() { await toolbox.selectTool("storage"); dragTarget = "storage"; dropTarget = "inspector"; - expectedOrder = ["storage", "inspector", "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "accessibility", EXTENSION]; + expectedOrder = [ + "storage", + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "accessibility", + EXTENSION, + ]; await dndToolTab(toolbox, dragTarget, dropTarget); assertToolTabPreferenceOrder(expectedOrder); await resizeWindow(toolbox, originalWindowWidth, originalWindowHeight); @@ -86,8 +127,17 @@ add_task(async function() { await extension.unload(); dragTarget = "webconsole"; dropTarget = "inspector"; - expectedOrder = ["webconsole", "inspector", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"]; + expectedOrder = [ + "webconsole", + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ]; await dndToolTab(toolbox, dragTarget, dropTarget); assertToolTabPreferenceOrder(expectedOrder); }); diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_hidden_extension.js b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_hidden_extension.js index a16e7cd2d4bb..96efe5265bc0 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_hidden_extension.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_hidden_extension.js @@ -14,39 +14,121 @@ const EXTENSION = "@reorder.test"; const TEST_DATA = [ { description: "Test that drags a tab to left beyond the extension's tab", - startingOrder: ["inspector", EXTENSION, "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + startingOrder: [ + "inspector", + EXTENSION, + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], dragTarget: "webconsole", dropTarget: "inspector", - expectedOrder: ["webconsole", "inspector", EXTENSION, "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + expectedOrder: [ + "webconsole", + "inspector", + EXTENSION, + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], }, { description: "Test that drags a tab to right beyond the extension's tab", - startingOrder: ["inspector", EXTENSION, "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + startingOrder: [ + "inspector", + EXTENSION, + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], dragTarget: "inspector", dropTarget: "webconsole", - expectedOrder: [EXTENSION, "webconsole", "inspector", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + expectedOrder: [ + EXTENSION, + "webconsole", + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], }, { - description: "Test that drags a tab to left end, but hidden tab is left end", - startingOrder: [EXTENSION, "inspector", "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + description: + "Test that drags a tab to left end, but hidden tab is left end", + startingOrder: [ + EXTENSION, + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], dragTarget: "webconsole", dropTarget: "inspector", - expectedOrder: [EXTENSION, "webconsole", "inspector", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"], + expectedOrder: [ + EXTENSION, + "webconsole", + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ], }, { - description: "Test that drags a tab to right end, but hidden tab is right end", - startingOrder: ["inspector", "webconsole", "jsdebugger", "styleeditor", "performance", - "memory", "netmonitor", "storage", "accessibility", EXTENSION], + description: + "Test that drags a tab to right end, but hidden tab is right end", + startingOrder: [ + "inspector", + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + EXTENSION, + ], dragTarget: "webconsole", dropTarget: "accessibility", - expectedOrder: ["inspector", "jsdebugger", "styleeditor", "performance", "memory", - "netmonitor", "storage", "accessibility", EXTENSION, "webconsole"], + expectedOrder: [ + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + EXTENSION, + "webconsole", + ], }, ]; @@ -84,11 +166,20 @@ add_task(async function() { await extension.startup(); const tab = await addTab("about:blank"); - const toolbox = await openToolboxForTab(tab, "webconsole", Toolbox.HostType.BOTTOM); + const toolbox = await openToolboxForTab( + tab, + "webconsole", + Toolbox.HostType.BOTTOM + ); await extension.awaitMessage("devtools-page-ready"); - for (const { description, startingOrder, - dragTarget, dropTarget, expectedOrder } of TEST_DATA) { + for (const { + description, + startingOrder, + dragTarget, + dropTarget, + expectedOrder, + } of TEST_DATA) { info(description); prepareTestWithHiddenExtension(toolbox, startingOrder); await dndToolTab(toolbox, dragTarget, dropTarget); @@ -96,12 +187,31 @@ add_task(async function() { } info("Test ordering preference after uninstalling hidden addon"); - const startingOrder = ["inspector", EXTENSION, "webconsole", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"]; + const startingOrder = [ + "inspector", + EXTENSION, + "webconsole", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ]; const dragTarget = "webconsole"; const dropTarget = "inspector"; - const expectedOrder = ["webconsole", "inspector", "jsdebugger", "styleeditor", - "performance", "memory", "netmonitor", "storage", "accessibility"]; + const expectedOrder = [ + "webconsole", + "inspector", + "jsdebugger", + "styleeditor", + "performance", + "memory", + "netmonitor", + "storage", + "accessibility", + ]; prepareTestWithHiddenExtension(toolbox, startingOrder); await extension.unload(); await dndToolTab(toolbox, dragTarget, dropTarget); @@ -109,13 +219,19 @@ add_task(async function() { }); function prepareTestWithHiddenExtension(toolbox, startingOrder) { - Services.prefs.setCharPref("devtools.toolbox.tabsOrder", startingOrder.join(",")); + Services.prefs.setCharPref( + "devtools.toolbox.tabsOrder", + startingOrder.join(",") + ); for (const id of startingOrder) { if (id === EXTENSION) { - ok(!getElementByToolId(toolbox, id), "Hidden extension tab should not exist"); + ok( + !getElementByToolId(toolbox, id), + "Hidden extension tab should not exist" + ); } else { - ok(getElementByToolId(toolbox, id), `Tab element should exist for ${ id }`); + ok(getElementByToolId(toolbox, id), `Tab element should exist for ${id}`); } } } diff --git a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_secondary_toolbox.js b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_secondary_toolbox.js index e22ec91f885d..39e102633002 100644 --- a/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_secondary_toolbox.js +++ b/devtools/client/framework/test/browser_toolbox_toolbar_reorder_with_secondary_toolbox.js @@ -9,7 +9,9 @@ // We test whether the ordering preference will not change when the secondary toolbox // was closed without reordering. -const { gDevToolsBrowser } = require("devtools/client/framework/devtools-browser"); +const { + gDevToolsBrowser, +} = require("devtools/client/framework/devtools-browser"); add_task(async function() { registerCleanupFunction(() => { @@ -18,18 +20,25 @@ add_task(async function() { // Keep initial tabs order preference of devtools so as to compare after re-ordering // tabs on browser content toolbox. - const initialTabsOrderOnDevTools = Services.prefs.getCharPref("devtools.toolbox.tabsOrder"); + const initialTabsOrderOnDevTools = Services.prefs.getCharPref( + "devtools.toolbox.tabsOrder" + ); info("Prepare the toolbox on browser content toolbox"); - await addTab(`${ URL_ROOT }doc_empty-tab-01.html`); + await addTab(`${URL_ROOT}doc_empty-tab-01.html`); // Select "memory" tool from first, because the webconsole might connect to the content. Services.prefs.setCharPref("devtools.toolbox.selectedTool", "memory"); const toolbox = await gDevToolsBrowser.openContentProcessToolbox(gBrowser); - info("Check whether the value of devtools.toolbox.tabsOrder was not affected after closed"); + info( + "Check whether the value of devtools.toolbox.tabsOrder was not affected after closed" + ); const onToolboxDestroyed = toolbox.once("destroyed"); toolbox.win.top.close(); await onToolboxDestroyed; - is(Services.prefs.getCharPref("devtools.toolbox.tabsOrder"), initialTabsOrderOnDevTools, - "The preference of devtools.toolbox.tabsOrder should not be affected"); + is( + Services.prefs.getCharPref("devtools.toolbox.tabsOrder"), + initialTabsOrderOnDevTools, + "The preference of devtools.toolbox.tabsOrder should not be affected" + ); }); diff --git a/devtools/client/framework/test/browser_toolbox_tools_per_toolbox_registration.js b/devtools/client/framework/test/browser_toolbox_tools_per_toolbox_registration.js index 5e30d4b9993e..a83ba613feb0 100644 --- a/devtools/client/framework/test/browser_toolbox_tools_per_toolbox_registration.js +++ b/devtools/client/framework/test/browser_toolbox_tools_per_toolbox_registration.js @@ -18,29 +18,30 @@ var toolbox; var target; function test() { - addTab(TEST_URL).then(async (tab) => { + addTab(TEST_URL).then(async tab => { target = await TargetFactory.forTab(tab); - gDevTools.showToolbox(target) + gDevTools + .showToolbox(target) .then(toolboxRegister) .then(testToolRegistered); }); } var resolveToolInstanceBuild; -var waitForToolInstanceBuild = new Promise((resolve) => { +var waitForToolInstanceBuild = new Promise(resolve => { resolveToolInstanceBuild = resolve; }); var resolveToolInstanceDestroyed; -var waitForToolInstanceDestroyed = new Promise((resolve) => { +var waitForToolInstanceDestroyed = new Promise(resolve => { resolveToolInstanceDestroyed = resolve; }); function toolboxRegister(aToolbox) { toolbox = aToolbox; - waitForToolInstanceBuild = new Promise((resolve) => { + waitForToolInstanceBuild = new Promise(resolve => { resolveToolInstanceBuild = resolve; }); @@ -67,9 +68,14 @@ function toolboxRegister(aToolbox) { } function testToolRegistered() { - ok(!gDevTools.getToolDefinitionMap().has(TOOL_ID), "per-toolbox tool is not registered globally"); - ok(toolbox.hasAdditionalTool(TOOL_ID), - "per-toolbox tool registered to the specific toolbox"); + ok( + !gDevTools.getToolDefinitionMap().has(TOOL_ID), + "per-toolbox tool is not registered globally" + ); + ok( + toolbox.hasAdditionalTool(TOOL_ID), + "per-toolbox tool registered to the specific toolbox" + ); // Test that the tool appeared in the UI. const doc = toolbox.doc; @@ -91,9 +97,10 @@ function testToolRegistered() { // Test that the tool is built once selected and then test its unregistering. info("select per-toolbox tool in the opened toolbox."); - gDevTools.showToolbox(target, TOOL_ID) - .then(waitForToolInstanceBuild) - .then(testUnregister); + gDevTools + .showToolbox(target, TOOL_ID) + .then(waitForToolInstanceBuild) + .then(testUnregister); } function getAllBrowserWindows() { @@ -104,14 +111,14 @@ function testUnregister() { info("remove per-toolbox tool in the opened toolbox."); toolbox.removeAdditionalTool(TOOL_ID); - Promise.all([ - waitForToolInstanceDestroyed, - ]).then(toolboxToolUnregistered); + Promise.all([waitForToolInstanceDestroyed]).then(toolboxToolUnregistered); } function toolboxToolUnregistered() { - ok(!toolbox.hasAdditionalTool(TOOL_ID), - "per-toolbox tool unregistered from the specific toolbox"); + ok( + !toolbox.hasAdditionalTool(TOOL_ID), + "per-toolbox tool unregistered from the specific toolbox" + ); // test that it disappeared from the UI const doc = toolbox.doc; diff --git a/devtools/client/framework/test/browser_toolbox_view_source_01.js b/devtools/client/framework/test/browser_toolbox_view_source_01.js index ac1e09a24227..db221b2a60a9 100644 --- a/devtools/client/framework/test/browser_toolbox_view_source_01.js +++ b/devtools/client/framework/test/browser_toolbox_view_source_01.js @@ -26,7 +26,7 @@ async function viewSource() { } function test() { - viewSource().then(finish, (aError) => { + viewSource().then(finish, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); finish(); }); diff --git a/devtools/client/framework/test/browser_toolbox_view_source_02.js b/devtools/client/framework/test/browser_toolbox_view_source_02.js index f604cf1f0ba3..8f62916119fd 100644 --- a/devtools/client/framework/test/browser_toolbox_view_source_02.js +++ b/devtools/client/framework/test/browser_toolbox_view_source_02.js @@ -27,7 +27,7 @@ async function viewSource() { } function test() { - viewSource().then(finish, (aError) => { + viewSource().then(finish, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); finish(); }); diff --git a/devtools/client/framework/test/browser_toolbox_view_source_03.js b/devtools/client/framework/test/browser_toolbox_view_source_03.js index bbd99cc3a5ca..db67625d5258 100644 --- a/devtools/client/framework/test/browser_toolbox_view_source_03.js +++ b/devtools/client/framework/test/browser_toolbox_view_source_03.js @@ -15,25 +15,38 @@ async function viewSource() { const toolbox = await openNewTabAndToolbox(URL); const fileFound = await toolbox.viewSourceInStyleEditor(CSS_URL, 2); - ok(fileFound, "viewSourceInStyleEditor should resolve to true if source found."); + ok( + fileFound, + "viewSourceInStyleEditor should resolve to true if source found." + ); const stylePanel = toolbox.getPanel("styleeditor"); ok(stylePanel, "The style editor panel was opened."); - is(toolbox.currentToolId, "styleeditor", "The style editor panel was selected."); + is( + toolbox.currentToolId, + "styleeditor", + "The style editor panel was selected." + ); const { UI } = stylePanel; - is(UI.selectedEditor.styleSheet.href, CSS_URL, - "The correct source is shown in the style editor."); - is(UI.selectedEditor.sourceEditor.getCursor().line + 1, 2, - "The correct line is highlighted in the style editor's source editor."); + is( + UI.selectedEditor.styleSheet.href, + CSS_URL, + "The correct source is shown in the style editor." + ); + is( + UI.selectedEditor.sourceEditor.getCursor().line + 1, + 2, + "The correct line is highlighted in the style editor's source editor." + ); await closeToolboxAndTab(toolbox); finish(); } function test() { - viewSource().then(finish, (aError) => { + viewSource().then(finish, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); finish(); }); diff --git a/devtools/client/framework/test/browser_toolbox_view_source_04.js b/devtools/client/framework/test/browser_toolbox_view_source_04.js index d0a6788aa104..39d034d82c65 100644 --- a/devtools/client/framework/test/browser_toolbox_view_source_04.js +++ b/devtools/client/framework/test/browser_toolbox_view_source_04.js @@ -23,8 +23,11 @@ async function viewSource() { await toolbox.viewSourceInScratchpad(scratchpadURL, 2); - is(scratchpad.editor.getCursor().line, 2, - "The correct line is highlighted in scratchpad's editor."); + is( + scratchpad.editor.getCursor().line, + 2, + "The correct line is highlighted in scratchpad's editor." + ); win.close(); await closeToolboxAndTab(toolbox); @@ -32,7 +35,7 @@ async function viewSource() { } function test() { - viewSource().then(finish, (aError) => { + viewSource().then(finish, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); finish(); }); diff --git a/devtools/client/framework/test/browser_toolbox_window_reload_target.js b/devtools/client/framework/test/browser_toolbox_window_reload_target.js index ac94bf6f21fd..432c348fb5de 100644 --- a/devtools/client/framework/test/browser_toolbox_window_reload_target.js +++ b/devtools/client/framework/test/browser_toolbox_window_reload_target.js @@ -12,13 +12,16 @@ requestLongerTimeout(10); -const TEST_URL = "data:text/html;charset=utf-8," + - "Test reload" + - "

Testing reload from devtools

"; +const TEST_URL = + "data:text/html;charset=utf-8," + + "Test reload" + + "

Testing reload from devtools

"; const { Toolbox } = require("devtools/client/framework/toolbox"); const { LocalizationHelper } = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); // Track how many page reloads we've sent to the page. var reloadsSent = 0; @@ -30,22 +33,37 @@ add_task(async function() { loadFrameScriptUtils(); info("Getting the entire list of tools supported in this tab"); - const toolIDs = gDevTools.getToolDefinitionArray() - .filter(def => def.isTargetSupported(target)) - .map(def => def.id); + const toolIDs = gDevTools + .getToolDefinitionArray() + .filter(def => def.isTargetSupported(target)) + .map(def => def.id); - info("Display the toolbox, docked at the bottom, with the first tool selected"); - const toolbox = await gDevTools.showToolbox(target, toolIDs[0], - Toolbox.HostType.BOTTOM); + info( + "Display the toolbox, docked at the bottom, with the first tool selected" + ); + const toolbox = await gDevTools.showToolbox( + target, + toolIDs[0], + Toolbox.HostType.BOTTOM + ); - info("Listen to page reloads to check that they are indeed sent by the toolbox"); + info( + "Listen to page reloads to check that they are indeed sent by the toolbox" + ); let reloadDetected = 0; const reloadCounter = msg => { reloadDetected++; info("Detected reload #" + reloadDetected); - is(reloadDetected, reloadsSent, "Detected the right number of reloads in the page"); + is( + reloadDetected, + reloadsSent, + "Detected the right number of reloads in the page" + ); }; - gBrowser.selectedBrowser.messageManager.addMessageListener("devtools:test:load", reloadCounter); + gBrowser.selectedBrowser.messageManager.addMessageListener( + "devtools:test:load", + reloadCounter + ); info("Start testing with the toolbox docked"); // Note that we actually only test 1 tool in docked mode, to cut down on test time. @@ -63,7 +81,10 @@ add_task(async function() { info("Switch back to docked mode"); await toolbox.switchHost(Toolbox.HostType.BOTTOM); - gBrowser.selectedBrowser.messageManager.removeMessageListener("devtools:test:load", reloadCounter); + gBrowser.selectedBrowser.messageManager.removeMessageListener( + "devtools:test:load", + reloadCounter + ); await toolbox.destroy(); gBrowser.removeCurrentTab(); diff --git a/devtools/client/framework/test/browser_toolbox_window_shortcuts.js b/devtools/client/framework/test/browser_toolbox_window_shortcuts.js index 1d9e6c7d4cad..d19d978f7cdb 100644 --- a/devtools/client/framework/test/browser_toolbox_window_shortcuts.js +++ b/devtools/client/framework/test/browser_toolbox_window_shortcuts.js @@ -5,11 +5,16 @@ "use strict"; -var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports) - .wrappedJSObject; -var {Toolbox} = require("devtools/client/framework/toolbox"); +var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService( + Ci.nsISupports +).wrappedJSObject; +var { Toolbox } = require("devtools/client/framework/toolbox"); -var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = []; +var toolbox, + toolIDs, + toolShortcuts = [], + idIndex, + modifiedPrefs = []; async function test() { addTab("about:blank").then(async function() { @@ -34,8 +39,9 @@ async function test() { } const target = await TargetFactory.forTab(gBrowser.selectedTab); idIndex = 0; - gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW) - .then(testShortcuts); + gDevTools + .showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW) + .then(testShortcuts); }); } @@ -61,16 +67,25 @@ function testShortcuts(aToolbox, aIndex) { shiftKey: toolModifiers.includes("shift"), }; idIndex = aIndex; - info("Testing shortcut for tool " + aIndex + ":" + toolIDs[aIndex] + - " using key " + key); + info( + "Testing shortcut for tool " + + aIndex + + ":" + + toolIDs[aIndex] + + " using key " + + key + ); EventUtils.synthesizeKey(key, modifiers, toolbox.win.parent); } function selectCB(id) { info("toolbox-select event from " + id); - is(toolIDs.indexOf(id), idIndex, - "Correct tool is selected on pressing the shortcut for " + id); + is( + toolIDs.indexOf(id), + idIndex, + "Correct tool is selected on pressing the shortcut for " + id + ); testShortcuts(toolbox, idIndex + 1); } diff --git a/devtools/client/framework/test/browser_toolbox_window_title_changes.js b/devtools/client/framework/test/browser_toolbox_window_title_changes.js index bbd28ca9156f..bf6818f7395f 100644 --- a/devtools/client/framework/test/browser_toolbox_window_title_changes.js +++ b/devtools/client/framework/test/browser_toolbox_window_title_changes.js @@ -5,7 +5,7 @@ requestLongerTimeout(5); -var {Toolbox} = require("devtools/client/framework/toolbox"); +var { Toolbox } = require("devtools/client/framework/toolbox"); function test() { const URL_1 = "data:text/plain;charset=UTF-8,abcde"; @@ -24,22 +24,24 @@ function test() { addTab(URL_1).then(async function() { let target = await TargetFactory.forTab(gBrowser.selectedTab); - gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM) + gDevTools + .showToolbox(target, null, Toolbox.HostType.BOTTOM) .then(function(aToolbox) { toolbox = aToolbox; }) .then(() => toolbox.selectTool(TOOL_ID_1)) - // undock toolbox and check title + // undock toolbox and check title .then(() => { // We have to first switch the host in order to spawn the new top level window // on which we are going to listen from title change event - return toolbox.switchHost(Toolbox.HostType.WINDOW) + return toolbox + .switchHost(Toolbox.HostType.WINDOW) .then(() => waitForTitleChange(toolbox)); }) .then(checkTitle.bind(null, NAME_1, URL_1, "toolbox undocked")) - // switch to different tool and check title + // switch to different tool and check title .then(async () => { const onTitleChanged = waitForTitleChange(toolbox); panel = await toolbox.selectTool(TOOL_ID_2); @@ -47,7 +49,7 @@ function test() { }) .then(checkTitle.bind(null, NAME_1, URL_1, "tool changed")) - // navigate to different local url and check title + // navigate to different local url and check title .then(async function() { const onTitleChanged = waitForTitleChange(toolbox); const waitForReloaded = panel.once("reloaded"); @@ -57,7 +59,7 @@ function test() { }) .then(checkTitle.bind(null, NAME_2, URL_2, "url changed")) - // navigate to a real url and check title + // navigate to a real url and check title .then(async () => { const onTitleChanged = waitForTitleChange(toolbox); const waitForReloaded = panel.once("reloaded"); @@ -67,17 +69,22 @@ function test() { }) .then(checkTitle.bind(null, NAME_3, URL_3, "url changed")) - // destroy toolbox, create new one hosted in a window (with a - // different tool id), and check title + // destroy toolbox, create new one hosted in a window (with a + // different tool id), and check title .then(function() { // Give the tools a chance to handle the navigation event before // destroying the toolbox. executeSoon(function() { - toolbox.destroy() + toolbox + .destroy() .then(async function() { // After destroying the toolbox, a fresh target is required. target = await TargetFactory.forTab(gBrowser.selectedTab); - return gDevTools.showToolbox(target, null, Toolbox.HostType.WINDOW); + return gDevTools.showToolbox( + target, + null, + Toolbox.HostType.WINDOW + ); }) .then(function(aToolbox) { toolbox = aToolbox; @@ -87,8 +94,14 @@ function test() { toolbox.selectTool(TOOL_ID_1); return onTitleChanged; }) - .then(checkTitle.bind(null, NAME_3, URL_3, - "toolbox destroyed and recreated")) + .then( + checkTitle.bind( + null, + NAME_3, + URL_3, + "toolbox destroyed and recreated" + ) + ) // clean up .then(() => toolbox.destroy()) diff --git a/devtools/client/framework/test/browser_toolbox_window_title_frame_select.js b/devtools/client/framework/test/browser_toolbox_window_title_frame_select.js index 1e83de322c12..92ce93cce9e1 100644 --- a/devtools/client/framework/test/browser_toolbox_window_title_frame_select.js +++ b/devtools/client/framework/test/browser_toolbox_window_title_frame_select.js @@ -11,27 +11,35 @@ * attribute set when the list of frames is opened. */ -var {Toolbox} = require("devtools/client/framework/toolbox"); +var { Toolbox } = require("devtools/client/framework/toolbox"); const URL = URL_ROOT + "browser_toolbox_window_title_frame_select_page.html"; const IFRAME_URL = URL_ROOT + "browser_toolbox_window_title_changes_page.html"; -const {LocalizationHelper} = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); add_task(async function() { Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true); await addTab(URL); const target = await TargetFactory.forTab(gBrowser.selectedTab); - let toolbox = await gDevTools.showToolbox(target, null, - Toolbox.HostType.BOTTOM); + let toolbox = await gDevTools.showToolbox( + target, + null, + Toolbox.HostType.BOTTOM + ); await toolbox.switchHost(Toolbox.HostType.WINDOW); // Wait for title change event *after* switch host, in order to listen // for the event on the WINDOW host window, which only exists after switchHost await waitForTitleChange(toolbox); - is(getTitle(), `Developer Tools - Page title - ${URL}`, - "Devtools title correct after switching to detached window host"); + is( + getTitle(), + `Developer Tools - Page title - ${URL}`, + "Devtools title correct after switching to detached window host" + ); // Wait for tick to avoid unexpected 'popuphidden' event, which // blocks the frame popup menu opened below. See also bug 1276873 @@ -43,26 +51,34 @@ add_task(async function() { // Open frame menu and wait till it's available on the screen. // Also check 'aria-expanded' attribute on the command button. - is(btn.getAttribute("aria-expanded"), "false", - "The aria-expanded attribute must be set to false"); + is( + btn.getAttribute("aria-expanded"), + "false", + "The aria-expanded attribute must be set to false" + ); btn.click(); const panel = toolbox.doc.getElementById("command-button-frames-panel"); ok(panel, "popup panel has created."); await waitUntil(() => panel.classList.contains("tooltip-visible")); - is(btn.getAttribute("aria-expanded"), "true", - "The aria-expanded attribute must be set to true"); + is( + btn.getAttribute("aria-expanded"), + "true", + "The aria-expanded attribute must be set to true" + ); // Verify that the frame list menu is populated const menuList = toolbox.doc.getElementById("toolbox-frame-menu"); const frames = Array.from(menuList.querySelectorAll(".command")); is(frames.length, 2, "We have both frames in the list"); - const topFrameBtn = - frames.filter(b => b.querySelector(".label").textContent == URL)[0]; - const iframeBtn = - frames.filter(b => b.querySelector(".label").textContent == IFRAME_URL)[0]; + const topFrameBtn = frames.filter( + b => b.querySelector(".label").textContent == URL + )[0]; + const iframeBtn = frames.filter( + b => b.querySelector(".label").textContent == IFRAME_URL + )[0]; ok(topFrameBtn, "Got top level document in the list"); ok(iframeBtn, "Got iframe document in the list"); @@ -82,8 +98,11 @@ add_task(async function() { await onTitleChanged; info("Navigation to the iframe is done, the inspector should be back up"); - is(getTitle(), `Developer Tools - Page title - ${URL}`, - "Devtools title was not updated after changing inspected frame"); + is( + getTitle(), + `Developer Tools - Page title - ${URL}`, + "Devtools title was not updated after changing inspected frame" + ); info("Cleanup toolbox and test preferences."); await toolbox.destroy(); @@ -112,13 +131,19 @@ async function testShortcutToOpenFrames(btn, toolbox) { ok(panel, "popup panel has created."); await waitUntil(() => panel.classList.contains("tooltip-visible")); - is(btn.getAttribute("aria-expanded"), "true", - "The aria-expanded attribute must be set to true"); + is( + btn.getAttribute("aria-expanded"), + "true", + "The aria-expanded attribute must be set to true" + ); // pressing Esc should hide the menu again EventUtils.sendKey("ESCAPE", toolbox.win); await waitUntil(() => !panel.classList.contains("tooltip-visible")); - is(btn.getAttribute("aria-expanded"), "false", - "The aria-expanded attribute must be set to false"); + is( + btn.getAttribute("aria-expanded"), + "false", + "The aria-expanded attribute must be set to false" + ); } diff --git a/devtools/client/framework/test/browser_toolbox_zoom.js b/devtools/client/framework/test/browser_toolbox_zoom.js index 630db6fb0e26..91d7ec24026b 100644 --- a/devtools/client/framework/test/browser_toolbox_zoom.js +++ b/devtools/client/framework/test/browser_toolbox_zoom.js @@ -3,9 +3,11 @@ "use strict"; -const {LocalizationHelper} = require("devtools/shared/l10n"); -const {Toolbox} = require("devtools/client/framework/toolbox"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const { Toolbox } = require("devtools/client/framework/toolbox"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); add_task(async function() { registerCleanupFunction(function() { @@ -16,9 +18,11 @@ add_task(async function() { Services.prefs.setCharPref("devtools.toolbox.zoomValue", "1.0"); await addTab("about:blank"); const target = await TargetFactory.forTab(gBrowser.selectedTab); - const toolbox = await gDevTools.showToolbox(target, - "styleeditor", - Toolbox.HostType.BOTTOM); + const toolbox = await gDevTools.showToolbox( + target, + "styleeditor", + Toolbox.HostType.BOTTOM + ); info("testing zoom keys"); @@ -36,10 +40,14 @@ function testZoomLevel(type, times, expected, toolbox) { const zoom = getCurrentZoom(toolbox); is(zoom.toFixed(1), expected, "zoom level correct after zoom " + type); - const savedZoom = parseFloat(Services.prefs.getCharPref( - "devtools.toolbox.zoomValue")); - is(savedZoom.toFixed(1), expected, - "saved zoom level is correct after zoom " + type); + const savedZoom = parseFloat( + Services.prefs.getCharPref("devtools.toolbox.zoomValue") + ); + is( + savedZoom.toFixed(1), + expected, + "saved zoom level is correct after zoom " + type + ); } function sendZoomKey(shortcut, times) { diff --git a/devtools/client/framework/test/browser_toolbox_zoom_popup.js b/devtools/client/framework/test/browser_toolbox_zoom_popup.js index 6e909ff11d35..e83c1f41cc0a 100644 --- a/devtools/client/framework/test/browser_toolbox_zoom_popup.js +++ b/devtools/client/framework/test/browser_toolbox_zoom_popup.js @@ -5,7 +5,7 @@ // Test the popup menu position when zooming in the devtools panel. -const {Toolbox} = require("devtools/client/framework/toolbox"); +const { Toolbox } = require("devtools/client/framework/toolbox"); // Use a simple URL in order to prevent displacing the left position of the // frames menu. @@ -21,9 +21,11 @@ add_task(async function() { info("Load iframe page for checking the frame menu with x1.4 zoom."); await addTab(TEST_URL); const target = await TargetFactory.forTab(gBrowser.selectedTab); - const toolbox = await gDevTools.showToolbox(target, - "inspector", - Toolbox.HostType.WINDOW); + const toolbox = await gDevTools.showToolbox( + target, + "inspector", + Toolbox.HostType.WINDOW + ); const inspector = toolbox.getCurrentPanel(); const hostWindow = toolbox.win.parent; const originWidth = hostWindow.outerWidth; @@ -35,7 +37,9 @@ add_task(async function() { return parseFloat(windowUtils.fullZoom.toFixed(1)) === zoom; }); - info("Resizing and moving the toolbox window in order to display the chevron menu."); + info( + "Resizing and moving the toolbox window in order to display the chevron menu." + ); // If the window is displayed bottom of screen, the menu might be displayed // above the button so move it to the top of the screen first. hostWindow.moveTo(0, 0); @@ -45,23 +49,30 @@ add_task(async function() { const prevTabs = toolbox.doc.querySelectorAll(".devtools-tab").length; hostWindow.resizeTo(400, hostWindow.outerHeight); await waitUntil(() => { - return hostWindow.screen.top === 0 && + return ( + hostWindow.screen.top === 0 && hostWindow.screen.left === 0 && hostWindow.outerWidth === 400 && toolbox.doc.getElementById("tools-chevron-menu-button") && inspector.panelDoc.querySelector(".all-tabs-menu") && - prevTabs != toolbox.doc.querySelectorAll(".devtools-tab").length; + prevTabs != toolbox.doc.querySelectorAll(".devtools-tab").length + ); }); - const menuList = - [toolbox.win.document.getElementById("toolbox-meatball-menu-button"), - toolbox.win.document.getElementById("command-button-frames"), - toolbox.win.document.getElementById("tools-chevron-menu-button"), - inspector.panelDoc.querySelector(".all-tabs-menu")]; + const menuList = [ + toolbox.win.document.getElementById("toolbox-meatball-menu-button"), + toolbox.win.document.getElementById("command-button-frames"), + toolbox.win.document.getElementById("tools-chevron-menu-button"), + inspector.panelDoc.querySelector(".all-tabs-menu"), + ]; for (const menu of menuList) { - const { buttonBounds, menuType, menuBounds, arrowBounds } = - await getButtonAndMenuInfo(toolbox, menu); + const { + buttonBounds, + menuType, + menuBounds, + arrowBounds, + } = await getButtonAndMenuInfo(toolbox, menu); switch (menuType) { case "native": @@ -84,8 +95,11 @@ add_task(async function() { const buttonCenter = buttonBounds.left + buttonBounds.width / 2; const arrowCenter = arrowBounds.left + arrowBounds.width / 2; const delta = Math.abs(arrowCenter - buttonCenter); - ok(delta < 1, "Center of arrow is within 1px of button center" + - ` (delta: ${delta})`); + ok( + delta < 1, + "Center of arrow is within 1px of button center" + + ` (delta: ${delta})` + ); } break; } @@ -125,7 +139,8 @@ async function getButtonAndMenuInfo(toolbox, menuButton) { screenX: 1, }, menuButton, - doc.defaultView); + doc.defaultView + ); let menuPopup; let menuType; @@ -138,7 +153,7 @@ async function getButtonAndMenuInfo(toolbox, menuButton) { menuType = "native"; const popupset = topDoc.querySelector("popupset"); await waitUntil(() => { - menuPopup = popupset.querySelector("menupopup[menu-api=\"true\"]"); + menuPopup = popupset.querySelector('menupopup[menu-api="true"]'); return !!menuPopup && menuPopup.state === "open"; }); } diff --git a/devtools/client/framework/test/browser_two_tabs.js b/devtools/client/framework/test/browser_two_tabs.js index 52ab56e69502..24663152ecdb 100644 --- a/devtools/client/framework/test/browser_two_tabs.js +++ b/devtools/client/framework/test/browser_two_tabs.js @@ -40,9 +40,8 @@ add_task(async () => { }); async function checkGetTab(client, tab1, tab2, targetFront1, targetFront2) { - let front = await client.mainRoot.getTab({tab: tab1}); - is(targetFront1, front, - "getTab returns the same target form for first tab"); + let front = await client.mainRoot.getTab({ tab: tab1 }); + is(targetFront1, front, "getTab returns the same target form for first tab"); const filter = {}; // Filter either by tabId or outerWindowID, // if we are running tests OOP or not. @@ -53,11 +52,13 @@ async function checkGetTab(client, tab1, tab2, targetFront1, targetFront2) { filter.outerWindowID = windowUtils.outerWindowID; } front = await client.mainRoot.getTab(filter); - is(targetFront1, front, - "getTab returns the same target form when filtering by tabId/outerWindowID"); - front = await client.mainRoot.getTab({tab: tab2}); - is(targetFront2, front, - "getTab returns the same target form for second tab"); + is( + targetFront1, + front, + "getTab returns the same target form when filtering by tabId/outerWindowID" + ); + front = await client.mainRoot.getTab({ tab: tab2 }); + is(targetFront2, front, "getTab returns the same target form for second tab"); } async function checkGetTabFailures(client) { @@ -72,7 +73,10 @@ async function checkGetTabFailures(client) { await client.mainRoot.getTab({ outerWindowID: -999 }); ok(false, "getTab unexpectedly succeed with a wrong outerWindowID"); } catch (error) { - is(error, "Protocol error (noTab): Unable to find tab with outerWindowID '-999'"); + is( + error, + "Protocol error (noTab): Unable to find tab with outerWindowID '-999'" + ); } } @@ -80,12 +84,18 @@ async function checkSelectedTargetActor(targetFront2) { // Send a naive request to the second target actor to check if it works await targetFront2.attach(); const response = await targetFront2.activeConsole.startListeners([]); - ok("startedListeners" in response, "Actor from the selected tab should respond to the request."); + ok( + "startedListeners" in response, + "Actor from the selected tab should respond to the request." + ); } async function checkFirstTargetActor(targetFront1) { // then send a request to the first target actor to check if it still works await targetFront1.attach(); const response = await targetFront1.activeConsole.startListeners([]); - ok("startedListeners" in response, "Actor from the first tab should still respond."); + ok( + "startedListeners" in response, + "Actor from the first tab should still respond." + ); } diff --git a/devtools/client/framework/test/head.js b/devtools/client/framework/test/head.js index 40621c436e76..a615d21e5001 100644 --- a/devtools/client/framework/test/head.js +++ b/devtools/client/framework/test/head.js @@ -7,7 +7,10 @@ /* import-globals-from ../../shared/test/telemetry-test-helpers.js */ // shared-head.js handles imports, constants, and utility functions -Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", this); +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", + this +); const EventEmitter = require("devtools/shared/event-emitter"); @@ -33,7 +36,8 @@ function getParentProcessActors(callback) { DebuggerServer.allowChromeProcess = true; const client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect() + client + .connect() .then(() => client.mainRoot.getMainProcess()) .then(front => { callback(client, front); @@ -102,7 +106,12 @@ function waitForContentMessage(name) { * @return {Promise} Resolves to the response data if a response is expected, * immediately resolves otherwise */ -function executeInContent(name, data = {}, objects = {}, expectResponse = true) { +function executeInContent( + name, + data = {}, + objects = {}, + expectResponse = true +) { info("Sending message " + name + " to content"); const mm = gBrowser.selectedBrowser.messageManager; @@ -121,7 +130,9 @@ function executeInContent(name, data = {}, objects = {}, expectResponse = true) function synthesizeKeyElement(el) { const key = el.getAttribute("key") || el.getAttribute("keycode"); const mod = {}; - el.getAttribute("modifiers").split(" ").forEach((m) => mod[m + "Key"] = true); + el.getAttribute("modifiers") + .split(" ") + .forEach(m => (mod[m + "Key"] = true)); info(`Synthesizing: key=${key}, mod=${JSON.stringify(mod)}`); EventUtils.synthesizeKey(key, mod, el.ownerDocument.defaultView); } @@ -141,8 +152,11 @@ function checkHostType(toolbox, hostType, previousHostType) { is(pref, hostType, "host pref is " + hostType); if (previousHostType) { - is(Services.prefs.getCharPref("devtools.toolbox.previousHost"), - previousHostType, "The previous host is correct"); + is( + Services.prefs.getCharPref("devtools.toolbox.previousHost"), + previousHostType, + "The previous host is correct" + ); } } @@ -191,13 +205,13 @@ function waitForSourceLoad(toolbox, url) { } /** -* When a Toolbox is started it creates a DevToolPanel for each of the tools -* by calling toolDefinition.build(). The returned object should -* at least implement these functions. They will be used by the ToolBox. -* -* There may be no benefit in doing this as an abstract type, but if nothing -* else gives us a place to write documentation. -*/ + * When a Toolbox is started it creates a DevToolPanel for each of the tools + * by calling toolDefinition.build(). The returned object should + * at least implement these functions. They will be used by the ToolBox. + * + * There may be no benefit in doing this as an abstract type, but if nothing + * else gives us a place to write documentation. + */ function DevToolPanel(iframeWindow, toolbox) { EventEmitter.decorate(this); @@ -251,7 +265,9 @@ async function openChevronMenu(toolbox) { const chevronMenuButton = toolbox.doc.querySelector(".tools-chevron-menu"); EventUtils.synthesizeMouseAtCenter(chevronMenuButton, {}, toolbox.win); - const menuPopup = toolbox.doc.getElementById("tools-chevron-menu-button-panel"); + const menuPopup = toolbox.doc.getElementById( + "tools-chevron-menu-button-panel" + ); ok(menuPopup, "tools-chevron-menupopup is available"); info("Waiting for the menu popup to be displayed"); @@ -265,54 +281,83 @@ async function closeChevronMenu(toolbox) { chevronMenuButton.focus(); EventUtils.sendKey("ESCAPE", toolbox.doc.defaultView); - const menuPopup = toolbox.doc.getElementById("tools-chevron-menu-button-panel"); + const menuPopup = toolbox.doc.getElementById( + "tools-chevron-menu-button-panel" + ); info("Closing the chevron popup menu"); await waitUntil(() => !menuPopup.classList.contains("tooltip-visible")); } function prepareToolTabReorderTest(toolbox, startingOrder) { - Services.prefs.setCharPref("devtools.toolbox.tabsOrder", startingOrder.join(",")); - ok(!toolbox.doc.getElementById("tools-chevron-menu-button"), - "The size of the screen being too small"); + Services.prefs.setCharPref( + "devtools.toolbox.tabsOrder", + startingOrder.join(",") + ); + ok( + !toolbox.doc.getElementById("tools-chevron-menu-button"), + "The size of the screen being too small" + ); for (const id of startingOrder) { - ok(getElementByToolId(toolbox, id), `Tab element should exist for ${ id }`); + ok(getElementByToolId(toolbox, id), `Tab element should exist for ${id}`); } } async function dndToolTab(toolbox, dragTarget, dropTarget, passedTargets = []) { - info(`Drag ${ dragTarget } to ${ dropTarget }`); - const dragTargetEl = getElementByToolIdOrExtensionIdOrSelector(toolbox, dragTarget); + info(`Drag ${dragTarget} to ${dropTarget}`); + const dragTargetEl = getElementByToolIdOrExtensionIdOrSelector( + toolbox, + dragTarget + ); const onReady = dragTargetEl.classList.contains("selected") - ? Promise.resolve() : toolbox.once("select"); - EventUtils.synthesizeMouseAtCenter(dragTargetEl, - { type: "mousedown" }, - dragTargetEl.ownerGlobal); + ? Promise.resolve() + : toolbox.once("select"); + EventUtils.synthesizeMouseAtCenter( + dragTargetEl, + { type: "mousedown" }, + dragTargetEl.ownerGlobal + ); await onReady; for (const passedTarget of passedTargets) { - info(`Via ${ passedTarget }`); - const passedTargetEl = - getElementByToolIdOrExtensionIdOrSelector(toolbox, passedTarget); - EventUtils.synthesizeMouseAtCenter(passedTargetEl, - { type: "mousemove" }, - passedTargetEl.ownerGlobal); + info(`Via ${passedTarget}`); + const passedTargetEl = getElementByToolIdOrExtensionIdOrSelector( + toolbox, + passedTarget + ); + EventUtils.synthesizeMouseAtCenter( + passedTargetEl, + { type: "mousemove" }, + passedTargetEl.ownerGlobal + ); } if (dropTarget) { - const dropTargetEl = getElementByToolIdOrExtensionIdOrSelector(toolbox, dropTarget); - EventUtils.synthesizeMouseAtCenter(dropTargetEl, - { type: "mousemove" }, - dropTargetEl.ownerGlobal); - EventUtils.synthesizeMouseAtCenter(dropTargetEl, - { type: "mouseup" }, - dropTargetEl.ownerGlobal); + const dropTargetEl = getElementByToolIdOrExtensionIdOrSelector( + toolbox, + dropTarget + ); + EventUtils.synthesizeMouseAtCenter( + dropTargetEl, + { type: "mousemove" }, + dropTargetEl.ownerGlobal + ); + EventUtils.synthesizeMouseAtCenter( + dropTargetEl, + { type: "mouseup" }, + dropTargetEl.ownerGlobal + ); } else { const containerEl = toolbox.doc.getElementById("toolbox-container"); - EventUtils.synthesizeMouse(containerEl, 0, 0, - { type: "mouseout" }, containerEl.ownerGlobal); + EventUtils.synthesizeMouse( + containerEl, + 0, + 0, + { type: "mouseout" }, + containerEl.ownerGlobal + ); } // Wait for updating the preference. @@ -332,28 +377,37 @@ function assertToolTabOrder(toolbox, expectedOrder) { const tabEls = toolbox.doc.querySelectorAll(".devtools-tab"); for (let i = 0; i < expectedOrder.length; i++) { - const isOrdered = tabEls[i].dataset.id === expectedOrder[i] || - tabEls[i].dataset.extensionId === expectedOrder[i]; - ok(isOrdered, `The tab[${ expectedOrder[i] }] should exist at [${ i }]`); + const isOrdered = + tabEls[i].dataset.id === expectedOrder[i] || + tabEls[i].dataset.extensionId === expectedOrder[i]; + ok(isOrdered, `The tab[${expectedOrder[i]}] should exist at [${i}]`); } } function assertToolTabSelected(toolbox, dragTarget) { info("Check whether the drag target was selected"); - const dragTargetEl = getElementByToolIdOrExtensionIdOrSelector(toolbox, dragTarget); - ok(dragTargetEl.classList.contains("selected"), "The dragged tool should be selected"); + const dragTargetEl = getElementByToolIdOrExtensionIdOrSelector( + toolbox, + dragTarget + ); + ok( + dragTargetEl.classList.contains("selected"), + "The dragged tool should be selected" + ); } function assertToolTabPreferenceOrder(expectedOrder) { info("Check the order in DevTools preference for tabs order"); - is(Services.prefs.getCharPref("devtools.toolbox.tabsOrder"), expectedOrder.join(","), - "The preference should be correct"); + is( + Services.prefs.getCharPref("devtools.toolbox.tabsOrder"), + expectedOrder.join(","), + "The preference should be correct" + ); } function getElementByToolId(toolbox, id) { for (const tabEl of toolbox.doc.querySelectorAll(".devtools-tab")) { - if (tabEl.dataset.id === id || - tabEl.dataset.extensionId === id) { + if (tabEl.dataset.id === id || tabEl.dataset.extensionId === id) { return tabEl; } } @@ -413,17 +467,19 @@ async function openAboutToolbox(params) { * Returns a promise that will resolve when the preferences are set. */ function setupPreferencesForBrowserToolbox() { - const options = {"set": [ - ["devtools.debugger.prompt-connection", false], - ["devtools.debugger.remote-enabled", true], - ["devtools.chrome.enabled", true], - // Test-only pref to allow passing `testScript` argument to the browser - // toolbox - ["devtools.browser-toolbox.allow-unsafe-script", true], - // On debug test runner, it takes more than the default time (20s) - // to get a initialized console - ["devtools.debugger.remote-timeout", 120000], - ]}; + const options = { + set: [ + ["devtools.debugger.prompt-connection", false], + ["devtools.debugger.remote-enabled", true], + ["devtools.chrome.enabled", true], + // Test-only pref to allow passing `testScript` argument to the browser + // toolbox + ["devtools.browser-toolbox.allow-unsafe-script", true], + // On debug test runner, it takes more than the default time (20s) + // to get a initialized console + ["devtools.debugger.remote-timeout", 120000], + ], + }; return SpecialPowers.pushPrefEnv(options); } diff --git a/devtools/client/framework/test/helper_disable_cache.js b/devtools/client/framework/test/helper_disable_cache.js index c70f1f49aff1..7c2f1cbfe167 100644 --- a/devtools/client/framework/test/helper_disable_cache.js +++ b/devtools/client/framework/test/helper_disable_cache.js @@ -33,7 +33,8 @@ var tabs = [ title: "Tab 3", desc: "No toolbox", startToolbox: false, - }]; + }, +]; async function initTab(tabX, startToolbox) { tabX.tab = await addTab(TEST_URI); @@ -56,19 +57,27 @@ async function checkCacheEnabled(tabX, expected) { await reloadTab(tabX); - const oldGuid = await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() { - const doc = content.document; - const h1 = doc.querySelector("h1"); - return h1.textContent; - }); + const oldGuid = await ContentTask.spawn( + gBrowser.selectedBrowser, + {}, + function() { + const doc = content.document; + const h1 = doc.querySelector("h1"); + return h1.textContent; + } + ); await reloadTab(tabX); - const guid = await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() { - const doc = content.document; - const h1 = doc.querySelector("h1"); - return h1.textContent; - }); + const guid = await ContentTask.spawn( + gBrowser.selectedBrowser, + {}, + function() { + const doc = content.document; + const h1 = doc.querySelector("h1"); + return h1.textContent; + } + ); if (expected) { is(guid, oldGuid, tabX.title + " cache is enabled"); @@ -97,9 +106,11 @@ async function setDisableCacheCheckboxChecked(tabX, state) { function reloadTab(tabX) { const browser = gBrowser.selectedBrowser; - const reloadTabPromise = BrowserTestUtils.browserLoaded(browser).then(function() { - info("Reloaded tab " + tabX.title); - }); + const reloadTabPromise = BrowserTestUtils.browserLoaded(browser).then( + function() { + info("Reloaded tab " + tabX.title); + } + ); info("Reloading tab " + tabX.title); const mm = loadFrameScriptUtils(); diff --git a/devtools/client/framework/test/jest/components/debug-target-info.test.js b/devtools/client/framework/test/jest/components/debug-target-info.test.js index 6a67c39451cf..7f212cf6f06c 100644 --- a/devtools/client/framework/test/jest/components/debug-target-info.test.js +++ b/devtools/client/framework/test/jest/components/debug-target-info.test.js @@ -9,9 +9,13 @@ const renderer = require("react-test-renderer"); const React = require("devtools/client/shared/vendor/react"); -const DebugTargetInfo = React.createFactory(require("devtools/client/framework/components/DebugTargetInfo")); -const { CONNECTION_TYPES, DEBUG_TARGET_TYPES } = - require("devtools/client/shared/remote-debugging/constants"); +const DebugTargetInfo = React.createFactory( + require("devtools/client/framework/components/DebugTargetInfo") +); +const { + CONNECTION_TYPES, + DEBUG_TARGET_TYPES, +} = require("devtools/client/shared/remote-debugging/constants"); /** * Stub for the L10N property expected by the DebugTargetInfo component. @@ -89,7 +93,9 @@ describe("DebugTargetInfo component", () => { describe("Connection info", () => { it("displays connection info for USB Release target", () => { const component = renderer.create(DebugTargetInfo(USB_TARGET_INFO)); - expect(findByClassName(component.root, "qa-connection-info").length).toEqual(1); + expect( + findByClassName(component.root, "qa-connection-info").length + ).toEqual(1); }); it("renders the expected snapshot for USB Release target", () => { @@ -98,29 +104,45 @@ describe("DebugTargetInfo component", () => { }); it("hides the connection info for This Firefox target", () => { - const component = renderer.create(DebugTargetInfo(THIS_FIREFOX_TARGET_INFO)); - expect(findByClassName(component.root, "qa-connection-info").length).toEqual(0); + const component = renderer.create( + DebugTargetInfo(THIS_FIREFOX_TARGET_INFO) + ); + expect( + findByClassName(component.root, "qa-connection-info").length + ).toEqual(0); }); }); describe("Target title", () => { it("displays the target title if the target of the Toolbox has a name", () => { - const component = renderer.create(DebugTargetInfo(THIS_FIREFOX_TARGET_INFO)); - expect(findByClassName(component.root, "qa-target-title").length).toEqual(1); + const component = renderer.create( + DebugTargetInfo(THIS_FIREFOX_TARGET_INFO) + ); + expect(findByClassName(component.root, "qa-target-title").length).toEqual( + 1 + ); }); it("renders the expected snapshot for This Firefox target", () => { - const component = renderer.create(DebugTargetInfo(THIS_FIREFOX_TARGET_INFO)); + const component = renderer.create( + DebugTargetInfo(THIS_FIREFOX_TARGET_INFO) + ); expect(component.toJSON()).toMatchSnapshot(); }); it("doesn't display the target title if the target of the Toolbox has no name", () => { - const component = renderer.create(DebugTargetInfo(THIS_FIREFOX_NO_NAME_TARGET_INFO)); - expect(findByClassName(component.root, "qa-target-title").length).toEqual(0); + const component = renderer.create( + DebugTargetInfo(THIS_FIREFOX_NO_NAME_TARGET_INFO) + ); + expect(findByClassName(component.root, "qa-target-title").length).toEqual( + 0 + ); }); it("renders the expected snapshot for a Toolbox with an unnamed target", () => { - const component = renderer.create(DebugTargetInfo(THIS_FIREFOX_NO_NAME_TARGET_INFO)); + const component = renderer.create( + DebugTargetInfo(THIS_FIREFOX_NO_NAME_TARGET_INFO) + ); expect(component.toJSON()).toMatchSnapshot(); }); }); @@ -133,25 +155,33 @@ describe("DebugTargetInfo component", () => { }; it("renders the expected snapshot for a tab target", () => { - const props = buildProps(USB_TARGET_INFO, { targetType: DEBUG_TARGET_TYPES.TAB }); + const props = buildProps(USB_TARGET_INFO, { + targetType: DEBUG_TARGET_TYPES.TAB, + }); const component = renderer.create(DebugTargetInfo(props)); expect(component.toJSON()).toMatchSnapshot(); }); it("renders the expected snapshot for a worker target", () => { - const props = buildProps(USB_TARGET_INFO, { targetType: DEBUG_TARGET_TYPES.WORKER }); + const props = buildProps(USB_TARGET_INFO, { + targetType: DEBUG_TARGET_TYPES.WORKER, + }); const component = renderer.create(DebugTargetInfo(props)); expect(component.toJSON()).toMatchSnapshot(); }); it("renders the expected snapshot for an extension target", () => { - const props = buildProps(USB_TARGET_INFO, { targetType: DEBUG_TARGET_TYPES.EXTENSION }); + const props = buildProps(USB_TARGET_INFO, { + targetType: DEBUG_TARGET_TYPES.EXTENSION, + }); const component = renderer.create(DebugTargetInfo(props)); expect(component.toJSON()).toMatchSnapshot(); }); it("renders the expected snapshot for a process target", () => { - const props = buildProps(USB_TARGET_INFO, { targetType: DEBUG_TARGET_TYPES.PROCESS }); + const props = buildProps(USB_TARGET_INFO, { + targetType: DEBUG_TARGET_TYPES.PROCESS, + }); const component = renderer.create(DebugTargetInfo(props)); expect(component.toJSON()).toMatchSnapshot(); }); diff --git a/devtools/client/framework/test/metrics/browser_metrics_debugger.js b/devtools/client/framework/test/metrics/browser_metrics_debugger.js index 7a4d421f6c17..1f2c41758a21 100644 --- a/devtools/client/framework/test/metrics/browser_metrics_debugger.js +++ b/devtools/client/framework/test/metrics/browser_metrics_debugger.js @@ -11,7 +11,8 @@ * retrieved by perfherder via logs. */ -const TEST_URL = "data:text/html;charset=UTF-8,
Debugger modules load test
"; +const TEST_URL = + "data:text/html;charset=UTF-8,
Debugger modules load test
"; add_task(async function() { const toolbox = await openNewTabAndToolbox(TEST_URL, "jsdebugger"); diff --git a/devtools/client/framework/test/metrics/browser_metrics_inspector.js b/devtools/client/framework/test/metrics/browser_metrics_inspector.js index 8fa022b3d844..ad79c9f49030 100644 --- a/devtools/client/framework/test/metrics/browser_metrics_inspector.js +++ b/devtools/client/framework/test/metrics/browser_metrics_inspector.js @@ -11,7 +11,8 @@ * by perfherder via logs. */ -const TEST_URL = "data:text/html;charset=UTF-8,
Inspector modules load test
"; +const TEST_URL = + "data:text/html;charset=UTF-8,
Inspector modules load test
"; add_task(async function() { await openNewTabAndToolbox(TEST_URL, "inspector"); diff --git a/devtools/client/framework/test/metrics/browser_metrics_netmonitor.js b/devtools/client/framework/test/metrics/browser_metrics_netmonitor.js index b363e051649f..47774f37333f 100644 --- a/devtools/client/framework/test/metrics/browser_metrics_netmonitor.js +++ b/devtools/client/framework/test/metrics/browser_metrics_netmonitor.js @@ -11,7 +11,8 @@ * retrieved by perfherder via logs. */ -const TEST_URL = "data:text/html;charset=UTF-8,
Netmonitor modules load test
"; +const TEST_URL = + "data:text/html;charset=UTF-8,
Netmonitor modules load test
"; add_task(async function() { const toolbox = await openNewTabAndToolbox(TEST_URL, "netmonitor"); diff --git a/devtools/client/framework/test/metrics/browser_metrics_webconsole.js b/devtools/client/framework/test/metrics/browser_metrics_webconsole.js index 05d066ba981b..afdb489c5d8b 100644 --- a/devtools/client/framework/test/metrics/browser_metrics_webconsole.js +++ b/devtools/client/framework/test/metrics/browser_metrics_webconsole.js @@ -11,7 +11,8 @@ * retrieved by perfherder via logs. */ -const TEST_URL = "data:text/html;charset=UTF-8,
Webconsole modules load test
"; +const TEST_URL = + "data:text/html;charset=UTF-8,
Webconsole modules load test
"; add_task(async function() { const toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole"); diff --git a/devtools/client/framework/test/metrics/head.js b/devtools/client/framework/test/metrics/head.js index c0f4412f9a44..b0f8646750bd 100644 --- a/devtools/client/framework/test/metrics/head.js +++ b/devtools/client/framework/test/metrics/head.js @@ -5,7 +5,10 @@ /* import-globals-from ../../../shared/test/telemetry-test-helpers.js */ // shared-head.js handles imports, constants, and utility functions -Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", this); +Services.scriptloader.loadSubScript( + "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", + this +); // So that PERFHERDER data can be extracted from the logs. SimpleTest.requestCompleteLog(); @@ -53,34 +56,40 @@ function runMetricsTest({ filterString, loaders, panelName }) { framework: { name: "devtools", }, - suites: [{ - name: panelName + "-metrics", - value: allModulesChars, - subtests: [ - { - name: panelName + "-modules", - value: panelModulesCount, - }, - { - name: panelName + "-chars", - value: panelModulesChars, - }, - { - name: "all-modules", - value: allModulesCount, - }, - { - name: "all-chars", - value: allModulesChars, - }, - ], - }], + suites: [ + { + name: panelName + "-metrics", + value: allModulesChars, + subtests: [ + { + name: panelName + "-modules", + value: panelModulesCount, + }, + { + name: panelName + "-chars", + value: panelModulesChars, + }, + { + name: "all-modules", + value: allModulesCount, + }, + { + name: "all-chars", + value: allModulesChars, + }, + ], + }, + ], }; info("PERFHERDER_DATA: " + JSON.stringify(PERFHERDER_DATA)); // Simply check that we found valid values. - ok(allModulesCount > panelModulesCount && - panelModulesCount > 0, "Successfully recorded module count for " + panelName); - ok(allModulesChars > panelModulesChars && - panelModulesChars > 0, "Successfully recorded char count for " + panelName); + ok( + allModulesCount > panelModulesCount && panelModulesCount > 0, + "Successfully recorded module count for " + panelName + ); + ok( + allModulesChars > panelModulesChars && panelModulesChars > 0, + "Successfully recorded char count for " + panelName + ); } diff --git a/devtools/client/framework/test/unit/test_tabs_absolute_order.js b/devtools/client/framework/test/unit/test_tabs_absolute_order.js index b3bb8f4dc57f..9f2220ed810d 100644 --- a/devtools/client/framework/test/unit/test_tabs_absolute_order.js +++ b/devtools/client/framework/test/unit/test_tabs_absolute_order.js @@ -28,14 +28,16 @@ const TEST_DATA = [ expectedOrder: ["T1", "T3", "E1", "T4", "T2", "T5"], }, { - description: "Test for drag a tab to left end in case hidden tab was left end", + description: + "Test for drag a tab to left end in case hidden tab was left end", preferenceOrder: ["E1", "T1", "T2", "T3", "T4", "T5"], currentTabsOrder: ["T4", "T1", "T2", "T3", "T5"], dragTarget: "T4", expectedOrder: ["E1", "T4", "T1", "T2", "T3", "T5"], }, { - description: "Test for drag a tab to right end in case hidden tab was right end", + description: + "Test for drag a tab to right end in case hidden tab was right end", preferenceOrder: ["T1", "T2", "T3", "T4", "T5", "E1"], currentTabsOrder: ["T2", "T3", "T4", "T5", "T1"], dragTarget: "T1", @@ -51,13 +53,27 @@ const TEST_DATA = [ ]; function run_test() { - const { toAbsoluteOrder } = - require("devtools/client/framework/toolbox-tabs-order-manager"); + const { + toAbsoluteOrder, + } = require("devtools/client/framework/toolbox-tabs-order-manager"); - for (const { description, preferenceOrder, - currentTabsOrder, dragTarget, expectedOrder} of TEST_DATA) { + for (const { + description, + preferenceOrder, + currentTabsOrder, + dragTarget, + expectedOrder, + } of TEST_DATA) { info(description); - const resultOrder = toAbsoluteOrder(preferenceOrder, currentTabsOrder, dragTarget); - equal(resultOrder.join(","), expectedOrder.join(","), "Result should be correct"); + const resultOrder = toAbsoluteOrder( + preferenceOrder, + currentTabsOrder, + dragTarget + ); + equal( + resultOrder.join(","), + expectedOrder.join(","), + "Result should be correct" + ); } } diff --git a/devtools/client/framework/toolbox-context-menu.js b/devtools/client/framework/toolbox-context-menu.js index d5e9d66ccfdd..e1c3cc77db8e 100644 --- a/devtools/client/framework/toolbox-context-menu.js +++ b/devtools/client/framework/toolbox-context-menu.js @@ -44,61 +44,77 @@ function createEditContextMenu(win, id) { loadEditMenuStrings(win); const docshell = win.docShell; - const menu = new Menu({id}); - menu.append(new MenuItem({ - id: "editmenu-undo", - l10nID: "editmenu-undo", - disabled: !docshell.isCommandEnabled("cmd_undo"), - click: () => { - docshell.doCommand("cmd_undo"); - }, - })); - menu.append(new MenuItem({ - type: "separator", - })); - menu.append(new MenuItem({ - id: "editmenu-cut", - l10nID: "editmenu-cut", - disabled: !docshell.isCommandEnabled("cmd_cut"), - click: () => { - docshell.doCommand("cmd_cut"); - }, - })); - menu.append(new MenuItem({ - id: "editmenu-copy", - l10nID: "editmenu-copy", - disabled: !docshell.isCommandEnabled("cmd_copy"), - click: () => { - docshell.doCommand("cmd_copy"); - }, - })); - menu.append(new MenuItem({ - id: "editmenu-paste", - l10nID: "editmenu-paste", - disabled: !docshell.isCommandEnabled("cmd_paste"), - click: () => { - docshell.doCommand("cmd_paste"); - }, - })); - menu.append(new MenuItem({ - id: "editmenu-delete", - l10nID: "editmenu-delete", - disabled: !docshell.isCommandEnabled("cmd_delete"), - click: () => { - docshell.doCommand("cmd_delete"); - }, - })); - menu.append(new MenuItem({ - type: "separator", - })); - menu.append(new MenuItem({ - id: "editmenu-selectAll", - l10nID: "editmenu-select-all", - disabled: !docshell.isCommandEnabled("cmd_selectAll"), - click: () => { - docshell.doCommand("cmd_selectAll"); - }, - })); + const menu = new Menu({ id }); + menu.append( + new MenuItem({ + id: "editmenu-undo", + l10nID: "editmenu-undo", + disabled: !docshell.isCommandEnabled("cmd_undo"), + click: () => { + docshell.doCommand("cmd_undo"); + }, + }) + ); + menu.append( + new MenuItem({ + type: "separator", + }) + ); + menu.append( + new MenuItem({ + id: "editmenu-cut", + l10nID: "editmenu-cut", + disabled: !docshell.isCommandEnabled("cmd_cut"), + click: () => { + docshell.doCommand("cmd_cut"); + }, + }) + ); + menu.append( + new MenuItem({ + id: "editmenu-copy", + l10nID: "editmenu-copy", + disabled: !docshell.isCommandEnabled("cmd_copy"), + click: () => { + docshell.doCommand("cmd_copy"); + }, + }) + ); + menu.append( + new MenuItem({ + id: "editmenu-paste", + l10nID: "editmenu-paste", + disabled: !docshell.isCommandEnabled("cmd_paste"), + click: () => { + docshell.doCommand("cmd_paste"); + }, + }) + ); + menu.append( + new MenuItem({ + id: "editmenu-delete", + l10nID: "editmenu-delete", + disabled: !docshell.isCommandEnabled("cmd_delete"), + click: () => { + docshell.doCommand("cmd_delete"); + }, + }) + ); + menu.append( + new MenuItem({ + type: "separator", + }) + ); + menu.append( + new MenuItem({ + id: "editmenu-selectAll", + l10nID: "editmenu-select-all", + disabled: !docshell.isCommandEnabled("cmd_selectAll"), + click: () => { + docshell.doCommand("cmd_selectAll"); + }, + }) + ); return menu; } diff --git a/devtools/client/framework/toolbox-host-manager.js b/devtools/client/framework/toolbox-host-manager.js index af5f1c3900be..1de7bf68640a 100644 --- a/devtools/client/framework/toolbox-host-manager.js +++ b/devtools/client/framework/toolbox-host-manager.js @@ -5,8 +5,10 @@ "use strict"; const Services = require("Services"); -const {LocalizationHelper} = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const Telemetry = require("devtools/client/shared/telemetry"); @@ -15,8 +17,18 @@ const WIDTH_CHEVRON_AND_MEATBALL = 50; const WIDTH_CHEVRON_AND_MEATBALL_AND_CLOSE = 74; const ZOOM_VALUE_PREF = "devtools.toolbox.zoomValue"; -loader.lazyRequireGetter(this, "Toolbox", "devtools/client/framework/toolbox", true); -loader.lazyRequireGetter(this, "Hosts", "devtools/client/framework/toolbox-hosts", true); +loader.lazyRequireGetter( + this, + "Toolbox", + "devtools/client/framework/toolbox", + true +); +loader.lazyRequireGetter( + this, + "Hosts", + "devtools/client/framework/toolbox-hosts", + true +); /** * Implement a wrapper on the chrome side to setup a Toolbox within Firefox UI. @@ -72,10 +84,18 @@ ToolboxHostManager.prototype = { // We have to listen on capture as no event fires on bubble this.host.frame.addEventListener("unload", this, true); - const msSinceProcessStart = parseInt(this.telemetry.msSinceProcessStart(), 10); - const toolbox = new Toolbox(this.target, toolId, this.host.type, - this.host.frame.contentWindow, this.frameId, - msSinceProcessStart); + const msSinceProcessStart = parseInt( + this.telemetry.msSinceProcessStart(), + 10 + ); + const toolbox = new Toolbox( + this.target, + toolId, + this.host.type, + this.host.frame.contentWindow, + this.frameId, + msSinceProcessStart + ); // Prevent reloading the toolbox when loading the tools in a tab // (e.g. from about:debugging) @@ -93,19 +113,23 @@ ToolboxHostManager.prototype = { }, setMinWidthWithZoom: function() { - const zoomValue = - parseFloat(Services.prefs.getCharPref(ZOOM_VALUE_PREF)); + const zoomValue = parseFloat(Services.prefs.getCharPref(ZOOM_VALUE_PREF)); if (isNaN(zoomValue)) { return; } - if (this.hostType === Toolbox.HostType.LEFT || - this.hostType === Toolbox.HostType.RIGHT) { - this.host.frame.minWidth = WIDTH_CHEVRON_AND_MEATBALL_AND_CLOSE * zoomValue; - } else if (this.hostType === Toolbox.HostType.WINDOW || - this.hostType === Toolbox.HostType.PAGE || - this.hostType === Toolbox.HostType.CUSTOM) { + if ( + this.hostType === Toolbox.HostType.LEFT || + this.hostType === Toolbox.HostType.RIGHT + ) { + this.host.frame.minWidth = + WIDTH_CHEVRON_AND_MEATBALL_AND_CLOSE * zoomValue; + } else if ( + this.hostType === Toolbox.HostType.WINDOW || + this.hostType === Toolbox.HostType.PAGE || + this.hostType === Toolbox.HostType.CUSTOM + ) { this.host.frame.minWidth = WIDTH_CHEVRON_AND_MEATBALL * zoomValue; } }, @@ -216,8 +240,10 @@ ToolboxHostManager.prototype = { this.destroyHost(); - if (this.hostType !== Toolbox.HostType.CUSTOM && - this.hostType !== Toolbox.HostType.PAGE) { + if ( + this.hostType !== Toolbox.HostType.CUSTOM && + this.hostType !== Toolbox.HostType.PAGE + ) { Services.prefs.setCharPref(PREVIOUS_HOST, this.hostType); } @@ -229,8 +255,10 @@ ToolboxHostManager.prototype = { this.setMinWidthWithZoom(); - if (hostType !== Toolbox.HostType.CUSTOM && - hostType !== Toolbox.HostType.PAGE) { + if ( + hostType !== Toolbox.HostType.CUSTOM && + hostType !== Toolbox.HostType.PAGE + ) { Services.prefs.setCharPref(LAST_HOST, hostType); } @@ -250,7 +278,10 @@ ToolboxHostManager.prototype = { // When Firefox toplevel is closed, the frame may already be detached and // the top level document gone if (this.host.frame.ownerDocument.defaultView) { - this.host.frame.ownerDocument.defaultView.removeEventListener("message", this); + this.host.frame.ownerDocument.defaultView.removeEventListener( + "message", + this + ); } this.host.frame.removeEventListener("unload", this, true); diff --git a/devtools/client/framework/toolbox-hosts.js b/devtools/client/framework/toolbox-hosts.js index 6e3c08f27fbd..7a2c3e38f57b 100644 --- a/devtools/client/framework/toolbox-hosts.js +++ b/devtools/client/framework/toolbox-hosts.js @@ -9,9 +9,16 @@ const EventEmitter = require("devtools/shared/event-emitter"); const promise = require("promise"); const Services = require("Services"); -const {DOMHelpers} = require("resource://devtools/client/shared/DOMHelpers.jsm"); +const { + DOMHelpers, +} = require("resource://devtools/client/shared/DOMHelpers.jsm"); -loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true); +loader.lazyRequireGetter( + this, + "gDevToolsBrowser", + "devtools/client/framework/devtools-browser", + true +); /* A host should always allow this much space for the page to be displayed. * There is also a min-height on the browser, but we still don't want to set @@ -50,15 +57,19 @@ BottomHost.prototype = { const gBrowser = this.hostTab.ownerDocument.defaultView.gBrowser; const ownerDocument = gBrowser.ownerDocument; - this._browserContainer = - gBrowser.getBrowserContainer(this.hostTab.linkedBrowser); + this._browserContainer = gBrowser.getBrowserContainer( + this.hostTab.linkedBrowser + ); this._splitter = ownerDocument.createXULElement("splitter"); this._splitter.setAttribute("class", "devtools-horizontal-splitter"); // Avoid resizing notification containers this._splitter.setAttribute("resizebefore", "flex"); - this.frame = createDevToolsFrame(ownerDocument, "devtools-toolbox-bottom-iframe"); + this.frame = createDevToolsFrame( + ownerDocument, + "devtools-toolbox-bottom-iframe" + ); this.frame.height = Math.min( Services.prefs.getIntPref(this.heightPref), this._browserContainer.clientHeight - MIN_PAGE_SIZE @@ -134,13 +145,18 @@ class SidebarHost { await gDevToolsBrowser.loadBrowserStyleSheet(this.hostTab.ownerGlobal); const gBrowser = this.hostTab.ownerDocument.defaultView.gBrowser; const ownerDocument = gBrowser.ownerDocument; - this._browserContainer = gBrowser.getBrowserContainer(this.hostTab.linkedBrowser); + this._browserContainer = gBrowser.getBrowserContainer( + this.hostTab.linkedBrowser + ); this._browserPanel = gBrowser.getPanel(this.hostTab.linkedBrowser); this._splitter = ownerDocument.createXULElement("splitter"); this._splitter.setAttribute("class", "devtools-side-splitter"); - this.frame = createDevToolsFrame(ownerDocument, "devtools-toolbox-side-iframe"); + this.frame = createDevToolsFrame( + ownerDocument, + "devtools-toolbox-side-iframe" + ); this.frame.width = Math.min( Services.prefs.getIntPref(this.widthPref), this._browserPanel.clientWidth - MIN_PAGE_SIZE @@ -151,8 +167,7 @@ class SidebarHost { const topDoc = topWindow.document.documentElement; const isLTR = topWindow.getComputedStyle(topDoc).direction === "ltr"; - if (isLTR && this.type == "right" || - !isLTR && this.type == "left") { + if ((isLTR && this.type == "right") || (!isLTR && this.type == "left")) { this._browserPanel.appendChild(this._splitter); this._browserPanel.appendChild(this.frame); } else { @@ -242,15 +257,25 @@ WindowHost.prototype = { create: function() { return new Promise(resolve => { const flags = "chrome,centerscreen,resizable,dialog=no"; - const win = Services.ww.openWindow(null, this.WINDOW_URL, "_blank", - flags, null); + const win = Services.ww.openWindow( + null, + this.WINDOW_URL, + "_blank", + flags, + null + ); const frameLoad = () => { win.removeEventListener("load", frameLoad, true); win.focus(); - this.frame = createDevToolsFrame(win.document, "devtools-toolbox-window-iframe"); - win.document.getElementById("devtools-toolbox-window").appendChild(this.frame); + this.frame = createDevToolsFrame( + win.document, + "devtools-toolbox-window-iframe" + ); + win.document + .getElementById("devtools-toolbox-window") + .appendChild(this.frame); // The forceOwnRefreshDriver attribute is set to avoid Windows only issues with // CSS transitions when switching from docked to window hosts. @@ -419,10 +444,10 @@ function createDevToolsFrame(doc, className) { } exports.Hosts = { - "bottom": BottomHost, - "left": LeftHost, - "right": RightHost, - "window": WindowHost, - "custom": CustomHost, - "page": PageHost, + bottom: BottomHost, + left: LeftHost, + right: RightHost, + window: WindowHost, + custom: CustomHost, + page: PageHost, }; diff --git a/devtools/client/framework/toolbox-init.js b/devtools/client/framework/toolbox-init.js index 7622150944f4..61ab5e5f8239 100644 --- a/devtools/client/framework/toolbox-init.js +++ b/devtools/client/framework/toolbox-init.js @@ -39,8 +39,9 @@ const onLoad = new Promise(r => { async function showErrorPage(doc, errorMessage) { const win = doc.defaultView; - const { BrowserLoader } = - ChromeUtils.import("resource://devtools/client/shared/browser-loader.js"); + const { BrowserLoader } = ChromeUtils.import( + "resource://devtools/client/shared/browser-loader.js" + ); const browserRequire = BrowserLoader({ window: win, useOnlyShared: true, @@ -49,9 +50,12 @@ async function showErrorPage(doc, errorMessage) { const React = browserRequire("devtools/client/shared/vendor/react"); const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom"); const DebugTargetErrorPage = React.createFactory( - require("devtools/client/framework/components/DebugTargetErrorPage")); + require("devtools/client/framework/components/DebugTargetErrorPage") + ); const { LocalizationHelper } = browserRequire("devtools/shared/l10n"); - const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); + const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" + ); // mount the React component into our XUL container once the DOM is ready await onLoad; @@ -67,14 +71,20 @@ async function showErrorPage(doc, errorMessage) { ReactDOM.render(element, mountEl); // make sure we unmount the component when the page is destroyed - win.addEventListener("unload", () => { - ReactDOM.unmountComponentAtNode(mountEl); - }, { once: true }); + win.addEventListener( + "unload", + () => { + ReactDOM.unmountComponentAtNode(mountEl); + }, + { once: true } + ); } async function initToolbox(url, host) { const { gDevTools } = require("devtools/client/framework/devtools"); - const { targetFromURL } = require("devtools/client/framework/target-from-url"); + const { + targetFromURL, + } = require("devtools/client/framework/target-from-url"); const { Toolbox } = require("devtools/client/framework/toolbox"); const { DebuggerServer } = require("devtools/server/main"); const { DebuggerClient } = require("devtools/shared/client/debugger-client"); @@ -89,8 +99,9 @@ async function initToolbox(url, host) { // mozbrowser>) whose reference is set on the host iframe. // `iframe` is the targeted document to debug - let iframe = host.wrappedJSObject ? host.wrappedJSObject.target - : host.target; + let iframe = host.wrappedJSObject + ? host.wrappedJSObject.target + : host.target; if (!iframe) { throw new Error("Unable to find the targeted iframe to debug"); } @@ -136,7 +147,7 @@ if (url.search.length > 1) { if (url.searchParams.has("disconnected")) { const error = new Error("Debug target was disconnected"); showErrorPage(host.contentDocument, `${error}`); - // otherwise, try to init the toolbox + // otherwise, try to init the toolbox } else { initToolbox(url, host); } diff --git a/devtools/client/framework/toolbox-options.js b/devtools/client/framework/toolbox-options.js index c7ee112e6d7f..50f553ce916f 100644 --- a/devtools/client/framework/toolbox-options.js +++ b/devtools/client/framework/toolbox-options.js @@ -5,12 +5,19 @@ "use strict"; const Services = require("Services"); -const {gDevTools} = require("devtools/client/framework/devtools"); +const { gDevTools } = require("devtools/client/framework/devtools"); -const {LocalizationHelper} = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); -loader.lazyRequireGetter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm", true); +loader.lazyRequireGetter( + this, + "AppConstants", + "resource://gre/modules/AppConstants.jsm", + true +); exports.OptionsPanel = OptionsPanel; @@ -67,7 +74,9 @@ function OptionsPanel(iframeWindow, toolbox) { this._themeUnregistered = this._themeUnregistered.bind(this); this._disableJSClicked = this._disableJSClicked.bind(this); - this.disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript"); + this.disableJSNode = this.panelDoc.getElementById( + "devtools-disable-javascript" + ); this._addListeners(); @@ -76,7 +85,6 @@ function OptionsPanel(iframeWindow, toolbox) { } OptionsPanel.prototype = { - get target() { return this.toolbox.target; }, @@ -95,8 +103,10 @@ OptionsPanel.prototype = { _addListeners: function() { Services.prefs.addObserver("devtools.cache.disabled", this._prefChanged); Services.prefs.addObserver("devtools.theme", this._prefChanged); - Services.prefs.addObserver("devtools.source-map.client-service.enabled", - this._prefChanged); + Services.prefs.addObserver( + "devtools.source-map.client-service.enabled", + this._prefChanged + ); gDevTools.on("theme-registered", this._themeRegistered); gDevTools.on("theme-unregistered", this._themeUnregistered); @@ -113,8 +123,10 @@ OptionsPanel.prototype = { _removeListeners: function() { Services.prefs.removeObserver("devtools.cache.disabled", this._prefChanged); Services.prefs.removeObserver("devtools.theme", this._prefChanged); - Services.prefs.removeObserver("devtools.source-map.client-service.enabled", - this._prefChanged); + Services.prefs.removeObserver( + "devtools.source-map.client-service.enabled", + this._prefChanged + ); this.toolbox.off("tool-registered", this.setupToolsList); this.toolbox.off("tool-unregistered", this.setupToolsList); @@ -155,7 +167,8 @@ OptionsPanel.prototype = { await this.toolbox.isOpen; const enabledToolbarButtonsBox = this.panelDoc.getElementById( - "enabled-toolbox-buttons-box"); + "enabled-toolbox-buttons-box" + ); const toolbarButtons = this.toolbox.toolbarButtons; @@ -164,11 +177,14 @@ OptionsPanel.prototype = { return; } - const onCheckboxClick = (checkbox) => { + const onCheckboxClick = checkbox => { const commandButton = toolbarButtons.filter( - toggleableButton => toggleableButton.id === checkbox.id)[0]; + toggleableButton => toggleableButton.id === checkbox.id + )[0]; Services.prefs.setBoolPref( - commandButton.visibilityswitch, checkbox.checked); + commandButton.visibilityswitch, + checkbox.checked + ); this.toolbox.updateToolboxButtonsVisibility(); }; @@ -182,8 +198,10 @@ OptionsPanel.prototype = { if (Services.prefs.getBoolPref(button.visibilityswitch, true)) { checkboxInput.setAttribute("checked", true); } - checkboxInput.addEventListener("change", - onCheckboxClick.bind(this, checkboxInput)); + checkboxInput.addEventListener( + "change", + onCheckboxClick.bind(this, checkboxInput) + ); checkboxLabel.appendChild(checkboxInput); checkboxLabel.appendChild(checkboxSpanLabel); @@ -202,9 +220,11 @@ OptionsPanel.prototype = { setupToolsList: function() { const defaultToolsBox = this.panelDoc.getElementById("default-tools-box"); const additionalToolsBox = this.panelDoc.getElementById( - "additional-tools-box"); + "additional-tools-box" + ); const toolsNotSupportedLabel = this.panelDoc.getElementById( - "tools-not-supported-label"); + "tools-not-supported-label" + ); let atleastOneToolNotSupported = false; // Signal tool registering/unregistering globally (for the tools registered @@ -215,13 +235,20 @@ OptionsPanel.prototype = { Services.prefs.setBoolPref(tool.visibilityswitch, this.checked); if (!tool.isWebExtension) { - gDevTools.emit(this.checked ? "tool-registered" : "tool-unregistered", tool.id); + gDevTools.emit( + this.checked ? "tool-registered" : "tool-unregistered", + tool.id + ); // Record which tools were registered and unregistered. - telemetry.keyedScalarSet("devtools.tool.registered", tool.id, this.checked); + telemetry.keyedScalarSet( + "devtools.tool.registered", + tool.id, + this.checked + ); } }; - const createToolCheckbox = (tool) => { + const createToolCheckbox = tool => { const checkboxLabel = this.panelDoc.createElement("label"); const checkboxInput = this.panelDoc.createElement("input"); checkboxInput.setAttribute("type", "checkbox"); @@ -233,8 +260,10 @@ OptionsPanel.prototype = { checkboxSpanLabel.textContent = tool.label; } else { atleastOneToolNotSupported = true; - checkboxSpanLabel.textContent = - L10N.getFormatStr("options.toolNotSupportedMarker", tool.label); + checkboxSpanLabel.textContent = L10N.getFormatStr( + "options.toolNotSupportedMarker", + tool.label + ); checkboxInput.setAttribute("data-unsupported", "true"); checkboxInput.setAttribute("disabled", "true"); } @@ -243,8 +272,10 @@ OptionsPanel.prototype = { checkboxInput.setAttribute("checked", "true"); } - checkboxInput.addEventListener("change", - onCheckboxClick.bind(checkboxInput, this.telemetry, tool)); + checkboxInput.addEventListener( + "change", + onCheckboxClick.bind(checkboxInput, this.telemetry, tool) + ); checkboxLabel.appendChild(checkboxInput); checkboxLabel.appendChild(checkboxSpanLabel); @@ -267,8 +298,9 @@ OptionsPanel.prototype = { fragment.appendChild(createToolCheckbox(tool)); } - const toolsNotSupportedLabelNode = - this.panelDoc.getElementById("tools-not-supported-label"); + const toolsNotSupportedLabelNode = this.panelDoc.getElementById( + "tools-not-supported-label" + ); defaultToolsBox.insertBefore(fragment, toolsNotSupportedLabelNode); // Clean up any existent additional tools content. @@ -284,27 +316,29 @@ OptionsPanel.prototype = { } // Populating the additional tools that came from the installed WebExtension add-ons. - for (const {uuid, name, pref} of this.toolbox.listWebExtensions()) { + for (const { uuid, name, pref } of this.toolbox.listWebExtensions()) { atleastOneAddon = true; - additionalToolsBox.appendChild(createToolCheckbox({ - isWebExtension: true, + additionalToolsBox.appendChild( + createToolCheckbox({ + isWebExtension: true, - // Use the preference as the unified webextensions tool id. - id: `webext-${uuid}`, - tooltip: name, - label: name, - // Disable the devtools extension using the given pref name: - // the toolbox options for the WebExtensions are not related to a single - // tool (e.g. a devtools panel created from the extension devtools_page) - // but to the entire devtools part of a webextension which is enabled - // by the Addon Manager (but it may be disabled by its related - // devtools about:config preference), and so the following - visibilityswitch: pref, + // Use the preference as the unified webextensions tool id. + id: `webext-${uuid}`, + tooltip: name, + label: name, + // Disable the devtools extension using the given pref name: + // the toolbox options for the WebExtensions are not related to a single + // tool (e.g. a devtools panel created from the extension devtools_page) + // but to the entire devtools part of a webextension which is enabled + // by the Addon Manager (but it may be disabled by its related + // devtools about:config preference), and so the following + visibilityswitch: pref, - // Only local tabs are currently supported as targets. - isTargetSupported: target => target.isLocalTab, - })); + // Only local tabs are currently supported as targets. + isTargetSupported: target => target.isLocalTab, + }) + ); } if (!atleastOneAddon) { @@ -336,8 +370,7 @@ OptionsPanel.prototype = { inputRadio.setAttribute("value", theme.id); inputRadio.setAttribute("name", "devtools-theme-item"); inputRadio.addEventListener("change", function(e) { - SetPref(themeBox.getAttribute("data-pref"), - e.target.value); + SetPref(themeBox.getAttribute("data-pref"), e.target.value); }); const inputSpanLabel = this.panelDoc.createElement("span"); @@ -368,14 +401,16 @@ OptionsPanel.prototype = { // Labels for these new buttons are nightly only and mostly intended for working on // devtools. - const prefDefinitions = [{ - pref: "devtools.performance.new-panel-enabled", - label: "Enable new performance recorder (then re-open DevTools)", - id: "devtools-new-performance", - parentId: "context-options", - }]; + const prefDefinitions = [ + { + pref: "devtools.performance.new-panel-enabled", + label: "Enable new performance recorder (then re-open DevTools)", + id: "devtools-new-performance", + parentId: "context-options", + }, + ]; - const createPreferenceOption = ({pref, label, id}) => { + const createPreferenceOption = ({ pref, label, id }) => { const inputLabel = this.panelDoc.createElement("label"); const checkbox = this.panelDoc.createElement("input"); checkbox.setAttribute("type", "checkbox"); @@ -405,14 +440,18 @@ OptionsPanel.prototype = { // no element after the last label. But that's OK and it will do what we // want. const referenceElement = parent.querySelector("label:last-of-type + *"); - parent.insertBefore(createPreferenceOption(prefDefinition), referenceElement); + parent.insertBefore( + createPreferenceOption(prefDefinition), + referenceElement + ); parent.removeAttribute("hidden"); } }, async populatePreferences() { const prefCheckboxes = this.panelDoc.querySelectorAll( - "input[type=checkbox][data-pref]"); + "input[type=checkbox][data-pref]" + ); for (const prefCheckbox of prefCheckboxes) { if (GetPref(prefCheckbox.getAttribute("data-pref"))) { prefCheckbox.setAttribute("checked", true); @@ -424,18 +463,20 @@ OptionsPanel.prototype = { } // Themes radio inputs are handled in setupThemeList const prefRadiogroups = this.panelDoc.querySelectorAll( - ".radiogroup[data-pref]:not(#devtools-theme-box)"); + ".radiogroup[data-pref]:not(#devtools-theme-box)" + ); for (const radioGroup of prefRadiogroups) { const selectedValue = GetPref(radioGroup.getAttribute("data-pref")); - for (const radioInput of radioGroup.querySelectorAll("input[type=radio]")) { + for (const radioInput of radioGroup.querySelectorAll( + "input[type=radio]" + )) { if (radioInput.getAttribute("value") == selectedValue) { radioInput.setAttribute("checked", true); } radioInput.addEventListener("change", function(e) { - SetPref(radioGroup.getAttribute("data-pref"), - e.target.value); + SetPref(radioGroup.getAttribute("data-pref"), e.target.value); }); } } @@ -455,21 +496,24 @@ OptionsPanel.prototype = { prefSelect.addEventListener("change", function(e) { const select = e.target; - SetPref(select.getAttribute("data-pref"), - select.options[select.selectedIndex].value); + SetPref( + select.getAttribute("data-pref"), + select.options[select.selectedIndex].value + ); }); } if (!this.target.chrome) { - this.disableJSNode.checked = - !this.target.configureOptions.javascriptEnabled; + this.disableJSNode.checked = !this.target.configureOptions + .javascriptEnabled; this.disableJSNode.addEventListener("click", this._disableJSClicked); } else { // Hide the checkbox and label this.disableJSNode.parentNode.style.display = "none"; - const triggersPageRefreshLabel = - this.panelDoc.getElementById("triggers-page-refresh-label"); + const triggersPageRefreshLabel = this.panelDoc.getElementById( + "triggers-page-refresh-label" + ); triggersPageRefreshLabel.style.display = "none"; } }, @@ -509,7 +553,7 @@ OptionsPanel.prototype = { const checked = event.target.checked; const options = { - "javascriptEnabled": !checked, + javascriptEnabled: !checked, }; this.target.reconfigure({ options }); diff --git a/devtools/client/framework/toolbox-process-window.js b/devtools/client/framework/toolbox-process-window.js index 12ef7b391c9e..39c1b10765a9 100644 --- a/devtools/client/framework/toolbox-process-window.js +++ b/devtools/client/framework/toolbox-process-window.js @@ -6,7 +6,9 @@ "use strict"; -var { loader, require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm"); +var { loader, require } = ChromeUtils.import( + "resource://devtools/shared/Loader.jsm" +); // Require this module to setup core modules loader.require("devtools/client/framework/devtools-browser"); @@ -18,7 +20,9 @@ var { DebuggerClient } = require("devtools/shared/client/debugger-client"); var { PrefsHelper } = require("devtools/client/shared/prefs"); const KeyShortcuts = require("devtools/client/shared/key-shortcuts"); const { LocalizationHelper } = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); // Timeout to wait before we assume that a connect() timed out without an error. // In milliseconds. (With the Debugger pane open, this has been reported to last @@ -44,7 +48,9 @@ function appendStatusMessage(msg) { } function toggleStatusMessage(visible = true) { - const statusMessageContainer = document.getElementById("status-message-container"); + const statusMessageContainer = document.getElementById( + "status-message-container" + ); if (visible) { statusMessageContainer.removeAttribute("hidden"); } else { @@ -62,15 +68,18 @@ function hideStatusMessage() { var connect = async function() { // Initiate the connection - const env = Cc["@mozilla.org/process/environment;1"] - .getService(Ci.nsIEnvironment); + const env = Cc["@mozilla.org/process/environment;1"].getService( + Ci.nsIEnvironment + ); const port = env.get("MOZ_BROWSER_TOOLBOX_PORT"); // A port needs to be passed in from the environment, for instance: // MOZ_BROWSER_TOOLBOX_PORT=6080 ./mach run -chrome \ // chrome://devtools/content/framework/toolbox-process-window.html if (!port) { - throw new Error("Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT"); + throw new Error( + "Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT" + ); } const host = Prefs.chromeDebuggingHost; @@ -93,11 +102,20 @@ var connect = async function() { // Certain options should be toggled since we can assume chrome debugging here function setPrefDefaults() { Services.prefs.setBoolPref("devtools.inspector.showUserAgentStyles", true); - Services.prefs.setBoolPref("devtools.performance.ui.show-platform-data", true); - Services.prefs.setBoolPref("devtools.inspector.showAllAnonymousContent", true); + Services.prefs.setBoolPref( + "devtools.performance.ui.show-platform-data", + true + ); + Services.prefs.setBoolPref( + "devtools.inspector.showAllAnonymousContent", + true + ); Services.prefs.setBoolPref("browser.dom.window.dump.enabled", true); Services.prefs.setBoolPref("devtools.console.stdout.chrome", true); - Services.prefs.setBoolPref("devtools.command-button-noautohide.enabled", true); + Services.prefs.setBoolPref( + "devtools.command-button-noautohide.enabled", + true + ); // Bug 1225160 - Using source maps with browser debugging can lead to a crash Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", false); Services.prefs.setBoolPref("devtools.preference.new-panel-enabled", false); @@ -106,28 +124,39 @@ function setPrefDefaults() { Services.prefs.setBoolPref("devtools.performance.enabled", false); } -window.addEventListener("load", async function() { - gShortcuts = new KeyShortcuts({window}); - gShortcuts.on("CmdOrCtrl+W", onCloseCommand); +window.addEventListener( + "load", + async function() { + gShortcuts = new KeyShortcuts({ window }); + gShortcuts.on("CmdOrCtrl+W", onCloseCommand); - const statusMessageContainer = document.getElementById("status-message-title"); - statusMessageContainer.textContent = L10N.getStr("browserToolbox.statusMessage"); + const statusMessageContainer = document.getElementById( + "status-message-title" + ); + statusMessageContainer.textContent = L10N.getStr( + "browserToolbox.statusMessage" + ); - setPrefDefaults(); + setPrefDefaults(); - // Reveal status message if connecting is slow or if an error occurs. - const delayedStatusReveal = setTimeout(revealStatusMessage, STATUS_REVEAL_TIME); - try { - await connect(); - clearTimeout(delayedStatusReveal); - hideStatusMessage(); - } catch (e) { - clearTimeout(delayedStatusReveal); - appendStatusMessage(e); - revealStatusMessage(); - console.error(e); - } -}, { once: true }); + // Reveal status message if connecting is slow or if an error occurs. + const delayedStatusReveal = setTimeout( + revealStatusMessage, + STATUS_REVEAL_TIME + ); + try { + await connect(); + clearTimeout(delayedStatusReveal); + hideStatusMessage(); + } catch (e) { + clearTimeout(delayedStatusReveal); + appendStatusMessage(e); + revealStatusMessage(); + console.error(e); + } + }, + { once: true } +); function onCloseCommand(event) { window.close(); @@ -135,15 +164,17 @@ function onCloseCommand(event) { async function openToolbox(target) { const form = target.targetForm; - appendStatusMessage(`Create toolbox target: ${JSON.stringify({form}, null, 2)}`); + appendStatusMessage( + `Create toolbox target: ${JSON.stringify({ form }, null, 2)}` + ); const frame = document.getElementById("toolbox-iframe"); // Remember the last panel that was used inside of this profile. // But if we are testing, then it should always open the debugger panel. - const selectedTool = - Services.prefs.getCharPref("devtools.browsertoolbox.panel", - Services.prefs.getCharPref("devtools.toolbox.selectedTool", - "jsdebugger")); + const selectedTool = Services.prefs.getCharPref( + "devtools.browsertoolbox.panel", + Services.prefs.getCharPref("devtools.toolbox.selectedTool", "jsdebugger") + ); const toolboxOptions = { customIframe: frame }; appendStatusMessage(`Show toolbox with ${selectedTool} selected`); @@ -160,15 +191,18 @@ function onNewToolbox(toolbox) { gToolbox = toolbox; bindToolboxHandlers(); raise(); - const env = Cc["@mozilla.org/process/environment;1"] - .getService(Ci.nsIEnvironment); + const env = Cc["@mozilla.org/process/environment;1"].getService( + Ci.nsIEnvironment + ); const testScript = env.get("MOZ_TOOLBOX_TEST_SCRIPT"); if (testScript) { // Only allow executing random chrome scripts when a special // test-only pref is set const prefName = "devtools.browser-toolbox.allow-unsafe-script"; - if (Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL && - Services.prefs.getBoolPref(prefName) === true) { + if ( + Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL && + Services.prefs.getBoolPref(prefName) === true + ) { evaluateTestScript(testScript, toolbox); } } @@ -218,8 +252,9 @@ function setupThreadListeners(panel) { } function updateBadgeText(paused) { - const dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"] - .getService(Ci.nsIMacDockSupport); + const dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"].getService( + Ci.nsIMacDockSupport + ); dockSupport.badgeText = paused ? "▐▐ " : " ▶"; } @@ -255,8 +290,9 @@ function setTitle(title) { } function quitApp() { - const quit = Cc["@mozilla.org/supports-PRBool;1"] - .createInstance(Ci.nsISupportsPRBool); + const quit = Cc["@mozilla.org/supports-PRBool;1"].createInstance( + Ci.nsISupportsPRBool + ); Services.obs.notifyObservers(quit, "quit-application-requested"); const shouldProceed = !quit.data; diff --git a/devtools/client/framework/toolbox-tabs-order-manager.js b/devtools/client/framework/toolbox-tabs-order-manager.js index 0a506a2622c5..7133ef71e9d3 100644 --- a/devtools/client/framework/toolbox-tabs-order-manager.js +++ b/devtools/client/framework/toolbox-tabs-order-manager.js @@ -50,8 +50,10 @@ class ToolboxTabsOrderManager { } isLastTab(tabElement) { - return !tabElement.nextSibling || - tabElement.nextSibling.id === "tools-chevron-menu-button"; + return ( + !tabElement.nextSibling || + tabElement.nextSibling.id === "tools-chevron-menu-button" + ); } isRTL() { @@ -64,10 +66,9 @@ class ToolboxTabsOrderManager { // Concat the overflowed tabs id since they are not contained in visible tabs. // The overflowed tabs cannot be reordered so we just append the id from current // panel definitions on their order. - const overflowedTabIds = - this.currentPanelDefinitions - .filter(definition => !tabs.some(tab => tab.dataset.id === definition.id)) - .map(definition => definition.extensionId || definition.id); + const overflowedTabIds = this.currentPanelDefinitions + .filter(definition => !tabs.some(tab => tab.dataset.id === definition.id)) + .map(definition => definition.extensionId || definition.id); const currentTabIds = tabIds.concat(overflowedTabIds); const dragTargetId = this.dragTarget.dataset.extensionId || this.dragTarget.dataset.id; @@ -77,9 +78,11 @@ class ToolboxTabsOrderManager { // Remove panel id which is not in panel definitions and addons list. const extensions = await AddonManager.getAllAddons(); const definitions = gDevTools.getToolDefinitionArray(); - const result = - absoluteIds.filter(id => definitions.find(d => id === (d.extensionId || d.id)) || - extensions.find(e => id === e.id)); + const result = absoluteIds.filter( + id => + definitions.find(d => id === (d.extensionId || d.id)) || + extensions.find(e => id === e.id) + ); Services.prefs.setCharPref(PREFERENCE_NAME, result.join(",")); } @@ -96,7 +99,9 @@ class ToolboxTabsOrderManager { this.dragStartX = e.pageX; this.dragTarget = e.target; this.previousPageX = e.pageX; - this.toolboxContainerElement = this.dragTarget.closest("#toolbox-container"); + this.toolboxContainerElement = this.dragTarget.closest( + "#toolbox-container" + ); this.toolboxTabsElement = this.dragTarget.closest(".toolbox-tabs"); this.isOrderUpdated = false; this.eventTarget = this.dragTarget.ownerGlobal.top; @@ -113,13 +118,17 @@ class ToolboxTabsOrderManager { this.dragTarget.offsetLeft + diffPageX + this.dragTarget.clientWidth / 2; let isDragTargetPreviousSibling = false; - const tabElements = this.toolboxTabsElement.querySelectorAll(".devtools-tab"); + const tabElements = this.toolboxTabsElement.querySelectorAll( + ".devtools-tab" + ); // Calculate the minimum and maximum X-offset that can be valid for the drag target. const firstElement = tabElements[0]; - const firstElementCenterX = firstElement.offsetLeft + firstElement.clientWidth / 2; + const firstElementCenterX = + firstElement.offsetLeft + firstElement.clientWidth / 2; const lastElement = tabElements[tabElements.length - 1]; - const lastElementCenterX = lastElement.offsetLeft + lastElement.clientWidth / 2; + const lastElementCenterX = + lastElement.offsetLeft + lastElement.clientWidth / 2; const max = Math.max(firstElementCenterX, lastElementCenterX); const min = Math.min(firstElementCenterX, lastElementCenterX); @@ -135,12 +144,15 @@ class ToolboxTabsOrderManager { // Is the dragTarget near the center of the other tab? const anotherCenterX = tabElement.offsetLeft + tabElement.clientWidth / 2; - const distanceWithDragTarget = Math.abs(dragTargetCenterX - anotherCenterX); + const distanceWithDragTarget = Math.abs( + dragTargetCenterX - anotherCenterX + ); const isReplaceable = distanceWithDragTarget < tabElement.clientWidth / 3; if (isReplaceable) { - const replaceableElement = - isDragTargetPreviousSibling ? tabElement.nextSibling : tabElement; + const replaceableElement = isDragTargetPreviousSibling + ? tabElement.nextSibling + : tabElement; this.insertBefore(replaceableElement); break; } @@ -162,7 +174,7 @@ class ToolboxTabsOrderManager { distance = 0; } - this.dragTarget.style.left = `${ distance }px`; + this.dragTarget.style.left = `${distance}px`; this.previousPageX = e.pageX; } @@ -179,7 +191,8 @@ class ToolboxTabsOrderManager { // Log which tabs reordered. The question we want to answer is: // "How frequently are the tabs re-ordered, also which tabs get re-ordered?" - const toolId = this.dragTarget.dataset.extensionId || this.dragTarget.dataset.id; + const toolId = + this.dragTarget.dataset.extensionId || this.dragTarget.dataset.id; this.telemetry.keyedScalarAdd(TABS_REORDERED_SCALAR, toolId, 1); } diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js index afd236682b8d..1336c7121400 100644 --- a/devtools/client/framework/toolbox.js +++ b/devtools/client/framework/toolbox.js @@ -4,8 +4,10 @@ "use strict"; -const SOURCE_MAP_WORKER = "resource://devtools/client/shared/source-map/worker.js"; -const SOURCE_MAP_WORKER_ASSETS = "resource://devtools/client/shared/source-map/assets/"; +const SOURCE_MAP_WORKER = + "resource://devtools/client/shared/source-map/worker.js"; +const SOURCE_MAP_WORKER_ASSETS = + "resource://devtools/client/shared/source-map/assets/"; const MAX_ORDINAL = 99; const SPLITCONSOLE_ENABLED_PREF = "devtools.toolbox.splitconsoleEnabled"; @@ -15,75 +17,139 @@ const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST"; const CURRENT_THEME_SCALAR = "devtools.current_theme"; const HTML_NS = "http://www.w3.org/1999/xhtml"; -var {Ci, Cc} = require("chrome"); +var { Ci, Cc } = require("chrome"); var promise = require("promise"); const { debounce } = require("devtools/shared/debounce"); var Services = require("Services"); var ChromeUtils = require("ChromeUtils"); -var {gDevTools} = require("devtools/client/framework/devtools"); +var { gDevTools } = require("devtools/client/framework/devtools"); var EventEmitter = require("devtools/shared/event-emitter"); var Telemetry = require("devtools/client/shared/telemetry"); const { getUnicodeUrl } = require("devtools/client/shared/unicode-url"); -var { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm"); +var { + DOMHelpers, +} = require("resource://devtools/client/shared/DOMHelpers.jsm"); const { KeyCodes } = require("devtools/client/shared/keycodes"); -var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports) - .wrappedJSObject; +var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService( + Ci.nsISupports +).wrappedJSObject; -const { BrowserLoader } = - ChromeUtils.import("resource://devtools/client/shared/browser-loader.js"); +const { BrowserLoader } = ChromeUtils.import( + "resource://devtools/client/shared/browser-loader.js" +); -const {LocalizationHelper} = require("devtools/shared/l10n"); -const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const L10N = new LocalizationHelper( + "devtools/client/locales/toolbox.properties" +); -loader.lazyRequireGetter(this, "AppConstants", - "resource://gre/modules/AppConstants.jsm", true); -loader.lazyRequireGetter(this, "flags", - "devtools/shared/flags"); -loader.lazyRequireGetter(this, "KeyShortcuts", - "devtools/client/shared/key-shortcuts"); -loader.lazyRequireGetter(this, "ZoomKeys", - "devtools/client/shared/zoom-keys"); -loader.lazyRequireGetter(this, "settleAll", - "devtools/shared/ThreadSafeDevToolsUtils", true); -loader.lazyRequireGetter(this, "ToolboxButtons", - "devtools/client/definitions", true); -loader.lazyRequireGetter(this, "SourceMapURLService", - "devtools/client/framework/source-map-url-service", true); -loader.lazyRequireGetter(this, "HUDService", - "devtools/client/webconsole/hudservice", true); -loader.lazyRequireGetter(this, "viewSource", - "devtools/client/shared/view-source"); -loader.lazyRequireGetter(this, "buildHarLog", - "devtools/client/netmonitor/src/har/har-builder-utils", true); -loader.lazyRequireGetter(this, "NetMonitorAPI", - "devtools/client/netmonitor/src/api", true); -loader.lazyRequireGetter(this, "sortPanelDefinitions", - "devtools/client/framework/toolbox-tabs-order-manager", true); -loader.lazyRequireGetter(this, "createEditContextMenu", - "devtools/client/framework/toolbox-context-menu", true); -loader.lazyRequireGetter(this, "remoteClientManager", - "devtools/client/shared/remote-debugging/remote-client-manager.js", true); -loader.lazyRequireGetter(this, "ResponsiveUIManager", - "devtools/client/responsive.html/manager", true); -loader.lazyRequireGetter(this, "DevToolsUtils", - "devtools/shared/DevToolsUtils"); +loader.lazyRequireGetter( + this, + "AppConstants", + "resource://gre/modules/AppConstants.jsm", + true +); +loader.lazyRequireGetter(this, "flags", "devtools/shared/flags"); +loader.lazyRequireGetter( + this, + "KeyShortcuts", + "devtools/client/shared/key-shortcuts" +); +loader.lazyRequireGetter(this, "ZoomKeys", "devtools/client/shared/zoom-keys"); +loader.lazyRequireGetter( + this, + "settleAll", + "devtools/shared/ThreadSafeDevToolsUtils", + true +); +loader.lazyRequireGetter( + this, + "ToolboxButtons", + "devtools/client/definitions", + true +); +loader.lazyRequireGetter( + this, + "SourceMapURLService", + "devtools/client/framework/source-map-url-service", + true +); +loader.lazyRequireGetter( + this, + "HUDService", + "devtools/client/webconsole/hudservice", + true +); +loader.lazyRequireGetter( + this, + "viewSource", + "devtools/client/shared/view-source" +); +loader.lazyRequireGetter( + this, + "buildHarLog", + "devtools/client/netmonitor/src/har/har-builder-utils", + true +); +loader.lazyRequireGetter( + this, + "NetMonitorAPI", + "devtools/client/netmonitor/src/api", + true +); +loader.lazyRequireGetter( + this, + "sortPanelDefinitions", + "devtools/client/framework/toolbox-tabs-order-manager", + true +); +loader.lazyRequireGetter( + this, + "createEditContextMenu", + "devtools/client/framework/toolbox-context-menu", + true +); +loader.lazyRequireGetter( + this, + "remoteClientManager", + "devtools/client/shared/remote-debugging/remote-client-manager.js", + true +); +loader.lazyRequireGetter( + this, + "ResponsiveUIManager", + "devtools/client/responsive.html/manager", + true +); +loader.lazyRequireGetter( + this, + "DevToolsUtils", + "devtools/shared/DevToolsUtils" +); loader.lazyGetter(this, "domNodeConstants", () => { return require("devtools/shared/dom-node-constants"); }); loader.lazyGetter(this, "DEBUG_TARGET_TYPES", () => { - return require("devtools/client/shared/remote-debugging/constants").DEBUG_TARGET_TYPES; + return require("devtools/client/shared/remote-debugging/constants") + .DEBUG_TARGET_TYPES; }); loader.lazyGetter(this, "registerHarOverlay", () => { return require("devtools/client/netmonitor/src/har/toolbox-overlay").register; }); -loader.lazyGetter(this, "reloadAndRecordTab", - () => require("devtools/client/webreplay/menu.js").reloadAndRecordTab); -loader.lazyGetter(this, "reloadAndStopRecordingTab", - () => require("devtools/client/webreplay/menu.js").reloadAndStopRecordingTab); +loader.lazyGetter( + this, + "reloadAndRecordTab", + () => require("devtools/client/webreplay/menu.js").reloadAndRecordTab +); +loader.lazyGetter( + this, + "reloadAndStopRecordingTab", + () => require("devtools/client/webreplay/menu.js").reloadAndStopRecordingTab +); /** * A "Toolbox" is the component that holds all the tools for one specific @@ -105,8 +171,14 @@ loader.lazyGetter(this, "reloadAndStopRecordingTab", * the number of milliseconds since process start using monotonic * timestamps (unaffected by system clock changes). */ -function Toolbox(target, selectedTool, hostType, contentWindow, frameId, - msSinceProcessStart) { +function Toolbox( + target, + selectedTool, + hostType, + contentWindow, + frameId, + msSinceProcessStart +) { this._target = target; this._win = contentWindow; this.frameId = frameId; @@ -154,8 +226,9 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId, this._highlighterReady = this._highlighterReady.bind(this); this._highlighterHidden = this._highlighterHidden.bind(this); this._applyCacheSettings = this._applyCacheSettings.bind(this); - this._applyServiceWorkersTestingSettings = - this._applyServiceWorkersTestingSettings.bind(this); + this._applyServiceWorkersTestingSettings = this._applyServiceWorkersTestingSettings.bind( + this + ); this._saveSplitConsoleHeight = this._saveSplitConsoleHeight.bind(this); this._onFocus = this._onFocus.bind(this); this._onBrowserMessage = this._onBrowserMessage.bind(this); @@ -175,7 +248,9 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId, this._onToolSelected = this._onToolSelected.bind(this); this._onTargetClosed = this._onTargetClosed.bind(this); this._onContextMenu = this._onContextMenu.bind(this); - this.updateToolboxButtonsVisibility = this.updateToolboxButtonsVisibility.bind(this); + this.updateToolboxButtonsVisibility = this.updateToolboxButtonsVisibility.bind( + this + ); this.updateToolboxButtons = this.updateToolboxButtons.bind(this); this.selectTool = this.selectTool.bind(this); this._pingTelemetrySelectTool = this._pingTelemetrySelectTool.bind(this); @@ -196,9 +271,11 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId, this._hostType = hostType; - this.isOpen = new Promise(function(resolve) { - this._resolveIsOpen = resolve; - }.bind(this)); + this.isOpen = new Promise( + function(resolve) { + this._resolveIsOpen = resolve; + }.bind(this) + ); EventEmitter.decorate(this); @@ -221,7 +298,8 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId, */ loader.lazyGetter(this, "direction", () => { const { documentElement } = this.doc; - const isRtl = this.win.getComputedStyle(documentElement).direction === "rtl"; + const isRtl = + this.win.getComputedStyle(documentElement).direction === "rtl"; return isRtl ? "rtl" : "ltr"; }); } @@ -292,7 +370,10 @@ Toolbox.prototype = { * can be set by add-ons. */ _combineAndSortPanelDefinitions() { - let definitions = [...this._panelDefinitions, ...this.getVisibleAdditionalTools()]; + let definitions = [ + ...this._panelDefinitions, + ...this.getVisibleAdditionalTools(), + ]; definitions = sortPanelDefinitions(definitions); this.component.setPanelDefinitions(definitions); }, @@ -450,8 +531,11 @@ Toolbox.prototype = { return false; } const focusedWin = Services.focus.focusedWindow; - return focusedWin && focusedWin === - this.doc.querySelector("#toolbox-panel-iframe-webconsole").contentWindow; + return ( + focusedWin && + focusedWin === + this.doc.querySelector("#toolbox-panel-iframe-webconsole").contentWindow + ); }, _onPausedState: function(packet) { @@ -493,10 +577,12 @@ Toolbox.prototype = { const threadOptions = { autoBlackBox: false, ignoreFrameEnvironment: true, - pauseOnExceptions: - Services.prefs.getBoolPref("devtools.debugger.pause-on-exceptions"), - ignoreCaughtExceptions: - Services.prefs.getBoolPref("devtools.debugger.ignore-caught-exceptions"), + pauseOnExceptions: Services.prefs.getBoolPref( + "devtools.debugger.pause-on-exceptions" + ), + ignoreCaughtExceptions: Services.prefs.getBoolPref( + "devtools.debugger.ignore-caught-exceptions" + ), }; const [, threadClient] = await this._target.attachThread(threadOptions); @@ -524,7 +610,7 @@ Toolbox.prototype = { * Open the toolbox */ open: function() { - return (async function() { + return async function() { const isToolboxURL = this.win.location.href.startsWith(this._URL); if (isToolboxURL) { // Update the URL so that onceDOMReady watch for the right url. @@ -554,9 +640,7 @@ Toolbox.prototype = { // Start tracking network activity on toolbox open for targets such as tabs. // (Workers and potentially others don't manage the console client in the target.) if (this._target.activeConsole) { - await this._target.activeConsole.startListeners([ - "NetworkActivity", - ]); + await this._target.activeConsole.startListeners(["NetworkActivity"]); } this._threadClient = await this._attachAndResumeThread(); @@ -579,9 +663,14 @@ Toolbox.prototype = { const framesPromise = this._listFrames(); - Services.prefs.addObserver("devtools.cache.disabled", this._applyCacheSettings); - Services.prefs.addObserver("devtools.serviceWorkers.testing.enabled", - this._applyServiceWorkersTestingSettings); + Services.prefs.addObserver( + "devtools.cache.disabled", + this._applyCacheSettings + ); + Services.prefs.addObserver( + "devtools.serviceWorkers.testing.enabled", + this._applyServiceWorkersTestingSettings + ); // Get the DOM element to mount the ToolboxController to. this._componentMount = this.doc.getElementById("toolbox-toolbar-mount"); @@ -595,12 +684,25 @@ Toolbox.prototype = { this._addChromeEventHandlerEvents(); this._registerOverlays(); - this._componentMount.addEventListener("keypress", this._onToolbarArrowKeypress); - this._componentMount.setAttribute("aria-label", L10N.getStr("toolbox.label")); + this._componentMount.addEventListener( + "keypress", + this._onToolbarArrowKeypress + ); + this._componentMount.setAttribute( + "aria-label", + L10N.getStr("toolbox.label") + ); - this.webconsolePanel = this.doc.querySelector("#toolbox-panel-webconsole"); - this.webconsolePanel.height = Services.prefs.getIntPref(SPLITCONSOLE_HEIGHT_PREF); - this.webconsolePanel.addEventListener("resize", this._saveSplitConsoleHeight); + this.webconsolePanel = this.doc.querySelector( + "#toolbox-panel-webconsole" + ); + this.webconsolePanel.height = Services.prefs.getIntPref( + SPLITCONSOLE_HEIGHT_PREF + ); + this.webconsolePanel.addEventListener( + "resize", + this._saveSplitConsoleHeight + ); this._buildButtons(); @@ -623,9 +725,12 @@ Toolbox.prototype = { // requestIdleCallback allows releasing it to allow user events to be processed. // Use 16ms maximum delay to allow one frame to be rendered at 60FPS // (1000ms/60FPS=16ms) - this.win.requestIdleCallback(() => { - this.component.setCanRender(); - }, {timeout: 16}); + this.win.requestIdleCallback( + () => { + this.component.setCanRender(); + }, + { timeout: 16 } + ); await this.selectTool(this._defaultToolId, "initial_panel"); @@ -635,16 +740,25 @@ Toolbox.prototype = { if (Services.prefs.getBoolPref(SPLITCONSOLE_ENABLED_PREF)) { splitConsolePromise = this.openSplitConsole(); this.telemetry.addEventProperty( - this.win, "open", "tools", null, "splitconsole", true); + this.win, + "open", + "tools", + null, + "splitconsole", + true + ); } else { this.telemetry.addEventProperty( - this.win, "open", "tools", null, "splitconsole", false); + this.win, + "open", + "tools", + null, + "splitconsole", + false + ); } - await promise.all([ - splitConsolePromise, - framesPromise, - ]); + await promise.all([splitConsolePromise, framesPromise]); // Lazily connect to the profiler here and don't wait for it to complete, // used to intercept console.profile calls before the performance tools are open. @@ -659,12 +773,14 @@ Toolbox.prototype = { this.emit("ready"); this._resolveIsOpen(); - }.bind(this))().catch(e => { - console.error("Exception while opening the toolbox", String(e), e); - // While the exception stack is correctly printed in the Browser console when - // passing `e` to console.error, it is not on the stdout, so print it via dump. - dump(e.stack + "\n"); - }); + } + .bind(this)() + .catch(e => { + console.error("Exception while opening the toolbox", String(e), e); + // While the exception stack is correctly printed in the Browser console when + // passing `e` to console.error, it is not on the stdout, so print it via dump. + dump(e.stack + "\n"); + }); }, /** @@ -704,9 +820,15 @@ Toolbox.prototype = { this._addShortcuts(); this._addWindowHostShortcuts(); - this._chromeEventHandler.addEventListener("keypress", this._splitConsoleOnKeypress); + this._chromeEventHandler.addEventListener( + "keypress", + this._splitConsoleOnKeypress + ); this._chromeEventHandler.addEventListener("focus", this._onFocus, true); - this._chromeEventHandler.addEventListener("contextmenu", this._onContextMenu); + this._chromeEventHandler.addEventListener( + "contextmenu", + this._onContextMenu + ); }, _removeChromeEventHandlerEvents: function() { @@ -719,10 +841,15 @@ Toolbox.prototype = { this._removeShortcuts(); this._removeWindowHostShortcuts(); - this._chromeEventHandler.removeEventListener("keypress", - this._splitConsoleOnKeypress); + this._chromeEventHandler.removeEventListener( + "keypress", + this._splitConsoleOnKeypress + ); this._chromeEventHandler.removeEventListener("focus", this._onFocus, true); - this._chromeEventHandler.removeEventListener("contextmenu", this._onContextMenu); + this._chromeEventHandler.removeEventListener( + "contextmenu", + this._onContextMenu + ); this._chromeEventHandler = null; }, @@ -746,21 +873,18 @@ Toolbox.prototype = { }); // Listen for tool navigation shortcuts. - this.shortcuts.on(L10N.getStr("toolbox.nextTool.key"), - event => { - this.selectNextTool(); - event.preventDefault(); - }); - this.shortcuts.on(L10N.getStr("toolbox.previousTool.key"), - event => { - this.selectPreviousTool(); - event.preventDefault(); - }); - this.shortcuts.on(L10N.getStr("toolbox.toggleHost.key"), - event => { - this.switchToPreviousHost(); - event.preventDefault(); - }); + this.shortcuts.on(L10N.getStr("toolbox.nextTool.key"), event => { + this.selectNextTool(); + event.preventDefault(); + }); + this.shortcuts.on(L10N.getStr("toolbox.previousTool.key"), event => { + this.selectPreviousTool(); + event.preventDefault(); + }); + this.shortcuts.on(L10N.getStr("toolbox.toggleHost.key"), event => { + this.switchToPreviousHost(); + event.preventDefault(); + }); // List for Help/Settings key. this.shortcuts.on(L10N.getStr("toolbox.help.key"), this.toggleOptions); @@ -827,7 +951,9 @@ Toolbox.prototype = { // KeyShortcuts contain tool-specific and global key shortcuts, // here we only need to copy shortcut specific to each tool. shortcuts.on(electronKey, () => { - this.selectTool(toolId, "key_shortcut").then(() => this.fireCustomKey(toolId)); + this.selectTool(toolId, "key_shortcut").then(() => + this.fireCustomKey(toolId) + ); }); } } @@ -839,9 +965,15 @@ Toolbox.prototype = { // The others are only registered in window host type as for other hosts, // these keys are already registered by devtools-startup.js - shortcuts.on(L10N.getStr("toolbox.toggleToolboxF12.key"), this.closeToolbox); + shortcuts.on( + L10N.getStr("toolbox.toggleToolboxF12.key"), + this.closeToolbox + ); if (AppConstants.platform == "macosx") { - shortcuts.on(L10N.getStr("toolbox.toggleToolboxOSX.key"), this.closeToolbox); + shortcuts.on( + L10N.getStr("toolbox.toggleToolboxOSX.key"), + this.closeToolbox + ); } else { shortcuts.on(L10N.getStr("toolbox.toggleToolbox.key"), this.closeToolbox); } @@ -858,11 +990,13 @@ Toolbox.prototype = { // Handle context menu events in standard input elements: and