From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- toolkit/content/tests/browser/audio.ogg | Bin 0 -> 14290 bytes toolkit/content/tests/browser/browser.ini | 118 ++ .../tests/browser/browser_autoscroll_disabled.js | 82 + .../content/tests/browser/browser_bug1170531.js | 112 ++ .../content/tests/browser/browser_bug1198465.js | 76 + .../content/tests/browser/browser_bug1572798.js | 29 + .../browser_bug295977_autoscroll_overflow.js | 381 ++++ toolkit/content/tests/browser/browser_bug451286.js | 166 ++ toolkit/content/tests/browser/browser_bug594509.js | 15 + toolkit/content/tests/browser/browser_bug982298.js | 72 + .../browser/browser_charsetMenu_swapBrowsers.js | 34 + .../content/tests/browser/browser_contentTitle.js | 17 + .../browser/browser_content_url_annotation.js | 78 + .../browser/browser_crash_previous_frameloader.js | 131 ++ .../tests/browser/browser_datetime_datepicker.js | 791 ++++++++ .../browser/browser_default_image_filename.js | 61 + .../browser_default_image_filename_redirect.js | 53 + .../tests/browser/browser_delay_autoplay_media.js | 145 ++ ...browser_delay_autoplay_media_pausedAfterPlay.js | 121 ++ .../browser_delay_autoplay_multipleMedia.js | 77 + .../browser_delay_autoplay_notInTreeAudio.js | 66 + .../browser_delay_autoplay_playAfterTabVisible.js | 68 + .../browser_delay_autoplay_playMediaInMuteTab.js | 97 + ...rowser_delay_autoplay_silentAudioTrack_media.js | 63 + .../browser/browser_delay_autoplay_webAudio.js | 40 + .../tests/browser/browser_f7_caret_browsing.js | 278 +++ toolkit/content/tests/browser/browser_findbar.js | 523 ++++++ .../browser/browser_findbar_disabled_manual.js | 33 + .../content/tests/browser/browser_isSynthetic.js | 66 + .../browser_keyevents_during_autoscrolling.js | 129 ++ .../tests/browser/browser_label_textlink.js | 63 + .../content/tests/browser/browser_license_links.js | 27 + .../tests/browser/browser_mediaStreamPlayback.html | 24 + .../browser_mediaStreamPlaybackWithoutAudio.html | 17 + .../tests/browser/browser_media_wakelock.js | 160 ++ .../tests/browser/browser_media_wakelock_PIP.js | 156 ++ .../browser/browser_media_wakelock_webaudio.js | 127 ++ .../tests/browser/browser_quickfind_editable.js | 59 + .../browser/browser_remoteness_change_listeners.js | 39 + .../browser_resume_bkg_video_on_tab_hover.js | 154 ++ .../content/tests/browser/browser_saveImageURL.js | 75 + .../tests/browser/browser_save_resend_postdata.js | 169 ++ .../browser_suspend_videos_outside_viewport.js | 39 + .../content/tests/browser/common/mockTransfer.js | 85 + .../content/tests/browser/data/post_form_inner.sjs | 31 + .../content/tests/browser/data/post_form_outer.sjs | 34 + toolkit/content/tests/browser/doggy.png | Bin 0 -> 46876 bytes toolkit/content/tests/browser/empty.png | Bin 0 -> 14528 bytes .../content/tests/browser/file_contentTitle.html | 14 + .../tests/browser/file_document_open_audio.html | 11 + toolkit/content/tests/browser/file_empty.html | 8 + .../content/tests/browser/file_findinframe.html | 5 + .../content/tests/browser/file_mediaPlayback2.html | 14 + .../content/tests/browser/file_multipleAudio.html | 19 + .../tests/browser/file_multiplePlayingAudio.html | 23 + .../tests/browser/file_nonAutoplayAudio.html | 7 + .../browser/file_outside_viewport_videos.html | 41 + toolkit/content/tests/browser/file_redirect.html | 13 + .../content/tests/browser/file_redirect_to.html | 15 + .../tests/browser/file_silentAudioTrack.html | 18 + toolkit/content/tests/browser/file_video.html | 9 + .../tests/browser/file_videoWithAudioOnly.html | 9 + .../tests/browser/file_videoWithoutAudioTrack.html | 9 + toolkit/content/tests/browser/file_webAudio.html | 29 + toolkit/content/tests/browser/firebird.png | Bin 0 -> 16179 bytes .../content/tests/browser/firebird.png^headers^ | 2 + toolkit/content/tests/browser/gizmo-noaudio.webm | Bin 0 -> 112663 bytes toolkit/content/tests/browser/gizmo.mp4 | Bin 0 -> 455255 bytes toolkit/content/tests/browser/head.js | 338 ++++ toolkit/content/tests/browser/image.jpg | Bin 0 -> 24204 bytes toolkit/content/tests/browser/image_page.html | 9 + .../content/tests/browser/silentAudioTrack.webm | Bin 0 -> 224800 bytes .../tests/chrome/RegisterUnregisterChrome.js | 140 ++ .../content/tests/chrome/bug263683_window.xhtml | 203 ++ .../content/tests/chrome/bug304188_window.xhtml | 86 + .../content/tests/chrome/bug331215_window.xhtml | 97 + .../content/tests/chrome/bug360437_window.xhtml | 121 ++ .../content/tests/chrome/bug366992_window.xhtml | 74 + .../content/tests/chrome/bug409624_window.xhtml | 96 + .../content/tests/chrome/bug429723_window.xhtml | 84 + .../content/tests/chrome/bug451540_window.xhtml | 252 +++ .../content/tests/chrome/bug624329_window.xhtml | 22 + toolkit/content/tests/chrome/chrome.ini | 204 +++ .../content/tests/chrome/dialog_dialogfocus.xhtml | 64 + .../content/tests/chrome/dialog_dialogfocus2.xhtml | 8 + .../tests/chrome/file_about_networking_wsh.py | 10 + .../chrome/file_autocomplete_with_composition.js | 712 +++++++ .../tests/chrome/file_edit_contextmenu.xhtml | 46 + .../tests/chrome/file_editor_with_autocomplete.js | 625 +++++++ toolkit/content/tests/chrome/file_empty.xhtml | 3 + .../tests/chrome/findbar_entireword_window.xhtml | 271 +++ .../tests/chrome/findbar_events_window.xhtml | 189 ++ toolkit/content/tests/chrome/findbar_window.xhtml | 777 ++++++++ .../content/tests/chrome/frame_popup_anchor.xhtml | 81 + .../tests/chrome/frame_popupremoving_frame.xhtml | 75 + .../chrome/frame_subframe_origin_subframe1.xhtml | 41 + .../chrome/frame_subframe_origin_subframe2.xhtml | 37 + .../tests/chrome/popup_childframe_node.xhtml | 2 + toolkit/content/tests/chrome/popup_trigger.js | 1262 +++++++++++++ toolkit/content/tests/chrome/rtlchrome/rtl.css | 2 + toolkit/content/tests/chrome/rtlchrome/rtl.dtd | 1 + .../content/tests/chrome/rtlchrome/rtl.manifest | 5 + .../tests/chrome/sample_entireword_latin1.html | 11 + .../tests/chrome/test_about_networking.html | 54 + toolkit/content/tests/chrome/test_arrowpanel.xhtml | 322 ++++ .../content/tests/chrome/test_autocomplete2.xhtml | 191 ++ .../content/tests/chrome/test_autocomplete3.xhtml | 202 ++ .../content/tests/chrome/test_autocomplete4.xhtml | 282 +++ .../content/tests/chrome/test_autocomplete5.xhtml | 166 ++ .../tests/chrome/test_autocomplete_emphasis.xhtml | 182 ++ .../tests/chrome/test_autocomplete_mac_caret.xhtml | 80 + ...test_autocomplete_placehold_last_complete.xhtml | 306 ++++ ...est_autocomplete_with_composition_on_input.html | 64 + .../content/tests/chrome/test_browser_drop.xhtml | 35 + toolkit/content/tests/chrome/test_bug1048178.xhtml | 85 + toolkit/content/tests/chrome/test_bug263683.xhtml | 39 + toolkit/content/tests/chrome/test_bug304188.xhtml | 37 + toolkit/content/tests/chrome/test_bug331215.xhtml | 38 + toolkit/content/tests/chrome/test_bug360220.xhtml | 61 + toolkit/content/tests/chrome/test_bug360437.xhtml | 40 + toolkit/content/tests/chrome/test_bug365773.xhtml | 67 + toolkit/content/tests/chrome/test_bug366992.xhtml | 40 + toolkit/content/tests/chrome/test_bug382990.xhtml | 44 + toolkit/content/tests/chrome/test_bug409624.xhtml | 38 + toolkit/content/tests/chrome/test_bug418874.xhtml | 70 + toolkit/content/tests/chrome/test_bug429723.xhtml | 38 + toolkit/content/tests/chrome/test_bug437844.xhtml | 89 + toolkit/content/tests/chrome/test_bug451540.xhtml | 39 + toolkit/content/tests/chrome/test_bug457632.xhtml | 180 ++ toolkit/content/tests/chrome/test_bug460942.xhtml | 42 + toolkit/content/tests/chrome/test_bug471776.xhtml | 48 + toolkit/content/tests/chrome/test_bug509732.xhtml | 55 + toolkit/content/tests/chrome/test_bug557987.xhtml | 71 + toolkit/content/tests/chrome/test_bug562554.xhtml | 85 + toolkit/content/tests/chrome/test_bug624329.xhtml | 154 ++ toolkit/content/tests/chrome/test_bug792324.xhtml | 74 + toolkit/content/tests/chrome/test_button.xhtml | 65 + .../content/tests/chrome/test_chromemargin.xhtml | 35 + .../tests/chrome/test_closemenu_attribute.xhtml | 96 + .../tests/chrome/test_contextmenu_list.xhtml | 289 +++ toolkit/content/tests/chrome/test_cursorsnap.xhtml | 123 ++ .../tests/chrome/test_custom_element_base.xhtml | 366 ++++ .../test_custom_element_delay_connection.xhtml | 110 ++ .../tests/chrome/test_custom_element_parts.html | 44 + toolkit/content/tests/chrome/test_deck.xhtml | 131 ++ .../content/tests/chrome/test_dialogfocus.xhtml | 137 ++ .../tests/chrome/test_edit_contextmenu.html | 90 + .../test_editor_for_input_with_autocomplete.html | 84 + toolkit/content/tests/chrome/test_findbar.xhtml | 47 + .../tests/chrome/test_findbar_entireword.xhtml | 38 + .../content/tests/chrome/test_findbar_events.xhtml | 38 + toolkit/content/tests/chrome/test_frames.xhtml | 61 + .../content/tests/chrome/test_hiddenitems.xhtml | 76 + .../content/tests/chrome/test_hiddenpaging.xhtml | 83 + toolkit/content/tests/chrome/test_keys.xhtml | 28 + .../content/tests/chrome/test_labelcontrol.xhtml | 54 + toolkit/content/tests/chrome/test_largemenu.html | 21 + .../tests/chrome/test_maximized_persist.xhtml | 154 ++ toolkit/content/tests/chrome/test_menu.xhtml | 75 + toolkit/content/tests/chrome/test_menu_hide.xhtml | 80 + .../tests/chrome/test_menu_withcapture.xhtml | 59 + toolkit/content/tests/chrome/test_menuchecks.xhtml | 147 ++ .../content/tests/chrome/test_menuitem_blink.xhtml | 106 ++ .../tests/chrome/test_menuitem_commands.xhtml | 102 ++ toolkit/content/tests/chrome/test_menulist.xhtml | 353 ++++ .../tests/chrome/test_menulist_keynav.xhtml | 312 ++++ .../tests/chrome/test_menulist_null_value.xhtml | 96 + .../tests/chrome/test_menulist_paging.xhtml | 163 ++ .../tests/chrome/test_menulist_position.xhtml | 112 ++ .../content/tests/chrome/test_mousescroll.xhtml | 274 +++ .../tests/chrome/test_mozinputbox_dictionary.xhtml | 100 + .../tests/chrome/test_navigate_persist.html | 80 + .../tests/chrome/test_notificationbox.xhtml | 499 +++++ toolkit/content/tests/chrome/test_panel.xhtml | 29 + .../tests/chrome/test_panel_anchoradjust.xhtml | 29 + .../content/tests/chrome/test_panel_focus.xhtml | 36 + .../content/tests/chrome/test_panelfrommenu.xhtml | 118 ++ .../content/tests/chrome/test_popup_anchor.xhtml | 29 + .../tests/chrome/test_popup_anchoratrect.xhtml | 28 + .../tests/chrome/test_popup_attribute.xhtml | 28 + .../content/tests/chrome/test_popup_button.xhtml | 28 + .../content/tests/chrome/test_popup_coords.xhtml | 91 + toolkit/content/tests/chrome/test_popup_keys.xhtml | 143 ++ .../tests/chrome/test_popup_moveToAnchor.xhtml | 84 + .../tests/chrome/test_popup_preventdefault.xhtml | 76 + .../chrome/test_popup_preventdefault_chrome.xhtml | 28 + .../content/tests/chrome/test_popup_recreate.xhtml | 83 + .../content/tests/chrome/test_popup_scaled.xhtml | 102 ++ toolkit/content/tests/chrome/test_popup_tree.xhtml | 72 + .../content/tests/chrome/test_popuphidden.xhtml | 74 + .../content/tests/chrome/test_popupincontent.xhtml | 137 ++ .../content/tests/chrome/test_popupremoving.xhtml | 165 ++ .../tests/chrome/test_popupremoving_frame.xhtml | 80 + toolkit/content/tests/chrome/test_position.xhtml | 133 ++ .../content/tests/chrome/test_preferences.xhtml | 539 ++++++ .../chrome/test_preferences_beforeaccept.xhtml | 57 + .../test_preferences_onsyncfrompreference.xhtml | 61 + toolkit/content/tests/chrome/test_props.xhtml | 86 + toolkit/content/tests/chrome/test_radio.xhtml | 83 + .../content/tests/chrome/test_richlistbox.xhtml | 117 ++ .../tests/chrome/test_screenPersistence.xhtml | 62 + toolkit/content/tests/chrome/test_scrollbar.xhtml | 132 ++ toolkit/content/tests/chrome/test_showcaret.xhtml | 99 + .../tests/chrome/test_subframe_origin.xhtml | 36 + toolkit/content/tests/chrome/test_tabbox.xhtml | 223 +++ toolkit/content/tests/chrome/test_tabindex.xhtml | 136 ++ .../content/tests/chrome/test_textbox_search.xhtml | 174 ++ toolkit/content/tests/chrome/test_titlebar.xhtml | 34 + toolkit/content/tests/chrome/test_tooltip.xhtml | 28 + .../tests/chrome/test_tooltip_noautohide.xhtml | 56 + toolkit/content/tests/chrome/test_tree.xhtml | 84 + toolkit/content/tests/chrome/test_tree_hier.xhtml | 136 ++ .../content/tests/chrome/test_tree_single.xhtml | 110 ++ toolkit/content/tests/chrome/test_tree_view.xhtml | 114 ++ .../tests/chrome/test_window_intrinsic_size.xhtml | 43 + .../content/tests/chrome/window_browser_drop.xhtml | 250 +++ .../content/tests/chrome/window_chromemargin.xhtml | 72 + .../tests/chrome/window_cursorsnap_dialog.xhtml | 104 ++ .../tests/chrome/window_cursorsnap_wizard.xhtml | 109 ++ .../tests/chrome/window_intrinsic_size.xhtml | 7 + toolkit/content/tests/chrome/window_keys.xhtml | 200 ++ .../content/tests/chrome/window_largemenu.xhtml | 424 +++++ .../tests/chrome/window_maximized_persist.xhtml | 15 + .../tests/chrome/window_navigate_persist.html | 11 + toolkit/content/tests/chrome/window_panel.xhtml | 285 +++ .../tests/chrome/window_panel_anchoradjust.xhtml | 185 ++ .../content/tests/chrome/window_panel_focus.xhtml | 132 ++ .../content/tests/chrome/window_popup_anchor.xhtml | 28 + .../tests/chrome/window_popup_anchoratrect.xhtml | 117 ++ .../tests/chrome/window_popup_attribute.xhtml | 40 + .../content/tests/chrome/window_popup_button.xhtml | 41 + .../window_popup_preventdefault_chrome.xhtml | 114 ++ .../content/tests/chrome/window_preferences.xhtml | 68 + .../content/tests/chrome/window_preferences2.xhtml | 29 + .../content/tests/chrome/window_preferences3.xhtml | 68 + .../chrome/window_preferences_beforeaccept.xhtml | 48 + .../window_preferences_commandretarget.xhtml | 40 + .../tests/chrome/window_preferences_disabled.xhtml | 38 + .../window_preferences_onsyncfrompreference.xhtml | 55 + .../tests/chrome/window_screenPosSize.xhtml | 17 + .../content/tests/chrome/window_showcaret.xhtml | 11 + .../tests/chrome/window_subframe_origin.xhtml | 40 + toolkit/content/tests/chrome/window_titlebar.xhtml | 221 +++ toolkit/content/tests/chrome/window_tooltip.xhtml | 360 ++++ toolkit/content/tests/chrome/xul_selectcontrol.js | 691 +++++++ .../content/tests/mochitest/file_mousecapture.html | 1 + .../tests/mochitest/file_mousecapture2.html | 8 + .../tests/mochitest/file_mousecapture3.html | 1 + .../tests/mochitest/file_mousecapture4.html | 1 + .../tests/mochitest/file_mousecapture5.html | 1 + toolkit/content/tests/mochitest/gizmo.mp4 | Bin 0 -> 455255 bytes toolkit/content/tests/mochitest/mochitest.ini | 20 + .../test_autocomplete_change_after_focus.html | 105 ++ .../content/tests/mochitest/test_bug1407085.html | 38 + .../tests/mochitest/test_mousecapture.xhtml | 329 ++++ .../test_video_control_no_control_overlay.html | 35 + toolkit/content/tests/moz.build | 21 + .../audio-dynamically-change-small-width-ref.html | 13 + .../audio-dynamically-change-small-width.html | 32 + .../tests/reftests/audio-with-bogus-url-ref.html | 14 + .../tests/reftests/audio-with-bogus-url.html | 14 + .../tests/reftests/audio-with-padding-ref.html | 19 + .../content/tests/reftests/audio-with-padding.html | 17 + toolkit/content/tests/reftests/foo.vtt | 4 + toolkit/content/tests/reftests/reftest.list | 4 + .../videocontrols-dynamically-add-cc-ref.html | 32 + .../reftests/videocontrols-dynamically-add-cc.html | 61 + .../content/tests/unit/test_contentAreaUtils.js | 82 + toolkit/content/tests/unit/xpcshell.ini | 4 + toolkit/content/tests/widgets/.eslintrc.js | 5 + toolkit/content/tests/widgets/audio.ogg | Bin 0 -> 14293 bytes toolkit/content/tests/widgets/audio.wav | Bin 0 -> 1422 bytes toolkit/content/tests/widgets/chrome.ini | 27 + .../widgets/file_videocontrols_jsdisabled.html | 2 + toolkit/content/tests/widgets/head.js | 57 + toolkit/content/tests/widgets/mochitest.ini | 55 + toolkit/content/tests/widgets/popup_shared.js | 548 ++++++ toolkit/content/tests/widgets/seek_with_sound.ogg | Bin 0 -> 299507 bytes .../widgets/test_audiocontrols_dimensions.html | 66 + toolkit/content/tests/widgets/test_bug1654500.html | 33 + toolkit/content/tests/widgets/test_bug898940.html | 31 + .../tests/widgets/test_contextmenu_menugroup.xhtml | 102 ++ .../tests/widgets/test_contextmenu_nested.xhtml | 138 ++ .../tests/widgets/test_editor_currentURI.xhtml | 37 + .../tests/widgets/test_label_checkbox.xhtml | 42 + toolkit/content/tests/widgets/test_menubar.xhtml | 30 + .../tests/widgets/test_mousecapture_area.html | 108 ++ .../content/tests/widgets/test_popupanchor.xhtml | 474 +++++ .../content/tests/widgets/test_popupreflows.xhtml | 104 ++ .../tests/widgets/test_tree_column_reorder.xhtml | 75 + .../tests/widgets/test_ua_widget_sandbox.html | 101 + .../tests/widgets/test_ua_widget_unbind.html | 56 + .../content/tests/widgets/test_videocontrols.html | 451 +++++ .../tests/widgets/test_videocontrols_audio.html | 60 + .../test_videocontrols_audio_direction.html | 31 + .../tests/widgets/test_videocontrols_error.html | 60 + .../tests/widgets/test_videocontrols_focus.html | 111 ++ .../test_videocontrols_iframe_fullscreen.html | 60 + .../widgets/test_videocontrols_jsdisabled.html | 69 + .../widgets/test_videocontrols_keyhandler.html | 150 ++ .../widgets/test_videocontrols_onclickplay.html | 74 + .../widgets/test_videocontrols_orientation.html | 63 + .../tests/widgets/test_videocontrols_size.html | 179 ++ .../widgets/test_videocontrols_standalone.html | 93 + .../test_videocontrols_video_direction.html | 31 + .../widgets/test_videocontrols_video_noaudio.html | 42 + .../tests/widgets/test_videocontrols_vtt.html | 112 ++ toolkit/content/tests/widgets/tree_shared.js | 1936 ++++++++++++++++++++ toolkit/content/tests/widgets/video.ogg | Bin 0 -> 285310 bytes .../widgets/videocontrols_direction-1-ref.html | 10 + .../tests/widgets/videocontrols_direction-1a.html | 10 + .../tests/widgets/videocontrols_direction-1b.html | 10 + .../tests/widgets/videocontrols_direction-1c.html | 10 + .../tests/widgets/videocontrols_direction-1d.html | 10 + .../tests/widgets/videocontrols_direction-1e.html | 10 + .../widgets/videocontrols_direction-2-ref.html | 10 + .../tests/widgets/videocontrols_direction-2a.html | 10 + .../tests/widgets/videocontrols_direction-2b.html | 10 + .../tests/widgets/videocontrols_direction-2c.html | 10 + .../tests/widgets/videocontrols_direction-2d.html | 10 + .../tests/widgets/videocontrols_direction-2e.html | 10 + .../tests/widgets/videocontrols_direction_test.js | 112 ++ toolkit/content/tests/widgets/videomask.css | 23 + .../tests/widgets/window_label_checkbox.xhtml | 46 + toolkit/content/tests/widgets/window_menubar.xhtml | 812 ++++++++ 325 files changed, 34826 insertions(+) create mode 100644 toolkit/content/tests/browser/audio.ogg create mode 100644 toolkit/content/tests/browser/browser.ini create mode 100644 toolkit/content/tests/browser/browser_autoscroll_disabled.js create mode 100644 toolkit/content/tests/browser/browser_bug1170531.js create mode 100644 toolkit/content/tests/browser/browser_bug1198465.js create mode 100644 toolkit/content/tests/browser/browser_bug1572798.js create mode 100644 toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js create mode 100644 toolkit/content/tests/browser/browser_bug451286.js create mode 100644 toolkit/content/tests/browser/browser_bug594509.js create mode 100644 toolkit/content/tests/browser/browser_bug982298.js create mode 100644 toolkit/content/tests/browser/browser_charsetMenu_swapBrowsers.js create mode 100644 toolkit/content/tests/browser/browser_contentTitle.js create mode 100644 toolkit/content/tests/browser/browser_content_url_annotation.js create mode 100644 toolkit/content/tests/browser/browser_crash_previous_frameloader.js create mode 100644 toolkit/content/tests/browser/browser_datetime_datepicker.js create mode 100644 toolkit/content/tests/browser/browser_default_image_filename.js create mode 100644 toolkit/content/tests/browser/browser_default_image_filename_redirect.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_media.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_media_pausedAfterPlay.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_multipleMedia.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_notInTreeAudio.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_playAfterTabVisible.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_playMediaInMuteTab.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_silentAudioTrack_media.js create mode 100644 toolkit/content/tests/browser/browser_delay_autoplay_webAudio.js create mode 100644 toolkit/content/tests/browser/browser_f7_caret_browsing.js create mode 100644 toolkit/content/tests/browser/browser_findbar.js create mode 100644 toolkit/content/tests/browser/browser_findbar_disabled_manual.js create mode 100644 toolkit/content/tests/browser/browser_isSynthetic.js create mode 100644 toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js create mode 100644 toolkit/content/tests/browser/browser_label_textlink.js create mode 100644 toolkit/content/tests/browser/browser_license_links.js create mode 100644 toolkit/content/tests/browser/browser_mediaStreamPlayback.html create mode 100644 toolkit/content/tests/browser/browser_mediaStreamPlaybackWithoutAudio.html create mode 100644 toolkit/content/tests/browser/browser_media_wakelock.js create mode 100644 toolkit/content/tests/browser/browser_media_wakelock_PIP.js create mode 100644 toolkit/content/tests/browser/browser_media_wakelock_webaudio.js create mode 100644 toolkit/content/tests/browser/browser_quickfind_editable.js create mode 100644 toolkit/content/tests/browser/browser_remoteness_change_listeners.js create mode 100644 toolkit/content/tests/browser/browser_resume_bkg_video_on_tab_hover.js create mode 100644 toolkit/content/tests/browser/browser_saveImageURL.js create mode 100644 toolkit/content/tests/browser/browser_save_resend_postdata.js create mode 100644 toolkit/content/tests/browser/browser_suspend_videos_outside_viewport.js create mode 100644 toolkit/content/tests/browser/common/mockTransfer.js create mode 100644 toolkit/content/tests/browser/data/post_form_inner.sjs create mode 100644 toolkit/content/tests/browser/data/post_form_outer.sjs create mode 100644 toolkit/content/tests/browser/doggy.png create mode 100644 toolkit/content/tests/browser/empty.png create mode 100644 toolkit/content/tests/browser/file_contentTitle.html create mode 100644 toolkit/content/tests/browser/file_document_open_audio.html create mode 100644 toolkit/content/tests/browser/file_empty.html create mode 100644 toolkit/content/tests/browser/file_findinframe.html create mode 100644 toolkit/content/tests/browser/file_mediaPlayback2.html create mode 100644 toolkit/content/tests/browser/file_multipleAudio.html create mode 100644 toolkit/content/tests/browser/file_multiplePlayingAudio.html create mode 100644 toolkit/content/tests/browser/file_nonAutoplayAudio.html create mode 100644 toolkit/content/tests/browser/file_outside_viewport_videos.html create mode 100644 toolkit/content/tests/browser/file_redirect.html create mode 100644 toolkit/content/tests/browser/file_redirect_to.html create mode 100644 toolkit/content/tests/browser/file_silentAudioTrack.html create mode 100644 toolkit/content/tests/browser/file_video.html create mode 100644 toolkit/content/tests/browser/file_videoWithAudioOnly.html create mode 100644 toolkit/content/tests/browser/file_videoWithoutAudioTrack.html create mode 100644 toolkit/content/tests/browser/file_webAudio.html create mode 100644 toolkit/content/tests/browser/firebird.png create mode 100644 toolkit/content/tests/browser/firebird.png^headers^ create mode 100644 toolkit/content/tests/browser/gizmo-noaudio.webm create mode 100644 toolkit/content/tests/browser/gizmo.mp4 create mode 100644 toolkit/content/tests/browser/head.js create mode 100644 toolkit/content/tests/browser/image.jpg create mode 100644 toolkit/content/tests/browser/image_page.html create mode 100644 toolkit/content/tests/browser/silentAudioTrack.webm create mode 100644 toolkit/content/tests/chrome/RegisterUnregisterChrome.js create mode 100644 toolkit/content/tests/chrome/bug263683_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug304188_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug331215_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug360437_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug366992_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug409624_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug429723_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug451540_window.xhtml create mode 100644 toolkit/content/tests/chrome/bug624329_window.xhtml create mode 100644 toolkit/content/tests/chrome/chrome.ini create mode 100644 toolkit/content/tests/chrome/dialog_dialogfocus.xhtml create mode 100644 toolkit/content/tests/chrome/dialog_dialogfocus2.xhtml create mode 100644 toolkit/content/tests/chrome/file_about_networking_wsh.py create mode 100644 toolkit/content/tests/chrome/file_autocomplete_with_composition.js create mode 100644 toolkit/content/tests/chrome/file_edit_contextmenu.xhtml create mode 100644 toolkit/content/tests/chrome/file_editor_with_autocomplete.js create mode 100644 toolkit/content/tests/chrome/file_empty.xhtml create mode 100644 toolkit/content/tests/chrome/findbar_entireword_window.xhtml create mode 100644 toolkit/content/tests/chrome/findbar_events_window.xhtml create mode 100644 toolkit/content/tests/chrome/findbar_window.xhtml create mode 100644 toolkit/content/tests/chrome/frame_popup_anchor.xhtml create mode 100644 toolkit/content/tests/chrome/frame_popupremoving_frame.xhtml create mode 100644 toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xhtml create mode 100644 toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xhtml create mode 100644 toolkit/content/tests/chrome/popup_childframe_node.xhtml create mode 100644 toolkit/content/tests/chrome/popup_trigger.js create mode 100644 toolkit/content/tests/chrome/rtlchrome/rtl.css create mode 100644 toolkit/content/tests/chrome/rtlchrome/rtl.dtd create mode 100644 toolkit/content/tests/chrome/rtlchrome/rtl.manifest create mode 100644 toolkit/content/tests/chrome/sample_entireword_latin1.html create mode 100644 toolkit/content/tests/chrome/test_about_networking.html create mode 100644 toolkit/content/tests/chrome/test_arrowpanel.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete2.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete3.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete4.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete5.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete_emphasis.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete_mac_caret.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete_placehold_last_complete.xhtml create mode 100644 toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html create mode 100644 toolkit/content/tests/chrome/test_browser_drop.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug1048178.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug263683.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug304188.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug331215.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug360220.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug360437.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug365773.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug366992.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug382990.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug409624.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug418874.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug429723.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug437844.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug451540.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug457632.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug460942.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug471776.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug509732.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug557987.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug562554.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug624329.xhtml create mode 100644 toolkit/content/tests/chrome/test_bug792324.xhtml create mode 100644 toolkit/content/tests/chrome/test_button.xhtml create mode 100644 toolkit/content/tests/chrome/test_chromemargin.xhtml create mode 100644 toolkit/content/tests/chrome/test_closemenu_attribute.xhtml create mode 100644 toolkit/content/tests/chrome/test_contextmenu_list.xhtml create mode 100644 toolkit/content/tests/chrome/test_cursorsnap.xhtml create mode 100644 toolkit/content/tests/chrome/test_custom_element_base.xhtml create mode 100644 toolkit/content/tests/chrome/test_custom_element_delay_connection.xhtml create mode 100644 toolkit/content/tests/chrome/test_custom_element_parts.html create mode 100644 toolkit/content/tests/chrome/test_deck.xhtml create mode 100644 toolkit/content/tests/chrome/test_dialogfocus.xhtml create mode 100644 toolkit/content/tests/chrome/test_edit_contextmenu.html create mode 100644 toolkit/content/tests/chrome/test_editor_for_input_with_autocomplete.html create mode 100644 toolkit/content/tests/chrome/test_findbar.xhtml create mode 100644 toolkit/content/tests/chrome/test_findbar_entireword.xhtml create mode 100644 toolkit/content/tests/chrome/test_findbar_events.xhtml create mode 100644 toolkit/content/tests/chrome/test_frames.xhtml create mode 100644 toolkit/content/tests/chrome/test_hiddenitems.xhtml create mode 100644 toolkit/content/tests/chrome/test_hiddenpaging.xhtml create mode 100644 toolkit/content/tests/chrome/test_keys.xhtml create mode 100644 toolkit/content/tests/chrome/test_labelcontrol.xhtml create mode 100644 toolkit/content/tests/chrome/test_largemenu.html create mode 100644 toolkit/content/tests/chrome/test_maximized_persist.xhtml create mode 100644 toolkit/content/tests/chrome/test_menu.xhtml create mode 100644 toolkit/content/tests/chrome/test_menu_hide.xhtml create mode 100644 toolkit/content/tests/chrome/test_menu_withcapture.xhtml create mode 100644 toolkit/content/tests/chrome/test_menuchecks.xhtml create mode 100644 toolkit/content/tests/chrome/test_menuitem_blink.xhtml create mode 100644 toolkit/content/tests/chrome/test_menuitem_commands.xhtml create mode 100644 toolkit/content/tests/chrome/test_menulist.xhtml create mode 100644 toolkit/content/tests/chrome/test_menulist_keynav.xhtml create mode 100644 toolkit/content/tests/chrome/test_menulist_null_value.xhtml create mode 100644 toolkit/content/tests/chrome/test_menulist_paging.xhtml create mode 100644 toolkit/content/tests/chrome/test_menulist_position.xhtml create mode 100644 toolkit/content/tests/chrome/test_mousescroll.xhtml create mode 100644 toolkit/content/tests/chrome/test_mozinputbox_dictionary.xhtml create mode 100644 toolkit/content/tests/chrome/test_navigate_persist.html create mode 100644 toolkit/content/tests/chrome/test_notificationbox.xhtml create mode 100644 toolkit/content/tests/chrome/test_panel.xhtml create mode 100644 toolkit/content/tests/chrome/test_panel_anchoradjust.xhtml create mode 100644 toolkit/content/tests/chrome/test_panel_focus.xhtml create mode 100644 toolkit/content/tests/chrome/test_panelfrommenu.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_anchor.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_anchoratrect.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_attribute.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_button.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_coords.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_keys.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_moveToAnchor.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_preventdefault.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_preventdefault_chrome.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_recreate.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_scaled.xhtml create mode 100644 toolkit/content/tests/chrome/test_popup_tree.xhtml create mode 100644 toolkit/content/tests/chrome/test_popuphidden.xhtml create mode 100644 toolkit/content/tests/chrome/test_popupincontent.xhtml create mode 100644 toolkit/content/tests/chrome/test_popupremoving.xhtml create mode 100644 toolkit/content/tests/chrome/test_popupremoving_frame.xhtml create mode 100644 toolkit/content/tests/chrome/test_position.xhtml create mode 100644 toolkit/content/tests/chrome/test_preferences.xhtml create mode 100644 toolkit/content/tests/chrome/test_preferences_beforeaccept.xhtml create mode 100644 toolkit/content/tests/chrome/test_preferences_onsyncfrompreference.xhtml create mode 100644 toolkit/content/tests/chrome/test_props.xhtml create mode 100644 toolkit/content/tests/chrome/test_radio.xhtml create mode 100644 toolkit/content/tests/chrome/test_richlistbox.xhtml create mode 100644 toolkit/content/tests/chrome/test_screenPersistence.xhtml create mode 100644 toolkit/content/tests/chrome/test_scrollbar.xhtml create mode 100644 toolkit/content/tests/chrome/test_showcaret.xhtml create mode 100644 toolkit/content/tests/chrome/test_subframe_origin.xhtml create mode 100644 toolkit/content/tests/chrome/test_tabbox.xhtml create mode 100644 toolkit/content/tests/chrome/test_tabindex.xhtml create mode 100644 toolkit/content/tests/chrome/test_textbox_search.xhtml create mode 100644 toolkit/content/tests/chrome/test_titlebar.xhtml create mode 100644 toolkit/content/tests/chrome/test_tooltip.xhtml create mode 100644 toolkit/content/tests/chrome/test_tooltip_noautohide.xhtml create mode 100644 toolkit/content/tests/chrome/test_tree.xhtml create mode 100644 toolkit/content/tests/chrome/test_tree_hier.xhtml create mode 100644 toolkit/content/tests/chrome/test_tree_single.xhtml create mode 100644 toolkit/content/tests/chrome/test_tree_view.xhtml create mode 100644 toolkit/content/tests/chrome/test_window_intrinsic_size.xhtml create mode 100644 toolkit/content/tests/chrome/window_browser_drop.xhtml create mode 100644 toolkit/content/tests/chrome/window_chromemargin.xhtml create mode 100644 toolkit/content/tests/chrome/window_cursorsnap_dialog.xhtml create mode 100644 toolkit/content/tests/chrome/window_cursorsnap_wizard.xhtml create mode 100644 toolkit/content/tests/chrome/window_intrinsic_size.xhtml create mode 100644 toolkit/content/tests/chrome/window_keys.xhtml create mode 100644 toolkit/content/tests/chrome/window_largemenu.xhtml create mode 100644 toolkit/content/tests/chrome/window_maximized_persist.xhtml create mode 100644 toolkit/content/tests/chrome/window_navigate_persist.html create mode 100644 toolkit/content/tests/chrome/window_panel.xhtml create mode 100644 toolkit/content/tests/chrome/window_panel_anchoradjust.xhtml create mode 100644 toolkit/content/tests/chrome/window_panel_focus.xhtml create mode 100644 toolkit/content/tests/chrome/window_popup_anchor.xhtml create mode 100644 toolkit/content/tests/chrome/window_popup_anchoratrect.xhtml create mode 100644 toolkit/content/tests/chrome/window_popup_attribute.xhtml create mode 100644 toolkit/content/tests/chrome/window_popup_button.xhtml create mode 100644 toolkit/content/tests/chrome/window_popup_preventdefault_chrome.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences2.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences3.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences_beforeaccept.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences_commandretarget.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences_disabled.xhtml create mode 100644 toolkit/content/tests/chrome/window_preferences_onsyncfrompreference.xhtml create mode 100644 toolkit/content/tests/chrome/window_screenPosSize.xhtml create mode 100644 toolkit/content/tests/chrome/window_showcaret.xhtml create mode 100644 toolkit/content/tests/chrome/window_subframe_origin.xhtml create mode 100644 toolkit/content/tests/chrome/window_titlebar.xhtml create mode 100644 toolkit/content/tests/chrome/window_tooltip.xhtml create mode 100644 toolkit/content/tests/chrome/xul_selectcontrol.js create mode 100644 toolkit/content/tests/mochitest/file_mousecapture.html create mode 100644 toolkit/content/tests/mochitest/file_mousecapture2.html create mode 100644 toolkit/content/tests/mochitest/file_mousecapture3.html create mode 100644 toolkit/content/tests/mochitest/file_mousecapture4.html create mode 100644 toolkit/content/tests/mochitest/file_mousecapture5.html create mode 100644 toolkit/content/tests/mochitest/gizmo.mp4 create mode 100644 toolkit/content/tests/mochitest/mochitest.ini create mode 100644 toolkit/content/tests/mochitest/test_autocomplete_change_after_focus.html create mode 100644 toolkit/content/tests/mochitest/test_bug1407085.html create mode 100644 toolkit/content/tests/mochitest/test_mousecapture.xhtml create mode 100644 toolkit/content/tests/mochitest/test_video_control_no_control_overlay.html create mode 100644 toolkit/content/tests/moz.build create mode 100644 toolkit/content/tests/reftests/audio-dynamically-change-small-width-ref.html create mode 100644 toolkit/content/tests/reftests/audio-dynamically-change-small-width.html create mode 100644 toolkit/content/tests/reftests/audio-with-bogus-url-ref.html create mode 100644 toolkit/content/tests/reftests/audio-with-bogus-url.html create mode 100644 toolkit/content/tests/reftests/audio-with-padding-ref.html create mode 100644 toolkit/content/tests/reftests/audio-with-padding.html create mode 100644 toolkit/content/tests/reftests/foo.vtt create mode 100644 toolkit/content/tests/reftests/reftest.list create mode 100644 toolkit/content/tests/reftests/videocontrols-dynamically-add-cc-ref.html create mode 100644 toolkit/content/tests/reftests/videocontrols-dynamically-add-cc.html create mode 100644 toolkit/content/tests/unit/test_contentAreaUtils.js create mode 100644 toolkit/content/tests/unit/xpcshell.ini create mode 100644 toolkit/content/tests/widgets/.eslintrc.js create mode 100644 toolkit/content/tests/widgets/audio.ogg create mode 100644 toolkit/content/tests/widgets/audio.wav create mode 100644 toolkit/content/tests/widgets/chrome.ini create mode 100644 toolkit/content/tests/widgets/file_videocontrols_jsdisabled.html create mode 100644 toolkit/content/tests/widgets/head.js create mode 100644 toolkit/content/tests/widgets/mochitest.ini create mode 100644 toolkit/content/tests/widgets/popup_shared.js create mode 100644 toolkit/content/tests/widgets/seek_with_sound.ogg create mode 100644 toolkit/content/tests/widgets/test_audiocontrols_dimensions.html create mode 100644 toolkit/content/tests/widgets/test_bug1654500.html create mode 100644 toolkit/content/tests/widgets/test_bug898940.html create mode 100644 toolkit/content/tests/widgets/test_contextmenu_menugroup.xhtml create mode 100644 toolkit/content/tests/widgets/test_contextmenu_nested.xhtml create mode 100644 toolkit/content/tests/widgets/test_editor_currentURI.xhtml create mode 100644 toolkit/content/tests/widgets/test_label_checkbox.xhtml create mode 100644 toolkit/content/tests/widgets/test_menubar.xhtml create mode 100644 toolkit/content/tests/widgets/test_mousecapture_area.html create mode 100644 toolkit/content/tests/widgets/test_popupanchor.xhtml create mode 100644 toolkit/content/tests/widgets/test_popupreflows.xhtml create mode 100644 toolkit/content/tests/widgets/test_tree_column_reorder.xhtml create mode 100644 toolkit/content/tests/widgets/test_ua_widget_sandbox.html create mode 100644 toolkit/content/tests/widgets/test_ua_widget_unbind.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_audio.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_audio_direction.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_error.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_focus.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_iframe_fullscreen.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_keyhandler.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_onclickplay.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_orientation.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_size.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_standalone.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_video_direction.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_video_noaudio.html create mode 100644 toolkit/content/tests/widgets/test_videocontrols_vtt.html create mode 100644 toolkit/content/tests/widgets/tree_shared.js create mode 100644 toolkit/content/tests/widgets/video.ogg create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1-ref.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1a.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1b.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1c.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1d.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1e.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2-ref.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2a.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2b.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2c.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2d.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2e.html create mode 100644 toolkit/content/tests/widgets/videocontrols_direction_test.js create mode 100644 toolkit/content/tests/widgets/videomask.css create mode 100644 toolkit/content/tests/widgets/window_label_checkbox.xhtml create mode 100644 toolkit/content/tests/widgets/window_menubar.xhtml (limited to 'toolkit/content/tests') diff --git a/toolkit/content/tests/browser/audio.ogg b/toolkit/content/tests/browser/audio.ogg new file mode 100644 index 0000000000..7f1833508a Binary files /dev/null and b/toolkit/content/tests/browser/audio.ogg differ diff --git a/toolkit/content/tests/browser/browser.ini b/toolkit/content/tests/browser/browser.ini new file mode 100644 index 0000000000..927178c3a9 --- /dev/null +++ b/toolkit/content/tests/browser/browser.ini @@ -0,0 +1,118 @@ +[DEFAULT] +prefs = + plugin.load_flash_only=false + media.cubeb.sandbox=false # BMO 1610640 +support-files = + audio.ogg + empty.png + file_contentTitle.html + file_empty.html + file_findinframe.html + file_mediaPlayback2.html + file_multipleAudio.html + file_multiplePlayingAudio.html + file_nonAutoplayAudio.html + file_redirect.html + file_redirect_to.html + file_silentAudioTrack.html + file_webAudio.html + head.js + image.jpg + image_page.html + silentAudioTrack.webm + +[browser_autoscroll_disabled.js] +skip-if = true # Bug 1312652 +[browser_delay_autoplay_media.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_delay_autoplay_media_pausedAfterPlay.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_delay_autoplay_playAfterTabVisible.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_delay_autoplay_multipleMedia.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_delay_autoplay_notInTreeAudio.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_delay_autoplay_playMediaInMuteTab.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_delay_autoplay_silentAudioTrack_media.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") || (os == "mac") || (os == "linux" && !debug) # aarch64 due to 1536573 #Bug 1524746 +[browser_delay_autoplay_webAudio.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_bug1572798.js] +tags = audiochannel +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +support-files = file_document_open_audio.html +[browser_bug1170531.js] +skip-if = + os == "linux" && !debug && !ccov # Bug 1647973 +[browser_bug1198465.js] +[browser_bug295977_autoscroll_overflow.js] +skip-if = ((debug || asan) && os == "win" && bits == 64) +[browser_bug451286.js] +skip-if = true # bug 1399845 tracks re-enabling this test. +[browser_bug594509.js] +[browser_bug982298.js] +[browser_charsetMenu_swapBrowsers.js] +[browser_content_url_annotation.js] +skip-if = !e10s || !crashreporter +[browser_contentTitle.js] +[browser_crash_previous_frameloader.js] +run-if = e10s && crashreporter +[browser_datetime_datepicker.js] +skip-if = tsan # Frequently times out on TSan +[browser_default_image_filename.js] +[browser_default_image_filename_redirect.js] +support-files = + doggy.png + firebird.png + firebird.png^headers^ +[browser_f7_caret_browsing.js] +[browser_findbar.js] +skip-if = os == "linux" && bits == 64 && os_version = "18.04" # Bug 1614739 +[browser_findbar_disabled_manual.js] +[browser_isSynthetic.js] +[browser_keyevents_during_autoscrolling.js] +[browser_label_textlink.js] +[browser_remoteness_change_listeners.js] +[browser_suspend_videos_outside_viewport.js] +support-files = + file_outside_viewport_videos.html + gizmo.mp4 +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_license_links.js] +[browser_media_wakelock.js] +support-files = + browser_mediaStreamPlayback.html + browser_mediaStreamPlaybackWithoutAudio.html + file_video.html + file_videoWithAudioOnly.html + file_videoWithoutAudioTrack.html + gizmo.mp4 + gizmo-noaudio.webm +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +[browser_media_wakelock_PIP.js] +support-files = + file_video.html + gizmo.mp4 +[browser_media_wakelock_webaudio.js] +[browser_quickfind_editable.js] +skip-if = (verify && debug && (os == 'linux')) +[browser_save_resend_postdata.js] +support-files = + common/mockTransfer.js + data/post_form_inner.sjs + data/post_form_outer.sjs +skip-if = e10s # Bug ?????? - test directly manipulates content (gBrowser.contentDocument.getElementById("postForm").submit();) +[browser_saveImageURL.js] +[browser_resume_bkg_video_on_tab_hover.js] +skip-if = (os == "win" && processor == "aarch64") || debug # aarch64 due to 1536573, Bug 1388959 + diff --git a/toolkit/content/tests/browser/browser_autoscroll_disabled.js b/toolkit/content/tests/browser/browser_autoscroll_disabled.js new file mode 100644 index 0000000000..d2f6efbd13 --- /dev/null +++ b/toolkit/content/tests/browser/browser_autoscroll_disabled.js @@ -0,0 +1,82 @@ +add_task(async function() { + const kPrefName_AutoScroll = "general.autoScroll"; + Services.prefs.setBoolPref(kPrefName_AutoScroll, false); + + let dataUri = + 'data:text/html,
\ + \ +'; + + let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); + BrowserTestUtils.loadURI(gBrowser, dataUri); + await loadedPromise; + + await BrowserTestUtils.synthesizeMouse( + "#i", + 50, + 50, + { button: 1 }, + gBrowser.selectedBrowser + ); + + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() { + var iframe = content.document.getElementById("iframe"); + + if (iframe) { + var e = new iframe.contentWindow.PageTransitionEvent("pagehide", { + bubbles: true, + cancelable: true, + persisted: false, + }); + iframe.contentDocument.dispatchEvent(e); + iframe.contentDocument.documentElement.dispatchEvent(e); + } + }); + + await BrowserTestUtils.synthesizeMouse( + "#i", + 100, + 100, + { type: "mousemove", clickCount: "0" }, + gBrowser.selectedBrowser + ); + + // If scrolling didn't work, we wouldn't do any redraws and thus time out, so + // request and force redraws to get the chance to check for scrolling at all. + await new Promise(resolve => window.requestAnimationFrame(resolve)); + + let msg = await SpecialPowers.spawn( + gBrowser.selectedBrowser, + [], + async function() { + // Skip the first animation frame callback as it's the same callback that + // the browser uses to kick off the scrolling. + return new Promise(resolve => { + function checkScroll() { + let msg = ""; + let elem = content.document.getElementById("i"); + if (elem.scrollTop != 0) { + msg += "element should not have scrolled vertically"; + } + if (elem.scrollLeft != 0) { + msg += "element should not have scrolled horizontally"; + } + + resolve(msg); + } + + content.requestAnimationFrame(checkScroll); + }); + } + ); + + ok(!msg, "element scroll " + msg); + + // restore the changed prefs + if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll)) { + Services.prefs.clearUserPref(kPrefName_AutoScroll); + } + + // wait for focus to fix a failure in the next test if the latter runs too soon. + await SimpleTest.promiseFocus(); +}); diff --git a/toolkit/content/tests/browser/browser_bug1170531.js b/toolkit/content/tests/browser/browser_bug1170531.js new file mode 100644 index 0000000000..d5a6501dcd --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug1170531.js @@ -0,0 +1,112 @@ +/* eslint-disable mozilla/no-arbitrary-setTimeout */ +// Test for bug 1170531 +// https://bugzilla.mozilla.org/show_bug.cgi?id=1170531 + +add_task(async function() { + // Get a bunch of DOM nodes + let editMenu = document.getElementById("edit-menu"); + let menuPopup = editMenu.menupopup; + + let closeMenu = function(aCallback) { + if (OS.Constants.Sys.Name == "Darwin") { + executeSoon(aCallback); + return; + } + + menuPopup.addEventListener( + "popuphidden", + function() { + executeSoon(aCallback); + }, + { once: true } + ); + + executeSoon(function() { + editMenu.open = false; + }); + }; + + let openMenu = function(aCallback) { + if (OS.Constants.Sys.Name == "Darwin") { + goUpdateGlobalEditMenuItems(); + // On OSX, we have a native menu, so it has to be updated. In single process browsers, + // this happens synchronously, but in e10s, we have to wait for the main thread + // to deal with it for us. 1 second should be plenty of time. + setTimeout(aCallback, 1000); + return; + } + + menuPopup.addEventListener( + "popupshown", + function() { + executeSoon(aCallback); + }, + { once: true } + ); + + executeSoon(function() { + editMenu.open = true; + }); + }; + + await BrowserTestUtils.withNewTab( + { gBrowser, url: "about:blank" }, + async function(browser) { + let menu_cut_disabled, menu_copy_disabled; + + BrowserTestUtils.loadURI(browser, "data:text/html,
hello!
"); + await BrowserTestUtils.browserLoaded(browser); + browser.focus(); + await new Promise(resolve => waitForFocus(resolve, window)); + await new Promise(resolve => + window.requestAnimationFrame(() => executeSoon(resolve)) + ); + await new Promise(openMenu); + menu_cut_disabled = + menuPopup.querySelector("#menu_cut").getAttribute("disabled") == "true"; + is(menu_cut_disabled, false, "menu_cut should be enabled"); + menu_copy_disabled = + menuPopup.querySelector("#menu_copy").getAttribute("disabled") == + "true"; + is(menu_copy_disabled, false, "menu_copy should be enabled"); + await new Promise(closeMenu); + + BrowserTestUtils.loadURI( + browser, + "data:text/html,
hello!
" + ); + await BrowserTestUtils.browserLoaded(browser); + browser.focus(); + await new Promise(resolve => waitForFocus(resolve, window)); + await new Promise(resolve => + window.requestAnimationFrame(() => executeSoon(resolve)) + ); + await new Promise(openMenu); + menu_cut_disabled = + menuPopup.querySelector("#menu_cut").getAttribute("disabled") == "true"; + is(menu_cut_disabled, false, "menu_cut should be enabled"); + menu_copy_disabled = + menuPopup.querySelector("#menu_copy").getAttribute("disabled") == + "true"; + is(menu_copy_disabled, false, "menu_copy should be enabled"); + await new Promise(closeMenu); + + BrowserTestUtils.loadURI(browser, "about:preferences"); + await BrowserTestUtils.browserLoaded(browser); + browser.focus(); + await new Promise(resolve => waitForFocus(resolve, window)); + await new Promise(resolve => + window.requestAnimationFrame(() => executeSoon(resolve)) + ); + await new Promise(openMenu); + menu_cut_disabled = + menuPopup.querySelector("#menu_cut").getAttribute("disabled") == "true"; + is(menu_cut_disabled, true, "menu_cut should be disabled"); + menu_copy_disabled = + menuPopup.querySelector("#menu_copy").getAttribute("disabled") == + "true"; + is(menu_copy_disabled, true, "menu_copy should be disabled"); + await new Promise(closeMenu); + } + ); +}); diff --git a/toolkit/content/tests/browser/browser_bug1198465.js b/toolkit/content/tests/browser/browser_bug1198465.js new file mode 100644 index 0000000000..7f578b3197 --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug1198465.js @@ -0,0 +1,76 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +var kPrefName = "accessibility.typeaheadfind.prefillwithselection"; +var kEmptyURI = "data:text/html,"; + +// This pref is false by default in OSX; ensure the test still works there. +Services.prefs.setBoolPref(kPrefName, true); + +registerCleanupFunction(function() { + Services.prefs.clearUserPref(kPrefName); +}); + +add_task(async function() { + let aTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, kEmptyURI); + ok(!gFindBarInitialized, "findbar isn't initialized yet"); + + // Note: the use case here is when the user types directly in the findbar + // _before_ it's prefilled with a text selection in the page. + + // So `yield BrowserTestUtils.sendChar()` can't be used here: + // - synthesizing a key in the browser won't actually send it to the + // findbar; the findbar isn't part of the browser content. + // - we need to _not_ wait for _startFindDeferred to be resolved; yielding + // a synthesized keypress on the browser implicitely happens after the + // browser has dispatched its return message with the prefill value for + // the findbar, which essentially nulls these tests. + + // The parent-side of the sidebar initialization is also async, so we do + // need to wait for that. We verify a bit further down that _startFindDeferred + // hasn't been resolved yet. + await gFindBarPromise; + + let findBar = gFindBar; + is(findBar._findField.value, "", "findbar is empty"); + + // Test 1 + // Any input in the findbar should erase a previous search. + + findBar._findField.value = "xy"; + findBar.startFind(); + is(findBar._findField.value, "xy", "findbar should have xy initial query"); + is(findBar._findField, document.activeElement, "findbar is now focused"); + + EventUtils.sendChar("z", window); + is(findBar._findField.value, "z", "z erases xy"); + + findBar._findField.value = ""; + ok(!findBar._findField.value, "erase findbar after first test"); + + // Test 2 + // Prefilling the findbar should be ignored if a search has been run. + + findBar.startFind(); + ok(findBar._startFindDeferred, "prefilled value hasn't been fetched yet"); + is(findBar._findField, document.activeElement, "findbar is still focused"); + + EventUtils.sendChar("a", window); + EventUtils.sendChar("b", window); + is(findBar._findField.value, "ab", "initial ab typed in the findbar"); + + // This resolves _startFindDeferred if it's still pending; let's just skip + // over waiting for the browser's return message that should do this as it + // doesn't really matter. + findBar.onCurrentSelection("foo", true); + ok(!findBar._startFindDeferred, "prefilled value fetched"); + is(findBar._findField.value, "ab", "ab kept instead of prefill value"); + + EventUtils.sendChar("c", window); + is(findBar._findField.value, "abc", "c is appended after ab"); + + // Clear the findField value to make the test run successfully + // for multiple runs in the same browser session. + findBar._findField.value = ""; + BrowserTestUtils.removeTab(aTab); +}); diff --git a/toolkit/content/tests/browser/browser_bug1572798.js b/toolkit/content/tests/browser/browser_bug1572798.js new file mode 100644 index 0000000000..8b5dffd432 --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug1572798.js @@ -0,0 +1,29 @@ +add_task(async function test_bug_1572798() { + let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank"); + BrowserTestUtils.loadURI( + tab.linkedBrowser, + "https://example.com/browser/toolkit/content/tests/browser/file_document_open_audio.html" + ); + await BrowserTestUtils.browserLoaded(tab.linkedBrowser); + let windowLoaded = BrowserTestUtils.waitForNewWindow(); + info("- clicking button to spawn a new window -"); + await ContentTask.spawn(tab.linkedBrowser, null, function() { + content.document.querySelector("button").click(); + }); + info("- waiting for the new window -"); + let newWin = await windowLoaded; + info("- checking that the new window plays the audio -"); + let documentOpenedBrowser = newWin.gBrowser.selectedBrowser; + await ContentTask.spawn(documentOpenedBrowser, null, async function() { + try { + await content.document.querySelector("audio").play(); + ok(true, "Could play the audio"); + } catch (e) { + ok(false, "Rejected audio promise" + e); + } + }); + + info("- Cleaning up -"); + await BrowserTestUtils.closeWindow(newWin); + await BrowserTestUtils.removeTab(tab); +}); diff --git a/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js b/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js new file mode 100644 index 0000000000..5cc6de19da --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js @@ -0,0 +1,381 @@ +requestLongerTimeout(2); +add_task(async function() { + function pushPrefs(prefs) { + return SpecialPowers.pushPrefEnv({ set: prefs }); + } + + await pushPrefs([ + ["general.autoScroll", true], + ["test.events.async.enabled", true], + ]); + + const expectScrollNone = 0; + const expectScrollVert = 1; + const expectScrollHori = 2; + const expectScrollBoth = 3; + + var allTests = [ + { + dataUri: + 'data:text/html,\ +
\ +
\ +
\ +
\ + \ + \ +
\ +
\ + \ + ', + }, + { elem: "a", expected: expectScrollNone }, + { elem: "b", expected: expectScrollBoth }, + { elem: "c", expected: expectScrollHori }, + { elem: "d", expected: expectScrollVert }, + { elem: "e", expected: expectScrollVert }, + { elem: "f", expected: expectScrollNone }, + { elem: "g", expected: expectScrollBoth }, + { elem: "h", expected: expectScrollNone }, + { + dataUri: + 'data:text/html,
\ + \ + ', + }, + { elem: "i", expected: expectScrollVert }, // bug 695121 + { + dataUri: + 'data:text/html,\ +
\ + \ + ', + }, + { elem: "j", expected: expectScrollVert }, // bug 914251 + { + dataUri: + 'data:text/html,\ +\ +
', + }, + { elem: "t", expected: expectScrollBoth }, // bug 1308775 + { + dataUri: + 'data:text/html,\ +
\ +\ +
\ +
\ +\ +
\ +\ +
filler to make document overflow: scroll;
\ +', + }, + { elem: "k", expected: expectScrollBoth }, + { elem: "k", expected: expectScrollNone, testwindow: true }, + { elem: "l", expected: expectScrollNone }, + { elem: "m", expected: expectScrollVert, testwindow: true }, + { + dataUri: + 'data:text/html,\ +image map\ +\ + \ +\ +link\ +\ +\ +
\ +', + }, + { elem: "n", expected: expectScrollNone, testwindow: true }, + { elem: "o", expected: expectScrollNone, testwindow: true }, + { + elem: "p", + expected: expectScrollVert, + testwindow: true, + middlemousepastepref: false, + }, + { + elem: "q", + expected: expectScrollVert, + testwindow: true, + middlemousepastepref: false, + }, + { + dataUri: + 'data:text/html,\ +\ +\ +
\ +', + }, + { + elem: "r", + expected: expectScrollNone, + testwindow: true, + middlemousepastepref: true, + }, + { + elem: "s", + expected: expectScrollNone, + testwindow: true, + middlemousepastepref: true, + }, + { + dataUri: + "data:text/html," + + encodeURIComponent(` + + +
+ `), + }, + { + elem: "i", + // We expect the outer window to scroll vertically, not the iframe's window. + expected: expectScrollVert, + testwindow: true, + }, + { + dataUri: + "data:text/html," + + encodeURIComponent(` + + +
+ `), + }, + { + elem: "i", + // We expect the iframe's window to scroll vertically, so the outer window should not scroll. + expected: expectScrollNone, + testwindow: true, + }, + { + // Test: scroll is initiated in out of process iframe having no scrollable area + dataUri: + "data:text/html," + + encodeURIComponent(` + + +
+ +
+
+ `), + }, + { + elem: "noscroll-outofprocess-iframe", + // We expect the div to scroll vertically, not the iframe's window. + expected: expectScrollVert, + scrollable: "scroller", + }, + ]; + + for (let test of allTests) { + if (test.dataUri) { + let loadedPromise = BrowserTestUtils.browserLoaded( + gBrowser.selectedBrowser + ); + BrowserTestUtils.loadURI(gBrowser, test.dataUri); + await loadedPromise; + continue; + } + + let prefsChanged = "middlemousepastepref" in test; + if (prefsChanged) { + await pushPrefs([["middlemouse.paste", test.middlemousepastepref]]); + } + + await BrowserTestUtils.synthesizeMouse( + "#" + test.elem, + 50, + 80, + { button: 1 }, + gBrowser.selectedBrowser + ); + + // This ensures bug 605127 is fixed: pagehide in an unrelated document + // should not cancel the autoscroll. + await ContentTask.spawn( + gBrowser.selectedBrowser, + { waitForAutoScrollStart: test.expected != expectScrollNone }, + async ({ waitForAutoScrollStart }) => { + var iframe = content.document.getElementById("iframe"); + + if (iframe) { + var e = new iframe.contentWindow.PageTransitionEvent("pagehide", { + bubbles: true, + cancelable: true, + persisted: false, + }); + iframe.contentDocument.dispatchEvent(e); + iframe.contentDocument.documentElement.dispatchEvent(e); + } + if (waitForAutoScrollStart) { + await new Promise(resolve => + Services.obs.addObserver(resolve, "autoscroll-start") + ); + } + } + ); + + is( + document.activeElement, + gBrowser.selectedBrowser, + "Browser still focused after autoscroll started" + ); + + await BrowserTestUtils.synthesizeMouse( + "#" + test.elem, + 100, + 100, + { type: "mousemove", clickCount: "0" }, + gBrowser.selectedBrowser + ); + + if (prefsChanged) { + await SpecialPowers.popPrefEnv(); + } + + // Start checking for the scroll. + let firstTimestamp = undefined; + let timeCompensation; + do { + let timestamp = await new Promise(resolve => + window.requestAnimationFrame(resolve) + ); + if (firstTimestamp === undefined) { + firstTimestamp = timestamp; + } + + // This value is calculated similarly to the value of the same name in + // ClickEventHandler.autoscrollLoop, except here it's cumulative across + // all frames after the first one instead of being based only on the + // current frame. + timeCompensation = (timestamp - firstTimestamp) / 20; + info( + "timestamp=" + + timestamp + + " firstTimestamp=" + + firstTimestamp + + " timeCompensation=" + + timeCompensation + ); + + // Try to wait until enough time has passed to allow the scroll to happen. + // autoscrollLoop incrementally scrolls during each animation frame, but + // due to how its calculations work, when a frame is very close to the + // previous frame, no scrolling may actually occur during that frame. + // After 100ms's worth of frames, timeCompensation will be 1, making it + // more likely that the accumulated scroll in autoscrollLoop will be >= 1, + // although it also depends on acceleration, which here in this test + // should be > 1 due to how it synthesizes mouse events below. + } while (timeCompensation < 5); + + // Close the autoscroll popup by synthesizing Esc. + EventUtils.synthesizeKey("KEY_Escape"); + let scrollVert = test.expected & expectScrollVert; + let scrollHori = test.expected & expectScrollHori; + + await SpecialPowers.spawn( + gBrowser.selectedBrowser, + [ + { + scrollVert, + scrollHori, + elemid: test.scrollable || test.elem, + checkWindow: test.testwindow, + }, + ], + async function(args) { + let msg = ""; + if (args.checkWindow) { + if ( + !( + (args.scrollVert && content.scrollY > 0) || + (!args.scrollVert && content.scrollY == 0) + ) + ) { + msg += "Failed: "; + } + msg += + "Window for " + + args.elemid + + " should" + + (args.scrollVert ? "" : " not") + + " have scrolled vertically\n"; + + if ( + !( + (args.scrollHori && content.scrollX > 0) || + (!args.scrollHori && content.scrollX == 0) + ) + ) { + msg += "Failed: "; + } + msg += + " Window for " + + args.elemid + + " should" + + (args.scrollHori ? "" : " not") + + " have scrolled horizontally\n"; + } else { + let elem = content.document.getElementById(args.elemid); + if ( + !( + (args.scrollVert && elem.scrollTop > 0) || + (!args.scrollVert && elem.scrollTop == 0) + ) + ) { + msg += "Failed: "; + } + msg += + " " + + args.elemid + + " should" + + (args.scrollVert ? "" : " not") + + " have scrolled vertically\n"; + if ( + !( + (args.scrollHori && elem.scrollLeft > 0) || + (!args.scrollHori && elem.scrollLeft == 0) + ) + ) { + msg += "Failed: "; + } + msg += + args.elemid + + " should" + + (args.scrollHori ? "" : " not") + + " have scrolled horizontally"; + } + + Assert.ok(!msg.includes("Failed"), msg); + } + ); + + // Before continuing the test, we need to ensure that the IPC + // message that stops autoscrolling has had time to arrive. + await new Promise(resolve => executeSoon(resolve)); + } + + // remove 2 tabs that were opened by middle-click on links + while (gBrowser.visibleTabs.length > 1) { + gBrowser.removeTab(gBrowser.visibleTabs[gBrowser.visibleTabs.length - 1]); + } + + // wait for focus to fix a failure in the next test if the latter runs too soon. + await SimpleTest.promiseFocus(); +}); diff --git a/toolkit/content/tests/browser/browser_bug451286.js b/toolkit/content/tests/browser/browser_bug451286.js new file mode 100644 index 0000000000..7856356608 --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug451286.js @@ -0,0 +1,166 @@ +Services.scriptloader.loadSubScript( + "chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js", + this +); + +add_task(async function() { + const SEARCH_TEXT = "text"; + const DATAURI = "data:text/html," + SEARCH_TEXT; + + // Bug 451286. An iframe that should be highlighted + let visible = ""; + + // Bug 493658. An invisible iframe that shouldn't interfere with + // highlighting matches lying after it in the document + let invisible = + ""; + + let uri = DATAURI + invisible + SEARCH_TEXT + visible + SEARCH_TEXT; + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri); + let contentRect = tab.linkedBrowser.getBoundingClientRect(); + let noHighlightSnapshot = snapshotRect(window, contentRect); + ok(noHighlightSnapshot, "Got noHighlightSnapshot"); + + await openFindBarAndWait(); + gFindBar._findField.value = SEARCH_TEXT; + await findAgainAndWait(); + var matchCase = gFindBar.getElement("find-case-sensitive"); + if (matchCase.checked) { + matchCase.doCommand(); + } + + // Turn on highlighting + await toggleHighlightAndWait(true); + await closeFindBarAndWait(); + + // Take snapshot of highlighting + let findSnapshot = snapshotRect(window, contentRect); + ok(findSnapshot, "Got findSnapshot"); + + // Now, remove the highlighting, and take a snapshot to compare + // to our original state + await openFindBarAndWait(); + await toggleHighlightAndWait(false); + await closeFindBarAndWait(); + + let unhighlightSnapshot = snapshotRect(window, contentRect); + ok(unhighlightSnapshot, "Got unhighlightSnapshot"); + + // Select the matches that should have been highlighted manually + await SpecialPowers.spawn(tab.linkedBrowser, [], async function() { + let doc = content.document; + let win = doc.defaultView; + + // Create a manual highlight in the visible iframe to test bug 451286 + let iframe = doc.getElementById("visible"); + let ifBody = iframe.contentDocument.body; + let range = iframe.contentDocument.createRange(); + range.selectNodeContents(ifBody.childNodes[0]); + let ifWindow = iframe.contentWindow; + let ifDocShell = ifWindow.docShell; + + let ifController = ifDocShell + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsISelectionDisplay) + .QueryInterface(Ci.nsISelectionController); + + let frameFindSelection = ifController.getSelection( + ifController.SELECTION_FIND + ); + frameFindSelection.addRange(range); + + // Create manual highlights in the main document (the matches that lie + // before/after the iframes + let docShell = win.docShell; + + let controller = docShell + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsISelectionDisplay) + .QueryInterface(Ci.nsISelectionController); + + let docFindSelection = controller.getSelection(ifController.SELECTION_FIND); + + range = doc.createRange(); + range.selectNodeContents(doc.body.childNodes[0]); + docFindSelection.addRange(range); + range = doc.createRange(); + range.selectNodeContents(doc.body.childNodes[2]); + docFindSelection.addRange(range); + range = doc.createRange(); + range.selectNodeContents(doc.body.childNodes[4]); + docFindSelection.addRange(range); + }); + + // Take snapshot of manual highlighting + let manualSnapshot = snapshotRect(window, contentRect); + ok(manualSnapshot, "Got manualSnapshot"); + + // Test 1: Were the matches in iframe correctly highlighted? + let res = compareSnapshots(findSnapshot, manualSnapshot, true); + ok(res[0], "Matches found in iframe correctly highlighted"); + + // Test 2: Were the matches in iframe correctly unhighlighted? + res = compareSnapshots(noHighlightSnapshot, unhighlightSnapshot, true); + ok(res[0], "Highlighting in iframe correctly removed"); + + BrowserTestUtils.removeTab(tab); +}); + +function toggleHighlightAndWait(shouldHighlight) { + return new Promise(resolve => { + let listener = { + onFindResult() {}, + onHighlightFinished() { + gFindBar.browser.finder.removeResultListener(listener); + resolve(); + }, + onMatchesCountResult() {}, + }; + gFindBar.browser.finder.addResultListener(listener); + gFindBar.toggleHighlight(shouldHighlight); + }); +} + +function findAgainAndWait() { + return new Promise(resolve => { + let listener = { + onFindResult() { + gFindBar.browser.finder.removeResultListener(listener); + resolve(); + }, + onHighlightFinished() {}, + onMatchesCountResult() {}, + }; + gFindBar.browser.finder.addResultListener(listener); + gFindBar.onFindAgainCommand(); + }); +} + +async function openFindBarAndWait() { + await gFindBarPromise; + let awaitTransitionEnd = BrowserTestUtils.waitForEvent( + gFindBar, + "transitionend" + ); + gFindBar.open(); + await awaitTransitionEnd; +} + +// This test is comparing snapshots. It is necessary to wait for the gFindBar +// to close before taking the snapshot so the gFindBar does not take up space +// on the new snapshot. +async function closeFindBarAndWait() { + let awaitTransitionEnd = BrowserTestUtils.waitForEvent( + gFindBar, + "transitionend", + false, + event => { + return event.propertyName == "visibility"; + } + ); + gFindBar.close(); + await awaitTransitionEnd; +} diff --git a/toolkit/content/tests/browser/browser_bug594509.js b/toolkit/content/tests/browser/browser_bug594509.js new file mode 100644 index 0000000000..cf93d2c71c --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug594509.js @@ -0,0 +1,15 @@ +add_task(async function() { + let tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "about:rights" + ); + + await SpecialPowers.spawn(tab.linkedBrowser, [], async function() { + Assert.ok( + content.document.getElementById("your-rights"), + "about:rights content loaded" + ); + }); + + BrowserTestUtils.removeTab(tab); +}); diff --git a/toolkit/content/tests/browser/browser_bug982298.js b/toolkit/content/tests/browser/browser_bug982298.js new file mode 100644 index 0000000000..99a4dc5e96 --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug982298.js @@ -0,0 +1,72 @@ +const scrollHtml = + 'blank'; + +add_task(async function() { + let url = "data:text/html;base64," + btoa(scrollHtml); + await BrowserTestUtils.withNewTab({ gBrowser, url }, async function(browser) { + let awaitFindResult = new Promise(resolve => { + let listener = { + onFindResult(aData) { + info("got find result"); + browser.finder.removeResultListener(listener); + + ok( + aData.result == Ci.nsITypeAheadFind.FIND_FOUND, + "should find string" + ); + resolve(); + }, + onCurrentSelection() {}, + onMatchesCountResult() {}, + }; + info("about to add results listener, open find bar, and send 'F' string"); + browser.finder.addResultListener(listener); + }); + await gFindBarPromise; + gFindBar.onFindCommand(); + EventUtils.sendString("F"); + info("added result listener and sent string 'F'"); + await awaitFindResult; + + // scroll textarea to bottom + await SpecialPowers.spawn(browser, [], () => { + let textarea = content.document.getElementById("textarea1"); + textarea.scrollTop = textarea.scrollHeight; + }); + BrowserTestUtils.loadURI(browser, "about:blank"); + await BrowserTestUtils.browserLoaded(browser); + + ok( + browser.currentURI.spec == "about:blank", + "got load event for about:blank" + ); + + let awaitFindResult2 = new Promise(resolve => { + let listener = { + onFindResult(aData) { + info("got find result #2"); + browser.finder.removeResultListener(listener); + resolve(); + }, + onCurrentSelection() {}, + onMatchesCountResult() {}, + }; + + browser.finder.addResultListener(listener); + info("added result listener"); + }); + // find again needs delay for crash test + setTimeout(function() { + // ignore exception if occured + try { + info("about to send find again command"); + gFindBar.onFindAgainCommand(false); + info("sent find again command"); + } catch (e) { + info("got exception from onFindAgainCommand: " + e); + } + }, 0); + await awaitFindResult2; + }); +}); diff --git a/toolkit/content/tests/browser/browser_charsetMenu_swapBrowsers.js b/toolkit/content/tests/browser/browser_charsetMenu_swapBrowsers.js new file mode 100644 index 0000000000..8eda01de8e --- /dev/null +++ b/toolkit/content/tests/browser/browser_charsetMenu_swapBrowsers.js @@ -0,0 +1,34 @@ +/* Test that the charset menu is properly enabled when swapping browsers. */ +add_task(async function test() { + // NB: This test cheats and calls updateCharacterEncodingMenuState directly + // instead of opening the "View" menu. + function charsetMenuEnabled() { + updateCharacterEncodingMenuState(); + return !document.getElementById("charsetMenu").hasAttribute("disabled"); + } + + const PAGE = "data:text/html,hello"; + let tab1 = await BrowserTestUtils.openNewForegroundTab({ + gBrowser, + url: PAGE, + }); + ok(charsetMenuEnabled(), "should have a charset menu here"); + + let tab2 = await BrowserTestUtils.openNewForegroundTab({ gBrowser }); + ok(!charsetMenuEnabled(), "about:blank shouldn't have a charset menu"); + + await BrowserTestUtils.switchTab(gBrowser, tab1); + + let swapped = BrowserTestUtils.waitForEvent( + tab2.linkedBrowser, + "SwapDocShells" + ); + + // NB: Closes tab1. + gBrowser.swapBrowsersAndCloseOther(tab2, tab1); + await swapped; + + ok(charsetMenuEnabled(), "should have a charset after the swap"); + + BrowserTestUtils.removeTab(tab2); +}); diff --git a/toolkit/content/tests/browser/browser_contentTitle.js b/toolkit/content/tests/browser/browser_contentTitle.js new file mode 100644 index 0000000000..abd70809fc --- /dev/null +++ b/toolkit/content/tests/browser/browser_contentTitle.js @@ -0,0 +1,17 @@ +var url = + "https://example.com/browser/toolkit/content/tests/browser/file_contentTitle.html"; + +add_task(async function() { + let tab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, url)); + await BrowserTestUtils.waitForContentEvent( + tab.linkedBrowser, + "TestLocationChange", + true, + null, + true + ); + + is(gBrowser.contentTitle, "Test Page", "Should have the right title."); + + gBrowser.removeTab(tab); +}); diff --git a/toolkit/content/tests/browser/browser_content_url_annotation.js b/toolkit/content/tests/browser/browser_content_url_annotation.js new file mode 100644 index 0000000000..72180ec2d0 --- /dev/null +++ b/toolkit/content/tests/browser/browser_content_url_annotation.js @@ -0,0 +1,78 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +/* global Services, requestLongerTimeout, TestUtils, BrowserTestUtils, + ok, info, dump, is, Ci, Cu, Components, ctypes, + gBrowser, add_task, addEventListener, removeEventListener, ContentTask */ + +"use strict"; + +// Running this test in ASAN is slow. +requestLongerTimeout(2); + +/** + * Removes a file from a directory. This is a no-op if the file does not + * exist. + * + * @param directory + * The nsIFile representing the directory to remove from. + * @param filename + * A string for the file to remove from the directory. + */ +function removeFile(directory, filename) { + let file = directory.clone(); + file.append(filename); + if (file.exists()) { + file.remove(false); + } +} + +/** + * Returns the directory where crash dumps are stored. + * + * @return nsIFile + */ +function getMinidumpDirectory() { + let dir = Services.dirsvc.get("ProfD", Ci.nsIFile); + dir.append("minidumps"); + return dir; +} + +/** + * Checks that the URL is correctly annotated on a content process crash. + */ +add_task(async function test_content_url_annotation() { + let url = + "https://example.com/browser/toolkit/content/tests/browser/file_redirect.html"; + let redirect_url = + "https://example.com/browser/toolkit/content/tests/browser/file_redirect_to.html"; + + await BrowserTestUtils.withNewTab( + { + gBrowser, + }, + async function(browser) { + ok(browser.isRemoteBrowser, "Should be a remote browser"); + + // file_redirect.html should send us to file_redirect_to.html + let promise = BrowserTestUtils.waitForContentEvent( + browser, + "RedirectDone", + true, + null, + true + ); + BrowserTestUtils.loadURI(browser, url); + await promise; + + // Crash the tab + let annotations = await BrowserTestUtils.crashFrame(browser); + + ok("URL" in annotations, "annotated a URL"); + is( + annotations.URL, + redirect_url, + "Should have annotated the URL after redirect" + ); + } + ); +}); diff --git a/toolkit/content/tests/browser/browser_crash_previous_frameloader.js b/toolkit/content/tests/browser/browser_crash_previous_frameloader.js new file mode 100644 index 0000000000..6870cd825d --- /dev/null +++ b/toolkit/content/tests/browser/browser_crash_previous_frameloader.js @@ -0,0 +1,131 @@ +"use strict"; + +/** + * Returns the id of the crash minidump. + * + * @param subject (nsISupports) + * The subject passed through the ipc:content-shutdown + * observer notification when a content process crash has + * occurred. + * @returns {String} The crash dump id. + */ +function getCrashDumpId(subject) { + Assert.ok( + subject instanceof Ci.nsIPropertyBag2, + "Subject needs to be a nsIPropertyBag2 to clean up properly" + ); + + return subject.getPropertyAsAString("dumpID"); +} + +/** + * Cleans up the .dmp and .extra file from a crash. + * + * @param id {String} The crash dump id. + */ +function cleanUpMinidump(id) { + let dir = Services.dirsvc.get("ProfD", Ci.nsIFile); + dir.append("minidumps"); + + let file = dir.clone(); + file.append(id + ".dmp"); + file.remove(true); + + file = dir.clone(); + file.append(id + ".extra"); + file.remove(true); +} + +/** + * This test ensures that if a remote frameloader crashes after + * the frameloader owner swaps it out for a new frameloader, + * that a oop-browser-crashed event is not sent to the new + * frameloader's browser element. + */ +add_task(async function test_crash_in_previous_frameloader() { + // On debug builds, crashing tabs results in much thinking, which + // slows down the test and results in intermittent test timeouts, + // so we'll pump up the expected timeout for this test. + requestLongerTimeout(2); + + if (!gMultiProcessBrowser) { + Assert.ok(false, "This test should only be run in multi-process mode."); + return; + } + + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: "http://example.com", + }, + async function(browser) { + // First, sanity check... + Assert.ok( + browser.isRemoteBrowser, + "This browser needs to be remote if this test is going to " + + "work properly." + ); + + // We will wait for the oop-browser-crashed event to have + // a chance to appear. That event is fired when RemoteTabs + // are destroyed, and that occurs _before_ ContentParents + // are destroyed, so we'll wait on the ipc:content-shutdown + // observer notification, which is fired when a ContentParent + // goes away. After we see this notification, oop-browser-crashed + // events should have fired. + let contentProcessGone = TestUtils.topicObserved("ipc:content-shutdown"); + let sawTabCrashed = false; + let onTabCrashed = () => { + sawTabCrashed = true; + }; + + browser.addEventListener("oop-browser-crashed", onTabCrashed); + + // The name of the game is to cause a crash in a remote browser, + // and then immediately swap out the browser for a non-remote one. + await SpecialPowers.spawn(browser, [], function() { + const { ctypes } = ChromeUtils.import( + "resource://gre/modules/ctypes.jsm" + ); + + let dies = function() { + ChromeUtils.privateNoteIntentionalCrash(); + let zero = new ctypes.intptr_t(8); + let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t)); + badptr.contents; + }; + + // When the parent flips the remoteness of the browser, the + // page should receive the pagehide event, which we'll then + // use to crash the frameloader. + docShell.chromeEventHandler.addEventListener("pagehide", function() { + dump("\nEt tu, Brute?\n"); + dies(); + }); + }); + + gBrowser.updateBrowserRemoteness(browser, { + remoteType: E10SUtils.NOT_REMOTE, + }); + info("Waiting for content process to go away."); + let [subject /* , data */] = await contentProcessGone; + + // If we don't clean up the minidump, the harness will + // complain. + let dumpID = getCrashDumpId(subject); + + Assert.ok(dumpID, "There should be a dumpID"); + if (dumpID) { + await Services.crashmanager.ensureCrashIsPresent(dumpID); + cleanUpMinidump(dumpID); + } + + info("Content process is gone!"); + Assert.ok( + !sawTabCrashed, + "Should not have seen the oop-browser-crashed event." + ); + browser.removeEventListener("oop-browser-crashed", onTabCrashed); + } + ); +}); diff --git a/toolkit/content/tests/browser/browser_datetime_datepicker.js b/toolkit/content/tests/browser/browser_datetime_datepicker.js new file mode 100644 index 0000000000..a354dda0ec --- /dev/null +++ b/toolkit/content/tests/browser/browser_datetime_datepicker.js @@ -0,0 +1,791 @@ +/* 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 MONTH_YEAR = ".month-year", + DAYS_VIEW = ".days-view", + BTN_PREV_MONTH = ".prev", + BTN_NEXT_MONTH = ".next"; +const DATE_FORMAT = new Intl.DateTimeFormat("en-US", { + year: "numeric", + month: "long", + timeZone: "UTC", +}).format; +const DATE_FORMAT_LOCAL = new Intl.DateTimeFormat("en-US", { + year: "numeric", + month: "long", +}).format; + +// Create a list of abbreviations for calendar class names +const W = "weekend", + O = "outside", + S = "selection", + R = "out-of-range", + T = "today", + P = "off-step"; + +// Calendar classlist for 2016-12. Used to verify the classNames are correct. +const calendarClasslist_201612 = [ + [W, O], + [O], + [O], + [O], + [], + [], + [W], + [W], + [], + [], + [], + [], + [], + [W], + [W], + [], + [], + [], + [S], + [], + [W], + [W], + [], + [], + [], + [], + [], + [W], + [W], + [], + [], + [], + [], + [], + [W], + [W, O], + [O], + [O], + [O], + [O], + [O], + [W, O], +]; + +function getCalendarText() { + return helper.getChildren(DAYS_VIEW).map(child => child.textContent); +} + +function getCalendarClassList() { + return helper + .getChildren(DAYS_VIEW) + .map(child => Array.from(child.classList)); +} + +function mergeArrays(a, b) { + return a.map((classlist, index) => classlist.concat(b[index])); +} + +async function verifyPickerPosition(browsingContext, inputId) { + let inputRect = await SpecialPowers.spawn( + browsingContext, + [inputId], + async function(inputIdChild) { + let rect = content.document + .getElementById(inputIdChild) + .getBoundingClientRect(); + return { + left: content.mozInnerScreenX + rect.left, + bottom: content.mozInnerScreenY + rect.bottom, + }; + } + ); + + function is_close(got, exp, msg) { + // on some platforms we see differences of a fraction of a pixel - so + // allow any difference of < 1 pixels as being OK. + ok( + Math.abs(got - exp) < 1, + msg + ": " + got + " should be equal(-ish) to " + exp + ); + } + is_close(helper.panel.screenX, inputRect.left, "datepicker x position"); + is_close(helper.panel.screenY, inputRect.bottom, "datepicker y position"); +} + +let helper = new DateTimeTestHelper(); + +registerCleanupFunction(() => { + helper.cleanup(); +}); + +/** + * Test that date picker opens to today's date when input field is blank + */ +add_task(async function test_datepicker_today() { + const date = new Date(); + + await helper.openPicker("data:text/html, "); + + if (date.getMonth() === new Date().getMonth()) { + Assert.equal( + helper.getElement(MONTH_YEAR).textContent, + DATE_FORMAT_LOCAL(date) + ); + } else { + Assert.ok( + true, + "Skipping datepicker today test if month changes when opening picker." + ); + } + + await helper.tearDown(); +}); + +/** + * Test that date picker opens to the correct month, with calendar days + * displayed correctly, given a date value is set. + */ +add_task(async function test_datepicker_open() { + const inputValue = "2016-12-15"; + + await helper.openPicker( + `data:text/html, ` + ); + + Assert.equal( + helper.getElement(MONTH_YEAR).textContent, + DATE_FORMAT(new Date(inputValue)) + ); + Assert.deepEqual( + getCalendarText(), + [ + "27", + "28", + "29", + "30", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "21", + "22", + "23", + "24", + "25", + "26", + "27", + "28", + "29", + "30", + "31", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + ], + "2016-12" + ); + Assert.deepEqual( + getCalendarClassList(), + calendarClasslist_201612, + "2016-12 classNames" + ); + + await helper.tearDown(); +}); + +/** + * Ensure picker closes when focus moves to a different input. + */ +add_task(async function test_datepicker_focus_change() { + await helper.openPicker( + `data:text/html,` + ); + let browser = helper.tab.linkedBrowser; + await verifyPickerPosition(browser, "date"); + + isnot(helper.panel.hidden, "Panel should be visible"); + + await SpecialPowers.spawn(browser, [], () => { + content.document.querySelector("#other").focus(); + }); + + // NOTE: Would be cool to be able to use promisePickerClosed(), but + // popuphidden isn't really triggered for this code path it seems, so oh + // well. + await BrowserTestUtils.waitForCondition( + () => helper.panel.hidden, + "waiting for close" + ); + await helper.tearDown(); +}); + +/** + * Ensure picker opens and closes with key bindings appropriately. + */ +/* +disabled for bug 1676078 +add_task(async function test_datepicker_keyboard_open() { + const inputValue = "2016-12-15"; + const prevMonth = "2016-11-01"; + await helper.openPicker( + `data:text/html,` + ); + let browser = helper.tab.linkedBrowser; + await verifyPickerPosition(browser, "date"); + + BrowserTestUtils.synthesizeKey(" ", {}, browser); + + await BrowserTestUtils.waitForCondition( + () => helper.panel.hidden, + "waiting for close" + ); + + BrowserTestUtils.synthesizeKey(" ", {}, browser); + + await BrowserTestUtils.waitForCondition( + () => !helper.panel.hidden, + "waiting for open" + ); + + // NOTE: After the click, the first input field (the month one) is focused, + // so down arrow will change the selected month. + // + // This assumes en-US locale, which seems fine for testing purposes (as + // DATE_FORMAT and other bits around do the same). + BrowserTestUtils.synthesizeKey("VK_DOWN", {}, browser); + + // It'd be good to use something else than waitForCondition for this but + // there's no exposed event atm when the value changes from the child. + await BrowserTestUtils.waitForCondition(() => { + return ( + helper.getElement(MONTH_YEAR).textContent == + DATE_FORMAT(new Date(prevMonth)) + ); + }, "Should update date when updating months"); + + await helper.tearDown(); +}); +*/ + +/** + * When the prev month button is clicked, calendar should display the dates for + * the previous month. + */ +add_task(async function test_datepicker_prev_month_btn() { + const inputValue = "2016-12-15"; + const prevMonth = "2016-11-01"; + + await helper.openPicker( + `data:text/html, ` + ); + helper.click(helper.getElement(BTN_PREV_MONTH)); + + Assert.equal( + helper.getElement(MONTH_YEAR).textContent, + DATE_FORMAT(new Date(prevMonth)) + ); + Assert.deepEqual( + getCalendarText(), + [ + "30", + "31", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "21", + "22", + "23", + "24", + "25", + "26", + "27", + "28", + "29", + "30", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + ], + "2016-11" + ); + + await helper.tearDown(); +}); + +/** + * When the next month button is clicked, calendar should display the dates for + * the next month. + */ +add_task(async function test_datepicker_next_month_btn() { + const inputValue = "2016-12-15"; + const nextMonth = "2017-01-01"; + + await helper.openPicker( + `data:text/html, ` + ); + helper.click(helper.getElement(BTN_NEXT_MONTH)); + + Assert.equal( + helper.getElement(MONTH_YEAR).textContent, + DATE_FORMAT(new Date(nextMonth)) + ); + Assert.deepEqual( + getCalendarText(), + [ + "25", + "26", + "27", + "28", + "29", + "30", + "31", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "21", + "22", + "23", + "24", + "25", + "26", + "27", + "28", + "29", + "30", + "31", + "1", + "2", + "3", + "4", + ], + "2017-01" + ); + + await helper.tearDown(); +}); + +/** + * When a date on the calendar is clicked, date picker should close and set + * value to the input box. + */ +add_task(async function test_datepicker_clicked() { + const inputValue = "2016-12-15"; + const firstDayOnCalendar = "2016-11-27"; + + await helper.openPicker( + `data:text/html, ` + ); + + let browser = helper.tab.linkedBrowser; + await verifyPickerPosition(browser, "date"); + + // Click the first item (top-left corner) of the calendar + let promise = BrowserTestUtils.waitForContentEvent( + helper.tab.linkedBrowser, + "input" + ); + helper.click(helper.getElement(DAYS_VIEW).children[0]); + await promise; + + let value = await SpecialPowers.spawn( + browser, + [], + () => content.document.querySelector("input").value + ); + Assert.equal(value, firstDayOnCalendar); + + await helper.tearDown(); +}); + +/** + * Ensure that the datepicker popop appears correctly positioned when + * the input field has been transformed. + */ +add_task(async function test_datepicker_transformed_position() { + const inputValue = "2016-12-15"; + + const style = + "transform: translateX(7px) translateY(13px); border-top: 2px; border-left: 5px; margin: 30px;"; + const iframeContent = ``; + await helper.openPicker( + "data:text/html, + + diff --git a/toolkit/content/tests/browser/file_mediaPlayback2.html b/toolkit/content/tests/browser/file_mediaPlayback2.html new file mode 100644 index 0000000000..890b494a05 --- /dev/null +++ b/toolkit/content/tests/browser/file_mediaPlayback2.html @@ -0,0 +1,14 @@ + + + + diff --git a/toolkit/content/tests/browser/file_multipleAudio.html b/toolkit/content/tests/browser/file_multipleAudio.html new file mode 100644 index 0000000000..5dc37febb4 --- /dev/null +++ b/toolkit/content/tests/browser/file_multipleAudio.html @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/toolkit/content/tests/browser/file_multiplePlayingAudio.html b/toolkit/content/tests/browser/file_multiplePlayingAudio.html new file mode 100644 index 0000000000..ae122506fb --- /dev/null +++ b/toolkit/content/tests/browser/file_multiplePlayingAudio.html @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/toolkit/content/tests/browser/file_nonAutoplayAudio.html b/toolkit/content/tests/browser/file_nonAutoplayAudio.html new file mode 100644 index 0000000000..4d2641021a --- /dev/null +++ b/toolkit/content/tests/browser/file_nonAutoplayAudio.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/toolkit/content/tests/browser/file_outside_viewport_videos.html b/toolkit/content/tests/browser/file_outside_viewport_videos.html new file mode 100644 index 0000000000..84aa34358d --- /dev/null +++ b/toolkit/content/tests/browser/file_outside_viewport_videos.html @@ -0,0 +1,41 @@ + + + outside viewport videos + + + +
+
+
+
+
+
+
+
+ + diff --git a/toolkit/content/tests/browser/file_redirect.html b/toolkit/content/tests/browser/file_redirect.html new file mode 100644 index 0000000000..4d5fa9dfd1 --- /dev/null +++ b/toolkit/content/tests/browser/file_redirect.html @@ -0,0 +1,13 @@ + + + + +redirecting... + + +redirectin u bro + + diff --git a/toolkit/content/tests/browser/file_redirect_to.html b/toolkit/content/tests/browser/file_redirect_to.html new file mode 100644 index 0000000000..28c0b53713 --- /dev/null +++ b/toolkit/content/tests/browser/file_redirect_to.html @@ -0,0 +1,15 @@ + + + + +redirected! + + +u got redirected, bro + + diff --git a/toolkit/content/tests/browser/file_silentAudioTrack.html b/toolkit/content/tests/browser/file_silentAudioTrack.html new file mode 100644 index 0000000000..afdf2c5297 --- /dev/null +++ b/toolkit/content/tests/browser/file_silentAudioTrack.html @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/toolkit/content/tests/browser/file_video.html b/toolkit/content/tests/browser/file_video.html new file mode 100644 index 0000000000..3c70268fbb --- /dev/null +++ b/toolkit/content/tests/browser/file_video.html @@ -0,0 +1,9 @@ + + + +video + + + + + diff --git a/toolkit/content/tests/browser/file_videoWithAudioOnly.html b/toolkit/content/tests/browser/file_videoWithAudioOnly.html new file mode 100644 index 0000000000..be84d60c34 --- /dev/null +++ b/toolkit/content/tests/browser/file_videoWithAudioOnly.html @@ -0,0 +1,9 @@ + + + +video + + + + + diff --git a/toolkit/content/tests/browser/file_videoWithoutAudioTrack.html b/toolkit/content/tests/browser/file_videoWithoutAudioTrack.html new file mode 100644 index 0000000000..a732b7c9d0 --- /dev/null +++ b/toolkit/content/tests/browser/file_videoWithoutAudioTrack.html @@ -0,0 +1,9 @@ + + + +video without audio track + + + + + diff --git a/toolkit/content/tests/browser/file_webAudio.html b/toolkit/content/tests/browser/file_webAudio.html new file mode 100644 index 0000000000..f6fb5e7c07 --- /dev/null +++ b/toolkit/content/tests/browser/file_webAudio.html @@ -0,0 +1,29 @@ + + + + + + +

+
+
+
+
diff --git a/toolkit/content/tests/browser/firebird.png b/toolkit/content/tests/browser/firebird.png
new file mode 100644
index 0000000000..de5c22f8ce
Binary files /dev/null and b/toolkit/content/tests/browser/firebird.png differ
diff --git a/toolkit/content/tests/browser/firebird.png^headers^ b/toolkit/content/tests/browser/firebird.png^headers^
new file mode 100644
index 0000000000..2918fdbe5f
--- /dev/null
+++ b/toolkit/content/tests/browser/firebird.png^headers^
@@ -0,0 +1,2 @@
+HTTP 302 Found
+Location: doggy.png
diff --git a/toolkit/content/tests/browser/gizmo-noaudio.webm b/toolkit/content/tests/browser/gizmo-noaudio.webm
new file mode 100644
index 0000000000..9f412cb6e3
Binary files /dev/null and b/toolkit/content/tests/browser/gizmo-noaudio.webm differ
diff --git a/toolkit/content/tests/browser/gizmo.mp4 b/toolkit/content/tests/browser/gizmo.mp4
new file mode 100644
index 0000000000..87efad5ade
Binary files /dev/null and b/toolkit/content/tests/browser/gizmo.mp4 differ
diff --git a/toolkit/content/tests/browser/head.js b/toolkit/content/tests/browser/head.js
new file mode 100644
index 0000000000..8973f1a6b4
--- /dev/null
+++ b/toolkit/content/tests/browser/head.js
@@ -0,0 +1,338 @@
+"use strict";
+
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", this);
+
+/**
+ * A wrapper for the findbar's method "close", which is not synchronous
+ * because of animation.
+ */
+function closeFindbarAndWait(findbar) {
+  return new Promise(resolve => {
+    if (findbar.hidden) {
+      resolve();
+      return;
+    }
+    findbar.addEventListener("transitionend", function cont(aEvent) {
+      if (aEvent.propertyName != "visibility") {
+        return;
+      }
+      findbar.removeEventListener("transitionend", cont);
+      resolve();
+    });
+    let close = findbar.getElement("find-closebutton");
+    close.doCommand();
+  });
+}
+
+function pushPrefs(...aPrefs) {
+  return new Promise(resolve => {
+    SpecialPowers.pushPrefEnv({ set: aPrefs }, resolve);
+  });
+}
+
+/**
+ * Used to check whether the audio unblocking icon is in the tab.
+ */
+async function waitForTabBlockEvent(tab, expectBlocked) {
+  if (tab.activeMediaBlocked == expectBlocked) {
+    ok(true, "The tab should " + (expectBlocked ? "" : "not ") + "be blocked");
+  } else {
+    info("Block state doens't match, wait for attributes changes.");
+    await BrowserTestUtils.waitForEvent(
+      tab,
+      "TabAttrModified",
+      false,
+      event => {
+        if (event.detail.changed.includes("activemedia-blocked")) {
+          is(
+            tab.activeMediaBlocked,
+            expectBlocked,
+            "The tab should " + (expectBlocked ? "" : "not ") + "be blocked"
+          );
+          return true;
+        }
+        return false;
+      }
+    );
+  }
+}
+
+/**
+ * Used to check whether the tab has soundplaying attribute.
+ */
+async function waitForTabPlayingEvent(tab, expectPlaying) {
+  if (tab.soundPlaying == expectPlaying) {
+    ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
+  } else {
+    info("Playing state doesn't match, wait for attributes changes.");
+    await BrowserTestUtils.waitForEvent(
+      tab,
+      "TabAttrModified",
+      false,
+      event => {
+        if (event.detail.changed.includes("soundplaying")) {
+          is(
+            tab.soundPlaying,
+            expectPlaying,
+            "The tab should " + (expectPlaying ? "" : "not ") + "be playing"
+          );
+          return true;
+        }
+        return false;
+      }
+    );
+  }
+}
+
+function getTestPlugin(pluginName) {
+  var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(
+    SpecialPowers.Ci.nsIPluginHost
+  );
+  var tags = ph.getPluginTags();
+  var name = pluginName || "Test Plug-in";
+  for (var tag of tags) {
+    if (tag.name == name) {
+      return tag;
+    }
+  }
+
+  ok(false, "Could not find plugin tag with plugin name '" + name + "'");
+  return null;
+}
+
+async function setTestPluginEnabledState(newEnabledState, pluginName) {
+  var oldEnabledState = await SpecialPowers.setTestPluginEnabledState(
+    newEnabledState,
+    pluginName
+  );
+  if (!oldEnabledState) {
+    return;
+  }
+  var plugin = getTestPlugin(pluginName);
+  // Run a nested event loop to wait for the preference change to
+  // propagate to the child. Yuck!
+  SpecialPowers.Services.tm.spinEventLoopUntil(() => {
+    return plugin.enabledState == newEnabledState;
+  });
+  SimpleTest.registerCleanupFunction(function() {
+    return SpecialPowers.setTestPluginEnabledState(oldEnabledState, pluginName);
+  });
+}
+
+function disable_non_test_mouse(disable) {
+  let utils = window.windowUtils;
+  utils.disableNonTestMouseEvents(disable);
+}
+
+function hover_icon(icon, tooltip) {
+  disable_non_test_mouse(true);
+
+  let popupShownPromise = BrowserTestUtils.waitForEvent(tooltip, "popupshown");
+  EventUtils.synthesizeMouse(icon, 1, 1, { type: "mouseover" });
+  EventUtils.synthesizeMouse(icon, 2, 2, { type: "mousemove" });
+  EventUtils.synthesizeMouse(icon, 3, 3, { type: "mousemove" });
+  EventUtils.synthesizeMouse(icon, 4, 4, { type: "mousemove" });
+  return popupShownPromise;
+}
+
+function leave_icon(icon) {
+  EventUtils.synthesizeMouse(icon, 0, 0, { type: "mouseout" });
+  EventUtils.synthesizeMouseAtCenter(document.documentElement, {
+    type: "mousemove",
+  });
+  EventUtils.synthesizeMouseAtCenter(document.documentElement, {
+    type: "mousemove",
+  });
+  EventUtils.synthesizeMouseAtCenter(document.documentElement, {
+    type: "mousemove",
+  });
+
+  disable_non_test_mouse(false);
+}
+
+/**
+ * Helper class for testing datetime input picker widget
+ */
+class DateTimeTestHelper {
+  constructor() {
+    this.panel = gBrowser._getAndMaybeCreateDateTimePickerPanel();
+    this.panel.setAttribute("animate", false);
+    this.tab = null;
+    this.frame = null;
+  }
+
+  /**
+   * Opens a new tab with the URL of the test page, and make sure the picker is
+   * ready for testing.
+   *
+   * @param  {String} pageUrl
+   * @param  {bool} inFrame true if input is in the first child frame
+   */
+  async openPicker(pageUrl, inFrame) {
+    this.tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
+    let bc = gBrowser.selectedBrowser;
+    if (inFrame) {
+      await SpecialPowers.spawn(bc, [], async function() {
+        const iframe = content.document.querySelector("iframe");
+        // Ensure the iframe's position is correct before doing any
+        // other operations
+        iframe.getBoundingClientRect();
+      });
+      bc = bc.browsingContext.children[0];
+    }
+    await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, bc);
+    this.frame = this.panel.querySelector("#dateTimePopupFrame");
+    await this.waitForPickerReady();
+  }
+
+  promisePickerClosed() {
+    return new Promise(resolve => {
+      this.panel.addEventListener("popuphidden", resolve, { once: true });
+    });
+  }
+
+  async waitForPickerReady() {
+    let readyPromise;
+    let loadPromise = new Promise(resolve => {
+      this.frame.addEventListener(
+        "load",
+        () => {
+          // Add the PickerReady event listener directly inside the load event
+          // listener to avoid missing the event.
+          readyPromise = BrowserTestUtils.waitForEvent(
+            this.frame.contentDocument,
+            "PickerReady"
+          );
+          resolve();
+        },
+        { capture: true, once: true }
+      );
+    });
+
+    await loadPromise;
+    // Wait for picker elements to be ready
+    await readyPromise;
+  }
+
+  /**
+   * Find an element on the picker.
+   *
+   * @param  {String} selector
+   * @return {DOMElement}
+   */
+  getElement(selector) {
+    return this.frame.contentDocument.querySelector(selector);
+  }
+
+  /**
+   * Find the children of an element on the picker.
+   *
+   * @param  {String} selector
+   * @return {Array}
+   */
+  getChildren(selector) {
+    return Array.from(this.getElement(selector).children);
+  }
+
+  /**
+   * Click on an element
+   *
+   * @param  {DOMElement} element
+   */
+  click(element) {
+    EventUtils.synthesizeMouseAtCenter(element, {}, this.frame.contentWindow);
+  }
+
+  /**
+   * Close the panel and the tab
+   */
+  async tearDown() {
+    if (!this.panel.hidden) {
+      let pickerClosePromise = this.promisePickerClosed();
+      this.panel.hidePopup();
+      await pickerClosePromise;
+    }
+    BrowserTestUtils.removeTab(this.tab);
+    this.tab = null;
+  }
+
+  /**
+   * Clean up after tests. Remove the frame to prevent leak.
+   */
+  cleanup() {
+    this.frame.remove();
+    this.frame = null;
+    this.panel.removeAttribute("animate");
+    this.panel = null;
+  }
+}
+
+/**
+ * Used to listen events if you just need it once
+ */
+function once(target, name) {
+  var p = new Promise(function(resolve, reject) {
+    target.addEventListener(
+      name,
+      function() {
+        resolve();
+      },
+      { once: true }
+    );
+  });
+  return p;
+}
+
+/**
+ * check if current wakelock is equal to expected state, if not, then wait until
+ * the wakelock changes its state to expected state.
+ * @param needLock
+ *        the wakolock should be locked or not
+ * @param isForegroundLock
+ *        when the lock is on, the wakelock should be in the foreground or not
+ */
+async function waitForExpectedWakeLockState(
+  topic,
+  { needLock, isForegroundLock }
+) {
+  const powerManagerService = Cc["@mozilla.org/power/powermanagerservice;1"];
+  const powerManager = powerManagerService.getService(
+    Ci.nsIPowerManagerService
+  );
+  const wakelockState = powerManager.getWakeLockState(topic);
+  let expectedLockState = "unlocked";
+  if (needLock) {
+    expectedLockState = isForegroundLock
+      ? "locked-foreground"
+      : "locked-background";
+  }
+  if (wakelockState != expectedLockState) {
+    info(`wait until wakelock becomes ${expectedLockState}`);
+    await wakeLockObserved(
+      powerManager,
+      topic,
+      state => state == expectedLockState
+    );
+  }
+  is(
+    powerManager.getWakeLockState(topic),
+    expectedLockState,
+    `the wakelock state for '${topic}' is equal to '${expectedLockState}'`
+  );
+}
+
+function wakeLockObserved(powerManager, observeTopic, checkFn) {
+  return new Promise(resolve => {
+    function wakeLockListener() {}
+    wakeLockListener.prototype = {
+      QueryInterface: ChromeUtils.generateQI(["nsIDOMMozWakeLockListener"]),
+      callback(topic, state) {
+        if (topic == observeTopic && checkFn(state)) {
+          powerManager.removeWakeLockListener(wakeLockListener.prototype);
+          resolve();
+        }
+      },
+    };
+    powerManager.addWakeLockListener(wakeLockListener.prototype);
+  });
+}
diff --git a/toolkit/content/tests/browser/image.jpg b/toolkit/content/tests/browser/image.jpg
new file mode 100644
index 0000000000..5031808ad2
Binary files /dev/null and b/toolkit/content/tests/browser/image.jpg differ
diff --git a/toolkit/content/tests/browser/image_page.html b/toolkit/content/tests/browser/image_page.html
new file mode 100644
index 0000000000..522a1d8cf9
--- /dev/null
+++ b/toolkit/content/tests/browser/image_page.html
@@ -0,0 +1,9 @@
+
+
+
+
+OHAI
+
+
+
+
diff --git a/toolkit/content/tests/browser/silentAudioTrack.webm b/toolkit/content/tests/browser/silentAudioTrack.webm
new file mode 100644
index 0000000000..8e08a86c45
Binary files /dev/null and b/toolkit/content/tests/browser/silentAudioTrack.webm differ
diff --git a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js
new file mode 100644
index 0000000000..c5c1fceab7
--- /dev/null
+++ b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js
@@ -0,0 +1,140 @@
+/* This code is mostly copied from chrome/test/unit/head_crtestutils.js */
+
+// This file assumes chrome-harness.js is loaded in the global scope.
+/* import-globals-from ../../../../testing/mochitest/chrome-harness.js */
+
+const NS_CHROME_MANIFESTS_FILE_LIST = "ChromeML";
+const XUL_CACHE_PREF = "nglayout.debug.disable_xul_cache";
+
+var gChromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+  Ci.nsIXULChromeRegistry
+);
+
+// Create the temporary file in the profile, instead of in TmpD, because
+// we know the mochitest harness kills off the profile when it's done.
+function copyToTemporaryFile(f) {
+  let tmpd = Services.dirsvc.get("ProfD", Ci.nsIFile);
+  let tmpf = tmpd.clone();
+  tmpf.append("temp.manifest");
+  tmpf.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
+  tmpf.remove(false);
+  f.copyTo(tmpd, tmpf.leafName);
+  return tmpf;
+}
+
+function* dirIter(directory) {
+  var testsDir = Services.io.newURI(directory).QueryInterface(Ci.nsIFileURL)
+    .file;
+
+  let en = testsDir.directoryEntries;
+  while (en.hasMoreElements()) {
+    yield en.nextFile;
+  }
+}
+
+function getParent(path) {
+  let lastSlash = path.lastIndexOf("/");
+  if (lastSlash == -1) {
+    lastSlash = path.lastIndexOf("\\");
+    if (lastSlash == -1) {
+      return "";
+    }
+    return "/" + path.substring(0, lastSlash).replace(/\\/g, "/");
+  }
+  return path.substring(0, lastSlash);
+}
+
+function copyDirToTempProfile(path, subdirname) {
+  if (subdirname === undefined) {
+    subdirname = "mochikit-tmp";
+  }
+
+  let tmpdir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+  tmpdir.append(subdirname);
+  tmpdir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0o777);
+
+  let rootDir = getParent(path);
+  if (rootDir == "") {
+    return tmpdir;
+  }
+
+  // The SimpleTest directory is hidden
+  var files = Array.from(dirIter("file://" + rootDir));
+  for (let f in files) {
+    files[f].copyTo(tmpdir, "");
+  }
+  return tmpdir;
+}
+
+function convertChromeURI(chromeURI) {
+  let uri = Services.io.newURI(chromeURI);
+  return gChromeReg.convertChromeURL(uri);
+}
+
+function chromeURIToFile(chromeURI) {
+  var jar = getJar(chromeURI);
+  if (jar) {
+    var tmpDir = extractJarToTmp(jar);
+    let parts = chromeURI.split("/");
+    if (parts[parts.length - 1] != "") {
+      tmpDir.append(parts[parts.length - 1]);
+    }
+    return tmpDir;
+  }
+
+  return convertChromeURI(chromeURI).QueryInterface(Ci.nsIFileURL).file;
+}
+
+// Register a chrome manifest temporarily and return a function which un-does
+// the registrarion when no longer needed.
+function createManifestTemporarily(tempDir, manifestText) {
+  Services.prefs.setBoolPref(XUL_CACHE_PREF, true);
+
+  tempDir.append("temp.manifest");
+
+  let foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(
+    Ci.nsIFileOutputStream
+  );
+  foStream.init(tempDir, 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate
+  foStream.write(manifestText, manifestText.length);
+  foStream.close();
+  let tempfile = copyToTemporaryFile(tempDir);
+
+  Components.manager
+    .QueryInterface(Ci.nsIComponentRegistrar)
+    .autoRegister(tempfile);
+
+  return function() {
+    tempfile.fileSize = 0; // truncate the manifest
+    gChromeReg.checkForNewChrome();
+    Services.prefs.clearUserPref(XUL_CACHE_PREF);
+  };
+}
+
+// Register a chrome manifest temporarily and return a function which un-does
+// the registrarion when no longer needed.
+function registerManifestTemporarily(manifestURI) {
+  Services.prefs.setBoolPref(XUL_CACHE_PREF, true);
+
+  let file = chromeURIToFile(manifestURI);
+
+  let tempfile = copyToTemporaryFile(file);
+  Components.manager
+    .QueryInterface(Ci.nsIComponentRegistrar)
+    .autoRegister(tempfile);
+
+  return function() {
+    tempfile.fileSize = 0; // truncate the manifest
+    gChromeReg.checkForNewChrome();
+    Services.prefs.clearUserPref(XUL_CACHE_PREF);
+  };
+}
+
+function registerManifestPermanently(manifestURI) {
+  var chromepath = chromeURIToFile(manifestURI);
+
+  Components.manager
+    .QueryInterface(Ci.nsIComponentRegistrar)
+    .autoRegister(chromepath);
+  return chromepath;
+}
diff --git a/toolkit/content/tests/chrome/bug263683_window.xhtml b/toolkit/content/tests/chrome/bug263683_window.xhtml
new file mode 100644
index 0000000000..f2c25524e9
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug263683_window.xhtml
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug304188_window.xhtml b/toolkit/content/tests/chrome/bug304188_window.xhtml
new file mode 100644
index 0000000000..51553849f6
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug304188_window.xhtml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug331215_window.xhtml b/toolkit/content/tests/chrome/bug331215_window.xhtml
new file mode 100644
index 0000000000..c3db332466
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug331215_window.xhtml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+  
+
+  
+    
+  
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug360437_window.xhtml b/toolkit/content/tests/chrome/bug360437_window.xhtml
new file mode 100644
index 0000000000..a4968c6099
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug360437_window.xhtml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug366992_window.xhtml b/toolkit/content/tests/chrome/bug366992_window.xhtml
new file mode 100644
index 0000000000..698d26b43a
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug366992_window.xhtml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+  
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+
+  
+
+  
+
diff --git a/toolkit/content/tests/chrome/bug409624_window.xhtml b/toolkit/content/tests/chrome/bug409624_window.xhtml
new file mode 100644
index 0000000000..ced0aee9e1
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug409624_window.xhtml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+  
+
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug429723_window.xhtml b/toolkit/content/tests/chrome/bug429723_window.xhtml
new file mode 100644
index 0000000000..9408c7b1a1
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug429723_window.xhtml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+  
+
+  
+    
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug451540_window.xhtml b/toolkit/content/tests/chrome/bug451540_window.xhtml
new file mode 100644
index 0000000000..651fac8291
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug451540_window.xhtml
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/bug624329_window.xhtml b/toolkit/content/tests/chrome/bug624329_window.xhtml
new file mode 100644
index 0000000000..8cef32e4e5
--- /dev/null
+++ b/toolkit/content/tests/chrome/bug624329_window.xhtml
@@ -0,0 +1,22 @@
+
+
+
+
+
+  
+
+  
+    
+    
+  
+
diff --git a/toolkit/content/tests/chrome/chrome.ini b/toolkit/content/tests/chrome/chrome.ini
new file mode 100644
index 0000000000..fc9171278f
--- /dev/null
+++ b/toolkit/content/tests/chrome/chrome.ini
@@ -0,0 +1,204 @@
+[DEFAULT]
+skip-if = os == 'android'
+support-files =
+  ../widgets/popup_shared.js
+  ../widgets/tree_shared.js
+  RegisterUnregisterChrome.js
+  bug263683_window.xhtml
+  bug304188_window.xhtml
+  bug331215_window.xhtml
+  bug360437_window.xhtml
+  bug366992_window.xhtml
+  bug409624_window.xhtml
+  bug429723_window.xhtml
+  bug624329_window.xhtml
+  dialog_dialogfocus.xhtml
+  dialog_dialogfocus2.xhtml
+  file_empty.xhtml
+  file_edit_contextmenu.xhtml
+  file_about_networking_wsh.py
+  file_autocomplete_with_composition.js
+  file_editor_with_autocomplete.js
+  findbar_entireword_window.xhtml
+  findbar_events_window.xhtml
+  findbar_window.xhtml
+  frame_popup_anchor.xhtml
+  frame_popupremoving_frame.xhtml
+  frame_subframe_origin_subframe1.xhtml
+  frame_subframe_origin_subframe2.xhtml
+  popup_childframe_node.xhtml
+  popup_trigger.js
+  sample_entireword_latin1.html
+  window_browser_drop.xhtml
+  window_keys.xhtml
+  window_largemenu.xhtml
+  window_panel.xhtml
+  window_panel_anchoradjust.xhtml
+  window_popup_anchor.xhtml
+  window_popup_anchoratrect.xhtml
+  window_popup_attribute.xhtml
+  window_popup_button.xhtml
+  window_popup_preventdefault_chrome.xhtml
+  window_preferences.xhtml
+  window_preferences2.xhtml
+  window_preferences3.xhtml
+  window_preferences_commandretarget.xhtml
+  window_preferences_disabled.xhtml
+  window_screenPosSize.xhtml
+  window_showcaret.xhtml
+  window_subframe_origin.xhtml
+  window_titlebar.xhtml
+  window_tooltip.xhtml
+  xul_selectcontrol.js
+  rtlchrome/rtl.css
+  rtlchrome/rtl.dtd
+  rtlchrome/rtl.manifest
+prefs =
+  gfx.font_rendering.fallback.async=false
+
+[test_about_networking.html]
+[test_arrowpanel.xhtml]
+skip-if = (verify && (os == 'win')) || (debug && (os == 'win') && (bits == 32)) # Bug 1546256
+[test_autocomplete2.xhtml]
+[test_autocomplete3.xhtml]
+[test_autocomplete4.xhtml]
+[test_autocomplete5.xhtml]
+[test_autocomplete_emphasis.xhtml]
+[test_autocomplete_with_composition_on_input.html]
+[test_autocomplete_placehold_last_complete.xhtml]
+[test_browser_drop.xhtml]
+[test_bug263683.xhtml]
+skip-if = debug && (os == 'win' || os == 'linux')
+[test_bug304188.xhtml]
+skip-if = webrender
+[test_bug331215.xhtml]
+skip-if = webrender || (os == 'win' && debug) || (os == 'mac' && debug) #Bug 1339326 #Bug 1582327
+[test_bug360220.xhtml]
+[test_bug360437.xhtml]
+skip-if = os == 'linux' # Bug 1264604
+[test_bug365773.xhtml]
+[test_bug366992.xhtml]
+[test_bug382990.xhtml]
+[test_bug409624.xhtml]
+[test_bug418874.xhtml]
+[test_bug429723.xhtml]
+[test_bug437844.xhtml]
+skip-if = (verify && debug && (os == 'mac' || os == 'win'))
+[test_bug451540.xhtml]
+support-files = bug451540_window.xhtml
+[test_bug457632.xhtml]
+[test_bug460942.xhtml]
+[test_bug471776.xhtml]
+[test_bug509732.xhtml]
+[test_bug557987.xhtml]
+[test_bug562554.xhtml]
+[test_bug624329.xhtml]
+fail-if = (os == 'linux' && os_version == '18.04')  # Bug 1600194
+[test_bug792324.xhtml]
+[test_bug1048178.xhtml]
+skip-if = toolkit == "cocoa"
+[test_button.xhtml]
+[test_closemenu_attribute.xhtml]
+[test_contextmenu_list.xhtml]
+[test_custom_element_base.xhtml]
+[test_custom_element_delay_connection.xhtml]
+[test_custom_element_parts.html]
+[test_deck.xhtml]
+[test_dialogfocus.xhtml]
+[test_edit_contextmenu.html]
+[test_editor_for_input_with_autocomplete.html]
+[test_findbar.xhtml]
+skip-if = os == 'mac' && os_version == '10.14' # macosx1014 due to 1550078
+[test_findbar_entireword.xhtml]
+[test_findbar_events.xhtml]
+[test_frames.xhtml]
+[test_hiddenitems.xhtml]
+[test_hiddenpaging.xhtml]
+[test_keys.xhtml]
+[test_labelcontrol.xhtml]
+[test_largemenu.html]
+skip-if = os == 'linux' && !debug # Bug 1207174
+[test_maximized_persist.xhtml]
+support-files = window_maximized_persist.xhtml
+[test_navigate_persist.html]
+support-files = window_navigate_persist.html
+[test_menu.xhtml]
+[test_menu_withcapture.xhtml]
+[test_menu_hide.xhtml]
+[test_menuchecks.xhtml]
+[test_menuitem_blink.xhtml]
+[test_menuitem_commands.xhtml]
+[test_menulist.xhtml]
+[test_menulist_keynav.xhtml]
+[test_menulist_null_value.xhtml]
+[test_menulist_paging.xhtml]
+[test_menulist_position.xhtml]
+[test_mousescroll.xhtml]
+[test_mozinputbox_dictionary.xhtml]
+[test_notificationbox.xhtml]
+skip-if = (os == 'linux' && debug) || (os == 'win') # Bug 1429649
+[test_panel.xhtml]
+skip-if = os == 'mac' && os_version == '10.14' # macosx1014 due to 1550078
+[test_panel_anchoradjust.xhtml]
+[test_panelfrommenu.xhtml]
+[test_popup_anchor.xhtml]
+[test_popup_anchoratrect.xhtml]
+skip-if = os == 'linux' # 1167694
+[test_popup_attribute.xhtml]
+skip-if = os == 'linux' && asan || (os == 'mac' && debug) # Bug 1281360, 1582610
+[test_popup_button.xhtml]
+skip-if = os == 'linux' && asan || (os == 'mac' && debug) # Bug 1281360, 1582610
+[test_popup_coords.xhtml]
+[test_popup_keys.xhtml]
+[test_popup_moveToAnchor.xhtml]
+[test_popup_preventdefault.xhtml]
+[test_popup_preventdefault_chrome.xhtml]
+[test_popup_recreate.xhtml]
+[test_popup_scaled.xhtml]
+[test_popup_tree.xhtml]
+[test_popuphidden.xhtml]
+[test_popupincontent.xhtml]
+skip-if = (verify && (os == 'win'))
+[test_popupremoving.xhtml]
+[test_popupremoving_frame.xhtml]
+[test_position.xhtml]
+[test_preferences.xhtml]
+[test_preferences_beforeaccept.xhtml]
+support-files = window_preferences_beforeaccept.xhtml
+[test_preferences_onsyncfrompreference.xhtml]
+support-files = window_preferences_onsyncfrompreference.xhtml
+[test_props.xhtml]
+[test_radio.xhtml]
+[test_richlistbox.xhtml]
+[test_screenPersistence.xhtml]
+[test_scrollbar.xhtml]
+[test_showcaret.xhtml]
+[test_subframe_origin.xhtml]
+[test_tabbox.xhtml]
+[test_tabindex.xhtml]
+[test_textbox_search.xhtml]
+[test_titlebar.xhtml]
+skip-if = os == "linux" || (os == 'mac' && os_version == '10.14') # macosx1014 due to 1550078
+[test_tooltip.xhtml]
+skip-if = (os == 'mac' || os == 'win') # Bug 1141245, frequent timeouts on OSX 10.14, Windows
+[test_tooltip_noautohide.xhtml]
+[test_tree.xhtml]
+[test_tree_hier.xhtml]
+[test_tree_single.xhtml]
+[test_tree_view.xhtml]
+[test_window_intrinsic_size.xhtml]
+support-files = window_intrinsic_size.xhtml
+# test_panel_focus.xhtml won't work if the Full Keyboard Access preference is set to
+# textboxes and lists only, so skip this test on Mac
+[test_panel_focus.xhtml]
+support-files = window_panel_focus.xhtml
+skip-if = toolkit == "cocoa"
+[test_chromemargin.xhtml]
+support-files = window_chromemargin.xhtml
+skip-if = toolkit == "cocoa"
+[test_autocomplete_mac_caret.xhtml]
+skip-if = toolkit != "cocoa"
+[test_cursorsnap.xhtml]
+disabled =
+#skip-if = os != "win"
+support-files = window_cursorsnap_dialog.xhtml window_cursorsnap_wizard.xhtml
diff --git a/toolkit/content/tests/chrome/dialog_dialogfocus.xhtml b/toolkit/content/tests/chrome/dialog_dialogfocus.xhtml
new file mode 100644
index 0000000000..29e3c2d856
--- /dev/null
+++ b/toolkit/content/tests/chrome/dialog_dialogfocus.xhtml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
diff --git a/toolkit/content/tests/chrome/dialog_dialogfocus2.xhtml b/toolkit/content/tests/chrome/dialog_dialogfocus2.xhtml
new file mode 100644
index 0000000000..da4b3dbdfa
--- /dev/null
+++ b/toolkit/content/tests/chrome/dialog_dialogfocus2.xhtml
@@ -0,0 +1,8 @@
+
+
+
+
+  
+
diff --git a/toolkit/content/tests/chrome/file_about_networking_wsh.py b/toolkit/content/tests/chrome/file_about_networking_wsh.py
new file mode 100644
index 0000000000..57bd353c21
--- /dev/null
+++ b/toolkit/content/tests/chrome/file_about_networking_wsh.py
@@ -0,0 +1,10 @@
+from mod_pywebsocket import msgutil
+
+
+def web_socket_do_extra_handshake(request):
+    pass
+
+
+def web_socket_transfer_data(request):
+    while not request.client_terminated:
+        msgutil.receive_message(request)
diff --git a/toolkit/content/tests/chrome/file_autocomplete_with_composition.js b/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
new file mode 100644
index 0000000000..fe595d00e4
--- /dev/null
+++ b/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
@@ -0,0 +1,712 @@
+// nsDoTestsForAutoCompleteWithComposition tests autocomplete with composition.
+// Users must include SimpleTest.js and EventUtils.js.
+
+function waitForCondition(condition, nextTest) {
+  var tries = 0;
+  var interval = setInterval(function() {
+    if (condition() || tries >= 30) {
+      moveOn();
+    }
+    tries++;
+  }, 100);
+  var moveOn = function() {
+    clearInterval(interval);
+    nextTest();
+  };
+}
+
+function nsDoTestsForAutoCompleteWithComposition(
+  aDescription,
+  aWindow,
+  aTarget,
+  aAutoCompleteController,
+  aIsFunc,
+  aGetTargetValueFunc,
+  aOnFinishFunc
+) {
+  this._description = aDescription;
+  this._window = aWindow;
+  this._target = aTarget;
+  this._controller = aAutoCompleteController;
+
+  this._is = aIsFunc;
+  this._getTargetValue = aGetTargetValueFunc;
+  this._onFinish = aOnFinishFunc;
+
+  this._target.focus();
+
+  this._DefaultCompleteDefaultIndex = this._controller.input.completeDefaultIndex;
+
+  this._doTests();
+}
+
+nsDoTestsForAutoCompleteWithComposition.prototype = {
+  _window: null,
+  _target: null,
+  _controller: null,
+  _DefaultCompleteDefaultIndex: false,
+  _description: "",
+
+  _is: null,
+  _getTargetValue() {
+    return "not initialized";
+  },
+  _onFinish: null,
+
+  _doTests() {
+    if (++this._testingIndex == this._tests.length) {
+      this._controller.input.completeDefaultIndex = this._DefaultCompleteDefaultIndex;
+      this._onFinish();
+      return;
+    }
+
+    var test = this._tests[this._testingIndex];
+    if (
+      this._controller.input.completeDefaultIndex != test.completeDefaultIndex
+    ) {
+      this._controller.input.completeDefaultIndex = test.completeDefaultIndex;
+    }
+    test.execute(this._window);
+
+    if (test.popup) {
+      waitForCondition(
+        () => this._controller.input.popupOpen,
+        this._checkResult.bind(this)
+      );
+    } else {
+      waitForCondition(() => {
+        this._controller.searchStatus >=
+          Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH;
+      }, this._checkResult.bind(this));
+    }
+  },
+
+  _checkResult() {
+    var test = this._tests[this._testingIndex];
+    this._is(
+      this._getTargetValue(),
+      test.value,
+      this._description + ", " + test.description + ": value"
+    );
+    this._is(
+      this._controller.searchString,
+      test.searchString,
+      this._description + ", " + test.description + ": searchString"
+    );
+    this._is(
+      this._controller.input.popupOpen,
+      test.popup,
+      this._description + ", " + test.description + ": popupOpen"
+    );
+    this._doTests();
+  },
+
+  _testingIndex: -1,
+  _tests: [
+    // Simple composition when popup hasn't been shown.
+    // The autocomplete popup should not be shown during composition, but
+    // after compositionend, the popup should be shown.
+    {
+      description: "compositionstart shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "M",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "M" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "M",
+      searchString: "",
+    },
+    {
+      description: "modifying composition string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "Mo",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "o" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "",
+    },
+    {
+      description: "compositionend should open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Enter" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "Mo",
+      searchString: "Mo",
+    },
+    // If composition starts when popup is shown, the compositionstart event
+    // should cause closing the popup.
+    {
+      description: "compositionstart should close the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "z",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "z" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Moz",
+      searchString: "Mo",
+    },
+    {
+      description: "modifying composition string shouldn't reopen the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "zi",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "i" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mozi",
+      searchString: "Mo",
+    },
+    {
+      description:
+        "compositionend should research the result and open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Enter" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "Mozi",
+      searchString: "Mozi",
+    },
+    // If composition is cancelled, the value shouldn't be changed.
+    {
+      description: "compositionstart should reclose the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "l",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "l" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mozil",
+      searchString: "Mozi",
+    },
+    {
+      description: "modifying composition string shouldn't reopen the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "ll",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "l" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mozill",
+      searchString: "Mozi",
+    },
+    {
+      description:
+        "modifying composition string to empty string shouldn't reopen the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: { string: "", clauses: [{ length: 0, attr: 0 }] },
+            caret: { start: 0, length: 0 },
+            key: { key: "KEY_Backspace" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mozi",
+      searchString: "Mozi",
+    },
+    {
+      description: "cancled compositionend should reopen the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommit", data: "", key: { key: "KEY_Escape" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "Mozi",
+      searchString: "Mozi",
+    },
+    // But if composition replaces some characters and canceled, the search
+    // string should be the latest value.
+    {
+      description:
+        "compositionstart with selected string should close the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeKey("VK_LEFT", { shiftKey: true }, aWindow);
+        synthesizeKey("VK_LEFT", { shiftKey: true }, aWindow);
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "z",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "z" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Moz",
+      searchString: "Mozi",
+    },
+    {
+      description: "modifying composition string shouldn't reopen the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "zi",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "i" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mozi",
+      searchString: "Mozi",
+    },
+    {
+      description:
+        "modifying composition string to empty string shouldn't reopen the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: { string: "", clauses: [{ length: 0, attr: 0 }] },
+            caret: { start: 0, length: 0 },
+            key: { key: "KEY_Backspace" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "Mozi",
+    },
+    {
+      description:
+        "canceled compositionend should search the result with the latest value",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Escape" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "Mo",
+      searchString: "Mo",
+    },
+    // If all characters are removed, the popup should be closed.
+    {
+      description:
+        "the value becomes empty by backspace, the popup should be closed",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+      },
+      popup: false,
+      value: "",
+      searchString: "",
+    },
+    // composition which is canceled shouldn't cause opening the popup.
+    {
+      description: "compositionstart shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "M",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "M" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "M",
+      searchString: "",
+    },
+    {
+      description: "modifying composition string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "Mo",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "o" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "",
+    },
+    {
+      description:
+        "modifying composition string to empty string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: { string: "", clauses: [{ length: 0, attr: 0 }] },
+            caret: { start: 0, length: 0 },
+            key: { key: "KEY_Backspace" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "",
+      searchString: "",
+    },
+    {
+      description:
+        "canceled compositionend shouldn't open the popup if it was closed",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Escape" } },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "",
+      searchString: "",
+    },
+    // Down key should open the popup even if the editor is empty.
+    {
+      description: "DOWN key should open the popup even if the value is empty",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeKey("KEY_ArrowDown", {}, aWindow);
+      },
+      popup: true,
+      value: "",
+      searchString: "",
+    },
+    // If popup is open at starting composition, the popup should be reopened
+    // after composition anyway.
+    {
+      description: "compositionstart shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "M",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "M" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "M",
+      searchString: "",
+    },
+    {
+      description: "modifying composition string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "Mo",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "o" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "",
+    },
+    {
+      description:
+        "modifying composition string to empty string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: { string: "", clauses: [{ length: 0, attr: 0 }] },
+            caret: { start: 0, length: 0 },
+            key: { key: "KEY_Backspace" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "",
+      searchString: "",
+    },
+    {
+      description:
+        "canceled compositionend should open the popup if it was opened",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Escape" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "",
+      searchString: "",
+    },
+    // Type normally, and hit escape, the popup should be closed.
+    {
+      description: "ESCAPE should close the popup after typing something",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeKey("M", {}, aWindow);
+        synthesizeKey("o", {}, aWindow);
+        synthesizeKey("KEY_Escape", {}, aWindow);
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "Mo",
+    },
+    // Even if the popup is closed, composition which is canceled should open
+    // the popup if the value isn't empty.
+    // XXX This might not be good behavior, but anyway, this is minor issue...
+    {
+      description: "compositionstart shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "z",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "z" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Moz",
+      searchString: "Mo",
+    },
+    {
+      description: "modifying composition string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "zi",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "i" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mozi",
+      searchString: "Mo",
+    },
+    {
+      description:
+        "modifying composition string to empty string shouldn't open the popup",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: { string: "", clauses: [{ length: 0, attr: 0 }] },
+            caret: { start: 0, length: 0 },
+            key: { key: "KEY_Backspace" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "Mo",
+    },
+    {
+      description:
+        "canceled compositionend shouldn't open the popup if the popup was closed",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Escape" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "Mo",
+      searchString: "Mo",
+    },
+    // House keeping...
+    {
+      description: "house keeping for next tests",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+      },
+      popup: false,
+      value: "",
+      searchString: "",
+    },
+    // Testing for nsIAutoCompleteInput.completeDefaultIndex being true.
+    {
+      description:
+        "compositionstart shouldn't open the popup (completeDefaultIndex is true)",
+      completeDefaultIndex: true,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "M",
+              clauses: [{ length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 1, length: 0 },
+            key: { key: "M" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "M",
+      searchString: "",
+    },
+    {
+      description:
+        "modifying composition string shouldn't open the popup (completeDefaultIndex is true)",
+      completeDefaultIndex: true,
+      execute(aWindow) {
+        synthesizeCompositionChange(
+          {
+            composition: {
+              string: "Mo",
+              clauses: [{ length: 2, attr: COMPOSITION_ATTR_RAW_CLAUSE }],
+            },
+            caret: { start: 2, length: 0 },
+            key: { key: "o" },
+          },
+          aWindow
+        );
+      },
+      popup: false,
+      value: "Mo",
+      searchString: "",
+    },
+    {
+      description:
+        "compositionend should open the popup (completeDefaultIndex is true)",
+      completeDefaultIndex: true,
+      execute(aWindow) {
+        synthesizeComposition(
+          { type: "compositioncommitasis", key: { key: "KEY_Enter" } },
+          aWindow
+        );
+      },
+      popup: true,
+      value: "Mozilla",
+      searchString: "Mo",
+    },
+    // House keeping...
+    {
+      description: "house keeping for next tests",
+      completeDefaultIndex: false,
+      execute(aWindow) {
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+        synthesizeKey("KEY_Backspace", {}, aWindow);
+      },
+      popup: false,
+      value: "",
+      searchString: "",
+    },
+  ],
+};
diff --git a/toolkit/content/tests/chrome/file_edit_contextmenu.xhtml b/toolkit/content/tests/chrome/file_edit_contextmenu.xhtml
new file mode 100644
index 0000000000..e4d1a79040
--- /dev/null
+++ b/toolkit/content/tests/chrome/file_edit_contextmenu.xhtml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+  
+    
+  
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/findbar_events_window.xhtml b/toolkit/content/tests/chrome/findbar_events_window.xhtml
new file mode 100644
index 0000000000..92d8037590
--- /dev/null
+++ b/toolkit/content/tests/chrome/findbar_events_window.xhtml
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+  
+
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/findbar_window.xhtml b/toolkit/content/tests/chrome/findbar_window.xhtml
new file mode 100644
index 0000000000..320bc99b2e
--- /dev/null
+++ b/toolkit/content/tests/chrome/findbar_window.xhtml
@@ -0,0 +1,777 @@
+
+
+
+
+
+
+
+
+
+  
+
+  
+    
+  
+  
+  
+  
+
diff --git a/toolkit/content/tests/chrome/frame_popup_anchor.xhtml b/toolkit/content/tests/chrome/frame_popup_anchor.xhtml
new file mode 100644
index 0000000000..142bc7b0af
--- /dev/null
+++ b/toolkit/content/tests/chrome/frame_popup_anchor.xhtml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
diff --git a/toolkit/content/tests/chrome/frame_popupremoving_frame.xhtml b/toolkit/content/tests/chrome/frame_popupremoving_frame.xhtml
new file mode 100644
index 0000000000..e8f00ce7a9
--- /dev/null
+++ b/toolkit/content/tests/chrome/frame_popupremoving_frame.xhtml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+    
+        
+        
+        
+    
+
+
+
+    
+        
+        
+        
+    
+
+
+
+    
+        
+        
+        
+    
+
+
+
+    
+        
+        
+        
+    
+
+
+
+
+
+    
+      
+        
+          
+            
+              
+                
+                  
+                  
+                  
+                
+              
+            
+          
+        
+      
+    
+
+
+
+
+
diff --git a/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xhtml b/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xhtml
new file mode 100644
index 0000000000..f68a06d85d
--- /dev/null
+++ b/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xhtml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
diff --git a/toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xhtml b/toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xhtml
new file mode 100644
index 0000000000..338877ff96
--- /dev/null
+++ b/toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xhtml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
diff --git a/toolkit/content/tests/chrome/popup_childframe_node.xhtml b/toolkit/content/tests/chrome/popup_childframe_node.xhtml
new file mode 100644
index 0000000000..512f5f8c26
--- /dev/null
+++ b/toolkit/content/tests/chrome/popup_childframe_node.xhtml
@@ -0,0 +1,2 @@
+
diff --git a/toolkit/content/tests/chrome/popup_trigger.js b/toolkit/content/tests/chrome/popup_trigger.js
new file mode 100644
index 0000000000..1777b37039
--- /dev/null
+++ b/toolkit/content/tests/chrome/popup_trigger.js
@@ -0,0 +1,1262 @@
+/* import-globals-from ../widgets/popup_shared.js */
+
+var gMenuPopup = null;
+var gTrigger = null;
+var gIsMenu = false;
+var gScreenX = -1,
+  gScreenY = -1;
+var gCachedEvent = null;
+var gCachedEvent2 = null;
+
+function cacheEvent(modifiers) {
+  var cachedEvent = null;
+
+  var mouseFn = function(event) {
+    cachedEvent = event;
+  };
+
+  window.addEventListener("mousedown", mouseFn);
+  synthesizeMouse(document.documentElement, 0, 0, modifiers);
+  window.removeEventListener("mousedown", mouseFn);
+
+  return cachedEvent;
+}
+
+function runTests() {
+  if (screen.height < 768) {
+    ok(
+      false,
+      "popup tests are likely to fail for screen heights less than 768 pixels"
+    );
+  }
+
+  gMenuPopup = document.getElementById("thepopup");
+  gTrigger = document.getElementById("trigger");
+
+  gIsMenu = gTrigger.hasMenu();
+
+  // a hacky way to get the screen position of the document. Cache the event
+  // so that we can use it in calls to openPopup.
+  gCachedEvent = cacheEvent({ shiftKey: true });
+  gScreenX = gCachedEvent.screenX;
+  gScreenY = gCachedEvent.screenY;
+  gCachedEvent2 = cacheEvent({
+    altKey: true,
+    ctrlKey: true,
+    shiftKey: true,
+    metaKey: true,
+  });
+
+  startPopupTests(popupTests);
+}
+
+var popupTests = [
+  {
+    testname: "mouse click on trigger",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    test() {
+      // for menus, no trigger will be set. For non-menus using the popup
+      // attribute, the trigger will be set to the node with the popup attribute
+      gExpectedTriggerNode = gIsMenu ? "notset" : gTrigger;
+      synthesizeMouse(gTrigger, 4, 4, {});
+    },
+    async result(testname) {
+      gExpectedTriggerNode = null;
+      // menus are the anchor but non-menus are opened at screen coordinates
+      is(
+        gMenuPopup.anchorNode,
+        gIsMenu ? gTrigger : null,
+        testname + " anchorNode"
+      );
+      // menus are opened internally, but non-menus have a mouse event which
+      // triggered them
+      is(
+        gMenuPopup.triggerNode,
+        gIsMenu ? null : gTrigger,
+        testname + " triggerNode"
+      );
+      is(
+        document.popupNode,
+        gIsMenu ? null : gTrigger,
+        testname + " document.popupNode"
+      );
+      is(document.tooltipNode, null, testname + " document.tooltipNode");
+      // check to ensure the popup node for a different document isn't used
+      if (window.opener) {
+        is(
+          window.opener.document.popupNode,
+          null,
+          testname + " opener.document.popupNode"
+        );
+      }
+
+      // Popup may have wrong initial size in non e10s mode tests, because
+      // layout is not yet ready for popup content lazy population on
+      // popupshowing event.
+      await new Promise(r =>
+        requestAnimationFrame(() => requestAnimationFrame(r))
+      );
+
+      // this will be used in some tests to ensure the size doesn't change
+      var popuprect = gMenuPopup.getBoundingClientRect();
+      gPopupWidth = Math.round(popuprect.width);
+      gPopupHeight = Math.round(popuprect.height);
+
+      checkActive(gMenuPopup, "", testname);
+      checkOpen("trigger", testname);
+      // if a menu, the popup should be opened underneath the menu in the
+      // 'after_start' position, otherwise it is opened at the mouse position
+      if (gIsMenu) {
+        compareEdge(gTrigger, gMenuPopup, "after_start", 0, 0, testname);
+      }
+    },
+  },
+  {
+    // check that pressing cursor down while there is no selection
+    // highlights the first item
+    testname: "cursor down no selection",
+    events: ["DOMMenuItemActive item1"],
+    test() {
+      synthesizeKey("KEY_ArrowDown");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // check that pressing cursor up wraps and highlights the last item
+    testname: "cursor up wrap",
+    events() {
+      // No wrapping on menus on Mac
+      return platformIsMac()
+        ? []
+        : ["DOMMenuItemInactive item1", "DOMMenuItemActive last"];
+    },
+    test() {
+      synthesizeKey("KEY_ArrowUp");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, platformIsMac() ? "item1" : "last", testname);
+    },
+  },
+  {
+    // check that pressing cursor down wraps and highlights the first item
+    testname: "cursor down wrap",
+    condition() {
+      return !platformIsMac();
+    },
+    events: ["DOMMenuItemInactive last", "DOMMenuItemActive item1"],
+    test() {
+      synthesizeKey("KEY_ArrowDown");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // check that pressing cursor down highlights the second item
+    testname: "cursor down",
+    events: ["DOMMenuItemInactive item1", "DOMMenuItemActive item2"],
+    test() {
+      synthesizeKey("KEY_ArrowDown");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item2", testname);
+    },
+  },
+  {
+    // check that pressing cursor up highlights the second item
+    testname: "cursor up",
+    events: ["DOMMenuItemInactive item2", "DOMMenuItemActive item1"],
+    test() {
+      synthesizeKey("KEY_ArrowUp");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // cursor left should not do anything
+    testname: "cursor left",
+    test() {
+      synthesizeKey("KEY_ArrowLeft");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // cursor right should not do anything
+    testname: "cursor right",
+    test() {
+      synthesizeKey("KEY_ArrowRight");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // check cursor down when a disabled item exists in the menu
+    testname: "cursor down disabled",
+    events() {
+      // On Windows, disabled items are included when navigating, but on
+      // other platforms, disabled items are skipped over
+      if (navigator.platform.indexOf("Win") == 0) {
+        return ["DOMMenuItemInactive item1", "DOMMenuItemActive item2"];
+      }
+      return ["DOMMenuItemInactive item1", "DOMMenuItemActive amenu"];
+    },
+    test() {
+      document.getElementById("item2").disabled = true;
+      synthesizeKey("KEY_ArrowDown");
+    },
+  },
+  {
+    // check cursor up when a disabled item exists in the menu
+    testname: "cursor up disabled",
+    events() {
+      if (navigator.platform.indexOf("Win") == 0) {
+        return [
+          "DOMMenuItemInactive item2",
+          "DOMMenuItemActive amenu",
+          "DOMMenuItemInactive amenu",
+          "DOMMenuItemActive item2",
+          "DOMMenuItemInactive item2",
+          "DOMMenuItemActive item1",
+        ];
+      }
+      return ["DOMMenuItemInactive amenu", "DOMMenuItemActive item1"];
+    },
+    test() {
+      if (navigator.platform.indexOf("Win") == 0) {
+        synthesizeKey("KEY_ArrowDown");
+      }
+      synthesizeKey("KEY_ArrowUp");
+      if (navigator.platform.indexOf("Win") == 0) {
+        synthesizeKey("KEY_ArrowUp");
+      }
+    },
+  },
+  {
+    testname: "mouse click outside",
+    events: [
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuItemInactive item1",
+      "DOMMenuInactive thepopup",
+    ],
+    test() {
+      gMenuPopup.hidePopup();
+      // XXXndeakin event simulation fires events outside of the platform specific
+      // widget code so the popup capturing isn't handled. Thus, the menu won't
+      // rollup this way.
+      // synthesizeMouse(gTrigger, 0, -12, { });
+    },
+    result(testname, step) {
+      is(gMenuPopup.anchorNode, null, testname + " anchorNode");
+      is(gMenuPopup.triggerNode, null, testname + " triggerNode");
+      is(document.popupNode, null, testname + " document.popupNode");
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    // these tests check to ensure that passing an anchor and position
+    // puts the popup in the right place
+    testname: "open popup anchored",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    steps: [
+      "before_start",
+      "before_end",
+      "after_start",
+      "after_end",
+      "start_before",
+      "start_after",
+      "end_before",
+      "end_after",
+      "after_pointer",
+      "overlap",
+      "topleft topleft",
+      "topcenter topleft",
+      "topright topleft",
+      "leftcenter topright",
+      "rightcenter topright",
+      "bottomleft bottomleft",
+      "bottomcenter bottomleft",
+      "bottomright bottomleft",
+      "topleft bottomright",
+      "bottomcenter bottomright",
+      "rightcenter topright",
+    ],
+    test(testname, step) {
+      gExpectedTriggerNode = "notset";
+      gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false);
+    },
+    result(testname, step) {
+      // no triggerNode because it was opened without passing an event
+      gExpectedTriggerNode = null;
+      is(gMenuPopup.anchorNode, gTrigger, testname + " anchorNode");
+      is(gMenuPopup.triggerNode, null, testname + " triggerNode");
+      is(document.popupNode, null, testname + " document.popupNode");
+      compareEdge(gTrigger, gMenuPopup, step, 0, 0, testname);
+    },
+  },
+  {
+    // these tests check the same but with a 10 pixel margin on the popup
+    testname: "open popup anchored with margin",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    steps: [
+      "before_start",
+      "before_end",
+      "after_start",
+      "after_end",
+      "start_before",
+      "start_after",
+      "end_before",
+      "end_after",
+      "after_pointer",
+      "overlap",
+      "topleft topleft",
+      "topcenter topleft",
+      "topright topleft",
+      "leftcenter topright",
+      "rightcenter topright",
+      "bottomleft bottomleft",
+      "bottomcenter bottomleft",
+      "bottomright bottomleft",
+      "topleft bottomright",
+      "bottomcenter bottomright",
+      "rightcenter topright",
+    ],
+    test(testname, step) {
+      gMenuPopup.setAttribute("style", "margin: 10px;");
+      gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false);
+    },
+    result(testname, step) {
+      var rightmod =
+        step == "before_end" ||
+        step == "after_end" ||
+        step == "start_before" ||
+        step == "start_after" ||
+        step.match(/topright$/) ||
+        step.match(/bottomright$/);
+      var bottommod =
+        step == "before_start" ||
+        step == "before_end" ||
+        step == "start_after" ||
+        step == "end_after" ||
+        step.match(/bottomleft$/) ||
+        step.match(/bottomright$/);
+      compareEdge(
+        gTrigger,
+        gMenuPopup,
+        step,
+        rightmod ? -10 : 10,
+        bottommod ? -10 : 10,
+        testname
+      );
+      gMenuPopup.removeAttribute("style");
+    },
+  },
+  {
+    // these tests check the same but with a -8 pixel margin on the popup
+    testname: "open popup anchored with negative margin",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    steps: [
+      "before_start",
+      "before_end",
+      "after_start",
+      "after_end",
+      "start_before",
+      "start_after",
+      "end_before",
+      "end_after",
+      "after_pointer",
+      "overlap",
+    ],
+    test(testname, step) {
+      gMenuPopup.setAttribute("style", "margin: -8px;");
+      gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false);
+    },
+    result(testname, step) {
+      var rightmod =
+        step == "before_end" ||
+        step == "after_end" ||
+        step == "start_before" ||
+        step == "start_after";
+      var bottommod =
+        step == "before_start" ||
+        step == "before_end" ||
+        step == "start_after" ||
+        step == "end_after";
+      compareEdge(
+        gTrigger,
+        gMenuPopup,
+        step,
+        rightmod ? 8 : -8,
+        bottommod ? 8 : -8,
+        testname
+      );
+      gMenuPopup.removeAttribute("style");
+    },
+  },
+  {
+    testname: "open popup with large positive margin",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    steps: [
+      "before_start",
+      "before_end",
+      "after_start",
+      "after_end",
+      "start_before",
+      "start_after",
+      "end_before",
+      "end_after",
+      "after_pointer",
+      "overlap",
+    ],
+    test(testname, step) {
+      gMenuPopup.setAttribute("style", "margin: 1000px;");
+      gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false);
+    },
+    result(testname, step) {
+      var popuprect = gMenuPopup.getBoundingClientRect();
+      // as there is more room on the 'end' or 'after' side, popups will always
+      // appear on the right or bottom corners, depending on which side they are
+      // allowed to be flipped by.
+      var expectedleft =
+        step == "before_end" || step == "after_end"
+          ? 0
+          : Math.round(window.innerWidth - gPopupWidth);
+      var expectedtop =
+        step == "start_after" || step == "end_after"
+          ? 0
+          : Math.round(window.innerHeight - gPopupHeight);
+      is(
+        Math.round(popuprect.left),
+        expectedleft,
+        testname + " x position " + step
+      );
+      is(
+        Math.round(popuprect.top),
+        expectedtop,
+        testname + " y position " + step
+      );
+      gMenuPopup.removeAttribute("style");
+    },
+  },
+  {
+    testname: "open popup with large negative margin",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    steps: [
+      "before_start",
+      "before_end",
+      "after_start",
+      "after_end",
+      "start_before",
+      "start_after",
+      "end_before",
+      "end_after",
+      "after_pointer",
+      "overlap",
+    ],
+    test(testname, step) {
+      gMenuPopup.setAttribute("style", "margin: -1000px;");
+      gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false);
+    },
+    result(testname, step) {
+      var popuprect = gMenuPopup.getBoundingClientRect();
+      // using negative margins causes the reverse of positive margins, and
+      // popups will appear on the left or top corners.
+      var expectedleft =
+        step == "before_end" || step == "after_end"
+          ? Math.round(window.innerWidth - gPopupWidth)
+          : 0;
+      var expectedtop =
+        step == "start_after" || step == "end_after"
+          ? Math.round(window.innerHeight - gPopupHeight)
+          : 0;
+      is(
+        Math.round(popuprect.left),
+        expectedleft,
+        testname + " x position " + step
+      );
+      is(
+        Math.round(popuprect.top),
+        expectedtop,
+        testname + " y position " + step
+      );
+      gMenuPopup.removeAttribute("style");
+    },
+  },
+  {
+    testname: "popup with unknown step",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test() {
+      gMenuPopup.openPopup(gTrigger, "other", 0, 0, false, false);
+    },
+    result(testname) {
+      var triggerrect = gMenuPopup.getBoundingClientRect();
+      var popuprect = gMenuPopup.getBoundingClientRect();
+      is(
+        Math.round(popuprect.left),
+        triggerrect.left,
+        testname + " x position "
+      );
+      is(Math.round(popuprect.top), triggerrect.top, testname + " y position ");
+    },
+  },
+  {
+    // these tests check to ensure that the position attribute can be used
+    // to set the position of a popup instead of passing it as an argument
+    testname: "open popup anchored with attribute",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    steps: [
+      "before_start",
+      "before_end",
+      "after_start",
+      "after_end",
+      "start_before",
+      "start_after",
+      "end_before",
+      "end_after",
+      "after_pointer",
+      "overlap",
+      "topcenter topleft",
+      "topright bottomright",
+      "leftcenter topright",
+    ],
+    test(testname, step) {
+      gMenuPopup.setAttribute("position", step);
+      gMenuPopup.openPopup(gTrigger, "", 0, 0, false, false);
+    },
+    result(testname, step) {
+      compareEdge(gTrigger, gMenuPopup, step, 0, 0, testname);
+    },
+  },
+  {
+    // this test checks to ensure that the attributes override flag to openPopup
+    // can be used to override the popup's position. This test also passes an
+    // event to openPopup to check the trigger node.
+    testname: "open popup anchored with override",
+    events: ["popupshowing thepopup 0010", "popupshown thepopup"],
+    test(testname, step) {
+      // attribute overrides the position passed in
+      gMenuPopup.setAttribute("position", "end_after");
+      gExpectedTriggerNode = gCachedEvent.target;
+      gMenuPopup.openPopup(
+        gTrigger,
+        "before_start",
+        0,
+        0,
+        false,
+        true,
+        gCachedEvent
+      );
+    },
+    result(testname, step) {
+      gExpectedTriggerNode = null;
+      is(gMenuPopup.anchorNode, gTrigger, testname + " anchorNode");
+      is(
+        gMenuPopup.triggerNode,
+        gCachedEvent.target,
+        testname + " triggerNode"
+      );
+      is(
+        document.popupNode,
+        gCachedEvent.target,
+        testname + " document.popupNode"
+      );
+      compareEdge(gTrigger, gMenuPopup, "end_after", 0, 0, testname);
+    },
+  },
+  {
+    testname: "close popup with escape",
+    events: [
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuInactive thepopup",
+    ],
+    test(testname, step) {
+      synthesizeKey("KEY_Escape");
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    // check that offsets may be supplied to the openPopup method
+    testname: "open popup anchored with offsets",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      // attribute is empty so does not override
+      gMenuPopup.setAttribute("position", "");
+      gMenuPopup.openPopup(gTrigger, "before_start", 5, 10, true, true);
+    },
+    result(testname, step) {
+      compareEdge(gTrigger, gMenuPopup, "before_start", 5, 10, testname);
+    },
+  },
+  {
+    // if no anchor is supplied to openPopup, it should be opened relative
+    // to the viewport.
+    testname: "open popup unanchored",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    test(testname, step) {
+      gMenuPopup.openPopup(null, "after_start", 6, 8, false);
+    },
+    result(testname, step) {
+      var rect = gMenuPopup.getBoundingClientRect();
+      ok(
+        rect.left == 6 && rect.top == 8 && rect.right && rect.bottom,
+        testname
+      );
+    },
+  },
+  {
+    testname: "activate menuitem with mouse",
+    events: [
+      "DOMMenuInactive thepopup",
+      "command item3",
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuItemInactive item3",
+    ],
+    test(testname, step) {
+      var item3 = document.getElementById("item3");
+      synthesizeMouse(item3, 4, 4, {});
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    testname: "close popup",
+    condition() {
+      return false;
+    },
+    events: [
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuInactive thepopup",
+    ],
+    test(testname, step) {
+      gMenuPopup.hidePopup();
+    },
+  },
+  {
+    testname: "open popup at screen",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    test(testname, step) {
+      gExpectedTriggerNode = "notset";
+      gMenuPopup.openPopupAtScreen(gScreenX + 24, gScreenY + 20, false);
+    },
+    result(testname, step) {
+      gExpectedTriggerNode = null;
+      is(gMenuPopup.anchorNode, null, testname + " anchorNode");
+      is(gMenuPopup.triggerNode, null, testname + " triggerNode");
+      is(document.popupNode, null, testname + " document.popupNode");
+      var rect = gMenuPopup.getBoundingClientRect();
+      is(rect.left, 24, testname + " left");
+      is(rect.top, 20, testname + " top");
+      ok(rect.right, testname + " right is " + rect.right);
+      ok(rect.bottom, testname + " bottom is " + rect.bottom);
+    },
+  },
+  {
+    // check that pressing a menuitem's accelerator selects it. Note that
+    // the menuitem with the M accesskey overrides the earlier menuitem that
+    // begins with M.
+    testname: "menuitem accelerator",
+    events: [
+      "DOMMenuItemActive amenu",
+      "DOMMenuItemInactive amenu",
+      "DOMMenuInactive thepopup",
+      "command amenu",
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuItemInactive amenu",
+    ],
+    test() {
+      sendString("M");
+    },
+    result(testname) {
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    testname: "open context popup at screen",
+    events: ["popupshowing thepopup 0010", "popupshown thepopup"],
+    test(testname, step) {
+      gExpectedTriggerNode = gCachedEvent.target;
+      gMenuPopup.openPopupAtScreen(
+        gScreenX + 8,
+        gScreenY + 16,
+        true,
+        gCachedEvent
+      );
+    },
+    result(testname, step) {
+      gExpectedTriggerNode = null;
+      is(gMenuPopup.anchorNode, null, testname + " anchorNode");
+      is(
+        gMenuPopup.triggerNode,
+        gCachedEvent.target,
+        testname + " triggerNode"
+      );
+      is(
+        document.popupNode,
+        gCachedEvent.target,
+        testname + " document.popupNode"
+      );
+
+      var childframe = document.getElementById("childframe");
+      if (childframe) {
+        for (var t = 0; t < 2; t++) {
+          var child = childframe.contentDocument;
+          var evt = child.createEvent("Event");
+          evt.initEvent("click", true, true);
+          child.documentElement.dispatchEvent(evt);
+          is(
+            child.documentElement.getAttribute("data"),
+            "xundefined",
+            "cannot get popupNode from other document"
+          );
+          child.documentElement.setAttribute("data", "none");
+          // now try again with document.popupNode set explicitly
+          document.popupNode = gCachedEvent.target;
+        }
+      }
+
+      var openX = 8;
+      var openY = 16;
+      var rect = gMenuPopup.getBoundingClientRect();
+      is(rect.left, openX + (platformIsMac() ? 1 : 2), testname + " left");
+      is(rect.top, openY + (platformIsMac() ? -6 : 2), testname + " top");
+      ok(rect.right, testname + " right is " + rect.right);
+      ok(rect.bottom, testname + " bottom is " + rect.bottom);
+    },
+  },
+  {
+    // pressing a letter that doesn't correspond to an accelerator, but does
+    // correspond to the first letter in a menu's label. The menu should not
+    // close because there is more than one item corresponding to that letter
+    testname: "menuitem with non accelerator",
+    events: ["DOMMenuItemActive one"],
+    test() {
+      sendString("O");
+    },
+    result(testname) {
+      checkOpen("trigger", testname);
+      checkActive(gMenuPopup, "one", testname);
+    },
+  },
+  {
+    // pressing the letter again should select the next one that starts with
+    // that letter
+    testname: "menuitem with non accelerator again",
+    events: ["DOMMenuItemInactive one", "DOMMenuItemActive submenu"],
+    test() {
+      sendString("O");
+    },
+    result(testname) {
+      // 'submenu' is a menu but it should not be open
+      checkOpen("trigger", testname);
+      checkClosed("submenu", testname);
+      checkActive(gMenuPopup, "submenu", testname);
+    },
+  },
+  {
+    // open the submenu with the cursor right key
+    testname: "open submenu with cursor right",
+    events: [
+      "popupshowing submenupopup",
+      "DOMMenuItemActive submenuitem",
+      "popupshown submenupopup",
+    ],
+    test() {
+      synthesizeKey("KEY_ArrowRight");
+    },
+    result(testname) {
+      checkOpen("trigger", testname);
+      checkOpen("submenu", testname);
+      checkActive(gMenuPopup, "submenu", testname);
+      checkActive(
+        document.getElementById("submenupopup"),
+        "submenuitem",
+        testname
+      );
+    },
+  },
+  {
+    // close the submenu with the cursor left key
+    testname: "close submenu with cursor left",
+    events: [
+      "popuphiding submenupopup",
+      "popuphidden submenupopup",
+      "DOMMenuItemInactive submenuitem",
+      "DOMMenuInactive submenupopup",
+      "DOMMenuItemActive submenu",
+    ],
+    test() {
+      synthesizeKey("KEY_ArrowLeft");
+    },
+    result(testname) {
+      checkOpen("trigger", testname);
+      checkClosed("submenu", testname);
+      checkActive(gMenuPopup, "submenu", testname);
+      checkActive(document.getElementById("submenupopup"), "", testname);
+    },
+  },
+  {
+    // open the submenu with the enter key
+    testname: "open submenu with enter",
+    events: [
+      "popupshowing submenupopup",
+      "DOMMenuItemActive submenuitem",
+      "popupshown submenupopup",
+    ],
+    test() {
+      synthesizeKey("KEY_Enter");
+    },
+    result(testname) {
+      checkOpen("trigger", testname);
+      checkOpen("submenu", testname);
+      checkActive(gMenuPopup, "submenu", testname);
+      checkActive(
+        document.getElementById("submenupopup"),
+        "submenuitem",
+        testname
+      );
+    },
+  },
+  {
+    // close the submenu with the escape key
+    testname: "close submenu with escape",
+    events: [
+      "popuphiding submenupopup",
+      "popuphidden submenupopup",
+      "DOMMenuItemInactive submenuitem",
+      "DOMMenuInactive submenupopup",
+      "DOMMenuItemActive submenu",
+    ],
+    test() {
+      synthesizeKey("KEY_Escape");
+    },
+    result(testname) {
+      checkOpen("trigger", testname);
+      checkClosed("submenu", testname);
+      checkActive(gMenuPopup, "submenu", testname);
+      checkActive(document.getElementById("submenupopup"), "", testname);
+    },
+  },
+  {
+    // pressing the letter again when the next item is disabled should still
+    // select the disabled item on Windows, but select the next item on other
+    // platforms
+    testname: "menuitem with non accelerator disabled",
+    events() {
+      if (navigator.platform.indexOf("Win") == 0) {
+        return [
+          "DOMMenuItemInactive submenu",
+          "DOMMenuItemActive other",
+          "DOMMenuItemInactive other",
+          "DOMMenuItemActive item1",
+        ];
+      }
+      return [
+        "DOMMenuItemInactive submenu",
+        "DOMMenuItemActive last",
+        "DOMMenuItemInactive last",
+        "DOMMenuItemActive item1",
+      ];
+    },
+    test() {
+      sendString("OF");
+    },
+    result(testname) {
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // pressing a letter that doesn't correspond to an accelerator nor the
+    // first letter of a menu. This should have no effect.
+    testname: "menuitem with keypress no accelerator found",
+    test() {
+      sendString("G");
+    },
+    result(testname) {
+      checkOpen("trigger", testname);
+      checkActive(gMenuPopup, "item1", testname);
+    },
+  },
+  {
+    // when only one menuitem starting with that letter exists, it should be
+    // selected and the menu closed
+    testname: "menuitem with non accelerator single",
+    events: [
+      "DOMMenuItemInactive item1",
+      "DOMMenuItemActive amenu",
+      "DOMMenuItemInactive amenu",
+      "DOMMenuInactive thepopup",
+      "command amenu",
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuItemInactive amenu",
+    ],
+    test() {
+      sendString("M");
+    },
+    result(testname) {
+      checkClosed("trigger", testname);
+      checkActive(gMenuPopup, "", testname);
+    },
+  },
+  {
+    testname: "open context popup at screen with all modifiers set",
+    events: ["popupshowing thepopup 1111", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gMenuPopup.openPopupAtScreen(
+        gScreenX + 8,
+        gScreenY + 16,
+        true,
+        gCachedEvent2
+      );
+    },
+  },
+  {
+    testname: "open popup with open property",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    test(testname, step) {
+      openMenu(gTrigger);
+    },
+    result(testname, step) {
+      checkOpen("trigger", testname);
+      if (gIsMenu) {
+        compareEdge(gTrigger, gMenuPopup, "after_start", 0, 0, testname);
+      }
+    },
+  },
+  {
+    testname: "open submenu with open property",
+    events: [
+      "popupshowing submenupopup",
+      "DOMMenuItemActive submenu",
+      "popupshown submenupopup",
+    ],
+    test(testname, step) {
+      openMenu(document.getElementById("submenu"));
+    },
+    result(testname, step) {
+      checkOpen("trigger", testname);
+      checkOpen("submenu", testname);
+      // XXXndeakin
+      // getBoundingClientRect doesn't seem to working right for submenus
+      // so disable this test for now
+      // compareEdge(document.getElementById("submenu"),
+      //             document.getElementById("submenupopup"), "end_before", 0, 0, testname);
+    },
+  },
+  {
+    testname: "hidePopup hides entire chain",
+    events: [
+      "popuphiding submenupopup",
+      "popuphidden submenupopup",
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuInactive submenupopup",
+      "DOMMenuItemInactive submenu",
+      "DOMMenuItemInactive submenu",
+      "DOMMenuInactive thepopup",
+    ],
+    test() {
+      gMenuPopup.hidePopup();
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+      checkClosed("submenu", testname);
+    },
+  },
+  {
+    testname: "open submenu with open property without parent open",
+    test(testname, step) {
+      openMenu(document.getElementById("submenu"));
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+      checkClosed("submenu", testname);
+    },
+  },
+  {
+    testname: "open popup with open property and position",
+    condition() {
+      return gIsMenu;
+    },
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    test(testname, step) {
+      gMenuPopup.setAttribute("position", "before_start");
+      openMenu(gTrigger);
+    },
+    result(testname, step) {
+      compareEdge(gTrigger, gMenuPopup, "before_start", 0, 0, testname);
+    },
+  },
+  {
+    testname: "close popup with open property",
+    condition() {
+      return gIsMenu;
+    },
+    events: [
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuInactive thepopup",
+    ],
+    test(testname, step) {
+      closeMenu(gTrigger, gMenuPopup);
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    testname: "open popup with open property, position, anchor and alignment",
+    condition() {
+      return gIsMenu;
+    },
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gMenuPopup.setAttribute("position", "start_after");
+      gMenuPopup.setAttribute("popupanchor", "topright");
+      gMenuPopup.setAttribute("popupalign", "bottomright");
+      openMenu(gTrigger);
+    },
+    result(testname, step) {
+      compareEdge(gTrigger, gMenuPopup, "start_after", 0, 0, testname);
+    },
+  },
+  {
+    testname: "open popup with open property, anchor and alignment",
+    condition() {
+      return gIsMenu;
+    },
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gMenuPopup.removeAttribute("position");
+      gMenuPopup.setAttribute("popupanchor", "bottomright");
+      gMenuPopup.setAttribute("popupalign", "topright");
+      openMenu(gTrigger);
+    },
+    result(testname, step) {
+      compareEdge(gTrigger, gMenuPopup, "after_end", 0, 0, testname);
+      gMenuPopup.removeAttribute("popupanchor");
+      gMenuPopup.removeAttribute("popupalign");
+    },
+  },
+  {
+    testname: "focus and cursor down on trigger",
+    condition() {
+      return gIsMenu;
+    },
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gTrigger.focus();
+      synthesizeKey("KEY_ArrowDown", { altKey: !platformIsMac() });
+    },
+    result(testname, step) {
+      checkOpen("trigger", testname);
+      checkActive(gMenuPopup, "", testname);
+    },
+  },
+  {
+    testname: "focus and cursor up on trigger",
+    condition() {
+      return gIsMenu;
+    },
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    test(testname, step) {
+      gTrigger.focus();
+      synthesizeKey("KEY_ArrowUp", { altKey: !platformIsMac() });
+    },
+    result(testname, step) {
+      checkOpen("trigger", testname);
+      checkActive(gMenuPopup, "", testname);
+    },
+  },
+  {
+    testname: "select and enter on menuitem",
+    condition() {
+      return gIsMenu;
+    },
+    events: [
+      "DOMMenuItemActive item1",
+      "DOMMenuItemInactive item1",
+      "DOMMenuInactive thepopup",
+      "command item1",
+      "popuphiding thepopup",
+      "popuphidden thepopup",
+      "DOMMenuItemInactive item1",
+    ],
+    test(testname, step) {
+      synthesizeKey("KEY_ArrowDown");
+      synthesizeKey("KEY_Enter");
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    testname: "focus trigger and key to open",
+    condition() {
+      return gIsMenu;
+    },
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gTrigger.focus();
+      synthesizeKey(platformIsMac() ? " " : "KEY_F4");
+    },
+    result(testname, step) {
+      checkOpen("trigger", testname);
+      checkActive(gMenuPopup, "", testname);
+    },
+  },
+  {
+    // the menu should only open when the meta or alt key is not pressed
+    testname: "focus trigger and key wrong modifier",
+    condition() {
+      return gIsMenu;
+    },
+    test(testname, step) {
+      gTrigger.focus();
+      if (platformIsMac()) {
+        synthesizeKey("KEY_F4", { altKey: true });
+      } else {
+        synthesizeKey("", { metaKey: true });
+      }
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+    },
+  },
+  {
+    testname: "mouse click on disabled menu",
+    condition() {
+      return gIsMenu;
+    },
+    test(testname, step) {
+      gTrigger.setAttribute("disabled", "true");
+      synthesizeMouse(gTrigger, 4, 4, {});
+    },
+    result(testname, step) {
+      checkClosed("trigger", testname);
+      gTrigger.removeAttribute("disabled");
+    },
+  },
+  {
+    // openPopup using object as position argument
+    testname: "openPopup with object argument",
+    events: ["popupshowing thepopup 0000", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gMenuPopup.openPopup(gTrigger, { position: "before_start", x: 5, y: 7 });
+      checkOpen("trigger", testname);
+    },
+    result(testname, step) {
+      var triggerrect = gTrigger.getBoundingClientRect();
+      var popuprect = gMenuPopup.getBoundingClientRect();
+      is(
+        Math.round(popuprect.left),
+        Math.round(triggerrect.left + 5),
+        testname + " x position "
+      );
+      is(
+        Math.round(popuprect.bottom),
+        Math.round(triggerrect.top + 7),
+        testname + " y position "
+      );
+    },
+  },
+  {
+    // openPopup using object as position argument with event
+    testname: "openPopup with object argument with event",
+    events: ["popupshowing thepopup 1000", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gMenuPopup.openPopup(gTrigger, {
+        position: "after_start",
+        x: 0,
+        y: 0,
+        triggerEvent: new MouseEvent("mousedown", { altKey: true }),
+      });
+      checkOpen("trigger", testname);
+    },
+  },
+  {
+    // openPopup with no arguments
+    testname: "openPopup with no arguments",
+    events: ["popupshowing thepopup", "popupshown thepopup"],
+    autohide: "thepopup",
+    test(testname, step) {
+      gMenuPopup.openPopup();
+    },
+    result(testname, step) {
+      let isMenu = gTrigger.type == "menu";
+      // With no arguments, open in default menu position
+      var triggerrect = gTrigger.getBoundingClientRect();
+      var popuprect = gMenuPopup.getBoundingClientRect();
+      is(
+        Math.round(popuprect.left),
+        isMenu ? Math.round(triggerrect.left) : 0,
+        testname + " x position "
+      );
+      is(
+        Math.round(popuprect.top),
+        isMenu ? Math.round(triggerrect.bottom) : 0,
+        testname + " y position "
+      );
+    },
+  },
+  {
+    // openPopup should open the menu synchronously, however popupshown
+    // is fired asynchronously
+    testname: "openPopup synchronous",
+    events: [
+      "popupshowing thepopup",
+      "popupshowing submenupopup",
+      "popupshown thepopup",
+      "DOMMenuItemActive submenu",
+      "popupshown submenupopup",
+    ],
+    test(testname, step) {
+      gMenuPopup.openPopup(gTrigger, "after_start", 0, 0, false, true);
+      document
+        .getElementById("submenupopup")
+        .openPopup(gTrigger, "end_before", 0, 0, false, true);
+      checkOpen("trigger", testname);
+      checkOpen("submenu", testname);
+    },
+  },
+  {
+    // remove the content nodes for the popup
+    testname: "remove content",
+    test(testname, step) {
+      var submenupopup = document.getElementById("submenupopup");
+      submenupopup.remove();
+      var popup = document.getElementById("thepopup");
+      popup.remove();
+    },
+  },
+];
+
+function platformIsMac() {
+  return navigator.platform.indexOf("Mac") > -1;
+}
diff --git a/toolkit/content/tests/chrome/rtlchrome/rtl.css b/toolkit/content/tests/chrome/rtlchrome/rtl.css
new file mode 100644
index 0000000000..0fea010019
--- /dev/null
+++ b/toolkit/content/tests/chrome/rtlchrome/rtl.css
@@ -0,0 +1,2 @@
+/* Imitate RTL UI */
+window { direction: rtl; }
diff --git a/toolkit/content/tests/chrome/rtlchrome/rtl.dtd b/toolkit/content/tests/chrome/rtlchrome/rtl.dtd
new file mode 100644
index 0000000000..8b32de6746
--- /dev/null
+++ b/toolkit/content/tests/chrome/rtlchrome/rtl.dtd
@@ -0,0 +1 @@
+
diff --git a/toolkit/content/tests/chrome/rtlchrome/rtl.manifest b/toolkit/content/tests/chrome/rtlchrome/rtl.manifest
new file mode 100644
index 0000000000..a4cc6929be
--- /dev/null
+++ b/toolkit/content/tests/chrome/rtlchrome/rtl.manifest
@@ -0,0 +1,5 @@
+content rtlchrome /
+
+# Override intl.css with our own CSS file
+override chrome://global/locale/intl.css chrome://rtlchrome/rtl.css
+override chrome://global/locale/global.dtd chrome://rtlchrome/rtl.dtd
diff --git a/toolkit/content/tests/chrome/sample_entireword_latin1.html b/toolkit/content/tests/chrome/sample_entireword_latin1.html
new file mode 100644
index 0000000000..b2d66fa3c4
--- /dev/null
+++ b/toolkit/content/tests/chrome/sample_entireword_latin1.html
@@ -0,0 +1,11 @@
+
+
+  Latin entire-word find test page
+  
+    
+     

The twins of Mammon quarrelled. Their warring plunged the world into a new darkness, and the beast abhorred the darkness. So it began to move swiftly, and grew more powerful, and went forth and multiplied. And the beasts brought fire and light to the darkness.

+

from The Book of Mozilla, 15:1

+ + diff --git a/toolkit/content/tests/chrome/test_about_networking.html b/toolkit/content/tests/chrome/test_about_networking.html new file mode 100644 index 0000000000..5465c07751 --- /dev/null +++ b/toolkit/content/tests/chrome/test_about_networking.html @@ -0,0 +1,54 @@ + + + + + + Test for Bug + + + + + +Mozilla Bug +

+ +
+
+ + diff --git a/toolkit/content/tests/chrome/test_arrowpanel.xhtml b/toolkit/content/tests/chrome/test_arrowpanel.xhtml new file mode 100644 index 0000000000..cf83d5c947 --- /dev/null +++ b/toolkit/content/tests/chrome/test_arrowpanel.xhtml @@ -0,0 +1,322 @@ + + + + + + + + + + + diff --git a/toolkit/content/tests/chrome/test_autocomplete2.xhtml b/toolkit/content/tests/chrome/test_autocomplete2.xhtml new file mode 100644 index 0000000000..4a051357eb --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete2.xhtml @@ -0,0 +1,191 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete3.xhtml b/toolkit/content/tests/chrome/test_autocomplete3.xhtml new file mode 100644 index 0000000000..04a5117b6a --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete3.xhtml @@ -0,0 +1,202 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete4.xhtml b/toolkit/content/tests/chrome/test_autocomplete4.xhtml new file mode 100644 index 0000000000..9abf66ba19 --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete4.xhtml @@ -0,0 +1,282 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete5.xhtml b/toolkit/content/tests/chrome/test_autocomplete5.xhtml new file mode 100644 index 0000000000..72cb081f66 --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete5.xhtml @@ -0,0 +1,166 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete_emphasis.xhtml b/toolkit/content/tests/chrome/test_autocomplete_emphasis.xhtml new file mode 100644 index 0000000000..5155dee687 --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete_emphasis.xhtml @@ -0,0 +1,182 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete_mac_caret.xhtml b/toolkit/content/tests/chrome/test_autocomplete_mac_caret.xhtml new file mode 100644 index 0000000000..b49f8a1d5e --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete_mac_caret.xhtml @@ -0,0 +1,80 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete_placehold_last_complete.xhtml b/toolkit/content/tests/chrome/test_autocomplete_placehold_last_complete.xhtml new file mode 100644 index 0000000000..15ed2dfda9 --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete_placehold_last_complete.xhtml @@ -0,0 +1,306 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html b/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html new file mode 100644 index 0000000000..d15cd649e4 --- /dev/null +++ b/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html @@ -0,0 +1,64 @@ + + + + autocomplete with composition tests on HTML input element + + + + + + +

+ +
+ +
+ +
+
+ +
+
+
+ + diff --git a/toolkit/content/tests/chrome/test_browser_drop.xhtml b/toolkit/content/tests/chrome/test_browser_drop.xhtml new file mode 100644 index 0000000000..3b0f0fdb2b --- /dev/null +++ b/toolkit/content/tests/chrome/test_browser_drop.xhtml @@ -0,0 +1,35 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_bug1048178.xhtml b/toolkit/content/tests/chrome/test_bug1048178.xhtml new file mode 100644 index 0000000000..302835e3b9 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug1048178.xhtml @@ -0,0 +1,85 @@ + + + + + + + diff --git a/toolkit/content/tests/chrome/test_bug263683.xhtml b/toolkit/content/tests/chrome/test_bug263683.xhtml new file mode 100644 index 0000000000..64c7df08ac --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug263683.xhtml @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 263683 + + +

+ +
+    
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug304188.xhtml b/toolkit/content/tests/chrome/test_bug304188.xhtml new file mode 100644 index 0000000000..1047528d20 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug304188.xhtml @@ -0,0 +1,37 @@ + + + + + + + + + +Mozilla Bug 304188 +

+ +
+
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug331215.xhtml b/toolkit/content/tests/chrome/test_bug331215.xhtml new file mode 100644 index 0000000000..22560089c1 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug331215.xhtml @@ -0,0 +1,38 @@ + + + + + + + + + +Mozilla Bug 331215 +

+ +
+
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug360220.xhtml b/toolkit/content/tests/chrome/test_bug360220.xhtml new file mode 100644 index 0000000000..a942e0acd6 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug360220.xhtml @@ -0,0 +1,61 @@ + + + + + + + + + +Mozilla Bug 360220 +

+ +
+
+ + + + + + + + + + +
diff --git a/toolkit/content/tests/chrome/test_bug360437.xhtml b/toolkit/content/tests/chrome/test_bug360437.xhtml new file mode 100644 index 0000000000..dc592e4141 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug360437.xhtml @@ -0,0 +1,40 @@ + + + + + + + + + +Mozilla Bug 360437 +

+ +
+
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug365773.xhtml b/toolkit/content/tests/chrome/test_bug365773.xhtml new file mode 100644 index 0000000000..e85a590608 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug365773.xhtml @@ -0,0 +1,67 @@ + + + + + + + + + +Mozilla Bug 365773 +

+ + + +

+ +
+
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug366992.xhtml b/toolkit/content/tests/chrome/test_bug366992.xhtml new file mode 100644 index 0000000000..9b178f1abe --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug366992.xhtml @@ -0,0 +1,40 @@ + + + + + + + + + +Mozilla Bug 366992 +

+ +
+
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug382990.xhtml b/toolkit/content/tests/chrome/test_bug382990.xhtml new file mode 100644 index 0000000000..1f937ac1b6 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug382990.xhtml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/toolkit/content/tests/chrome/test_bug409624.xhtml b/toolkit/content/tests/chrome/test_bug409624.xhtml new file mode 100644 index 0000000000..6aa5f2ded9 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug409624.xhtml @@ -0,0 +1,38 @@ + + + + + + + + + + + Mozilla Bug 409624 + + +

+ +
+    
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug418874.xhtml b/toolkit/content/tests/chrome/test_bug418874.xhtml new file mode 100644 index 0000000000..42d75b10c4 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug418874.xhtml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + +

+

+ +
+    
+ + + + + +
diff --git a/toolkit/content/tests/chrome/test_bug429723.xhtml b/toolkit/content/tests/chrome/test_bug429723.xhtml new file mode 100644 index 0000000000..865f0d66f8 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug429723.xhtml @@ -0,0 +1,38 @@ + + + + + + + + + + +Mozilla Bug 429723 +

+ +
+
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug437844.xhtml b/toolkit/content/tests/chrome/test_bug437844.xhtml new file mode 100644 index 0000000000..9053783754 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug437844.xhtml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + Mozilla Bug 437844 + + + Mozilla Bug 348233 + + +

+ +
+    
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug451540.xhtml b/toolkit/content/tests/chrome/test_bug451540.xhtml new file mode 100644 index 0000000000..debcadfe05 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug451540.xhtml @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 451540 + + +

+ +
+    
+ + + + +
diff --git a/toolkit/content/tests/chrome/test_bug457632.xhtml b/toolkit/content/tests/chrome/test_bug457632.xhtml new file mode 100644 index 0000000000..bd8797b32d --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug457632.xhtml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + diff --git a/toolkit/content/tests/chrome/test_bug460942.xhtml b/toolkit/content/tests/chrome/test_bug460942.xhtml new file mode 100644 index 0000000000..53f33302be --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug460942.xhtml @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/toolkit/content/tests/chrome/test_bug471776.xhtml b/toolkit/content/tests/chrome/test_bug471776.xhtml new file mode 100644 index 0000000000..6e21ffd9ba --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug471776.xhtml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + +

+

+ +
+    
+ + + + + +
diff --git a/toolkit/content/tests/chrome/test_bug509732.xhtml b/toolkit/content/tests/chrome/test_bug509732.xhtml new file mode 100644 index 0000000000..3307d62450 --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug509732.xhtml @@ -0,0 +1,55 @@ + + + + + + + + diff --git a/toolkit/content/tests/chrome/test_bug557987.xhtml b/toolkit/content/tests/chrome/test_bug557987.xhtml new file mode 100644 index 0000000000..f9ea841cfd --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug557987.xhtml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/tests/chrome/test_bug562554.xhtml b/toolkit/content/tests/chrome/test_bug562554.xhtml new file mode 100644 index 0000000000..88f876f0df --- /dev/null +++ b/toolkit/content/tests/chrome/test_bug562554.xhtml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/toolkit/content/tests/chrome/test_contextmenu_list.xhtml b/toolkit/content/tests/chrome/test_contextmenu_list.xhtml new file mode 100644 index 0000000000..8fb5f112d0 --- /dev/null +++ b/toolkit/content/tests/chrome/test_contextmenu_list.xhtml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + +