Bug 1744179 - [devtools] Add doctype to all webconsole test pages.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Fri, 03 Dec 2021 15:41:06 +0000
changeset 601010 92df9c655be52b50e0b93a327a5913c14ad76ce1
parent 601009 7ae19ddb78734af719641236718623e887300027
child 601011 ae3f445e1c9bdbb394650a03eadd7a4a65fd2a30
push id39033
push userccozmuta@mozilla.com
push dateFri, 03 Dec 2021 21:38:02 +0000
treeherdermozilla-central@92df9c655be5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1744179
milestone96.0a1
first release with
nightly linux32
92df9c655be5 / 96.0a1 / 20211203213802 / files
nightly linux64
92df9c655be5 / 96.0a1 / 20211203213802 / files
nightly mac
92df9c655be5 / 96.0a1 / 20211203213802 / files
nightly win32
92df9c655be5 / 96.0a1 / 20211203213802 / files
nightly win64
92df9c655be5 / 96.0a1 / 20211203213802 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1744179 - [devtools] Add doctype to all webconsole test pages. Now what we show a warning message on pages with invalid/no doctype, a lot of tests were failing because of it. This patch only adds doctype on all webconsole test pages. Differential Revision: https://phabricator.services.mozilla.com/D132793
devtools/client/webconsole/test/browser/browser_console_chrome_context_message.js
devtools/client/webconsole/test/browser/browser_console_clear_cache.js
devtools/client/webconsole/test/browser/browser_console_clear_method.js
devtools/client/webconsole/test/browser/browser_console_content_getters.js
devtools/client/webconsole/test/browser/browser_console_content_longstring.js
devtools/client/webconsole/test/browser/browser_console_content_object.js
devtools/client/webconsole/test/browser/browser_console_content_object_context_menu.js
devtools/client/webconsole/test/browser/browser_console_content_object_in_sidebar.js
devtools/client/webconsole/test/browser/browser_console_devtools_loader_exception.js
devtools/client/webconsole/test/browser/browser_console_eager_eval.js
devtools/client/webconsole/test/browser/browser_console_error_source_click.js
devtools/client/webconsole/test/browser/browser_console_filters.js
devtools/client/webconsole/test/browser/browser_console_jsterm_await.js
devtools/client/webconsole/test/browser/browser_console_nsiconsolemessage.js
devtools/client/webconsole/test/browser/browser_console_screenshot.js
devtools/client/webconsole/test/browser/browser_console_webconsole_console_api_calls.js
devtools/client/webconsole/test/browser/browser_console_webconsole_ctrlw_close_tab.js
devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js
devtools/client/webconsole/test/browser/browser_jsterm_add_edited_input_to_history.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_accept_no_scroll.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_array_no_index.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_arrow_keys.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_await.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_cached_results.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_commands.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_control_space.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_del_key.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_disabled.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_eager_evaluation.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_escape_key.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_expression_variables.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_extraneous_closing_brackets.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_cache.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_cancel.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_confirm.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_learn_more_link.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_helpers.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_inside_text.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_native_getters.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_nav_and_tab_key.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_paste_undo.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_race_on_enter.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_return_key.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_return_key_no_selection.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_toggle.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_width.js
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_will_navigate.js
devtools/client/webconsole/test/browser/browser_jsterm_await_assignments.js
devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent.js
devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent_same_result.js
devtools/client/webconsole/test/browser/browser_jsterm_await_error.js
devtools/client/webconsole/test/browser/browser_jsterm_await_helper_dollar_underscore.js
devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js
devtools/client/webconsole/test/browser/browser_jsterm_completion.js
devtools/client/webconsole/test/browser/browser_jsterm_completion_bracket.js
devtools/client/webconsole/test/browser/browser_jsterm_completion_bracket_cached_results.js
devtools/client/webconsole/test/browser/browser_jsterm_completion_case_sensitivity.js
devtools/client/webconsole/test/browser/browser_jsterm_completion_dollar_underscore.js
devtools/client/webconsole/test/browser/browser_jsterm_completion_dollar_zero.js
devtools/client/webconsole/test/browser/browser_jsterm_completion_perfect_match.js
devtools/client/webconsole/test/browser/browser_jsterm_content_defined_helpers.js
devtools/client/webconsole/test/browser/browser_jsterm_context_menu_labels.js
devtools/client/webconsole/test/browser/browser_jsterm_copy_command.js
devtools/client/webconsole/test/browser/browser_jsterm_ctrl_a_select_all.js
devtools/client/webconsole/test/browser/browser_jsterm_ctrl_key_nav.js
devtools/client/webconsole/test/browser/browser_jsterm_document_no_xray.js
devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js
devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_element_highlight.js
devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_in_debugger_stackframe.js
devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_warnings.js
devtools/client/webconsole/test/browser/browser_jsterm_editor.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_disabled_history_nav_with_keyboard.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_execute.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_execute_selection.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_gutter.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_onboarding.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_resize.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_button.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_toggle_keyboard_shortcut.js
devtools/client/webconsole/test/browser/browser_jsterm_editor_toolbar.js
devtools/client/webconsole/test/browser/browser_jsterm_error_docs.js
devtools/client/webconsole/test/browser/browser_jsterm_error_outside_valid_range.js
devtools/client/webconsole/test/browser/browser_jsterm_file_load_save_keyboard_shortcut.js
devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js
devtools/client/webconsole/test/browser/browser_jsterm_helper_clear.js
devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar.js
devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar_dollar.js
devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar_x.js
devtools/client/webconsole/test/browser/browser_jsterm_helper_help.js
devtools/client/webconsole/test/browser/browser_jsterm_helper_keys_values.js
devtools/client/webconsole/test/browser/browser_jsterm_hide_when_devtools_chrome_enabled_false.js
devtools/client/webconsole/test/browser/browser_jsterm_history.js
devtools/client/webconsole/test/browser/browser_jsterm_history_arrow_keys.js
devtools/client/webconsole/test/browser/browser_jsterm_history_command.js
devtools/client/webconsole/test/browser/browser_jsterm_history_nav.js
devtools/client/webconsole/test/browser/browser_jsterm_history_persist.js
devtools/client/webconsole/test/browser/browser_jsterm_insert_tab_when_overflows_no_scroll.js
devtools/client/webconsole/test/browser/browser_jsterm_inspect.js
devtools/client/webconsole/test/browser/browser_jsterm_instance_of.js
devtools/client/webconsole/test/browser/browser_jsterm_middle_click_paste.js
devtools/client/webconsole/test/browser/browser_jsterm_null_undefined.js
devtools/client/webconsole/test/browser/browser_jsterm_popup_close_on_tab_switch.js
devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_user.js
devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_warnings.js
devtools/client/webconsole/test/browser/browser_jsterm_selfxss.js
devtools/client/webconsole/test/browser/browser_jsterm_syntax_highlight_output.js
devtools/client/webconsole/test/browser/browser_toolbox_console_new_process.js
devtools/client/webconsole/test/browser/browser_webconsole_async_stack.js
devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js
devtools/client/webconsole/test/browser/browser_webconsole_cached_messages_no_duplicate.js
devtools/client/webconsole/test/browser/browser_webconsole_certificate_messages.js
devtools/client/webconsole/test/browser/browser_webconsole_clear_cache.js
devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js
devtools/client/webconsole/test/browser/browser_webconsole_close_groups_after_navigation.js
devtools/client/webconsole/test/browser/browser_webconsole_close_sidebar.js
devtools/client/webconsole/test/browser/browser_webconsole_console_dir.js
devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js
devtools/client/webconsole/test/browser/browser_webconsole_console_error_expand_object.js
devtools/client/webconsole/test/browser/browser_webconsole_console_group_open_no_scroll.js
devtools/client/webconsole/test/browser/browser_webconsole_console_profile_unavailable.js
devtools/client/webconsole/test/browser/browser_webconsole_console_table_post_alterations.js
devtools/client/webconsole/test/browser/browser_webconsole_console_trace_distinct.js
devtools/client/webconsole/test/browser/browser_webconsole_context_menu_object_in_sidebar.js
devtools/client/webconsole/test/browser/browser_webconsole_context_menu_reveal_in_inspector.js
devtools/client/webconsole/test/browser/browser_webconsole_csp_ignore_reflected_xss_message.js
devtools/client/webconsole/test/browser/browser_webconsole_csp_violation.js
devtools/client/webconsole/test/browser/browser_webconsole_cspro.js
devtools/client/webconsole/test/browser/browser_webconsole_css_error_impacted_elements.js
devtools/client/webconsole/test/browser/browser_webconsole_document_focus.js
devtools/client/webconsole/test/browser/browser_webconsole_error_with_longstring_stack.js
devtools/client/webconsole/test/browser/browser_webconsole_error_with_unicode.js
devtools/client/webconsole/test/browser/browser_webconsole_error_with_url.js
devtools/client/webconsole/test/browser/browser_webconsole_filter_navigation_marker.js
devtools/client/webconsole/test/browser/browser_webconsole_filter_scroll.js
devtools/client/webconsole/test/browser/browser_webconsole_highlighter_console_helper.js
devtools/client/webconsole/test/browser/browser_webconsole_hsts_invalid-headers.js
devtools/client/webconsole/test/browser/browser_webconsole_input_field_focus_on_panel_select.js
devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js
devtools/client/webconsole/test/browser/browser_webconsole_inspect_cross_domain_object.js
devtools/client/webconsole/test/browser/browser_webconsole_limit_multiline.js
devtools/client/webconsole/test/browser/browser_webconsole_logErrorInPage.js
devtools/client/webconsole/test/browser/browser_webconsole_logWarningInPage.js
devtools/client/webconsole/test/browser/browser_webconsole_loglimit.js
devtools/client/webconsole/test/browser/browser_webconsole_longstring.js
devtools/client/webconsole/test/browser/browser_webconsole_longstring_getter.js
devtools/client/webconsole/test/browser/browser_webconsole_message_categories.js
devtools/client/webconsole/test/browser/browser_webconsole_mime_css_blocked.js
devtools/client/webconsole/test/browser/browser_webconsole_multiple_windows_and_tabs.js
devtools/client/webconsole/test/browser/browser_webconsole_navigate_to_parse_error.js
devtools/client/webconsole/test/browser/browser_webconsole_network_exceptions.js
devtools/client/webconsole/test/browser/browser_webconsole_network_messages_openinnet.js
devtools/client/webconsole/test/browser/browser_webconsole_network_messages_resend_request.js
devtools/client/webconsole/test/browser/browser_webconsole_network_reset_filter.js
devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js
devtools/client/webconsole/test/browser/browser_webconsole_object_in_sidebar_keyboard_nav.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector__proto__.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_entries.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters_prototype.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters_shadowed.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_key_sorting.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_nested_promise.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_nested_proxy.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_private_properties.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_scroll.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_selected_text.js
devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_symbols.js
devtools/client/webconsole/test/browser/browser_webconsole_observer_notifications.js
devtools/client/webconsole/test/browser/browser_webconsole_output_copy.js
devtools/client/webconsole/test/browser/browser_webconsole_persist.js
devtools/client/webconsole/test/browser/browser_webconsole_promise_rejected_object.js
devtools/client/webconsole/test/browser/browser_webconsole_repeat_different_objects.js
devtools/client/webconsole/test/browser/browser_webconsole_responsive_design_mode.js
devtools/client/webconsole/test/browser/browser_webconsole_reverse_search.js
devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_initial_value.js
devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_keyboard_navigation.js
devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_mouse_navigation.js
devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_toggle.js
devtools/client/webconsole/test/browser/browser_webconsole_script_errordoc_urls.js
devtools/client/webconsole/test/browser/browser_webconsole_scroll.js
devtools/client/webconsole/test/browser/browser_webconsole_show_subresource_security_errors.js
devtools/client/webconsole/test/browser/browser_webconsole_shows_reqs_from_netmonitor.js
devtools/client/webconsole/test/browser/browser_webconsole_shows_reqs_in_netmonitor.js
devtools/client/webconsole/test/browser/browser_webconsole_sidebar_object_expand_when_message_pruned.js
devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js
devtools/client/webconsole/test/browser/browser_webconsole_split.js
devtools/client/webconsole/test/browser/browser_webconsole_split_close_button.js
devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js
devtools/client/webconsole/test/browser/browser_webconsole_split_focus.js
devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js
devtools/client/webconsole/test/browser/browser_webconsole_strict_mode_errors.js
devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_execute_js.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_filters_changed.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_js_errors.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_jump_to_definition.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_object_expanded.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_persist_toggle_changed.js
devtools/client/webconsole/test/browser/browser_webconsole_telemetry_reverse_search.js
devtools/client/webconsole/test/browser/browser_webconsole_time_methods.js
devtools/client/webconsole/test/browser/browser_webconsole_timestamps.js
devtools/client/webconsole/test/browser/browser_webconsole_uncaught_exception.js
devtools/client/webconsole/test/browser/browser_webconsole_warn_about_replaced_api.js
devtools/client/webconsole/test/browser/browser_webconsole_wasm_errors.js
devtools/client/webconsole/test/browser/test-console-api-iframe.html
--- a/devtools/client/webconsole/test/browser/browser_console_chrome_context_message.js
+++ b/devtools/client/webconsole/test/browser/browser_console_chrome_context_message.js
@@ -10,17 +10,17 @@ add_task(async function() {
   // Needed for the execute() function below
   await pushPref("security.allow_parent_unrestricted_js_loads", true);
 
   // Show the content messages
   await pushPref("devtools.browserconsole.contentMessages", true);
 
   const hud = await BrowserConsoleManager.toggleBrowserConsole();
   await openNewTabAndConsole(
-    `data:text/html,<script>console.log("hello from content")</script>`
+    `data:text/html,<!DOCTYPE html><script>console.log("hello from content")</script>`
   );
 
   const expectedMessages = [
     `Cu.reportError`, // bug 1561930
   ];
 
   info("Set the focus on the Browser Console");
   hud.iframeWindow.focus();
--- a/devtools/client/webconsole/test/browser/browser_console_clear_cache.js
+++ b/devtools/client/webconsole/test/browser/browser_console_clear_cache.js
@@ -1,17 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Check that clearing the browser console output also clears the console cache.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,Test browser console clear cache";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html>Test browser console clear cache";
 
 add_task(async function() {
   await pushPref("devtools.browserconsole.contentMessages", true);
   await pushPref("devtools.browsertoolbox.fission", true);
 
   await addTab(TEST_URI);
   let hud = await BrowserConsoleManager.toggleBrowserConsole();
   // builtin-modules warning messages seem to be emitted late and causes the test to fail,
--- a/devtools/client/webconsole/test/browser/browser_console_clear_method.js
+++ b/devtools/client/webconsole/test/browser/browser_console_clear_method.js
@@ -3,17 +3,17 @@
 
 // XXX Remove this when the file is migrated to the new frontend.
 /* eslint-disable no-undef */
 
 // Check that console.clear() does not clear the output of the browser console.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<p>Bug 1296870";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html><p>Bug 1296870";
 
 add_task(async function() {
   await loadTab(TEST_URI);
   const hud = await BrowserConsoleManager.toggleBrowserConsole();
 
   info("Log a new message from the content page");
   SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
     content.wrappedJSObject.console.log("msg");
--- a/devtools/client/webconsole/test/browser/browser_console_content_getters.js
+++ b/devtools/client/webconsole/test/browser/browser_console_content_getters.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check evaluating and expanding getters in the Browser Console.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>Object Inspector on Getters</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>Object Inspector on Getters</h1>";
 const { ELLIPSIS } = require("devtools/shared/l10n");
 
 add_task(async function() {
   // Show the content messages
   await pushPref("devtools.browserconsole.contentMessages", true);
   // Enable Fission browser console to see the logged content object
   await pushPref("devtools.browsertoolbox.fission", true);
 
--- a/devtools/client/webconsole/test/browser/browser_console_content_longstring.js
+++ b/devtools/client/webconsole/test/browser/browser_console_content_longstring.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that very long content strings can be expanded and collapsed in the
 // Browser Console, and do not hang the browser.
 
 "use strict";
 
-const TEST_URI = "data:text/html,<meta charset=utf8>Test LongString hang";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html><meta charset=utf8>Test LongString hang";
 
 const LONGSTRING = `foobar${"a".repeat(
   9000
 )}foobaz${"abbababazomglolztest".repeat(100)}boom!`;
 
 add_task(async function() {
   // Show the content messages
   await pushPref("devtools.browserconsole.contentMessages", true);
--- a/devtools/client/webconsole/test/browser/browser_console_content_object.js
+++ b/devtools/client/webconsole/test/browser/browser_console_content_object.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Test that console API calls in the content page appear in the browser console.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>console API calls<script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>console API calls<script>
   console.log({ contentObject: "YAY!", deep: ["yes!"] });
 </script>`;
 
 add_task(async function() {
   // Show the content messages
   await pushPref("devtools.browserconsole.contentMessages", true);
   // Enable Fission browser console to see the logged content object
   await pushPref("devtools.browsertoolbox.fission", true);
--- a/devtools/client/webconsole/test/browser/browser_console_content_object_context_menu.js
+++ b/devtools/client/webconsole/test/browser/browser_console_content_object_context_menu.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Test that "Copy Object" on a the content message works in the browser console.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>console API calls<script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>console API calls<script>
   console.log({
     contentObject: "YAY!",
     deep: ["hello", "world"]
   });
 </script>`;
 
 add_task(async function() {
   // Show the content messages
--- a/devtools/client/webconsole/test/browser/browser_console_content_object_in_sidebar.js
+++ b/devtools/client/webconsole/test/browser/browser_console_content_object_in_sidebar.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the "Open in sidebar" context menu entry is active for
 // the content objects and opens the sidebar when clicked.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
   console.log(
     {a:1},
     100,
     {b:1},
     'foo',
     false,
     null,
     undefined
--- a/devtools/client/webconsole/test/browser/browser_console_devtools_loader_exception.js
+++ b/devtools/client/webconsole/test/browser/browser_console_devtools_loader_exception.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that exceptions from scripts loaded with the DevTools loader are
 // opened correctly in View Source from the Browser Console.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,<p>browser_console_devtools_loader_exception.js</p>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>browser_console_devtools_loader_exception.js</p>";
 
 add_task(async function() {
   // Disable the preloaded process as it creates processes intermittently
   // which forces the emission of RDP requests we aren't correctly waiting for.
   await pushPref("dom.ipc.processPrelaunch.enabled", false);
 
   const wcHud = await openNewTabAndConsole(TEST_URI);
   ok(wcHud, "web console opened");
--- a/devtools/client/webconsole/test/browser/browser_console_eager_eval.js
+++ b/devtools/client/webconsole/test/browser/browser_console_eager_eval.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Check evaluating eager-evaluation values.
-const TEST_URI = "data:text/html;charset=utf8,";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>";
 
 add_task(async function() {
   await addTab(TEST_URI);
 
   await pushPref("devtools.chrome.enabled", true);
 
   info("Open the Browser Console");
   const hud = await BrowserConsoleManager.toggleBrowserConsole();
--- a/devtools/client/webconsole/test/browser/browser_console_error_source_click.js
+++ b/devtools/client/webconsole/test/browser/browser_console_error_source_click.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that JS errors and CSS warnings open view source when their source link
 // is clicked in the Browser Console.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,<p>hello world" +
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>hello world" +
   "<button onclick='foobar.explode()'>click!</button>";
 
 add_task(async function() {
   // Disable the preloaded process as it creates processes intermittently
   // which forces the emission of RDP requests we aren't correctly waiting for.
   await pushPref("dom.ipc.processPrelaunch.enabled", false);
 
   await pushPref("devtools.browserconsole.contentMessages", true);
--- a/devtools/client/webconsole/test/browser/browser_console_filters.js
+++ b/devtools/client/webconsole/test/browser/browser_console_filters.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that the Browser Console does not use the same filter prefs as the Web
 // Console.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<p>browser console filters";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>browser console filters";
 
 add_task(async function() {
   let hud = await openNewTabAndConsole(TEST_URI);
   ok(hud, "web console opened");
 
   let filterState = await getFilterState(hud);
   ok(filterState.error, "The web console error filter is enabled");
 
--- a/devtools/client/webconsole/test/browser/browser_console_jsterm_await.js
+++ b/devtools/client/webconsole/test/browser/browser_console_jsterm_await.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // This is a lightweight version of browser_jsterm_await.js to only ensure top-level await
 // support in the Browser Console.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Top-level await Browser Console test";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Top-level await Browser Console test";
 
 add_task(async function() {
   // Needed for the execute() function below
   await pushPref("security.allow_parent_unrestricted_js_loads", true);
   // Enable await mapping.
   await pushPref("devtools.debugger.features.map-await-expression", true);
 
   await addTab(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_console_nsiconsolemessage.js
+++ b/devtools/client/webconsole/test/browser/browser_console_nsiconsolemessage.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that nsIConsoleMessages are displayed in the Browser Console.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>
 <title>browser_console_nsiconsolemessage.js</title>
 <p>hello world<p>
 nsIConsoleMessages ftw!`;
 
 add_task(async function() {
   // We don't use `openNewTabAndConsole()` here because we need to log a message
   // before opening the web console.
   await addTab(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_console_screenshot.js
+++ b/devtools/client/webconsole/test/browser/browser_console_screenshot.js
@@ -5,17 +5,17 @@
 
 "use strict";
 
 const COLOR_DIV_1 = "rgb(255, 0, 0)";
 const COLOR_DIV_2 = "rgb(0, 200, 0)";
 const COLOR_DIV_3 = "rgb(0, 0, 150)";
 const COLOR_DIV_4 = "rgb(100, 0, 100)";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>
     <style>
       body {
         margin: 0;
         height: 100vh;
         display: grid;
         grid-template-columns: 1fr 1fr;
         grid-template-rows: 1fr 1fr;
       }
--- a/devtools/client/webconsole/test/browser/browser_console_webconsole_console_api_calls.js
+++ b/devtools/client/webconsole/test/browser/browser_console_webconsole_console_api_calls.js
@@ -14,17 +14,17 @@ const contentArgs = {
   error: FILTER_PREFIX + "MyError",
   exception: FILTER_PREFIX + "MyException",
   info: FILTER_PREFIX + "MyInfo",
   debug: FILTER_PREFIX + "MyDebug",
   counterName: FILTER_PREFIX + "MyCounter",
   timerName: FILTER_PREFIX + "MyTimer",
 };
 
-const TEST_URI = `data:text/html,<meta charset=utf8>console API calls<script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>console API calls<script>
   console.log("${contentArgs.log}", {hello: "world"});
   console.warn("${contentArgs.warn}", {hello: "world"});
   console.error("${contentArgs.error}", {hello: "world"});
   console.exception("${contentArgs.exception}", {hello: "world"});
   console.info("${contentArgs.info}", {hello: "world"});
   console.debug("${contentArgs.debug}", {hello: "world"});
   console.count("${contentArgs.counterName}");
   console.time("${contentArgs.timerName}");
--- a/devtools/client/webconsole/test/browser/browser_console_webconsole_ctrlw_close_tab.js
+++ b/devtools/client/webconsole/test/browser/browser_console_webconsole_ctrlw_close_tab.js
@@ -3,17 +3,18 @@
 
 // Check that Ctrl-W closes the Browser Console and that Ctrl-W closes the
 // current tab when using the Web Console - bug 871156.
 
 "use strict";
 
 add_task(async function() {
   const TEST_URI =
-    "data:text/html;charset=utf8,<title>bug871156</title>\n" + "<p>hello world";
+    "data:text/html;charset=utf8,<!DOCTYPE html><title>bug871156</title>\n" +
+    "<p>hello world";
   const firstTab = gBrowser.selectedTab;
 
   let hud = await openNewTabAndConsole(TEST_URI);
 
   const toolbox = await gDevTools.getToolboxForTab(gBrowser.selectedTab);
 
   const tabClosed = once(gBrowser.tabContainer, "TabClose");
   tabClosed.then(() => info("tab closed"));
--- a/devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js
+++ b/devtools/client/webconsole/test/browser/browser_console_webconsole_private_browsing.js
@@ -6,18 +6,19 @@
 
 "use strict";
 
 const NON_PRIVATE_MESSAGE = "This is not a private message";
 const PRIVATE_MESSAGE = "This is a private message";
 const PRIVATE_UNDEFINED_FN = "privateException";
 const PRIVATE_EXCEPTION = `${PRIVATE_UNDEFINED_FN} is not defined`;
 
-const NON_PRIVATE_TEST_URI = "data:text/html;charset=utf8,Not private";
-const PRIVATE_TEST_URI = `data:text/html;charset=utf8,Test console in private windows
+const NON_PRIVATE_TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html>Not private";
+const PRIVATE_TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>Test console in private windows
   <script>
     function logMessages() {
       /* Wrap the exception so we don't throw in ContentTask. */
       setTimeout(() => {
         console.log("${PRIVATE_MESSAGE}");
         ${PRIVATE_UNDEFINED_FN}();
       }, 10);
     }
--- a/devtools/client/webconsole/test/browser/browser_jsterm_add_edited_input_to_history.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_add_edited_input_to_history.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that user input that is not submitted in the command line input is not
 // lost after navigating in history.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=817834
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 817834";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 817834";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   ok(!getInputValue(hud), "console input is empty");
   checkInputCursorPosition(hud, 0, "Cursor is at expected position");
 
   setInputValue(hud, '"first item"');
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that properties starting with underscores or dollars can be
 // autocompleted (bug 967468).
-const TEST_URI = `data:text/html;charset=utf8,test autocompletion with $ or _`;
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>test autocompletion with $ or _`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await executeAndWaitForMessage(
     hud,
     "var testObject = {$$aaab: '', $$aaac: ''}",
     "",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_accept_no_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_accept_no_scroll.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that the accepting an autocompletion does not scroll the input.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.foobar = Object.create(null, Object.getOwnPropertyDescriptors({
       item0: "value0",
       item1: "value1",
     }));
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_array_no_index.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_array_no_index.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 585991.
 
 const TEST_URI = `data:text/html;charset=utf-8,
+<!DOCTYPE html>
 <head>
   <script>
     window.foo = [1,2,3];
   </script>
 </head>
 <body>bug 585991 - Autocomplete popup on array</body>`;
 
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_arrow_keys.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_arrow_keys.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,<head><script>
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html><head><script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.foo = Object.create(null, Object.getOwnPropertyDescriptors({
       aa: "a",
       bbb: "b",
       bbbb: "b",
     }));
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_await.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_await.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 585991.
 
-const TEST_URI = `data:text/html;charset=utf-8,Autocomplete await expression`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Autocomplete await expression`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
 
   info("Check that the await keyword is in the autocomplete");
   await setInputValueForAutocompletion(hud, "aw");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_cached_results.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_cached_results.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the cached autocomplete results are used when the new
 // user input is a subset of the existing completion results.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
     x = Object.create(null, Object.getOwnPropertyDescriptors({
       dog: "woof",
       dos: "-",
       dot: ".",
       duh: 1,
       wut: 2,
     }))
   </script>`;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_commands.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_commands.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that console commands are autocompleted.
 
-const TEST_URI = `data:text/html;charset=utf-8,Test command autocomplete`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Test command autocomplete`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
 
   info(`Enter ":"`);
   jsterm.focus();
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_control_space.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_control_space.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that Ctrl+Space displays the autocompletion popup when it's hidden.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     var foo = Object.create(null, Object.getOwnPropertyDescriptors({
       item0: "value0",
       item1: "value1",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_del_key.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_del_key.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 585991.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     foo = {
       item0: "value0",
       item1: "value1",
     };
   </script>
 </head>
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_disabled.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_disabled.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that disabling autocomplete for console
 
-const TEST_URI = `data:text/html;charset=utf-8,Test command autocomplete`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Test command autocomplete`;
 
 add_task(async function() {
   // Run with autocomplete preference as false
   await pushPref("devtools.webconsole.input.autocomplete", false);
   await performTests_false();
 });
 
 async function performTests_false() {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_eager_evaluation.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_eager_evaluation.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the main expression is eagerly evaluated and its results are used in the autocomple popup
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,Test autocompletion for expression variables<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>Test autocompletion for expression variables<script>
     var testObj = {
       fun: () => ({ yay: "yay", yo: "yo", boo: "boo" })
     };
   </script>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_escape_key.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_escape_key.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 585991.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.foo = Object.create(null);
     Object.assign(window.foo, {
       item0: "value0",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_expression_variables.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_expression_variables.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that variable created in the expression are displayed in the autocomplete.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,Test autocompletion for expression variables<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>Test autocompletion for expression variables<script>
     var testGlobal;
   </script>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_extraneous_closing_brackets.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_extraneous_closing_brackets.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that, when the user types an extraneous closing bracket, no error
 // appears. See Bug 592442.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,test for bug 592442";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>test for bug 592442";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   try {
     await setInputValueForAutocompletion(hud, "document.getElementById)");
     ok(true, "no error was thrown when an extraneous bracket was inserted");
   } catch (ex) {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_cache.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_cache.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that the invoke getter authorizations are cleared when expected.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     var obj = props => Object.create(null, Object.getOwnPropertyDescriptors(props));
     let sideEffectVar;
     var foo = obj({
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_cancel.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_cancel.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that the confirm dialog can be closed with different actions.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     let sideEffect;
     window.foo = {
       get rab() {
         sideEffect = "getRab";
         return "rab";
       }
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_confirm.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_confirm.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that accessing properties with getters displays the confirm dialog to invoke them,
 // and then displays the autocomplete popup with the results.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     var obj = props => Object.create(null, Object.getOwnPropertyDescriptors(props));
     let sideEffect;
     var foo = obj({
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_learn_more_link.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_getters_learn_more_link.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that accessing properties with getters displays a "learn more" link in the confirm
 // dialog that navigates the user to the expected mdn page.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     let sideEffect;
     window.foo = Object.create(null, Object.getOwnPropertyDescriptors({
       get bar() {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_helpers.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_helpers.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the autocompletion results contain the names of JSTerm helpers.
 // See Bug 686937.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,<p>test JSTerm Helpers autocomplete";
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>test JSTerm Helpers autocomplete";
 
 add_task(async function() {
   await pushPref("devtools.editor.autoclosebrackets", false);
   const hud = await openNewTabAndConsole(TEST_URI);
   await testInspectAutoCompletion(hud, "i", true);
   await testInspectAutoCompletion(hud, "window.", false);
   await testInspectAutoCompletion(hud, "dump(i", true);
   await testInspectAutoCompletion(hud, "window.dump(i", true);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_inside_text.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_inside_text.js
@@ -6,17 +6,17 @@
 // Test that editing text inside parens behave as expected, i.e.
 // - it does not show the autocompletion text
 // - show popup when there's properties to complete
 // - insert the selected item from the popup in the input
 // - right arrow dismiss popup and don't autocomplete
 // - tab key when there is not visible autocomplete suggestion insert a tab
 // See Bug 812618, 1479521 and 1334130.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     window.testBugAA = "hello world";
     window.testBugBB = "hello world 2";
     window.x = "hello world 3";
   </script>
 </head>
 <body>bug 812618 - test completion inside text</body>`;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_native_getters.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_native_getters.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that native getters (e.g. document.body) autocompletes in the web console.
 // See Bug 651501.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Test document.body autocompletion";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test document.body autocompletion";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm, ui } = hud;
 
   const { autocompletePopup: popup } = jsterm;
 
   ok(!popup.isOpen, "popup is not open");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_nav_and_tab_key.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_nav_and_tab_key.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 585991.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.foo = Object.create(null, Object.getOwnPropertyDescriptors({
       item00: "value0",
       item1: "value1",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_paste_undo.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_paste_undo.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642615</p>";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>test for bug 642615</p>";
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "clipboardHelper",
   "@mozilla.org/widget/clipboardhelper;1",
   "nsIClipboardHelper"
 );
 const stringToCopy = "foobazbarBug642615";
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_race_on_enter.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_race_on_enter.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that pressing Enter quickly after a letter that makes the input exactly match the
 // item in the autocomplete popup does not insert unwanted character. See Bug 1595068.
 
-const TEST_URI = `data:text/html;charset=utf-8,<script>
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html><script>
   var uvwxyz = "zyxwvu";
 </script>Autocomplete race on Enter`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_return_key.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_return_key.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that the Enter keys works as expected. See Bug 585991 and 1483880.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.foobar = Object.create(null);
     Object.assign(window.foobar, {
       item0: "value0",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_return_key_no_selection.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_return_key_no_selection.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 873250.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     window.testBugA = "hello world";
     window.testBugB = "hello world 2";
   </script>
 </head>
 <body>bug 873250 - test pressing return with open popup, but no selection</body>`;
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_toggle.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_toggle.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test for the input autocomplete option: check if the preference toggles the
 // autocomplete feature in the console output. See bug 1593607.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>`;
 const PREF_INPUT_AUTOCOMPLETE = "devtools.webconsole.input.autocomplete";
 
 add_task(async function() {
   // making sure that input autocomplete is true at the start of test
   await pushPref(PREF_INPUT_AUTOCOMPLETE, true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info(
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_width.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_width.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that the autocomplete popup is resized when needed.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.xx = Object.create(null, Object.getOwnPropertyDescriptors({
       ["y".repeat(10)]: 1,
       ["z".repeat(20)]: 2
--- a/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_will_navigate.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_will_navigate.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that navigating the page closes the autocomplete popup.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <script>
     /* Create a prototype-less object so popup does not contain native
      * Object prototype properties.
      */
     window.foo = Object.create(null, Object.getOwnPropertyDescriptors({
       item0: "value0",
       item1: "value1",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_await_assignments.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_assignments.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that top-level await expressions work as expected.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test top-level await bindings";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test top-level await bindings";
 
 add_task(async function() {
   // Enable await mapping.
   await pushPref("devtools.debugger.features.map-await-expression", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Check that declaring a let variable does not create a global property");
   await executeAndWaitForMessage(
--- a/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that multiple concurrent top-level await expressions work as expected.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test top-level await";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test top-level await";
 
 add_task(async function() {
   // Enable await mapping.
   await pushPref("devtools.debugger.features.map-await-expression", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await clearOutput(hud);
   const delays = [3000, 500, 9000, 6000];
--- a/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent_same_result.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent_same_result.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that hitting Ctrl + E does toggle the editor mode.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1519105
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Test concurrent top-level await expressions returning same value";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test concurrent top-level await expressions returning same value";
 
 add_task(async function() {
   // Enable editor mode as we'll be able to quicly trigger multiple evaluations.
   await pushPref("devtools.webconsole.input.editor", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
   setInputValue(
     hud,
--- a/devtools/client/webconsole/test/browser/browser_jsterm_await_error.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_error.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that failing top-level await expression (rejected or throwing) work as expected.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test failing top-level await";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test failing top-level await";
 
 add_task(async function() {
   // Needed for the execute() function below
   await pushPref("security.allow_parent_unrestricted_js_loads", true);
 
   // Enable await mapping.
   await pushPref("devtools.debugger.features.map-await-expression", true);
   const hud = await openNewTabAndConsole(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_await_helper_dollar_underscore.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_helper_dollar_underscore.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that $_ works as expected with top-level await expressions.
 
 "use strict";
 requestLongerTimeout(2);
 
-const TEST_URI = "data:text/html;charset=utf-8,top-level await + $_";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>top-level await + $_";
 
 add_task(async function() {
   // Enable await mapping.
   await pushPref("devtools.debugger.features.map-await-expression", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const executeAndWaitForResultMessage = (input, expectedOutput) =>
     executeAndWaitForMessage(hud, input, expectedOutput, ".result");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_paused.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that top-level await expression work as expected when debugger is paused.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,Web Console test top-level await when debugger paused`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test top-level await when debugger paused`;
 
 add_task(async function() {
   // Enable await mapping.
   await pushPref("devtools.debugger.features.map-await-expression", true);
 
   // Force the split console to be closed.
   await pushPref("devtools.toolbox.splitconsoleEnabled", false);
   const hud = await openNewTabAndConsole(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test code completion
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test code completion
   <script>
     foobar = true;
   </script>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion_bracket.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion_bracket.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly with `[`
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test [ completion.
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test [ completion.
   <script>
     window.testObject = Object.create(null, Object.getOwnPropertyDescriptors({
       bar: 0,
       dataTest: 1,
       "data-test": 2,
       'da"ta"test': 3,
       "da\`ta\`test": 4,
       "da'ta'test": 5,
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion_bracket_cached_results.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion_bracket_cached_results.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly with `[` and cached results
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test [ completion cached results.
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test [ completion cached results.
   <script>
     window.testObject = Object.create(null, Object.getOwnPropertyDescriptors({
       bar: 0,
       dataTest: 1,
       "data-test": 2,
       'da"ta"test': 3,
       "da\`ta\`test": 4,
       "da'ta'test": 5,
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion_case_sensitivity.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion_case_sensitivity.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly in regards to case sensitivity.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test case-sensitivity completion.
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test case-sensitivity completion.
   <script>
     fooBar = Object.create(null, Object.getOwnPropertyDescriptors({
       Foo: 1,
       test: 2,
       Test: 3,
       TEST: 4,
     }));
     FooBar = true;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion_dollar_underscore.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion_dollar_underscore.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly on $_.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test code completion on $_`;
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test code completion on $_`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const { autocompletePopup } = jsterm;
 
   info(
     "Test that there's no issue when trying to do an autocompletion without last " +
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion_dollar_zero.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion_dollar_zero.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly on $0.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <title>$0 completion test</title>
 </head>
 <body>
   <div>
     <h1>$0 completion test</h1>
     <p>This is some example text</p>
   </div>
--- a/devtools/client/webconsole/test/browser/browser_jsterm_completion_perfect_match.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_completion_perfect_match.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that code completion works properly in regards to case sensitivity.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test completion perfect match.
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test completion perfect match.
   <script>
     x = Object.create(null, Object.getOwnPropertyDescriptors({
       foo: 1,
       foO: 2,
       fOo: 3,
       fOO: 4,
     }));
   </script>`;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_content_defined_helpers.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_content_defined_helpers.js
@@ -19,17 +19,17 @@ const HELPERS = [
   "help",
   "inspect",
   "keys",
   "screenshot",
   "values",
 ];
 
 // The page script sets a global function for each known helper (except print).
-const TEST_URI = `data:text/html,<meta charset=utf8>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>
   <script>
     const helpers = ${JSON.stringify(HELPERS)};
     for (const helper of helpers) {
       window[helper] = () => "${PREFIX}" + helper;
     }
   </script>`;
 
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_context_menu_labels.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_context_menu_labels.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that context menu for CodeMirror is properly localized.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<p>test page</p>`;
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test page</p>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
 
   const toolbox = await gDevTools.getToolboxForTab(gBrowser.selectedTab);
 
   // Open context menu and wait until it's visible
--- a/devtools/client/webconsole/test/browser/browser_jsterm_copy_command.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_copy_command.js
@@ -11,17 +11,17 @@ const text =
   "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
   "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
   "dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
   "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
   "proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +
   new Date();
 
 const id = "select-me";
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <body>
   <div>
     <h1>Testing copy command</h1>
     <p>This is some example text</p>
     <p id="${id}">${text}</p>
   </div>
   <div><p></p></div>
 </body>`;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_ctrl_a_select_all.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_ctrl_a_select_all.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Map Control + A to Select All, In the web console input
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Test console select all";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test console select all";
 
 add_task(async function() {
   // The TabContextMenu initializes its strings only on a focus or mouseover event.
   // Calls focus event on the TabContextMenu early in the test.
   gBrowser.selectedTab.focus();
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_ctrl_key_nav.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_ctrl_key_nav.js
@@ -5,17 +5,17 @@
 // see https://bugzilla.mozilla.org/show_bug.cgi?id=804845
 //
 // The shortcuts tested here have platform limitations:
 // - ctrl-e does not work on windows,
 // - ctrl-a, ctrl-p and ctrl-n only work on OSX
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for " +
   "bug 804845 and bug 619598";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   ok(!getInputValue(hud), "input is empty");
   checkInputCursorPosition(hud, 0, "Cursor is at the start of the input");
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_document_no_xray.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_document_no_xray.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html,Test evaluating document";
+const TEST_URI = "data:text/html,<!DOCTYPE html>Test evaluating document";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   // check for occurrences of Object XRayWrapper, bug 604430
   const { node } = await executeAndWaitForMessage(
     hud,
     "document",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <script>
 let x = 3, y = 4;
 function zzyzx() {
   x = 10;
 }
 function zzyzx2() {
   x = 10;
 }
--- a/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_element_highlight.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_element_highlight.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>
 <h1 class="title">hello</h1>
 <div id="mydiv">mydivtext</div>
 <script>
   x = Object.create(null, Object.getOwnPropertyDescriptors({
     a: document.querySelector("h1"),
     b: document.querySelector("div"),
     c: document.createElement("hr")
   }));
--- a/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_in_debugger_stackframe.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_in_debugger_stackframe.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Test that eager evaluation works as expected when paused in the debugger.
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <script>
 var x = "global";
 
 function pauseInDebugger(param) {
   let x = "local";
   debugger;
 }
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_warnings.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_eager_evaluation_warnings.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,Test that eager evaluation can't log warnings in the output`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Test that eager evaluation can't log warnings in the output`;
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   setInputValue(hud, `document.getElementById("")`);
   await waitForEagerEvaluationResult(hud, "null");
 
   info("Wait for a bit so a warning message could be displayed");
   await wait(2000);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that the editor is displayed as expected.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<p>Test editor";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html><p>Test editor";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", false);
 
   const tab = await addTab(TEST_URI);
   let hud = await openConsole(tab);
 
   info("Test that the editor mode is disabled when the pref is set to false");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_code_folding.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests for code folding appears in editor mode, does not appear in inline mode,
 // and that folded code does not remain folded when switched to inline mode.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1581641
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Test JsTerm editor code folding";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test JsTerm editor code folding";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Check that code folding gutter & arrow are rendered in editor mode");
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_disabled_history_nav_with_keyboard.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_disabled_history_nav_with_keyboard.js
@@ -3,17 +3,17 @@
 
 // Test that user input is not cleared when 'devtools.webconsole.input.editor'
 // is set to true.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1519313
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for bug 1519313";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 1519313";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const testExpressions = [
     "`Mozilla 😍 Firefox`",
     "`Firefox Devtools are awesome`",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_execute.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_execute.js
@@ -3,17 +3,17 @@
 
 // Test that user input is not cleared when 'devtools.webconsole.input.editor'
 // is set to true.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1519313
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for bug 1519313";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 1519313";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const expression = `x = 10`;
   setInputValue(hud, expression);
   await executeAndWaitForMessage(hud, undefined, "", ".result");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_execute_selection.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_execute_selection.js
@@ -3,17 +3,17 @@
 
 // Test that the user can execute only the code that is selected in the input, in editor
 // mode.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1576563
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for executing input selection";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for executing input selection";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const expression = `x = "first assignment";x;
     x = "second assignment";x;`;
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_gutter.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_gutter.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that CodeMirror's gutter in console input is displayed when
 // 'devtools.webconsole.input.editor' is true.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1519315
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Test JsTerm editor line gutters";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test JsTerm editor line gutters";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Check that the line numbers gutter is rendered when in editor layout");
   ok(
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_onboarding.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_onboarding.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the onboarding UI is displayed when first displaying the editor mode, and
 // that it can be permanentely dismissed.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1558417
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Test onboarding UI";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test onboarding UI";
 const EDITOR_UI_PREF = "devtools.webconsole.input.editor";
 const EDITOR_ONBOARDING_PREF = "devtools.webconsole.input.editorOnboarding";
 
 add_task(async function() {
   // Enable editor mode and force the onboarding pref to true so it's displayed.
   await pushPref(EDITOR_UI_PREF, true);
   await pushPref(EDITOR_ONBOARDING_PREF, true);
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_resize.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_resize.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the editor can be resized and that its width is persisted.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for editor resize";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for editor resize";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
   await pushPref("devtools.webconsole.input.editorOnboarding", false);
 
   // Reset editorWidth pref so we have steady results when running multiple times.
   await pushPref("devtools.webconsole.input.editorWidth", null);
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_button.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_reverse_search_button.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for bug 1567372";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 1567372";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Searching for `.webconsole-editor-toolbar`");
   const editorToolbar = hud.ui.outputNode.querySelector(
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_toggle_keyboard_shortcut.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_toggle_keyboard_shortcut.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that hitting Ctrl + B does toggle the editor mode.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1519105
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Test editor mode toggle keyboard shortcut";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test editor mode toggle keyboard shortcut";
 const EDITOR_PREF = "devtools.webconsole.input.editor";
 
 // See Bug 1631529
 requestLongerTimeout(2);
 
 add_task(async function() {
   // Start with the editor turned off
   await pushPref(EDITOR_PREF, false);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_editor_toolbar.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_editor_toolbar.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that the editor toolbar works as expected when in editor mode.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<p>Test editor toolbar";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>Test editor toolbar";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.input.editor", false);
 
   const tab = await addTab(TEST_URI);
   let hud = await openConsole(tab);
 
   info("Test that the toolbar is not displayed when in editor mode");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_error_docs.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_error_docs.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html,Test error documentation";
+const TEST_URI = "data:text/html,<!DOCTYPE html>Test error documentation";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   // Check that errors with entries in errordocs.js display links next to their messages.
   const ErrorDocs = require("devtools/server/actors/errordocs");
 
   const ErrorDocStatements = {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_error_outside_valid_range.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_error_outside_valid_range.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Ensure that dom errors, with error numbers outside of the range
 // of valid js.msg errors, don't cause crashes (See Bug 1270721).
 
-const TEST_URI = "data:text/html,Test error documentation";
+const TEST_URI = "data:text/html,<!DOCTYPE html>Test error documentation";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const text =
     "TypeError: Request constructor: 'foo' (value of 'redirect' member of RequestInit) is not a valid value " +
     "for enumeration RequestRedirect";
   await executeAndWaitForMessage(
--- a/devtools/client/webconsole/test/browser/browser_jsterm_file_load_save_keyboard_shortcut.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_file_load_save_keyboard_shortcut.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that the keyboard shortcut for loading/saving from the console input work as expected.
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Test load/save keyboard shortcut";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test load/save keyboard shortcut";
 const { FileUtils } = ChromeUtils.import(
   "resource://gre/modules/FileUtils.jsm"
 );
 const LOCAL_FILE_NAME = "snippet.js";
 const LOCAL_FILE_ORIGINAL_CONTENT = `"Hello from local file"`;
 const LOCAL_FILE_NEW_CONTENT = `"Hello from console input"`;
 
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_focus_reload.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that the console does not steal the focus when reloading a page, if the focus
 // is on the content page.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Focus test`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Focus test`;
 
 add_task(async function() {
   info("Testing that messages disappear on a refresh if logs aren't persisted");
   const hud = await openNewTabAndConsole(TEST_URI);
   is(isInputFocused(hud), true, "JsTerm is focused when opening the console");
 
   info("Put the focus on the content page");
   SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => content.focus());
--- a/devtools/client/webconsole/test/browser/browser_jsterm_helper_clear.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_helper_clear.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html,Test <code>clear()</code> jsterm helper";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html>Test <code>clear()</code> jsterm helper";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const onMessage = waitForMessage(hud, "message");
   SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.wrappedJSObject.console.log("message");
   });
--- a/devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html,
+const TEST_URI = `data:text/html,<!DOCTYPE html>
 <main>
   <ul>
     <li>First</li>
     <li>Second</li>
   </ul>
   <aside>Sidebar</aside>
 </main>
 `;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar_dollar.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar_dollar.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html,
+const TEST_URI = `data:text/html,<!DOCTYPE html>
 <main>
   <ul>
     <li>First</li>
     <li>Second</li>
   </ul>
   <aside>Sidebar</aside>
 </main>
 `;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar_x.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_helper_dollar_x.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html,
+const TEST_URI = `data:text/html,<!DOCTYPE html>
 <main>
   <ul>
     <li>First</li>
     <li>Second</li>
   </ul>
   <aside>Sidebar</aside>
 </main>
 `;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_helper_help.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_helper_help.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html,Test <code>help()</code> jsterm helper";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html>Test <code>help()</code> jsterm helper";
 const HELP_URL = "https://developer.mozilla.org/docs/Tools/Web_Console/Helpers";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   let openedLinks = 0;
   const oldOpenLink = hud.openLink;
   hud.openLink = url => {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_helper_keys_values.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_helper_keys_values.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html,Test <code>keys()</code> & <code>values()</code> jsterm helper";
+  "data:text/html,<!DOCTYPE html>Test <code>keys()</code> & <code>values()</code> jsterm helper";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   let message = await executeAndWaitForMessage(
     hud,
     "keys({a: 2, b:1})",
     `Array [ "a", "b" ]`,
--- a/devtools/client/webconsole/test/browser/browser_jsterm_hide_when_devtools_chrome_enabled_false.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_hide_when_devtools_chrome_enabled_false.js
@@ -38,17 +38,19 @@ add_task(async function() {
   // in the test.
   Services.prefs.setBoolPref("devtools.chrome.enabled", true);
 
   browserConsole = await BrowserConsoleManager.toggleBrowserConsole();
   objInspector = await logObject(browserConsole);
   testInputRelatedElementsAreVisibile(browserConsole);
   await testObjectInspectorPropertiesAreSet(objInspector);
 
-  const browserTab = await addTab("data:text/html;charset=utf8,hello world");
+  const browserTab = await addTab(
+    "data:text/html;charset=utf8,<!DOCTYPE html>hello world"
+  );
   webConsole = await openConsole(browserTab);
   objInspector = await logObject(webConsole);
   testInputRelatedElementsAreVisibile(webConsole);
   await testObjectInspectorPropertiesAreSet(objInspector);
 
   // Wait for the sourceMap worker target to be fully attached before closing the
   // Browser Console, otherwise this could lead to failures as the target tries to attach
   // while the connection is being destroyed.
--- a/devtools/client/webconsole/test/browser/browser_jsterm_history.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_history.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests the console history feature accessed via the up and down arrow keys.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=UTF-8,test";
+const TEST_URI = "data:text/html;charset=UTF-8,<!DOCTYPE html>test";
 const COMMANDS = ["document", "window", "window.location"];
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   jsterm.focus();
 
   for (const command of COMMANDS) {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_history_arrow_keys.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_history_arrow_keys.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bugs 594497 and 619598.
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for " +
   "bug 594497 and bug 619598";
 
 const TEST_VALUES = [
   "document",
   "window",
   "document.body",
   "document;\nwindow;\ndocument.body",
   "document.location",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_history_command.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_history_command.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests if the command history shows a table with the content we expected.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=UTF-8,test";
+const TEST_URI = "data:text/html;charset=UTF-8,<!DOCTYPE html>test";
 const COMMANDS = ["document", "window", "window.location"];
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   jsterm.focus();
 
   for (const command of COMMANDS) {
--- a/devtools/client/webconsole/test/browser/browser_jsterm_history_nav.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_history_nav.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // See Bug 660806. Check that history navigation with the UP/DOWN arrows does not trigger
 // autocompletion.
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>bug 660806 - history " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>bug 660806 - history " +
   "navigation must not show the autocomplete popup";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
   const popup = jsterm.autocompletePopup;
 
   // The autocomplete popup should never be displayed during the test.
--- a/devtools/client/webconsole/test/browser/browser_jsterm_history_persist.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_history_persist.js
@@ -4,17 +4,17 @@
 // Test that console command input is persisted across toolbox loads.
 // See Bug 943306.
 
 "use strict";
 
 requestLongerTimeout(2);
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for persisting history";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for persisting history";
 const INPUT_HISTORY_COUNT = 10;
 
 const {
   getHistoryEntries,
 } = require("devtools/client/webconsole/selectors/history");
 
 add_task(async function() {
   info("Setting custom input history pref to " + INPUT_HISTORY_COUNT);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_insert_tab_when_overflows_no_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_insert_tab_when_overflows_no_scroll.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Check that when the input overflows, inserting a tab doesn't not impact the
 // scroll position. See Bug 1578283.
 
 "use strict";
 
-const TEST_URI = "data:text/html,<meta charset=utf8>";
+const TEST_URI = "data:text/html,<!DOCTYPE html><meta charset=utf8>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const cmScroller = hud.ui.outputNode.querySelector(".CodeMirror-scroll");
 
   info("Fill in the input with a hundred lines to make it overflow");
   await setInputValue(hud, "x;\n".repeat(100));
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_inspect.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_inspect.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that the inspect() jsterm helper function works.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<p>test inspect() command";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>test inspect() command";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Test `inspect(window)`");
   // Add a global value so we can check it later.
   await executeAndWaitForMessage(
     hud,
--- a/devtools/client/webconsole/test/browser/browser_jsterm_instance_of.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_instance_of.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check instanceof correctness. See Bug 599940.
-const TEST_URI = "data:text/html,Test <code>instanceof</code> evaluation";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html>Test <code>instanceof</code> evaluation";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   let message = await executeAndWaitForMessage(
     hud,
     "[] instanceof Array",
     "true",
--- a/devtools/client/webconsole/test/browser/browser_jsterm_middle_click_paste.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_middle_click_paste.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that pasting clipboard content into input with middle-click works.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,Web Console test paste on middle-click`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test paste on middle-click`;
 
 add_task(async function() {
   await pushPref("devtools.selfxss.count", 5);
 
   // Enable pasting with middle-click.
   await pushPref("middlemouse.paste", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_jsterm_null_undefined.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_null_undefined.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html,Test evaluating null and undefined";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html>Test evaluating null and undefined";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   // Check that an evaluated null produces "null". See Bug 650780.
   let message = await executeAndWaitForMessage(hud, "null", "null", ".result");
   ok(message, "`null` returned the expected value");
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_popup_close_on_tab_switch.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_popup_close_on_tab_switch.js
@@ -1,20 +1,20 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the autocomplete popup closes on switching tabs. See bug 900448.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>bug 900448 - autocomplete " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>bug 900448 - autocomplete " +
   "popup closes on tab switch";
 const TEST_URI_NAVIGATE =
-  "data:text/html;charset=utf-8,<p>testing autocomplete closes";
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>testing autocomplete closes";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const popup = hud.jsterm.autocompletePopup;
   const popupShown = once(popup, "popup-opened");
 
   setInputValue(hud, "sc");
   EventUtils.sendString("r");
--- a/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_user.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_user.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that screenshot command works properly
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
   function screenshot() {
     console.log("contextScreen");
   }
 </script>`;
 
 add_task(async function() {
   await addTab(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_warnings.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_warnings.js
@@ -6,17 +6,17 @@
 
 "use strict";
 
 // The test times out on slow platforms (e.g. linux ccov)
 requestLongerTimeout(2);
 
 // We create a very big page here in order to make the :screenshot command fail on
 // purpose.
-const TEST_URI = `data:text/html;charset=utf8,
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>
    <style>
      body { margin:0; }
      .big { width:20000px; height:20000px; }
      .small { width:5px; height:5px; }
    </style>
    <div class="big"></div>
    <div class="small"></div>`;
 
--- a/devtools/client/webconsole/test/browser/browser_jsterm_selfxss.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_selfxss.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,<p>Test self-XSS protection</p>";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>Test self-XSS protection</p>";
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "clipboardHelper",
   "@mozilla.org/widget/clipboardhelper;1",
   "nsIClipboardHelper"
 );
 const WebConsoleUtils = require("devtools/client/webconsole/utils").Utils;
--- a/devtools/client/webconsole/test/browser/browser_jsterm_syntax_highlight_output.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_syntax_highlight_output.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Test syntax highlighted output";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test syntax highlighted output";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   // Syntax highlighting is implemented with a Custom Element:
   ok(
     hud.iframeWindow.customElements.get("syntax-highlighted"),
     "Custom Element exists"
--- a/devtools/client/webconsole/test/browser/browser_toolbox_console_new_process.js
+++ b/devtools/client/webconsole/test/browser/browser_toolbox_console_new_process.js
@@ -4,17 +4,17 @@
 
 // Test that when the multiprocess browser toolbox is used, console messages
 // from newly opened content processes appear.
 
 "use strict";
 
 requestLongerTimeout(4);
 
-const TEST_URI = `data:text/html,<meta charset=utf8>console API calls<script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>console API calls<script>
   console.log("Data Message");
 </script>`;
 
 const EXAMPLE_URI =
   "http://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-console.html";
 
 /* global gToolbox */
--- a/devtools/client/webconsole/test/browser/browser_webconsole_async_stack.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_async_stack.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that async stacktraces are displayed as expected.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
 function timeout(cb, delay) {
   setTimeout(cb, delay);
 }
 
 function promiseThen(cb) {
   Promise.resolve().then(cb);
 }
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js
@@ -3,17 +3,17 @@
 
 // Test to see if the cached messages are displayed when the console UI is opened.
 
 "use strict";
 
 // See Bug 1570524.
 requestLongerTimeout(2);
 
-const TEST_URI = `data:text/html,<meta charset=utf8><h1>Test cached messages</h1>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><h1>Test cached messages</h1>
   <style>
     h1 {
       color: cssColorBug611032;
     }
   </style>
   <script>
     function logException() {
       return new Promise(resolve => {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages_no_duplicate.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages_no_duplicate.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test to see if we don't get duplicated messages (cached and "live").
 // See Bug 1578138 for more information.
 
 "use strict";
 
 // Log 1 message every 50ms, until we reach 50 messages.
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
     var i = 0;
     var intervalId = setInterval(() => {
       if (i >= 50) {
         clearInterval(intervalId);
         intervalId = null;
         return;
       }
       console.log("startup message " + (++i));
--- a/devtools/client/webconsole/test/browser/browser_webconsole_certificate_messages.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_certificate_messages.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the Web Console shows weak crypto warnings (SHA-1 Certificate)
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Web Console weak crypto warnings test";
+  "data:text/html;charset=utf8,<!DOCTYPE html>Web Console weak crypto warnings test";
 const TEST_URI_PATH =
   "/browser/devtools/client/webconsole/test/" +
   "browser/test-certificate-messages.html";
 
 const SHA1_URL = "https://sha1ee.example.com" + TEST_URI_PATH;
 const SHA256_URL = "https://sha256ee.example.com" + TEST_URI_PATH;
 const TRIGGER_MSG = "If you haven't seen ssl warnings yet, you won't";
 const TLS_1_0_URL = "https://tls1.example.com" + TEST_URI_PATH;
--- a/devtools/client/webconsole/test/browser/browser_webconsole_clear_cache.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_clear_cache.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Check that clearing the output also clears the console cache.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Test clear cache<script>abcdef</script>";
+  "data:text/html;charset=utf8,<!DOCTYPE html>Test clear cache<script>abcdef</script>";
 const EXPECTED_REPORT = "ReferenceError: abcdef is not defined";
 
 add_task(async function() {
   const tab = await addTab(TEST_URI);
   let hud = await openConsole(tab);
 
   const CACHED_MESSAGE = "CACHED_MESSAGE";
   await logTextToConsole(hud, CACHED_MESSAGE);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js
@@ -3,17 +3,17 @@
 
 // When strings containing URLs are entered into the webconsole,
 // ensure that the output can be clicked to open those URLs.
 // This test only check that clicking on a link works as expected,
 // as the output is already tested in Reps (in Github).
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,Clickable URLS";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>Clickable URLS";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const currentTab = gBrowser.selectedTab;
 
   const firstURL = "http://example.com/";
   const secondURL = "http://example.com/?id=secondURL";
   SpecialPowers.spawn(
--- a/devtools/client/webconsole/test/browser/browser_webconsole_close_groups_after_navigation.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_close_groups_after_navigation.js
@@ -1,13 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
-const TEST_URI = `data:text/html;charset=utf8,<script>console.group('hello')</script>`;
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>console.group('hello')</script>`;
 
 add_task(async function() {
   // Enable persist logs
   await pushPref("devtools.webconsole.persistlog", true);
 
   info(
     "Open the console and wait for the console.group message to be rendered"
   );
--- a/devtools/client/webconsole/test/browser/browser_webconsole_close_sidebar.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_close_sidebar.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the sidebar is hidden for all methods of closing it.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>";
 
 add_task(async function() {
   // Should be removed when sidebar work is complete
   await pushPref("devtools.webconsole.sidebarToggle", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
   await showSidebar(hud);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_dir.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_dir.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check console.dir() calls.
-const TEST_URI = "data:text/html;charset=utf8,<h1>test console.dir</h1>";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>test console.dir</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   logAllStoreChanges(hud);
 
   info("console.dir on an array");
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Make sure that the Web Console output does not break after we try to call
 // console.dir() for objects that are not inspectable.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,test console.dir on uninspectable object";
+  "data:text/html;charset=utf8,<!DOCTYPE html>test console.dir on uninspectable object";
 const FIRST_LOG_MESSAGE = "fooBug773466a";
 const SECOND_LOG_MESSAGE = "fooBug773466b";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Logging a first message to make sure everything is working");
   await executeAndWaitForMessage(
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_error_expand_object.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_error_expand_object.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check console.error calls with expandable object.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>test console.error with objects</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>test console.error with objects</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const onMessagesLogged = waitForMessage(hud, "myError");
   SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.wrappedJSObject.console.error("myError", { a: "a", b: "b" });
   });
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_group_open_no_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_group_open_no_scroll.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that opening a group does not scroll the console output.
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
   Array.from({length: 100}, (_, i) => console.log("log-"+i));
   console.groupCollapsed("GROUP");
   console.log("in group");
 </script>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const outputScroller = hud.ui.outputScroller;
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_profile_unavailable.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_profile_unavailable.js
@@ -4,17 +4,18 @@
 "use strict";
 
 const {
   waitForRecordingStartedEvents,
   waitForRecordingStoppedEvents,
 } = require("devtools/client/performance/test/helpers/actions");
 
 // Check console.profile() shows a warning with the new performance panel.
-const TEST_URI = "data:text/html;charset=utf8,<h1>test console.profile</h1>";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>test console.profile</h1>";
 
 const EXPECTED_WARNING =
   "console.profile is not compatible with the new Performance recorder";
 
 add_task(async function consoleProfileWarningWithNewPerfPanel() {
   await pushPref("devtools.performance.new-panel-enabled", true);
   const hud = await openNewTabAndConsole(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_table_post_alterations.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_table_post_alterations.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that calling console.table on a variable which is modified after the
 // console.table call only shows data for when the variable was logged.
 
-const TEST_URI = `data:text/html,Test console.table with modified variable`;
+const TEST_URI = `data:text/html,<!DOCTYPE html>Test console.table with modified variable`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     const x = ["a", "b"];
     content.wrappedJSObject.console.table(x);
     x.push("c");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_console_trace_distinct.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_trace_distinct.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
     var bar = () => myFunc();
     var rab = () => myFunc();
     var myFunc = () => console.trace();
 
     bar();bar();
     rab();rab();
   </script>`;
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_context_menu_object_in_sidebar.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_context_menu_object_in_sidebar.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the "Open in sidebar" context menu entry is active for
 // the correct objects and opens the sidebar when clicked.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8," +
+  "data:text/html;charset=utf8,<!DOCTYPE html>" +
   `<script>
     console.log({a:1}, 100, {b:1}, 'foo', false, null, undefined);
 
     var error = new Error("oh my");
     error.customProperty = {code: 500, message: "Internal Server Error"};
     error.name = "CustomServerError";
     console.info(error);
   </script>`;
--- a/devtools/client/webconsole/test/browser/browser_webconsole_context_menu_reveal_in_inspector.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_context_menu_reveal_in_inspector.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test the "Reveal in Inspector" menu item of the webconsole is enabled only when
 // clicking on HTML elements attached to the DOM. Also check that clicking the menu
 // item or using the access-key Q does select the node in the inspector.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   <!DOCTYPE html>
   <html>
     <body></body>
     <script>
       console.log("foo");
       console.log({hello: "world"});
       console.log(document.createElement("span"));
       console.log(document.body.appendChild(document.createElement("div")));
--- a/devtools/client/webconsole/test/browser/browser_webconsole_csp_ignore_reflected_xss_message.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_csp_ignore_reflected_xss_message.js
@@ -9,17 +9,17 @@
 const EXPECTED_RESULT =
   "Not supporting directive \u2018reflected-xss\u2019. " +
   "Directive and values will be ignored.";
 const TEST_FILE =
   "http://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test_console_csp_ignore_reflected_xss_message.html";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Web Console CSP ignoring reflected XSS (bug 1045902)";
+  "data:text/html;charset=utf8,<!DOCTYPE html>Web Console CSP ignoring reflected XSS (bug 1045902)";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   await navigateTo(TEST_FILE);
 
   await waitFor(() => findMessage(hud, EXPECTED_RESULT, ".message.warn"));
   ok(
     true,
--- a/devtools/client/webconsole/test/browser/browser_webconsole_csp_violation.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_csp_violation.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the Web Console CSP messages for two META policies
 // are correctly displayed. See Bug 1247459.
 
 "use strict";
 
 add_task(async function() {
-  const TEST_URI = "data:text/html;charset=utf8,Web Console CSP violation test";
+  const TEST_URI =
+    "data:text/html;charset=utf8,<!DOCTYPE html>Web Console CSP violation test";
   const hud = await openNewTabAndConsole(TEST_URI);
   await clearOutput(hud);
   {
     const TEST_VIOLATION =
       "https://example.com/browser/devtools/client/webconsole/" +
       "test/browser/test-csp-violation.html";
     const CSP_VIOLATION_MSG =
       "Content Security Policy: The page\u2019s settings " +
--- a/devtools/client/webconsole/test/browser/browser_webconsole_cspro.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_cspro.js
@@ -11,17 +11,18 @@ So we expect a warning (image has been b
 The expected console messages in the constants CSP_VIOLATION_MSG and
 CSP_REPORT_MSG are confirmed to be found in the console messages.
 
 See Bug 1010953.
 */
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,Web Console CSP report only test";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html>Web Console CSP report only test";
 const TEST_VIOLATION =
   "http://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-cspro.html";
 const CSP_VIOLATION_MSG =
   "Content Security Policy: The page\u2019s settings blocked the loading of a resource " +
   "at http://some.example.com/cspro.png (\u201cimg-src\u201d).";
 const CSP_REPORT_MSG =
   "Content Security Policy: The page\u2019s settings observed the loading of a " +
--- a/devtools/client/webconsole/test/browser/browser_webconsole_css_error_impacted_elements.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_css_error_impacted_elements.js
@@ -19,17 +19,17 @@ httpServer.registerPathHandler(`/`, func
       </head>
       <body class="subframe">
         <h1 class="subframe">Hello</h1>
         <p class="subframe">sub-frame</p>
       </body>
     </html>`);
 });
 
-const TEST_URI = `data:text/html,<meta charset=utf8>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>
   <style>
     button {
       cursor: unknownCursor;
     }
   </style>
   <button id=1>Button 1</button>
   <button id=2>Button 2</button>
   <iframe src="http://localhost:${httpServer.identity.primaryPort}/"></iframe>
--- a/devtools/client/webconsole/test/browser/browser_webconsole_document_focus.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_document_focus.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that focus is restored to content page after closing the console. See Bug 588342.
 const TEST_URI =
-  "data:text/html;charset=utf-8,Test content focus after closing console";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Test content focus after closing console";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Focus after console is opened");
   ok(isInputFocused(hud), "input node is focused after console is opened");
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
@@ -59,17 +59,17 @@ add_task(async function testSeparateWind
   ok(isFocused, "content document has focus after closing the console");
 });
 
 add_task(async function testSeparateWindowToolboxInactiveTab() {
   await openNewTabAndConsole(TEST_URI, true, "window");
 
   info("Focus after console is opened");
   const firstTab = gBrowser.selectedTab;
-  await addTab(`data:text/html,<meta charset=utf8>New tab XXX`);
+  await addTab(`data:text/html,<!DOCTYPE html><meta charset=utf8>New tab XXX`);
 
   await SpecialPowers.spawn(firstTab.linkedBrowser, [], async () => {
     // For some reason, there is no blur event fired on the document
     await ContentTaskUtils.waitForCondition(
       () => !content.browsingContext.isActive && !content.document.hasFocus(),
       "Waiting for first tab to become inactive"
     );
     content.onFocus = new Promise(resolve => {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_error_with_longstring_stack.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_error_with_longstring_stack.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check if an error with a longString stack is displayed as expected.
 
 "use strict";
 
 const MESSAGE = "Error with longString stack";
-const TEST_URI = `data:text/html;charset=utf8,<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
   const x = new Error("longString stack");
   x.stack = "s@http://exampl.com:1:1\\n".repeat(1000);
   console.log("${MESSAGE}", x);
 </script>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_error_with_unicode.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_error_with_unicode.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check if an error with Unicode characters is reported correctly.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<script>\u6e2c</script>";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><script>\u6e2c</script>";
 const EXPECTED_REPORT = "ReferenceError: \u6e2c is not defined";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   // On e10s, the exception is triggered in child process
   // and is ignored by test harness
   if (!Services.appinfo.browserTabsRemoteAutostart) {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_error_with_url.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_error_with_url.js
@@ -4,17 +4,17 @@
 // Check if an error with Unicode characters is reported correctly.
 
 "use strict";
 
 const longParam = "0".repeat(200);
 const url1 = `https://example.com?v=${longParam}`;
 const url2 = `https://example.org?v=${longParam}`;
 
-const TEST_URI = `data:text/html;charset=utf8,<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
   throw "Visit \u201c${url1}\u201d or \u201c${url2}\u201d to get more " +
         "information on this error.";
 </script>`;
 const { ELLIPSIS } = require("devtools/shared/l10n");
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_filter_navigation_marker.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_filter_navigation_marker.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that filters don't affect navigation markers.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   <p>Web Console test for navigation marker filtering.</p>
   <script>console.log("hello " + "world");</script>`;
 
 add_task(async function() {
   // Enable persist log
   await pushPref("devtools.webconsole.persistlog", true);
 
   const hud = await openNewTabAndConsole(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_filter_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_filter_scroll.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   <p>Web Console test for scroll when filtering.</p>
   <script>
   for (let i = 0; i < 100; i++) {
     console.log("init-" + i);
   }
   </script>
 `;
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_highlighter_console_helper.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_highlighter_console_helper.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the $0 console helper works as intended. See Bug 653531.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
 <head>
   <title>Inspector Tree Selection Test</title>
 </head>
 <body>
   <div>
     <h1>Inspector Tree Selection Test</h1>
     <p>This is some example text</p>
     <p>${loremIpsum()}</p>
--- a/devtools/client/webconsole/test/browser/browser_webconsole_hsts_invalid-headers.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_hsts_invalid-headers.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that errors about invalid HSTS security headers are logged to the web console.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console HSTS invalid header test";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console HSTS invalid header test";
 const SJS_URL =
   "https://example.com/browser/devtools/client/webconsole/" +
   "/test/browser/test_hsts-invalid-headers.sjs";
 const LEARN_MORE_URI =
   "https://developer.mozilla.org/docs/Web/HTTP/Headers/" +
   "Strict-Transport-Security" +
   DOCS_GA_PARAMS;
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_input_field_focus_on_panel_select.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_input_field_focus_on_panel_select.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the JS input field is focused when the user switches back to the
 // web console from other tools, see bug 891581.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf8,<p>Test console input focus";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><p>Test console input focus";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Focus after console is opened");
   ok(isInputFocused(hud), "input is focused after console is opened");
 
   const filterInput = getFilterInput(hud);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the input field is focused when the console is opened.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,Test input focused
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Test input focused
   <script>
     console.log("console message 1");
   </script>`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Focus after console is opened");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_inspect_cross_domain_object.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_inspect_cross_domain_object.js
@@ -21,17 +21,19 @@ add_task(async function() {
   let hud, node;
   if (isFissionEnabled()) {
     // When fission is enabled, we might miss the early message emitted while the target
     // is being switched, so here we directly open the "real" test URI. See Bug 1614291.
     hud = await openNewTabAndConsole(TEST_URI);
     info("Wait for the 'foobar' message to be logged by the frame");
     node = await waitFor(() => findMessage(hud, "foobar"));
   } else {
-    hud = await openNewTabAndConsole("data:text/html;charset=utf8,<p>hello");
+    hud = await openNewTabAndConsole(
+      "data:text/html;charset=utf8,<!DOCTYPE html><p>hello"
+    );
     info(
       "Navigate and wait for the 'foobar' message to be logged by the frame"
     );
     const onMessage = waitForMessage(hud, "foobar");
     await navigateTo(TEST_URI);
     ({ node } = await onMessage);
   }
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_limit_multiline.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_limit_multiline.js
@@ -14,17 +14,17 @@ const SMALL_EXPRESSION = `function fib(n
   return fib(n-1) + fib(n-2);
 }`;
 
 const LONG_EXPRESSION = `${SMALL_EXPRESSION}
 fib(3);`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(
-    "data:text/html,<meta charset=utf8>Test multi-line commands expandability"
+    "data:text/html,<!DOCTYPE html><meta charset=utf8>Test multi-line commands expandability"
   );
   info("Test that we don't slice messages with <= 5 lines");
   const message = await executeAndWaitForMessage(
     hud,
     SMALL_EXPRESSION,
     "function fib"
   );
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_logErrorInPage.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_logErrorInPage.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that we can log a message to the web console from the toolbox.
 
-const TEST_URI = "data:text/html;charset=utf-8,<p>test logErrorInPage";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>test logErrorInPage";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const toolbox = hud.ui.wrapper.toolbox;
 
   toolbox.target.logErrorInPage("beware the octopus", "content javascript");
 
   const node = await waitFor(() => findMessage(hud, "octopus"));
--- a/devtools/client/webconsole/test/browser/browser_webconsole_logWarningInPage.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_logWarningInPage.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that we can log warning message to the web console from the toolbox.
 
-const TEST_URI = "data:text/html;charset=utf-8,<p>test logErrorInPage";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>test logErrorInPage";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const toolbox = hud.ui.wrapper.toolbox;
 
   toolbox.target.logWarningInPage("beware the octopus", "content javascript");
 
   const node = await waitFor(() => findMessage(hud, "octopus"));
--- a/devtools/client/webconsole/test/browser/browser_webconsole_loglimit.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_loglimit.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that messages are properly updated when the log limit is reached.
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for " +
   "Old messages are removed after passing devtools.hud.loglimit";
 
 add_task(async function() {
   await pushPref("devtools.hud.loglimit", 140);
   const hud = await openNewTabAndConsole(TEST_URI);
   await clearOutput(hud);
 
   let onMessage = waitForMessage(hud, "test message [149]");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_longstring.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_longstring.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that very long strings can be expanded and collapsed, and do not hang the browser.
 
 "use strict";
 
-const TEST_URI = "data:text/html,<meta charset=utf8>Test LongString hang";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html><meta charset=utf8>Test LongString hang";
 
 const LONGSTRING = `foobar${"a".repeat(
   9000
 )}foobaz${"abbababazomglolztest".repeat(100)}boom!`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_longstring_getter.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_longstring_getter.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that getter properties that return long strings can be expanded. See Bug 1481833.
 
 "use strict";
 
 const LONGSTRING = "a ".repeat(10000);
-const TEST_URI = `data:text/html,Test expanding longString getter property
+const TEST_URI = `data:text/html,<!DOCTYPE html>Test expanding longString getter property
   <svg>
     <image xlink:href="data:image/png;base64,${LONGSTRING}"></image>
   </svg>
   <script>
     console.dir("Test message", document.querySelector("svg image").href);
   </script>`;
 
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_message_categories.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_message_categories.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that messages are logged and observed with the correct category. See Bug 595934.
 const { MESSAGE_CATEGORY } = require("devtools/shared/constants");
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console test for " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for " +
   "bug 595934 - message categories coverage.";
 const TESTS_PATH =
   "https://example.com/browser/devtools/client/webconsole/test/browser/";
 const TESTS = [
   {
     // #0
     file: "test-message-categories-css-loader.html",
     category: "CSS Loader",
--- a/devtools/client/webconsole/test/browser/browser_webconsole_mime_css_blocked.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_mime_css_blocked.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that non-CSS parser errors get displayed by default.
 
 "use strict";
 
 const CSS_URI = "data:text/bogus,foo";
-const TEST_URI = `data:text/html,<!doctype html><link rel="stylesheet" href="${CSS_URI}">`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><link rel="stylesheet" href="${CSS_URI}">`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const MSG = `The stylesheet ${CSS_URI} was not loaded because its MIME type, “text/bogus”, is not “text/css”`;
   await waitFor(() => findMessage(hud, MSG, ".message.error"), "", 100);
   ok(true, "MIME type error displayed");
 });
--- a/devtools/client/webconsole/test/browser/browser_webconsole_multiple_windows_and_tabs.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_multiple_windows_and_tabs.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the Web Console doesn't leak when multiple tabs and windows are
 // opened and then closed. See Bug 595350.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 595350";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 595350";
 
 add_task(async function() {
   requestLongerTimeout(3);
   // Bug 1518138: GC heuristics are broken for this test, so that the test
   // ends up running out of memory. Try to work-around the problem by GCing
   // before the test begins.
   Cu.forceShrinkingGC();
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_navigate_to_parse_error.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_navigate_to_parse_error.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that ensure CSP 'navigate-to' does not parse.
 // Bug 1566149
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Web Console navigate-to parse error test";
+  "data:text/html;charset=utf8,<!DOCTYPE html>Web Console navigate-to parse error test";
 const TEST_VIOLATION =
   "https://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-navigate-to-parse-error.html";
 
 const CSP_VIOLATION_MSG =
   "Content Security Policy: Couldn\u2019t process unknown directive \u2018navigate-to\u2019";
 
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_network_exceptions.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_network_exceptions.js
@@ -1,17 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that we report JS exceptions in event handlers coming from
 // network requests, like onreadystate for XHR. See bug 618078.
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 618078";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 618078";
 const TEST_URI2 =
   "https://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-network-exceptions.html";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   // On e10s, the exception is triggered in child process
--- a/devtools/client/webconsole/test/browser/browser_webconsole_network_messages_openinnet.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_network_messages_openinnet.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Test that 'Open in Network Panel' " +
+  "data:text/html;charset=utf8,<!DOCTYPE html>Test that 'Open in Network Panel' " +
   "context menu item opens the selected request in netmonitor panel.";
 
 const TEST_FILE = "test-network-request.html";
 const JSON_TEST_URL = "test-network-request.html";
 const TEST_PATH =
   "https://example.com/browser/devtools/client/webconsole/test/browser/";
 
 const NET_PREF = "devtools.webconsole.filter.net";
--- a/devtools/client/webconsole/test/browser/browser_webconsole_network_messages_resend_request.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_network_messages_resend_request.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Test that 'Resend Request' context menu " +
+  "data:text/html;charset=utf8,<!DOCTYPE html>Test that 'Resend Request' context menu " +
   "item resends the selected request and select it in netmonitor panel.";
 
 const TEST_FILE = "test-network-request.html";
 const TEST_PATH =
   "https://example.com/browser/devtools/client/webconsole/test/browser/";
 
 registerCleanupFunction(async function() {
   await new Promise(resolve => {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_network_reset_filter.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_network_reset_filter.js
@@ -3,17 +3,17 @@
 
 // Tests that network log messages bring up the network panel and select the
 // right request even if it was previously filtered off.
 
 "use strict";
 
 const TEST_PATH =
   "https://example.com/browser/devtools/client/webconsole/" + "test/browser/";
-const TEST_URI = "data:text/html;charset=utf8,<p>test file URI";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html><p>test file URI";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.filter.net", true);
 
   const toolbox = await openNewTabAndToolbox(TEST_URI, "webconsole");
   const hud = toolbox.getCurrentPanel().hud;
 
   const onMessages = waitForMessages({
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the ObjectInspector is rendered correctly in the sidebar.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,<script>
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>
     console.log({
       a:1,
       b:2,
       c:[3]
     });
   </script>`;
 
 add_task(async function() {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_in_sidebar_keyboard_nav.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_in_sidebar_keyboard_nav.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the ObjectInspector in the sidebar can be navigated with the keyboard.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>
   <script>
     console.log({
       a:1,
       b:2,
       c: Array.from({length: 100}, (_, i) => i)
     });
   </script>`;
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check expanding/collapsing object inspector in the console.
-const TEST_URI = "data:text/html;charset=utf8,<h1>test Object Inspector</h1>";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>test Object Inspector</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   logAllStoreChanges(hud);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.wrappedJSObject.console.log("oi-test", [1, 2, { a: "a", b: "b" }], {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector__proto__.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector__proto__.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check displaying object with __proto__ in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>test Object Inspector __proto__</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>test Object Inspector __proto__</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   logAllStoreChanges(hud);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     const obj = Object.create(null);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_entries.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_entries.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check expanding/collapsing maps and sets in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>Object Inspector on Maps & Sets</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>Object Inspector on Maps & Sets</h1>";
 const { ELLIPSIS } = require("devtools/shared/l10n");
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   logAllStoreChanges(hud);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check evaluating and expanding getters in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>Object Inspector on Getters</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>Object Inspector on Getters</h1>";
 const { ELLIPSIS } = require("devtools/shared/l10n");
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const LONGSTRING = "ab ".repeat(1e5);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [LONGSTRING], function(
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters_prototype.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters_prototype.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check evaluating getters on prototype nodes in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>Object Inspector on Getters</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>Object Inspector on Getters</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     class A {
       constructor() {
         this.myValue = "foo";
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters_shadowed.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_getters_shadowed.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check evaluating shadowed getters in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8,<h1>Object Inspector on Getters</h1>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>Object Inspector on Getters</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     const a = {
       getter: "[A]",
       __proto__: {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_key_sorting.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_key_sorting.js
@@ -16,17 +16,17 @@
  *  - Uint8Array
  *  - Uint16Array
  *  - Uint32Array
  *  - Uint8ClampedArray
  *  - Float32Array
  *  - Float64Array
  */
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   <html>
     <head>
       <title>Test document for bug 977500</title>
     </head>
     <body>
     <div></div> <div></div> <div></div>
     <div></div> <div></div> <div></div>
     <div></div> <div></div> <div></div>
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_nested_promise.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_nested_promise.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check evaluating and expanding promises in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8," +
+  "data:text/html;charset=utf8,<!DOCTYPE html>" +
   "<h1>Object Inspector on deeply nested promises</h1>";
 
 add_task(async function testExpandNestedPromise() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     let nestedPromise = Promise.resolve({});
     for (let i = 5; i > 0; --i) {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_nested_proxy.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_nested_proxy.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check evaluating and expanding getters in the console.
 const TEST_URI =
-  "data:text/html;charset=utf8," +
+  "data:text/html;charset=utf8,<!DOCTYPE html>" +
   "<h1>Object Inspector on deeply nested proxies</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     let proxy = new Proxy({}, {});
     for (let i = 0; i < 1e5; ++i) {
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_private_properties.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_private_properties.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check expanding/collapsing object with symbol properties in the console.
-const TEST_URI = "data:text/html;charset=utf8,";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     class MyClass {
       constructor(isParent = true) {
         this.publicProperty = "public property";
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_scroll.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that expanding an objectInspector node doesn't alter the output scroll position.
-const TEST_URI = "data:text/html;charset=utf8,test Object Inspector";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html>test Object Inspector";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.wrappedJSObject.console.log(
       "oi-test",
       content.wrappedJSObject.Math
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_selected_text.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_selected_text.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check expanding/collapsing object inspector in the console when text is selected.
-const TEST_URI = "data:text/html;charset=utf8,<h1>test Object Inspector</h1>";
+const TEST_URI =
+  "data:text/html;charset=utf8,<!DOCTYPE html><h1>test Object Inspector</h1>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const label = "oi-test";
   const onLoggedMessage = waitForMessage(hud, label);
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [label], function(str) {
     content.wrappedJSObject.console.log(str, [1, 2, 3]);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_symbols.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_inspector_symbols.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check expanding/collapsing object with symbol properties in the console.
-const TEST_URI = "data:text/html;charset=utf8,";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
     content.wrappedJSObject.console.log("oi-symbols-test", {
       [Symbol()]: "first symbol",
       [Symbol()]: "second symbol",
--- a/devtools/client/webconsole/test/browser/browser_webconsole_observer_notifications.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_observer_notifications.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>Web Console test for " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>Web Console test for " +
   "observer notifications";
 
 let created = false;
 let destroyed = false;
 
 add_task(async function() {
   setupObserver();
   await openNewTabAndConsole(TEST_URI);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_output_copy.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_output_copy.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test copy to clipboard on the console output. See Bug 587617.
-const TEST_URI = "data:text/html,Test copy to clipboard on the console output";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html>Test copy to clipboard on the console output";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const smokeMessage = "Hello world!";
   const onMessage = waitForMessage(hud, smokeMessage);
   SpecialPowers.spawn(gBrowser.selectedBrowser, [smokeMessage], function(msg) {
     content.wrappedJSObject.console.log(msg);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_persist.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_persist.js
@@ -65,19 +65,19 @@ add_task(async function() {
   ok(true, "Messages disappeared");
 
   await closeToolbox();
 });
 
 add_task(async function() {
   info("Testing that messages disappear on bfcache navigations");
   const firstLocation =
-    "data:text/html,<script>console.log('first document load');window.onpageshow=()=>console.log('first document show');</script>";
+    "data:text/html,<!DOCTYPE html><script>console.log('first document load');window.onpageshow=()=>console.log('first document show');</script>";
   const secondLocation =
-    "data:text/html,<script>console.log('second document load');window.onpageshow=()=>console.log('second document show');</script>";
+    "data:text/html,<!DOCTYPE html><script>console.log('second document load');window.onpageshow=()=>console.log('second document show');</script>";
   const hud = await openNewTabAndConsole(firstLocation);
 
   info("Wait for first page messages");
   // Look into .message-body as the default selector also include the frame,
   // which is the document url, which also include the logged string...
   await waitFor(
     () =>
       findMessages(hud, "first document load", ".message-body").length === 1 &&
--- a/devtools/client/webconsole/test/browser/browser_webconsole_promise_rejected_object.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_promise_rejected_object.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that rejected promise are reported to the console.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   <script>
     function createRejectedPromise(reason) {
       new Promise(function promiseCb(_, reject) {
         setTimeout(function setTimeoutCb(){
           reject(reason);
         }, 0);
       });
     }
--- a/devtools/client/webconsole/test/browser/browser_webconsole_repeat_different_objects.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_repeat_different_objects.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that makes sure messages are not considered repeated when console.log()
 // is invoked with different objects, see bug 865288.
 
 "use strict";
 
-const TEST_URI = "data:text/html,Test repeated objects";
+const TEST_URI = "data:text/html,<!DOCTYPE html>Test repeated objects";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const onMessages = waitForMessages({
     hud,
     messages: [{ text: "abba" }, { text: "abba" }, { text: "abba" }],
   });
--- a/devtools/client/webconsole/test/browser/browser_webconsole_responsive_design_mode.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_responsive_design_mode.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that messages are displayed in the console when RDM is enabled
 
-const TEST_URI = "data:text/html,<meta charset=utf8>Test logging in RDM";
+const TEST_URI =
+  "data:text/html,<!DOCTYPE html><meta charset=utf8>Test logging in RDM";
 
 const ResponsiveUIManager = require("devtools/client/responsive/manager");
 const message = require("devtools/client/responsive/utils/message");
 
 add_task(async function() {
   const tab = await addTab(TEST_URI);
 
   // Use a local file for the device list, otherwise the panel tries to reach an external
--- a/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Tests reverse search features.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse search`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse search`;
 const isMacOS = AppConstants.platform === "macosx";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const jstermHistory = [
     `document`,
     `Dog = "Snoopy"`,
--- a/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_initial_value.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_initial_value.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Tests reverse search features.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse search initial value`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse search initial value`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   const { jsterm } = hud;
 
   const jstermHistory = [
     `Dog = "Snoopy"`,
     `document
--- a/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_keyboard_navigation.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_keyboard_navigation.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Tests reverse search results keyboard navigation.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse search`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse search`;
 const isMacOS = AppConstants.platform === "macosx";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const jstermHistory = [
     `document`,
     `document
--- a/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_mouse_navigation.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_mouse_navigation.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Tests reverse search results mouse navigation.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse search`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse search`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const jstermHistory = [
     `document`,
     `document
        .querySelectorAll("span")
--- a/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_toggle.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_reverse_search_toggle.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Tests showing and hiding the reverse search UI.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse search toggle`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse search toggle`;
 const isMacOS = AppConstants.platform === "macosx";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Close the reverse search UI with ESC");
   await openReverseSearch(hud);
   let onReverseSearchUiClose = waitFor(
--- a/devtools/client/webconsole/test/browser/browser_webconsole_script_errordoc_urls.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_script_errordoc_urls.js
@@ -2,20 +2,20 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Ensure that [Learn More] links appear alongside any errors listed
 // in "errordocs.js". Note: this only tests script execution.
 
 "use strict";
 
 const ErrorDocs = require("devtools/server/actors/errordocs");
-const TEST_URI = "data:text/html;charset=utf8,errordoc tests";
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>errordoc tests";
 
 function makeURIData(script) {
-  return `data:text/html;charset=utf8,<script>${script}</script>`;
+  return `data:text/html;charset=utf8,<!DOCTYPE html><script>${script}</script>`;
 }
 
 const TestData = [
   {
     jsmsg: "JSMSG_READ_ONLY",
     script:
       "'use strict'; (Object.freeze({name: 'Elsa', score: 157})).score = 0;",
     isException: true,
--- a/devtools/client/webconsole/test/browser/browser_webconsole_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_scroll.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,<p>Web Console test for  scroll.</p>
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html><p>Web Console test for  scroll.</p>
   <script>
     var a = () => b();
     var b = () => c();
     var c = () => console.trace("trace in C");
 
     for (let i = 0; i < 100; i++) {
       if (i % 10 === 0) {
         c();
--- a/devtools/client/webconsole/test/browser/browser_webconsole_show_subresource_security_errors.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_show_subresource_security_errors.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Ensure non-toplevel security errors are displayed
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,Web Console subresource STS warning test";
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console subresource STS warning test";
 const TEST_DOC =
   "https://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-subresource-security-error.html";
 const SAMPLE_MSG = "specified a header that could not be parsed successfully.";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
   await clearOutput(hud);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_shows_reqs_from_netmonitor.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_shows_reqs_from_netmonitor.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Test that the netmonitor " +
+  "data:text/html;charset=utf8,<!DOCTYPE html>Test that the netmonitor " +
   "displays requests that have been recorded in the " +
   "web console, even if the netmonitor hadn't opened yet.";
 
 const TEST_FILE = "test-network-request.html";
 const TEST_PATH =
   "https://example.com/browser/devtools/client/webconsole/" +
   "test/browser/" +
   TEST_FILE;
--- a/devtools/client/webconsole/test/browser/browser_webconsole_shows_reqs_in_netmonitor.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_shows_reqs_in_netmonitor.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8,Test that the web console " +
+  "data:text/html;charset=utf8,<!DOCTYPE html>Test that the web console " +
   "displays requests that have been recorded in the " +
   "netmonitor, even if the console hadn't opened yet.";
 
 const TEST_FILE = "test-network-request.html";
 const TEST_PATH =
   "https://example.com/browser/devtools/client/webconsole/test/browser/" +
   TEST_FILE;
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_object_expand_when_message_pruned.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_object_expand_when_message_pruned.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Test that an object in the sidebar can still be expanded after the message where it was
 // logged is pruned.
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf8," +
+  "data:text/html;charset=utf8,<!DOCTYPE html>" +
   "<script>console.log({a:1,b:2,c:[3,4,5]});</script>";
 
 add_task(async function() {
   // Should be removed when sidebar work is complete (Bug 1447235)
   await pushPref("devtools.webconsole.sidebarToggle", true);
   // Set the loglimit to 1 so message gets pruned as soon as another message is displayed.
   await pushPref("devtools.hud.loglimit", 1);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the sidebar can be scrolled.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf8,Test sidebar scroll`;
+const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>Test sidebar scroll`;
 
 add_task(async function() {
   // Should be removed when sidebar work is complete
   await pushPref("devtools.webconsole.sidebarToggle", true);
   const isMacOS = Services.appinfo.OS === "Darwin";
 
   const hud = await openNewTabAndConsole(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_split.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_split.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for splitting";
+const TEST_URI =
+  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for splitting";
 const { LocalizationHelper } = require("devtools/shared/l10n");
 const L10N = new LocalizationHelper(
   "devtools/client/locales/toolbox.properties"
 );
 
 // Test is slow on Linux EC2 instances - Bug 962931
 requestLongerTimeout(4);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_split_close_button.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_split_close_button.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>Web Console test for close button of " +
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>Web Console test for close button of " +
   "split console";
 
 add_task(async function() {
   const toolbox = await openNewTabAndToolbox(TEST_URI, "inspector");
 
   info("Check the split console toolbar has a close button.");
 
   const onSplitConsoleReady = toolbox.once("webconsole-ready");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_split_escape_key.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>Web Console test for splitting";
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>Web Console test for splitting";
 
 add_task(async function() {
   info(
     "Test various cases where the escape key should hide the split console."
   );
 
   const toolbox = await openNewTabAndToolbox(TEST_URI, "inspector");
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_split_focus.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_split_focus.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>Web Console test for splitting</p>";
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>Web Console test for splitting</p>";
 
 add_task(async function() {
   info(
     "Test that the split console input is focused and restores the focus properly."
   );
 
   const toolbox = await openNewTabAndToolbox(TEST_URI, "inspector");
   ok(!toolbox.splitConsole, "Split console is hidden by default");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_split_persist.js
@@ -6,17 +6,17 @@
 // Test that the split console state is persisted.
 
 const { LocalizationHelper } = require("devtools/shared/l10n");
 const L10N = new LocalizationHelper(
   "devtools/client/locales/toolbox.properties"
 );
 
 const TEST_URI =
-  "data:text/html;charset=utf-8,<p>Web Console test for splitting</p>";
+  "data:text/html;charset=utf-8,<!DOCTYPE html><p>Web Console test for splitting</p>";
 
 add_task(async function() {
   info("Opening a tab while there is no user setting on split console pref");
   let toolbox = await openNewTabAndToolbox(TEST_URI, "inspector");
   ok(!toolbox.splitConsole, "Split console is hidden by default");
   ok(
     !(await doesMenuSayHide(toolbox)),
     "Split console menu item says split by default"
--- a/devtools/client/webconsole/test/browser/browser_webconsole_strict_mode_errors.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_strict_mode_errors.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Check that "use strict" JS errors generate errors, not warnings.
 
 "use strict";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(
-    "data:text/html;charset=utf8,empty page"
+    "data:text/html;charset=utf8,<!DOCTYPE html>empty page"
   );
 
   await loadScriptURI("'use strict';var arguments;");
   await waitForError(
     hud,
     "SyntaxError: 'arguments' can't be defined or assigned to in strict mode code"
   );
 
@@ -35,11 +35,14 @@ async function waitForError(hud, text) {
 }
 
 function loadScriptURI(script) {
   // On e10s, the exception is triggered in child process
   // and is ignored by test harness
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
-  const uri = "data:text/html;charset=utf8,<script>" + script + "</script>";
+  const uri =
+    "data:text/html;charset=utf8,<!DOCTYPE html><script>" +
+    script +
+    "</script>";
   return navigateTo(uri);
 }
--- a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js
@@ -6,17 +6,17 @@
 const {
   STUBS_UPDATE_ENV,
   getCleanedPacket,
   getSerializedPacket,
   getStubFile,
   writeStubsToFile,
 } = require(`${CHROME_URL_ROOT}stub-generator-helpers`);
 
-const TEST_URI = "data:text/html;charset=utf-8,stub generation";
+const TEST_URI = "data:text/html;charset=utf-8,<!DOCTYPE html>stub generation";
 const STUB_FILE = "evaluationResult.js";
 
 add_task(async function() {
   const isStubsUpdate = env.get(STUBS_UPDATE_ENV) == "true";
   info(`${isStubsUpdate ? "Update" : "Check"} ${STUB_FILE}`);
 
   const generatedStubs = await generateEvaluationResultStubs();
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_execute_js.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_execute_js.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Tests that the console record the execute_js telemetry event with expected data
 // when evaluating expressions.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test execute_js telemetry event`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test execute_js telemetry event`;
 const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
 
 add_task(async function() {
   // Let's reset the counts.
   Services.telemetry.clearEvents();
 
   // Ensure no events have been logged
   const snapshot = Services.telemetry.snapshotEvents(ALL_CHANNELS, true);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_filters_changed.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_filters_changed.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests the filters_changed telemetry event.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
   console.log("test message");
 </script>`;
 
 const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
 
 add_task(async function() {
   // Let's reset the counts.
   Services.telemetry.clearEvents();
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_js_errors.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_js_errors.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests the DEVTOOLS_JAVASCRIPT_ERROR_DISPLAYED telemetry event.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>document()</script>`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>document()</script>`;
 
 add_task(async function() {
   startTelemetry();
 
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info(
     "Check that the error message is logged in telemetry with the expected key"
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_jump_to_definition.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_jump_to_definition.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests the jump_to_definition telemetry event.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
   function x(){}
   console.log("test message", x);
 </script>`;
 
 const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
 
 add_task(async function() {
   // Let's reset the counts.
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_object_expanded.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_object_expanded.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests the object_expanded telemetry event.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
   console.log("test message", [1,2,3]);
 </script>`;
 
 const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
 
 add_task(async function() {
   // Let's reset the counts.
   Services.telemetry.clearEvents();
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_persist_toggle_changed.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_persist_toggle_changed.js
@@ -4,17 +4,17 @@
 // Tests the log persistence telemetry event
 
 "use strict";
 
 const { TelemetryTestUtils } = ChromeUtils.import(
   "resource://testing-common/TelemetryTestUtils.jsm"
 );
 
-const TEST_URI = `data:text/html,<meta charset=utf8><script>
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8><script>
   console.log("test message");
 </script>`;
 
 add_task(async function() {
   // Let's reset the counts.
   Services.telemetry.clearEvents();
 
   // Ensure no events have been logged
--- a/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_reverse_search.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_telemetry_reverse_search.js
@@ -5,17 +5,17 @@
 // on open, navigate forward, navigate back and evaluate expression.
 
 "use strict";
 
 const { TelemetryTestUtils } = ChromeUtils.import(
   "resource://testing-common/TelemetryTestUtils.jsm"
 );
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse_search telemetry event`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse_search telemetry event`;
 const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
 const isMacOS = AppConstants.platform === "macosx";
 
 add_task(async function() {
   // Let's reset the counts.
   Services.telemetry.clearEvents();
 
   // Ensure no events have been logged
--- a/devtools/client/webconsole/test/browser/browser_webconsole_time_methods.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_time_methods.js
@@ -5,25 +5,25 @@
 
 "use strict";
 
 const TEST_URI =
   "http://example.com/browser/devtools/client/webconsole/" +
   "test/browser/test-time-methods.html";
 
 const TEST_URI2 =
-  "data:text/html;charset=utf-8,<script>" +
+  "data:text/html;charset=utf-8,<!DOCTYPE html><script>" +
   "console.timeEnd('bTimer');</script>";
 
 const TEST_URI3 =
-  "data:text/html;charset=utf-8,<script>" +
+  "data:text/html;charset=utf-8,<!DOCTYPE html><script>" +
   "console.time('bTimer');console.log('smoke signal');</script>";
 
 const TEST_URI4 =
-  "data:text/html;charset=utf-8," +
+  "data:text/html;charset=utf-8,<!DOCTYPE html>" +
   "<script>console.timeEnd('bTimer');</script>";
 
 add_task(async function() {
   // Calling console.time('aTimer') followed by console.timeEnd('aTimer')
   // should result in the aTimer being ended, and a message like aTimer: 123ms
   // printed to the console
   const hud1 = await openNewTabAndConsole(TEST_URI);
 
--- a/devtools/client/webconsole/test/browser/browser_webconsole_timestamps.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_timestamps.js
@@ -3,17 +3,17 @@
 
 // Test for the message timestamps option: check if the preference toggles the
 // display of messages in the console output. See bug 722267.
 
 "use strict";
 
 const { PrefObserver } = require("devtools/client/shared/prefs");
 
-const TEST_URI = `data:text/html;charset=utf-8,
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>
   Web Console test for bug 1307871 - preference for toggling timestamps in messages`;
 const PREF_MESSAGE_TIMESTAMP = "devtools.webconsole.timestampMessages";
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   info("Call the log function defined in the test page");
   const onMessage = waitForMessage(hud, "simple text message");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_uncaught_exception.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_uncaught_exception.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that stack traces are shown when primitive values are thrown instead of
 // error objects.
 
 "use strict";
 
-const TEST_URI = `data:text/html,<meta charset=utf8>Test uncaught exception`;
+const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test uncaught exception`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   await checkThrowingWithStack(hud, `"tomato"`, "Uncaught tomato");
   await checkThrowingWithStack(hud, `""`, "Uncaught <empty string>");
   await checkThrowingWithStack(hud, `42`, "Uncaught 42");
   await checkThrowingWithStack(hud, `0`, "Uncaught 0");
--- a/devtools/client/webconsole/test/browser/browser_webconsole_warn_about_replaced_api.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_warn_about_replaced_api.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URI_REPLACED =
-  "data:text/html;charset=utf8,<script>console = {log: () => ''}</script>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><script>console = {log: () => ''}</script>";
 const TEST_URI_NOT_REPLACED =
-  "data:text/html;charset=utf8,<script>console.log('foo')</script>";
+  "data:text/html;charset=utf8,<!DOCTYPE html><script>console.log('foo')</script>";
 
 add_task(async function() {
   await pushPref("devtools.webconsole.timestampMessages", true);
   await pushPref("devtools.webconsole.persistlog", true);
 
   let hud = await openNewTabAndConsole(TEST_URI_NOT_REPLACED);
 
   await testWarningNotPresent(hud);
--- a/devtools/client/webconsole/test/browser/browser_webconsole_wasm_errors.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_wasm_errors.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that WASM errors are reported to the console.
 
 "use strict";
 
-const TEST_URI = `data:text/html;charset=utf-8,Wasm errors`;
+const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Wasm errors`;
 
 add_task(async function() {
   const hud = await openNewTabAndConsole(TEST_URI);
 
   const onCompileError = waitForMessage(
     hud,
     `Uncaught (in promise) CompileError: wasm validation error: at offset 0: failed to match magic number`,
     ".error"
--- a/devtools/client/webconsole/test/browser/test-console-api-iframe.html
+++ b/devtools/client/webconsole/test/browser/test-console-api-iframe.html
@@ -7,16 +7,16 @@
          http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
     <p>test for bug 613013</p>
     <script type="text/javascript">
       /* eslint-disable */
       (function () {
         var iframe = document.createElement('iframe');
-        iframe.src = 'data:text/html;charset=utf-8,little iframe';
+        iframe.src = 'data:text/html;charset=utf-8,<!DOCTYPE html>little iframe';
         document.body.appendChild(iframe);
 
         console.log("iframe added");
       })();
     </script>
   </body>
 </html>