From 4acc0d58cb0fa989d609972493be363c105f2594 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 1 Feb 2020 23:45:36 -0500 Subject: Issue #65 - Remove AppConstants from toolkit/content --- toolkit/content/aboutProfiles.js | 12 +++---- toolkit/content/aboutSupport.js | 71 ++++++++++++++++++------------------- toolkit/content/aboutTelemetry.js | 25 ++++++------- toolkit/content/browser-child.js | 1 - toolkit/content/contentAreaUtils.js | 10 +++--- toolkit/content/customizeToolbar.js | 9 +++-- toolkit/content/globalOverlay.js | 44 +++++++++++------------ toolkit/content/jar.mn | 12 +++---- 8 files changed, 88 insertions(+), 96 deletions(-) (limited to 'toolkit/content') diff --git a/toolkit/content/aboutProfiles.js b/toolkit/content/aboutProfiles.js index cddf88819..29c5f67ad 100644 --- a/toolkit/content/aboutProfiles.js +++ b/toolkit/content/aboutProfiles.js @@ -8,7 +8,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/XPCOMUtils.jsm'); -Cu.import('resource://gre/modules/AppConstants.jsm'); XPCOMUtils.defineLazyServiceGetter( this, @@ -130,12 +129,13 @@ function display(profileData) { if (dir) { td.appendChild(document.createTextNode(' ')); let button = document.createElement('button'); +#ifdef XP_WIN + let string = 'winOpenDir2'; +#elifdef XP_MACOSX + let string = 'macOpenDir'; +#else let string = 'openDir'; - if (AppConstants.platform == "win") { - string = 'winOpenDir2'; - } else if (AppConstants.platform == "macosx") { - string = 'macOpenDir'; - } +#endif let buttonText = document.createTextNode(bundle.GetStringFromName(string)); button.appendChild(buttonText); td.appendChild(button); diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index 5c889c18f..4e58bbef9 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -10,7 +10,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Troubleshoot.jsm"); Cu.import("resource://gre/modules/ResetProfile.jsm"); -Cu.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm"); @@ -42,7 +41,7 @@ var snapshotFormatters = { $("os-box").textContent = data.osVersion; $("binary-box").textContent = Services.dirsvc.get("XREExeF", Ci.nsIFile).path; $("supportLink").href = data.supportURL; - let version = AppConstants.MOZ_APP_VERSION_DISPLAY; + let version = Services.appinfo.version; if (data.versionArch) { version += " (" + data.versionArch + ")"; } @@ -197,23 +196,23 @@ var snapshotFormatters = { delete data.info; } - if (AppConstants.NIGHTLY_BUILD) { - let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - let gpuProcessPid = windowUtils.gpuProcessPid; +#ifdef NIGHTLY_BUILD + let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + let gpuProcessPid = windowUtils.gpuProcessPid; - if (gpuProcessPid != -1) { - let gpuProcessKillButton = $.new("button"); + if (gpuProcessPid != -1) { + let gpuProcessKillButton = $.new("button"); - gpuProcessKillButton.addEventListener("click", function() { - windowUtils.terminateGPUProcess(); - }); + gpuProcessKillButton.addEventListener("click", function() { + windowUtils.terminateGPUProcess(); + }); - gpuProcessKillButton.textContent = strings.GetStringFromName("gpuProcessKillButton"); - addRow("diagnostics", "GPUProcessPid", gpuProcessPid); - addRow("diagnostics", "GPUProcess", [gpuProcessKillButton]); - } + gpuProcessKillButton.textContent = strings.GetStringFromName("gpuProcessKillButton"); + addRow("diagnostics", "GPUProcessPid", gpuProcessPid); + addRow("diagnostics", "GPUProcess", [gpuProcessKillButton]); } +#endif // graphics-failures-tbody tbody if ("failures" in data) { @@ -583,15 +582,15 @@ function copyRawDataToClipboard(button) { Cc["@mozilla.org/widget/clipboard;1"]. getService(Ci.nsIClipboard). setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard); - if (AppConstants.platform == "android") { - // Present a toast notification. - let message = { - type: "Toast:Show", - message: stringBundle().GetStringFromName("rawDataCopied"), - duration: "short" - }; - Services.androidBridge.handleGeckoMessage(message); - } +#ifdef MOZ_WIDGET_ANDROID + // Present a toast notification. + let message = { + type: "Toast:Show", + message: stringBundle().GetStringFromName("rawDataCopied"), + duration: "short" + }; + Services.androidBridge.handleGeckoMessage(message); +#endif }); } catch (err) { @@ -637,15 +636,15 @@ function copyContentsToClipboard() { .getService(Ci.nsIClipboard); clipboard.setData(transferable, null, clipboard.kGlobalClipboard); - if (AppConstants.platform == "android") { - // Present a toast notification. - let message = { - type: "Toast:Show", - message: stringBundle().GetStringFromName("textCopied"), - duration: "short" - }; - Services.androidBridge.handleGeckoMessage(message); - } +#ifdef MOZ_WIDGET_ANDROID + // Present a toast notification. + let message = { + type: "Toast:Show", + message: stringBundle().GetStringFromName("textCopied"), + duration: "short" + }; + Services.androidBridge.handleGeckoMessage(message); +#endif } // Return the plain text representation of an element. Do a little bit @@ -654,10 +653,10 @@ function createTextForElement(elem) { let serializer = new Serializer(); let text = serializer.serialize(elem); +#ifdef XP_WIN // Actual CR/LF pairs are needed for some Windows text editors. - if (AppConstants.platform == "win") { - text = text.replace(/\n/g, "\r\n"); - } + text = text.replace(/\n/g, "\r\n"); +#endif return text; } diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js index c73a979c6..0829fe7e2 100644 --- a/toolkit/content/aboutTelemetry.js +++ b/toolkit/content/aboutTelemetry.js @@ -19,9 +19,6 @@ Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Task.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", - "resource://gre/modules/AppConstants.jsm"); - const Telemetry = Services.telemetry; const bundle = Services.strings.createBundle( "chrome://global/locale/aboutTelemetry.properties"); @@ -236,17 +233,17 @@ var Settings = { let elements = document.getElementsByClassName("change-data-choices-link"); for (let el of elements) { el.addEventListener("click", function() { - if (AppConstants.platform == "android") { - Cu.import("resource://gre/modules/Messaging.jsm"); - Messaging.sendRequest({ - type: "Settings:Show", - resource: "preferences_privacy", - }); - } else { - // Show the data choices preferences on desktop. - let mainWindow = getMainWindowWithPreferencesPane(); - mainWindow.openAdvancedPreferences("dataChoicesTab"); - } +#ifdef MOZ_WIDGET_ANDROID + Cu.import("resource://gre/modules/Messaging.jsm"); + Messaging.sendRequest({ + type: "Settings:Show", + resource: "preferences_privacy", + }); +#else + // Show the data choices preferences on desktop. + let mainWindow = getMainWindowWithPreferencesPane(); + mainWindow.openAdvancedPreferences("dataChoicesTab"); +#endif }, false); } }, diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js index 7d0fe18c5..ffb07dde2 100644 --- a/toolkit/content/browser-child.js +++ b/toolkit/content/browser-child.js @@ -7,7 +7,6 @@ var Ci = Components.interfaces; var Cu = Components.utils; var Cr = Components.results; -Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/BrowserUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import('resource://gre/modules/XPCOMUtils.jsm'); diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index 736fb7dfc..2512804fa 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -24,8 +24,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", "resource://gre/modules/Deprecated.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", - "resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); @@ -1161,10 +1159,10 @@ function getNormalizedLeafName(aFile, aDefaultExtension) if (!aDefaultExtension) return aFile; - if (AppConstants.platform == "win") { - // Remove trailing dots and spaces on windows - aFile = aFile.replace(/[\s.]+$/, ""); - } +#ifdef XP_WIN + // Remove trailing dots and spaces on windows + aFile = aFile.replace(/[\s.]+$/, ""); +#endif // Remove leading dots aFile = aFile.replace(/^\.+/, ""); diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js index 7400aaadc..05151b905 100644 --- a/toolkit/content/customizeToolbar.js +++ b/toolkit/content/customizeToolbar.js @@ -12,7 +12,6 @@ var gToolboxSheet = false; var gPaletteBox = null; Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://gre/modules/AppConstants.jsm"); function onLoad() { @@ -213,10 +212,10 @@ function wrapToolbarItems() { forEachCustomizableToolbar(function (toolbar) { Array.forEach(toolbar.childNodes, function (item) { - if (AppConstants.platform == "macosx") { - if (item.firstChild && item.firstChild.localName == "menubar") - return; - } +#ifdef XP_MACOSX + if (item.firstChild && item.firstChild.localName == "menubar") + return; +#endif if (isToolbarItem(item)) { let wrapper = wrapToolbarItem(item); cleanupItemForToolbar(item, wrapper); diff --git a/toolkit/content/globalOverlay.js b/toolkit/content/globalOverlay.js index 1df3d65fc..d8467f0a1 100644 --- a/toolkit/content/globalOverlay.js +++ b/toolkit/content/globalOverlay.js @@ -4,32 +4,32 @@ function closeWindow(aClose, aPromptFunction) { - let { AppConstants } = Components.utils.import("resource://gre/modules/AppConstants.jsm"); - +#ifdef XP_MACOSX // Closing the last window doesn't quit the application on OS X. - if (AppConstants.platform != "macosx") { - var windowCount = 0; - var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator); - var e = wm.getEnumerator(null); - - while (e.hasMoreElements()) { - var w = e.getNext(); - if (w.closed) { - continue; - } - if (++windowCount == 2) - break; + if (typeof(aPromptFunction) == "function" && !aPromptFunction()) { + return false; + } +#else + var windowCount = 0; + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var e = wm.getEnumerator(null); + + while (e.hasMoreElements()) { + var w = e.getNext(); + if (w.closed) { + continue; } + if (++windowCount == 2) + break; + } - // If we're down to the last window and someone tries to shut down, check to make sure we can! - if (windowCount == 1 && !canQuitApplication("lastwindow")) - return false; - if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction()) - return false; - } else if (typeof(aPromptFunction) == "function" && !aPromptFunction()) { + // If we're down to the last window and someone tries to shut down, check to make sure we can! + if (windowCount == 1 && !canQuitApplication("lastwindow")) return false; - } + if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction()) + return false; +#endif if (aClose) { window.close(); diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index 5a940679b..96c559bb2 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -20,7 +20,7 @@ toolkit.jar: content/global/aboutNetworking.js content/global/aboutNetworking.xhtml #ifndef ANDROID - content/global/aboutProfiles.js +* content/global/aboutProfiles.js content/global/aboutProfiles.xhtml #endif content/global/aboutServiceWorkers.js @@ -32,18 +32,18 @@ toolkit.jar: #endif * content/global/aboutSupport.js * content/global/aboutSupport.xhtml - content/global/aboutTelemetry.js +* content/global/aboutTelemetry.js content/global/aboutTelemetry.xhtml content/global/aboutTelemetry.css content/global/directionDetector.html content/global/plugins.html content/global/plugins.css - content/global/browser-child.js +* content/global/browser-child.js content/global/browser-content.js * content/global/buildconfig.html - content/global/contentAreaUtils.js +* content/global/contentAreaUtils.js content/global/customizeToolbar.css - content/global/customizeToolbar.js +* content/global/customizeToolbar.js content/global/customizeToolbar.xul content/global/datepicker.xhtml content/global/editMenuOverlay.js @@ -52,7 +52,7 @@ toolkit.jar: * content/global/finddialog.xul content/global/findUtils.js content/global/filepicker.properties - content/global/globalOverlay.js +* content/global/globalOverlay.js content/global/mozilla.xhtml #ifdef MOZ_PHOENIX content/global/logopage.xhtml -- cgit v1.2.3 From 28f0155307b8182653e31c1dd969828bbb0249f0 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 20 Feb 2020 11:01:30 +0100 Subject: Issue #1383 - Remove "Copy raw data to clipboard" button This resolves #1383 --- toolkit/content/aboutSupport.js | 39 -------------------------------------- toolkit/content/aboutSupport.xhtml | 3 --- 2 files changed, 42 deletions(-) (limited to 'toolkit/content') diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index 4e58bbef9..f49172230 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -564,42 +564,6 @@ function sortedArrayFromObject(obj) { return tuples; } -function copyRawDataToClipboard(button) { - if (button) - button.disabled = true; - try { - Troubleshoot.snapshot(function (snapshot) { - if (button) - button.disabled = false; - let str = Cc["@mozilla.org/supports-string;1"]. - createInstance(Ci.nsISupportsString); - str.data = JSON.stringify(snapshot, undefined, 2); - let transferable = Cc["@mozilla.org/widget/transferable;1"]. - createInstance(Ci.nsITransferable); - transferable.init(getLoadContext()); - transferable.addDataFlavor("text/unicode"); - transferable.setTransferData("text/unicode", str, str.data.length * 2); - Cc["@mozilla.org/widget/clipboard;1"]. - getService(Ci.nsIClipboard). - setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard); -#ifdef MOZ_WIDGET_ANDROID - // Present a toast notification. - let message = { - type: "Toast:Show", - message: stringBundle().GetStringFromName("rawDataCopied"), - duration: "short" - }; - Services.androidBridge.handleGeckoMessage(message); -#endif - }); - } - catch (err) { - if (button) - button.disabled = false; - throw err; - } -} - function getLoadContext() { return window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) @@ -912,9 +876,6 @@ function setupEventListeners() { $("reset-box-button").addEventListener("click", function(event) { ResetProfile.openConfirmationDialog(window); }); - $("copy-raw-data-to-clipboard").addEventListener("click", function(event) { - copyRawDataToClipboard(this); - }); $("copy-to-clipboard").addEventListener("click", function(event) { copyContentsToClipboard(); }); diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index fff86dff6..0b7b52164 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -61,9 +61,6 @@
- -- cgit v1.2.3 From eb70e6e3d0bff11c25f14b1196025791bf2308fb Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 25 Feb 2020 15:07:00 -0500 Subject: Issue #439 - Remove tests from toolkit/ --- toolkit/content/moz.build | 18 +- toolkit/content/tests/browser/.eslintrc.js | 7 - toolkit/content/tests/browser/audio.ogg | Bin 14290 -> 0 bytes toolkit/content/tests/browser/browser.ini | 76 -- .../tests/browser/browser_audioCompeting.js | 115 -- .../browser_audioCompeting_onlyForActiveAgent.js | 176 --- .../tests/browser/browser_autoscroll_disabled.js | 67 - .../tests/browser/browser_block_autoplay_media.js | 87 -- .../content/tests/browser/browser_bug1170531.js | 92 -- .../content/tests/browser/browser_bug1198465.js | 75 - .../browser_bug295977_autoscroll_overflow.js | 214 --- toolkit/content/tests/browser/browser_bug451286.js | 152 --- toolkit/content/tests/browser/browser_bug594509.js | 9 - toolkit/content/tests/browser/browser_bug982298.js | 70 - .../content/tests/browser/browser_contentTitle.js | 16 - .../browser/browser_content_url_annotation.js | 73 - .../browser/browser_crash_previous_frameloader.js | 108 -- .../tests/browser/browser_datetime_datepicker.js | 284 ---- .../browser/browser_default_image_filename.js | 45 - .../tests/browser/browser_f7_caret_browsing.js | 227 --- toolkit/content/tests/browser/browser_findbar.js | 249 ---- .../content/tests/browser/browser_isSynthetic.js | 72 - .../browser_keyevents_during_autoscrolling.js | 120 -- .../tests/browser/browser_label_textlink.js | 38 - .../content/tests/browser/browser_mediaPlayback.js | 30 - .../tests/browser/browser_mediaPlayback_mute.js | 104 -- .../browser/browser_mediaPlayback_suspended.js | 191 --- ...rowser_mediaPlayback_suspended_multipleAudio.js | 311 ----- toolkit/content/tests/browser/browser_mute.js | 16 - toolkit/content/tests/browser/browser_mute2.js | 26 - .../tests/browser/browser_quickfind_editable.js | 47 - .../content/tests/browser/browser_saveImageURL.js | 68 - .../tests/browser/browser_save_resend_postdata.js | 145 -- .../content/tests/browser/common/mockTransfer.js | 67 - .../content/tests/browser/data/post_form_inner.sjs | 31 - .../content/tests/browser/data/post_form_outer.sjs | 34 - toolkit/content/tests/browser/empty.png | Bin 14528 -> 0 bytes .../content/tests/browser/file_contentTitle.html | 14 - .../content/tests/browser/file_mediaPlayback.html | 9 - .../content/tests/browser/file_mediaPlayback2.html | 12 - .../tests/browser/file_mediaPlaybackFrame.html | 2 - .../tests/browser/file_mediaPlaybackFrame2.html | 2 - .../content/tests/browser/file_multipleAudio.html | 19 - .../tests/browser/file_multiplePlayingAudio.html | 23 - toolkit/content/tests/browser/file_redirect.html | 13 - .../content/tests/browser/file_redirect_to.html | 15 - toolkit/content/tests/browser/head.js | 123 -- toolkit/content/tests/browser/image.jpg | Bin 24204 -> 0 bytes toolkit/content/tests/browser/image_page.html | 9 - toolkit/content/tests/chrome/.eslintrc.js | 7 - .../tests/chrome/RegisterUnregisterChrome.js | 161 --- toolkit/content/tests/chrome/bug263683_window.xul | 210 --- toolkit/content/tests/chrome/bug304188_window.xul | 94 -- toolkit/content/tests/chrome/bug331215_window.xul | 102 -- toolkit/content/tests/chrome/bug360437_window.xul | 120 -- toolkit/content/tests/chrome/bug366992_window.xul | 57 - toolkit/content/tests/chrome/bug409624_window.xul | 98 -- toolkit/content/tests/chrome/bug429723_window.xul | 84 -- toolkit/content/tests/chrome/bug451540_window.xul | 248 ---- toolkit/content/tests/chrome/bug624329_window.xul | 22 - toolkit/content/tests/chrome/chrome.ini | 199 --- .../content/tests/chrome/dialog_dialogfocus.xul | 57 - .../tests/chrome/file_about_networking_wsh.py | 9 - .../chrome/file_autocomplete_with_composition.js | 540 -------- .../tests/chrome/findbar_entireword_window.xul | 275 ---- .../content/tests/chrome/findbar_events_window.xul | 173 --- toolkit/content/tests/chrome/findbar_window.xul | 756 ---------- .../content/tests/chrome/frame_popup_anchor.xul | 82 -- .../tests/chrome/frame_popupremoving_frame.xul | 75 - .../chrome/frame_subframe_origin_subframe1.xul | 43 - .../chrome/frame_subframe_origin_subframe2.xul | 39 - .../content/tests/chrome/popup_childframe_node.xul | 2 - toolkit/content/tests/chrome/popup_trigger.js | 859 ------------ 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/rtltest/content/dirtest.xul | 25 - .../tests/chrome/rtltest/righttoleft.manifest | 3 - .../tests/chrome/sample_entireword_latin1.html | 11 - .../tests/chrome/test_about_networking.html | 58 - toolkit/content/tests/chrome/test_arrowpanel.xul | 327 ----- .../content/tests/chrome/test_autocomplete2.xul | 197 --- .../content/tests/chrome/test_autocomplete3.xul | 188 --- .../content/tests/chrome/test_autocomplete4.xul | 280 ---- .../content/tests/chrome/test_autocomplete5.xul | 152 --- .../chrome/test_autocomplete_delayOnPaste.xul | 128 -- .../tests/chrome/test_autocomplete_emphasis.xul | 175 --- .../tests/chrome/test_autocomplete_mac_caret.xul | 74 - .../test_autocomplete_placehold_last_complete.xul | 309 ----- ...est_autocomplete_with_composition_on_input.html | 64 - ...st_autocomplete_with_composition_on_textbox.xul | 124 -- toolkit/content/tests/chrome/test_browser_drop.xul | 38 - toolkit/content/tests/chrome/test_bug1048178.xul | 86 -- toolkit/content/tests/chrome/test_bug253481.xul | 90 -- toolkit/content/tests/chrome/test_bug263683.xul | 39 - toolkit/content/tests/chrome/test_bug304188.xul | 37 - toolkit/content/tests/chrome/test_bug331215.xul | 38 - toolkit/content/tests/chrome/test_bug360220.xul | 61 - toolkit/content/tests/chrome/test_bug360437.xul | 40 - toolkit/content/tests/chrome/test_bug365773.xul | 67 - toolkit/content/tests/chrome/test_bug366992.xul | 40 - toolkit/content/tests/chrome/test_bug382990.xul | 44 - toolkit/content/tests/chrome/test_bug409624.xul | 39 - toolkit/content/tests/chrome/test_bug418874.xul | 71 - toolkit/content/tests/chrome/test_bug429723.xul | 38 - toolkit/content/tests/chrome/test_bug437844.xul | 95 -- toolkit/content/tests/chrome/test_bug451540.xul | 39 - toolkit/content/tests/chrome/test_bug457632.xul | 178 --- toolkit/content/tests/chrome/test_bug460942.xul | 42 - toolkit/content/tests/chrome/test_bug471776.xul | 47 - toolkit/content/tests/chrome/test_bug509732.xul | 53 - toolkit/content/tests/chrome/test_bug554279.xul | 39 - toolkit/content/tests/chrome/test_bug557987.xul | 76 -- toolkit/content/tests/chrome/test_bug562554.xul | 92 -- toolkit/content/tests/chrome/test_bug570192.xul | 53 - toolkit/content/tests/chrome/test_bug585946.xul | 51 - toolkit/content/tests/chrome/test_bug624329.xul | 160 --- toolkit/content/tests/chrome/test_bug792324.xul | 75 - toolkit/content/tests/chrome/test_button.xul | 71 - toolkit/content/tests/chrome/test_chromemargin.xul | 36 - .../tests/chrome/test_closemenu_attribute.xul | 96 -- .../tests/chrome/test_colorpicker_popup.xul | 148 -- .../content/tests/chrome/test_contextmenu_list.xul | 288 ---- toolkit/content/tests/chrome/test_cursorsnap.xul | 127 -- toolkit/content/tests/chrome/test_datepicker.xul | 415 ------ toolkit/content/tests/chrome/test_deck.xul | 133 -- toolkit/content/tests/chrome/test_dialogfocus.xul | 102 -- toolkit/content/tests/chrome/test_findbar.xul | 47 - .../tests/chrome/test_findbar_entireword.xul | 41 - .../content/tests/chrome/test_findbar_events.xul | 39 - toolkit/content/tests/chrome/test_focus_anons.xul | 119 -- toolkit/content/tests/chrome/test_hiddenitems.xul | 89 -- toolkit/content/tests/chrome/test_hiddenpaging.xul | 161 --- toolkit/content/tests/chrome/test_keys.xul | 29 - toolkit/content/tests/chrome/test_labelcontrol.xul | 44 - toolkit/content/tests/chrome/test_largemenu.xul | 29 - toolkit/content/tests/chrome/test_menu.xul | 85 -- .../content/tests/chrome/test_menu_anchored.xul | 77 -- toolkit/content/tests/chrome/test_menu_hide.xul | 58 - toolkit/content/tests/chrome/test_menuchecks.xul | 147 -- .../content/tests/chrome/test_menuitem_blink.xul | 106 -- .../tests/chrome/test_menuitem_commands.xul | 104 -- toolkit/content/tests/chrome/test_menulist.xul | 314 ----- .../content/tests/chrome/test_menulist_keynav.xul | 272 ---- .../tests/chrome/test_menulist_null_value.xul | 96 -- .../content/tests/chrome/test_menulist_paging.xul | 163 --- .../tests/chrome/test_menulist_position.xul | 97 -- toolkit/content/tests/chrome/test_mousescroll.xul | 274 ---- .../content/tests/chrome/test_notificationbox.xul | 522 ------- toolkit/content/tests/chrome/test_panel.xul | 31 - toolkit/content/tests/chrome/test_panel_focus.xul | 38 - .../content/tests/chrome/test_panelfrommenu.xul | 118 -- toolkit/content/tests/chrome/test_popup_anchor.xul | 30 - .../tests/chrome/test_popup_anchoratrect.xul | 28 - .../content/tests/chrome/test_popup_attribute.xul | 28 - toolkit/content/tests/chrome/test_popup_button.xul | 28 - toolkit/content/tests/chrome/test_popup_coords.xul | 91 -- toolkit/content/tests/chrome/test_popup_keys.xul | 148 -- .../tests/chrome/test_popup_moveToAnchor.xul | 84 -- .../tests/chrome/test_popup_preventdefault.xul | 76 -- .../chrome/test_popup_preventdefault_chrome.xul | 29 - .../content/tests/chrome/test_popup_recreate.xul | 83 -- toolkit/content/tests/chrome/test_popup_scaled.xul | 105 -- toolkit/content/tests/chrome/test_popup_tree.xul | 72 - toolkit/content/tests/chrome/test_popuphidden.xul | 74 - .../content/tests/chrome/test_popupincontent.xul | 131 -- .../content/tests/chrome/test_popupremoving.xul | 165 --- .../tests/chrome/test_popupremoving_frame.xul | 80 -- toolkit/content/tests/chrome/test_position.xul | 136 -- toolkit/content/tests/chrome/test_preferences.xul | 533 -------- .../tests/chrome/test_preferences_beforeaccept.xul | 55 - .../test_preferences_onsyncfrompreference.xul | 62 - .../content/tests/chrome/test_progressmeter.xul | 74 - toolkit/content/tests/chrome/test_props.xul | 91 -- toolkit/content/tests/chrome/test_radio.xul | 66 - .../tests/chrome/test_richlist_direction.xul | 138 -- toolkit/content/tests/chrome/test_righttoleft.xul | 126 -- toolkit/content/tests/chrome/test_scale.xul | 277 ---- toolkit/content/tests/chrome/test_scaledrag.xul | 197 --- .../tests/chrome/test_screenPersistence.xul | 63 - toolkit/content/tests/chrome/test_scrollbar.xul | 137 -- toolkit/content/tests/chrome/test_showcaret.xul | 101 -- toolkit/content/tests/chrome/test_sorttemplate.xul | 89 -- toolkit/content/tests/chrome/test_statusbar.xul | 42 - .../content/tests/chrome/test_subframe_origin.xul | 37 - toolkit/content/tests/chrome/test_tabbox.xul | 224 --- toolkit/content/tests/chrome/test_tabindex.xul | 120 -- .../tests/chrome/test_textbox_dictionary.xul | 98 -- .../tests/chrome/test_textbox_emptytext.xul | 48 - .../content/tests/chrome/test_textbox_number.xul | 353 ----- .../content/tests/chrome/test_textbox_search.xul | 170 --- toolkit/content/tests/chrome/test_timepicker.xul | 207 --- toolkit/content/tests/chrome/test_titlebar.xul | 35 - toolkit/content/tests/chrome/test_toolbar.xul | 227 --- toolkit/content/tests/chrome/test_tooltip.xul | 28 - .../tests/chrome/test_tooltip_noautohide.xul | 57 - toolkit/content/tests/chrome/test_tree.xul | 84 -- toolkit/content/tests/chrome/test_tree_hier.xul | 136 -- .../content/tests/chrome/test_tree_hier_cell.xul | 136 -- toolkit/content/tests/chrome/test_tree_single.xul | 110 -- toolkit/content/tests/chrome/test_tree_view.xul | 118 -- .../content/tests/chrome/window_browser_drop.xul | 242 ---- .../content/tests/chrome/window_chromemargin.xul | 73 - .../tests/chrome/window_cursorsnap_dialog.xul | 104 -- .../tests/chrome/window_cursorsnap_wizard.xul | 111 -- toolkit/content/tests/chrome/window_keys.xul | 202 --- toolkit/content/tests/chrome/window_largemenu.xul | 425 ------ toolkit/content/tests/chrome/window_panel.xul | 312 ----- .../content/tests/chrome/window_panel_focus.xul | 132 -- .../content/tests/chrome/window_popup_anchor.xul | 28 - .../tests/chrome/window_popup_anchoratrect.xul | 117 -- .../tests/chrome/window_popup_attribute.xul | 40 - .../content/tests/chrome/window_popup_button.xul | 41 - .../chrome/window_popup_preventdefault_chrome.xul | 113 -- .../content/tests/chrome/window_preferences.xul | 73 - .../content/tests/chrome/window_preferences2.xul | 25 - .../content/tests/chrome/window_preferences3.xul | 74 - .../chrome/window_preferences_beforeaccept.xul | 45 - .../chrome/window_preferences_commandretarget.xul | 36 - .../window_preferences_onsyncfrompreference.xul | 42 - .../content/tests/chrome/window_screenPosSize.xul | 17 - toolkit/content/tests/chrome/window_showcaret.xul | 10 - .../tests/chrome/window_subframe_origin.xul | 42 - toolkit/content/tests/chrome/window_titlebar.xul | 223 --- toolkit/content/tests/chrome/window_tooltip.xul | 311 ----- toolkit/content/tests/chrome/xul_selectcontrol.js | 390 ------ .../tests/fennec-tile-testapp/application.ini | 11 - .../fennec-tile-testapp/chrome/chrome.manifest | 1 - .../chrome/content/BrowserView.js | 694 ---------- .../chrome/content/FooScript.js | 352 ----- .../chrome/content/TileManager.js | 1018 -------------- .../chrome/content/WidgetStack.js | 1438 -------------------- .../chrome/content/firefoxOverlay.xul | 15 - .../fennec-tile-testapp/chrome/content/foo.xul | 460 ------- .../fennec-tile-testapp/chrome/content/main.xul | 7 - .../fennec-tile-testapp/chrome/content/overlay.js | 15 - .../chrome/locale/en-US/tile.dtd | 1 - .../chrome/locale/en-US/tile.properties | 3 - .../fennec-tile-testapp/chrome/skin/overlay.css | 5 - .../defaults/preferences/prefs.js | 2 - .../content/tests/fennec-tile-testapp/install.rdf | 17 - .../content/tests/fennec-tile-testapp/logread.py | 104 -- toolkit/content/tests/mochitest/mochitest.ini | 5 - .../test_autocomplete_change_after_focus.html | 105 -- .../tests/mochitest/test_mousecapture.xhtml | 340 ----- toolkit/content/tests/moz.build | 19 - .../reftests/bug-442419-progressmeter-max-ref.xul | 7 - .../reftests/bug-442419-progressmeter-max.xul | 7 - .../reftests/textbox-multiline-default-value.xul | 5 - .../tests/reftests/textbox-multiline-empty.xul | 5 - toolkit/content/tests/unit/.eslintrc.js | 7 - .../content/tests/unit/test_contentAreaUtils.js | 80 -- toolkit/content/tests/unit/xpcshell.ini | 5 - toolkit/content/tests/widgets/.eslintrc.js | 8 - toolkit/content/tests/widgets/audio.ogg | Bin 14293 -> 0 bytes toolkit/content/tests/widgets/audio.wav | Bin 1422 -> 0 bytes toolkit/content/tests/widgets/chrome.ini | 20 - toolkit/content/tests/widgets/head.js | 23 - toolkit/content/tests/widgets/mochitest.ini | 40 - toolkit/content/tests/widgets/popup_shared.js | 424 ------ toolkit/content/tests/widgets/seek_with_sound.ogg | Bin 299507 -> 0 bytes .../widgets/test_audiocontrols_dimensions.html | 38 - toolkit/content/tests/widgets/test_bug898940.html | 31 - .../tests/widgets/test_contextmenu_menugroup.xul | 102 -- .../tests/widgets/test_contextmenu_nested.xul | 138 -- .../tests/widgets/test_editor_currentURI.xul | 39 - toolkit/content/tests/widgets/test_menubar.xul | 30 - .../tests/widgets/test_mousecapture_area.html | 109 -- toolkit/content/tests/widgets/test_popupanchor.xul | 430 ------ .../content/tests/widgets/test_popupreflows.xul | 111 -- .../tests/widgets/test_tree_column_reorder.xul | 76 -- .../content/tests/widgets/test_videocontrols.html | 411 ------ .../tests/widgets/test_videocontrols_audio.html | 60 - .../test_videocontrols_audio_direction.html | 31 - .../test_videocontrols_iframe_fullscreen.html | 64 - .../widgets/test_videocontrols_jsdisabled.html | 70 - .../widgets/test_videocontrols_onclickplay.html | 74 - .../widgets/test_videocontrols_standalone.html | 90 -- .../test_videocontrols_video_direction.html | 31 - .../tests/widgets/test_videocontrols_vtt.html | 133 -- toolkit/content/tests/widgets/tree_shared.js | 1405 ------------------- toolkit/content/tests/widgets/video.ogg | Bin 285310 -> 0 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 | 90 -- toolkit/content/tests/widgets/videomask.css | 23 - toolkit/content/tests/widgets/window_menubar.xul | 820 ----------- 297 files changed, 6 insertions(+), 34998 deletions(-) delete mode 100644 toolkit/content/tests/browser/.eslintrc.js delete mode 100644 toolkit/content/tests/browser/audio.ogg delete mode 100644 toolkit/content/tests/browser/browser.ini delete mode 100644 toolkit/content/tests/browser/browser_audioCompeting.js delete mode 100644 toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js delete mode 100644 toolkit/content/tests/browser/browser_autoscroll_disabled.js delete mode 100644 toolkit/content/tests/browser/browser_block_autoplay_media.js delete mode 100644 toolkit/content/tests/browser/browser_bug1170531.js delete mode 100644 toolkit/content/tests/browser/browser_bug1198465.js delete mode 100644 toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js delete mode 100644 toolkit/content/tests/browser/browser_bug451286.js delete mode 100644 toolkit/content/tests/browser/browser_bug594509.js delete mode 100644 toolkit/content/tests/browser/browser_bug982298.js delete mode 100644 toolkit/content/tests/browser/browser_contentTitle.js delete mode 100644 toolkit/content/tests/browser/browser_content_url_annotation.js delete mode 100644 toolkit/content/tests/browser/browser_crash_previous_frameloader.js delete mode 100644 toolkit/content/tests/browser/browser_datetime_datepicker.js delete mode 100644 toolkit/content/tests/browser/browser_default_image_filename.js delete mode 100644 toolkit/content/tests/browser/browser_f7_caret_browsing.js delete mode 100644 toolkit/content/tests/browser/browser_findbar.js delete mode 100644 toolkit/content/tests/browser/browser_isSynthetic.js delete mode 100644 toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js delete mode 100644 toolkit/content/tests/browser/browser_label_textlink.js delete mode 100644 toolkit/content/tests/browser/browser_mediaPlayback.js delete mode 100644 toolkit/content/tests/browser/browser_mediaPlayback_mute.js delete mode 100644 toolkit/content/tests/browser/browser_mediaPlayback_suspended.js delete mode 100644 toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js delete mode 100644 toolkit/content/tests/browser/browser_mute.js delete mode 100644 toolkit/content/tests/browser/browser_mute2.js delete mode 100644 toolkit/content/tests/browser/browser_quickfind_editable.js delete mode 100644 toolkit/content/tests/browser/browser_saveImageURL.js delete mode 100644 toolkit/content/tests/browser/browser_save_resend_postdata.js delete mode 100644 toolkit/content/tests/browser/common/mockTransfer.js delete mode 100644 toolkit/content/tests/browser/data/post_form_inner.sjs delete mode 100644 toolkit/content/tests/browser/data/post_form_outer.sjs delete mode 100644 toolkit/content/tests/browser/empty.png delete mode 100644 toolkit/content/tests/browser/file_contentTitle.html delete mode 100644 toolkit/content/tests/browser/file_mediaPlayback.html delete mode 100644 toolkit/content/tests/browser/file_mediaPlayback2.html delete mode 100644 toolkit/content/tests/browser/file_mediaPlaybackFrame.html delete mode 100644 toolkit/content/tests/browser/file_mediaPlaybackFrame2.html delete mode 100644 toolkit/content/tests/browser/file_multipleAudio.html delete mode 100644 toolkit/content/tests/browser/file_multiplePlayingAudio.html delete mode 100644 toolkit/content/tests/browser/file_redirect.html delete mode 100644 toolkit/content/tests/browser/file_redirect_to.html delete mode 100644 toolkit/content/tests/browser/head.js delete mode 100644 toolkit/content/tests/browser/image.jpg delete mode 100644 toolkit/content/tests/browser/image_page.html delete mode 100644 toolkit/content/tests/chrome/.eslintrc.js delete mode 100644 toolkit/content/tests/chrome/RegisterUnregisterChrome.js delete mode 100644 toolkit/content/tests/chrome/bug263683_window.xul delete mode 100644 toolkit/content/tests/chrome/bug304188_window.xul delete mode 100644 toolkit/content/tests/chrome/bug331215_window.xul delete mode 100644 toolkit/content/tests/chrome/bug360437_window.xul delete mode 100644 toolkit/content/tests/chrome/bug366992_window.xul delete mode 100644 toolkit/content/tests/chrome/bug409624_window.xul delete mode 100644 toolkit/content/tests/chrome/bug429723_window.xul delete mode 100644 toolkit/content/tests/chrome/bug451540_window.xul delete mode 100644 toolkit/content/tests/chrome/bug624329_window.xul delete mode 100644 toolkit/content/tests/chrome/chrome.ini delete mode 100644 toolkit/content/tests/chrome/dialog_dialogfocus.xul delete mode 100644 toolkit/content/tests/chrome/file_about_networking_wsh.py delete mode 100644 toolkit/content/tests/chrome/file_autocomplete_with_composition.js delete mode 100644 toolkit/content/tests/chrome/findbar_entireword_window.xul delete mode 100644 toolkit/content/tests/chrome/findbar_events_window.xul delete mode 100644 toolkit/content/tests/chrome/findbar_window.xul delete mode 100644 toolkit/content/tests/chrome/frame_popup_anchor.xul delete mode 100644 toolkit/content/tests/chrome/frame_popupremoving_frame.xul delete mode 100644 toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xul delete mode 100644 toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xul delete mode 100644 toolkit/content/tests/chrome/popup_childframe_node.xul delete mode 100644 toolkit/content/tests/chrome/popup_trigger.js delete mode 100644 toolkit/content/tests/chrome/rtlchrome/rtl.css delete mode 100644 toolkit/content/tests/chrome/rtlchrome/rtl.dtd delete mode 100644 toolkit/content/tests/chrome/rtlchrome/rtl.manifest delete mode 100644 toolkit/content/tests/chrome/rtltest/content/dirtest.xul delete mode 100644 toolkit/content/tests/chrome/rtltest/righttoleft.manifest delete mode 100644 toolkit/content/tests/chrome/sample_entireword_latin1.html delete mode 100644 toolkit/content/tests/chrome/test_about_networking.html delete mode 100644 toolkit/content/tests/chrome/test_arrowpanel.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete2.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete3.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete4.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete5.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete_emphasis.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete_mac_caret.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete_placehold_last_complete.xul delete mode 100644 toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html delete mode 100644 toolkit/content/tests/chrome/test_autocomplete_with_composition_on_textbox.xul delete mode 100644 toolkit/content/tests/chrome/test_browser_drop.xul delete mode 100644 toolkit/content/tests/chrome/test_bug1048178.xul delete mode 100644 toolkit/content/tests/chrome/test_bug253481.xul delete mode 100644 toolkit/content/tests/chrome/test_bug263683.xul delete mode 100644 toolkit/content/tests/chrome/test_bug304188.xul delete mode 100644 toolkit/content/tests/chrome/test_bug331215.xul delete mode 100644 toolkit/content/tests/chrome/test_bug360220.xul delete mode 100644 toolkit/content/tests/chrome/test_bug360437.xul delete mode 100644 toolkit/content/tests/chrome/test_bug365773.xul delete mode 100644 toolkit/content/tests/chrome/test_bug366992.xul delete mode 100644 toolkit/content/tests/chrome/test_bug382990.xul delete mode 100644 toolkit/content/tests/chrome/test_bug409624.xul delete mode 100644 toolkit/content/tests/chrome/test_bug418874.xul delete mode 100644 toolkit/content/tests/chrome/test_bug429723.xul delete mode 100644 toolkit/content/tests/chrome/test_bug437844.xul delete mode 100644 toolkit/content/tests/chrome/test_bug451540.xul delete mode 100644 toolkit/content/tests/chrome/test_bug457632.xul delete mode 100644 toolkit/content/tests/chrome/test_bug460942.xul delete mode 100644 toolkit/content/tests/chrome/test_bug471776.xul delete mode 100644 toolkit/content/tests/chrome/test_bug509732.xul delete mode 100644 toolkit/content/tests/chrome/test_bug554279.xul delete mode 100644 toolkit/content/tests/chrome/test_bug557987.xul delete mode 100644 toolkit/content/tests/chrome/test_bug562554.xul delete mode 100644 toolkit/content/tests/chrome/test_bug570192.xul delete mode 100644 toolkit/content/tests/chrome/test_bug585946.xul delete mode 100644 toolkit/content/tests/chrome/test_bug624329.xul delete mode 100644 toolkit/content/tests/chrome/test_bug792324.xul delete mode 100644 toolkit/content/tests/chrome/test_button.xul delete mode 100644 toolkit/content/tests/chrome/test_chromemargin.xul delete mode 100644 toolkit/content/tests/chrome/test_closemenu_attribute.xul delete mode 100644 toolkit/content/tests/chrome/test_colorpicker_popup.xul delete mode 100644 toolkit/content/tests/chrome/test_contextmenu_list.xul delete mode 100644 toolkit/content/tests/chrome/test_cursorsnap.xul delete mode 100644 toolkit/content/tests/chrome/test_datepicker.xul delete mode 100644 toolkit/content/tests/chrome/test_deck.xul delete mode 100644 toolkit/content/tests/chrome/test_dialogfocus.xul delete mode 100644 toolkit/content/tests/chrome/test_findbar.xul delete mode 100644 toolkit/content/tests/chrome/test_findbar_entireword.xul delete mode 100644 toolkit/content/tests/chrome/test_findbar_events.xul delete mode 100644 toolkit/content/tests/chrome/test_focus_anons.xul delete mode 100644 toolkit/content/tests/chrome/test_hiddenitems.xul delete mode 100644 toolkit/content/tests/chrome/test_hiddenpaging.xul delete mode 100644 toolkit/content/tests/chrome/test_keys.xul delete mode 100644 toolkit/content/tests/chrome/test_labelcontrol.xul delete mode 100644 toolkit/content/tests/chrome/test_largemenu.xul delete mode 100644 toolkit/content/tests/chrome/test_menu.xul delete mode 100644 toolkit/content/tests/chrome/test_menu_anchored.xul delete mode 100644 toolkit/content/tests/chrome/test_menu_hide.xul delete mode 100644 toolkit/content/tests/chrome/test_menuchecks.xul delete mode 100644 toolkit/content/tests/chrome/test_menuitem_blink.xul delete mode 100644 toolkit/content/tests/chrome/test_menuitem_commands.xul delete mode 100644 toolkit/content/tests/chrome/test_menulist.xul delete mode 100644 toolkit/content/tests/chrome/test_menulist_keynav.xul delete mode 100644 toolkit/content/tests/chrome/test_menulist_null_value.xul delete mode 100644 toolkit/content/tests/chrome/test_menulist_paging.xul delete mode 100644 toolkit/content/tests/chrome/test_menulist_position.xul delete mode 100644 toolkit/content/tests/chrome/test_mousescroll.xul delete mode 100644 toolkit/content/tests/chrome/test_notificationbox.xul delete mode 100644 toolkit/content/tests/chrome/test_panel.xul delete mode 100644 toolkit/content/tests/chrome/test_panel_focus.xul delete mode 100644 toolkit/content/tests/chrome/test_panelfrommenu.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_anchor.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_anchoratrect.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_attribute.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_button.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_coords.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_keys.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_moveToAnchor.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_preventdefault.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_preventdefault_chrome.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_recreate.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_scaled.xul delete mode 100644 toolkit/content/tests/chrome/test_popup_tree.xul delete mode 100644 toolkit/content/tests/chrome/test_popuphidden.xul delete mode 100644 toolkit/content/tests/chrome/test_popupincontent.xul delete mode 100644 toolkit/content/tests/chrome/test_popupremoving.xul delete mode 100644 toolkit/content/tests/chrome/test_popupremoving_frame.xul delete mode 100644 toolkit/content/tests/chrome/test_position.xul delete mode 100644 toolkit/content/tests/chrome/test_preferences.xul delete mode 100644 toolkit/content/tests/chrome/test_preferences_beforeaccept.xul delete mode 100644 toolkit/content/tests/chrome/test_preferences_onsyncfrompreference.xul delete mode 100644 toolkit/content/tests/chrome/test_progressmeter.xul delete mode 100644 toolkit/content/tests/chrome/test_props.xul delete mode 100644 toolkit/content/tests/chrome/test_radio.xul delete mode 100644 toolkit/content/tests/chrome/test_richlist_direction.xul delete mode 100644 toolkit/content/tests/chrome/test_righttoleft.xul delete mode 100644 toolkit/content/tests/chrome/test_scale.xul delete mode 100644 toolkit/content/tests/chrome/test_scaledrag.xul delete mode 100644 toolkit/content/tests/chrome/test_screenPersistence.xul delete mode 100644 toolkit/content/tests/chrome/test_scrollbar.xul delete mode 100644 toolkit/content/tests/chrome/test_showcaret.xul delete mode 100644 toolkit/content/tests/chrome/test_sorttemplate.xul delete mode 100644 toolkit/content/tests/chrome/test_statusbar.xul delete mode 100644 toolkit/content/tests/chrome/test_subframe_origin.xul delete mode 100644 toolkit/content/tests/chrome/test_tabbox.xul delete mode 100644 toolkit/content/tests/chrome/test_tabindex.xul delete mode 100644 toolkit/content/tests/chrome/test_textbox_dictionary.xul delete mode 100644 toolkit/content/tests/chrome/test_textbox_emptytext.xul delete mode 100644 toolkit/content/tests/chrome/test_textbox_number.xul delete mode 100644 toolkit/content/tests/chrome/test_textbox_search.xul delete mode 100644 toolkit/content/tests/chrome/test_timepicker.xul delete mode 100644 toolkit/content/tests/chrome/test_titlebar.xul delete mode 100644 toolkit/content/tests/chrome/test_toolbar.xul delete mode 100644 toolkit/content/tests/chrome/test_tooltip.xul delete mode 100644 toolkit/content/tests/chrome/test_tooltip_noautohide.xul delete mode 100644 toolkit/content/tests/chrome/test_tree.xul delete mode 100644 toolkit/content/tests/chrome/test_tree_hier.xul delete mode 100644 toolkit/content/tests/chrome/test_tree_hier_cell.xul delete mode 100644 toolkit/content/tests/chrome/test_tree_single.xul delete mode 100644 toolkit/content/tests/chrome/test_tree_view.xul delete mode 100644 toolkit/content/tests/chrome/window_browser_drop.xul delete mode 100644 toolkit/content/tests/chrome/window_chromemargin.xul delete mode 100644 toolkit/content/tests/chrome/window_cursorsnap_dialog.xul delete mode 100644 toolkit/content/tests/chrome/window_cursorsnap_wizard.xul delete mode 100644 toolkit/content/tests/chrome/window_keys.xul delete mode 100644 toolkit/content/tests/chrome/window_largemenu.xul delete mode 100644 toolkit/content/tests/chrome/window_panel.xul delete mode 100644 toolkit/content/tests/chrome/window_panel_focus.xul delete mode 100644 toolkit/content/tests/chrome/window_popup_anchor.xul delete mode 100644 toolkit/content/tests/chrome/window_popup_anchoratrect.xul delete mode 100644 toolkit/content/tests/chrome/window_popup_attribute.xul delete mode 100644 toolkit/content/tests/chrome/window_popup_button.xul delete mode 100644 toolkit/content/tests/chrome/window_popup_preventdefault_chrome.xul delete mode 100644 toolkit/content/tests/chrome/window_preferences.xul delete mode 100644 toolkit/content/tests/chrome/window_preferences2.xul delete mode 100644 toolkit/content/tests/chrome/window_preferences3.xul delete mode 100644 toolkit/content/tests/chrome/window_preferences_beforeaccept.xul delete mode 100644 toolkit/content/tests/chrome/window_preferences_commandretarget.xul delete mode 100644 toolkit/content/tests/chrome/window_preferences_onsyncfrompreference.xul delete mode 100644 toolkit/content/tests/chrome/window_screenPosSize.xul delete mode 100644 toolkit/content/tests/chrome/window_showcaret.xul delete mode 100644 toolkit/content/tests/chrome/window_subframe_origin.xul delete mode 100644 toolkit/content/tests/chrome/window_titlebar.xul delete mode 100644 toolkit/content/tests/chrome/window_tooltip.xul delete mode 100644 toolkit/content/tests/chrome/xul_selectcontrol.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/application.ini delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/chrome.manifest delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/BrowserView.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/FooScript.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/WidgetStack.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/firefoxOverlay.xul delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/foo.xul delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/main.xul delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/content/overlay.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/locale/en-US/tile.dtd delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/locale/en-US/tile.properties delete mode 100644 toolkit/content/tests/fennec-tile-testapp/chrome/skin/overlay.css delete mode 100644 toolkit/content/tests/fennec-tile-testapp/defaults/preferences/prefs.js delete mode 100644 toolkit/content/tests/fennec-tile-testapp/install.rdf delete mode 100644 toolkit/content/tests/fennec-tile-testapp/logread.py delete mode 100644 toolkit/content/tests/mochitest/mochitest.ini delete mode 100644 toolkit/content/tests/mochitest/test_autocomplete_change_after_focus.html delete mode 100644 toolkit/content/tests/mochitest/test_mousecapture.xhtml delete mode 100644 toolkit/content/tests/moz.build delete mode 100644 toolkit/content/tests/reftests/bug-442419-progressmeter-max-ref.xul delete mode 100644 toolkit/content/tests/reftests/bug-442419-progressmeter-max.xul delete mode 100644 toolkit/content/tests/reftests/textbox-multiline-default-value.xul delete mode 100644 toolkit/content/tests/reftests/textbox-multiline-empty.xul delete mode 100644 toolkit/content/tests/unit/.eslintrc.js delete mode 100644 toolkit/content/tests/unit/test_contentAreaUtils.js delete mode 100644 toolkit/content/tests/unit/xpcshell.ini delete mode 100644 toolkit/content/tests/widgets/.eslintrc.js delete mode 100644 toolkit/content/tests/widgets/audio.ogg delete mode 100644 toolkit/content/tests/widgets/audio.wav delete mode 100644 toolkit/content/tests/widgets/chrome.ini delete mode 100644 toolkit/content/tests/widgets/head.js delete mode 100644 toolkit/content/tests/widgets/mochitest.ini delete mode 100644 toolkit/content/tests/widgets/popup_shared.js delete mode 100644 toolkit/content/tests/widgets/seek_with_sound.ogg delete mode 100644 toolkit/content/tests/widgets/test_audiocontrols_dimensions.html delete mode 100644 toolkit/content/tests/widgets/test_bug898940.html delete mode 100644 toolkit/content/tests/widgets/test_contextmenu_menugroup.xul delete mode 100644 toolkit/content/tests/widgets/test_contextmenu_nested.xul delete mode 100644 toolkit/content/tests/widgets/test_editor_currentURI.xul delete mode 100644 toolkit/content/tests/widgets/test_menubar.xul delete mode 100644 toolkit/content/tests/widgets/test_mousecapture_area.html delete mode 100644 toolkit/content/tests/widgets/test_popupanchor.xul delete mode 100644 toolkit/content/tests/widgets/test_popupreflows.xul delete mode 100644 toolkit/content/tests/widgets/test_tree_column_reorder.xul delete mode 100644 toolkit/content/tests/widgets/test_videocontrols.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_audio.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_audio_direction.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_iframe_fullscreen.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_onclickplay.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_standalone.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_video_direction.html delete mode 100644 toolkit/content/tests/widgets/test_videocontrols_vtt.html delete mode 100644 toolkit/content/tests/widgets/tree_shared.js delete mode 100644 toolkit/content/tests/widgets/video.ogg delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1-ref.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1a.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1b.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1c.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1d.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-1e.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2-ref.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2a.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2b.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2c.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2d.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction-2e.html delete mode 100644 toolkit/content/tests/widgets/videocontrols_direction_test.js delete mode 100644 toolkit/content/tests/widgets/videomask.css delete mode 100644 toolkit/content/tests/widgets/window_menubar.xul (limited to 'toolkit/content') diff --git a/toolkit/content/moz.build b/toolkit/content/moz.build index de50a82f5..b1f6b6419 100644 --- a/toolkit/content/moz.build +++ b/toolkit/content/moz.build @@ -4,12 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -TEST_DIRS += ['tests'] - -for var in ('target', 'MOZ_CONFIGURE_OPTIONS', 'CC', 'CC_VERSION', 'CXX'): +for var in ('target', + 'MOZ_CONFIGURE_OPTIONS', + 'CC', + 'CC_VERSION', + 'CXX'): DEFINES[var] = CONFIG[var] DEFINES['CFLAGS'] = CONFIG['OS_CFLAGS'] +DEFINES['TOPOBJDIR'] = TOPOBJDIR if CONFIG['OS_TARGET'] == 'Android': DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'] @@ -19,13 +22,4 @@ if CONFIG['MOZ_ANDROID_CXX_STL'] == 'libc++': JAR_MANIFESTS += ['jar.mn'] -with Files('aboutTelemetry.*'): - BUG_COMPONENT = ('Toolkit', 'Telemetry') - -with Files('customizeToolbar.*'): - BUG_COMPONENT = ('Toolkit', 'Toolbars and Toolbar Customization') -with Files('widgets/*'): - BUG_COMPONENT = ('Toolkit', 'XUL Widgets') - -DEFINES['TOPOBJDIR'] = TOPOBJDIR diff --git a/toolkit/content/tests/browser/.eslintrc.js b/toolkit/content/tests/browser/.eslintrc.js deleted file mode 100644 index c764b133d..000000000 --- a/toolkit/content/tests/browser/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" - ] -}; diff --git a/toolkit/content/tests/browser/audio.ogg b/toolkit/content/tests/browser/audio.ogg deleted file mode 100644 index 7f1833508..000000000 Binary files a/toolkit/content/tests/browser/audio.ogg and /dev/null differ diff --git a/toolkit/content/tests/browser/browser.ini b/toolkit/content/tests/browser/browser.ini deleted file mode 100644 index 67ba2f850..000000000 --- a/toolkit/content/tests/browser/browser.ini +++ /dev/null @@ -1,76 +0,0 @@ -[DEFAULT] -support-files = - head.js - file_contentTitle.html - audio.ogg - -[browser_audioCompeting.js] -tags = audiochannel -support-files = - file_multipleAudio.html -[browser_audioCompeting_onlyForActiveAgent.js] -tags = audiochannel -support-files = - file_multiplePlayingAudio.html -[browser_autoscroll_disabled.js] -[browser_block_autoplay_media.js] -tags = audiochannel -support-files = - file_multipleAudio.html -[browser_bug295977_autoscroll_overflow.js] -[browser_bug451286.js] -skip-if = !e10s -[browser_bug594509.js] -[browser_bug982298.js] -[browser_bug1198465.js] -[browser_contentTitle.js] -[browser_crash_previous_frameloader.js] -run-if = e10s && crashreporter -[browser_datetime_datepicker.js] -[browser_default_image_filename.js] -[browser_f7_caret_browsing.js] -[browser_findbar.js] -[browser_label_textlink.js] -[browser_isSynthetic.js] -support-files = - empty.png -[browser_keyevents_during_autoscrolling.js] -[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_content_url_annotation.js] -skip-if = !e10s || !crashreporter -support-files = - file_redirect.html - file_redirect_to.html -[browser_bug1170531.js] -[browser_mediaPlayback.js] -tags = audiochannel -support-files = - file_mediaPlayback.html - file_mediaPlaybackFrame.html -[browser_mediaPlayback_mute.js] -tags = audiochannel -support-files = - file_mediaPlayback2.html - file_mediaPlaybackFrame2.html -[browser_mediaPlayback_suspended.js] -tags = audiochannel -support-files = - file_mediaPlayback2.html -[browser_mediaPlayback_suspended_multipleAudio.js] -tags = audiochannel -support-files = - file_multipleAudio.html -[browser_mute.js] -tags = audiochannel -[browser_mute2.js] -tags = audiochannel -[browser_quickfind_editable.js] -[browser_saveImageURL.js] -support-files = - image.jpg - image_page.html diff --git a/toolkit/content/tests/browser/browser_audioCompeting.js b/toolkit/content/tests/browser/browser_audioCompeting.js deleted file mode 100644 index 7b6a76c1d..000000000 --- a/toolkit/content/tests/browser/browser_audioCompeting.js +++ /dev/null @@ -1,115 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_multipleAudio.html"; - -function* wait_for_tab_playing_event(tab, expectPlaying) { - if (tab.soundPlaying == expectPlaying) { - ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing"); - } else { - yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => { - if (event.detail.changed.indexOf("soundplaying") >= 0) { - is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing"); - return true; - } - return false; - }); - } -} - -function play_audio_from_invisible_tab () { - return new Promise(resolve => { - var autoPlay = content.document.getElementById('autoplay'); - if (!autoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.paused, true, "Audio in tab 1 was paused by audio competing."); - autoPlay.play(); - autoPlay.onpause = function() { - autoPlay.onpause = null; - ok(true, "Audio in tab 1 can't playback when other tab is playing in foreground."); - resolve(); - }; - }); -} - -function audio_should_keep_playing_even_go_to_background () { - var autoPlay = content.document.getElementById('autoplay'); - if (!autoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.paused, false, "Audio in tab 2 is still playing in the background."); -} - -function play_non_autoplay_audio () { - return new Promise(resolve => { - var autoPlay = content.document.getElementById('autoplay'); - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!autoPlay || !nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(nonAutoPlay.paused, true, "Non-autoplay audio isn't started playing yet."); - nonAutoPlay.play(); - - nonAutoPlay.onplay = function() { - nonAutoPlay.onplay = null; - is(nonAutoPlay.paused, false, "Start Non-autoplay audio."); - is(autoPlay.paused, false, "Autoplay audio is still playing."); - resolve(); - }; - }); -} - -add_task(function* setup_test_preference() { - yield new Promise(resolve => { - SpecialPowers.pushPrefEnv({"set": [ - ["dom.audiochannel.audioCompeting", true], - ["dom.ipc.processCount", 1] - ]}, resolve); - }); -}); - -add_task(function* cross_tabs_audio_competing () { - info("- open tab 1 in foreground -"); - let tab1 = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, - "about:blank"); - tab1.linkedBrowser.loadURI(PAGE); - yield wait_for_tab_playing_event(tab1, true); - - info("- open tab 2 in foreground -"); - let tab2 = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, - "about:blank"); - tab2.linkedBrowser.loadURI(PAGE); - yield wait_for_tab_playing_event(tab1, false); - - info("- open tab 3 in foreground -"); - let tab3 = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, - "about:blank"); - yield ContentTask.spawn(tab2.linkedBrowser, null, - audio_should_keep_playing_even_go_to_background); - - info("- play audio from background tab 1 -"); - yield ContentTask.spawn(tab1.linkedBrowser, null, - play_audio_from_invisible_tab); - - info("- remove tabs -"); - yield BrowserTestUtils.removeTab(tab1); - yield BrowserTestUtils.removeTab(tab2); - yield BrowserTestUtils.removeTab(tab3); -}); - -add_task(function* within_one_tab_audio_competing () { - info("- open tab and play audio1 -"); - let tab = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, - "about:blank"); - tab.linkedBrowser.loadURI(PAGE); - yield wait_for_tab_playing_event(tab, true); - - info("- play audio2 in the same tab -"); - yield ContentTask.spawn(tab.linkedBrowser, null, - play_non_autoplay_audio); - - info("- remove tab -"); - yield BrowserTestUtils.removeTab(tab); -}); - diff --git a/toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js b/toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js deleted file mode 100644 index 31cd3f624..000000000 --- a/toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js +++ /dev/null @@ -1,176 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_multiplePlayingAudio.html"; - -var SuspendedType = { - NONE_SUSPENDED : 0, - SUSPENDED_PAUSE : 1, - SUSPENDED_BLOCK : 2, - SUSPENDED_PAUSE_DISPOSABLE : 3 -}; - -function wait_for_event(browser, event) { - return BrowserTestUtils.waitForEvent(browser, event, false, (event) => { - is(event.originalTarget, browser, "Event must be dispatched to correct browser."); - return true; - }); -} - -function check_all_audio_suspended(suspendedType) { - var audio1 = content.document.getElementById("audio1"); - var audio2 = content.document.getElementById("audio2"); - if (!audio1 || !audio2) { - ok(false, "Can't get the audio element!"); - } - - is(audio1.computedSuspended, suspendedType, - "The suspeded state of audio1 is correct."); - is(audio2.computedSuspended, suspendedType, - "The suspeded state of audio2 is correct."); -} - -function check_audio1_suspended(suspendedType) { - var audio1 = content.document.getElementById("audio1"); - if (!audio1) { - ok(false, "Can't get the audio element!"); - } - - is(audio1.computedSuspended, suspendedType, - "The suspeded state of audio1 is correct."); -} - -function check_audio2_suspended(suspendedType) { - var audio2 = content.document.getElementById("audio2"); - if (!audio2) { - ok(false, "Can't get the audio element!"); - } - - is(audio2.computedSuspended, suspendedType, - "The suspeded state of audio2 is correct."); -} - -function check_all_audio_pause_state(expectedPauseState) { - var audio1 = content.document.getElementById("audio1"); - var audio2 = content.document.getElementById("audio2"); - if (!audio1 | !audio2) { - ok(false, "Can't get the audio element!"); - } - - is(audio1.paused, expectedPauseState, - "The pause state of audio1 is correct."); - is(audio2.paused, expectedPauseState, - "The pause state of audio2 is correct."); -} - -function check_audio1_pause_state(expectedPauseState) { - var audio1 = content.document.getElementById("audio1"); - if (!audio1) { - ok(false, "Can't get the audio element!"); - } - - is(audio1.paused, expectedPauseState, - "The pause state of audio1 is correct."); -} - -function check_audio2_pause_state(expectedPauseState) { - var audio2 = content.document.getElementById("audio2"); - if (!audio2) { - ok(false, "Can't get the audio element!"); - } - - is(audio2.paused, expectedPauseState, - "The pause state of audio2 is correct."); -} - -function play_audio1_from_page() { - var audio1 = content.document.getElementById("audio1"); - if (!audio1) { - ok(false, "Can't get the audio element!"); - } - - is(audio1.paused, true, "Audio1 is paused."); - audio1.play(); - return new Promise(resolve => { - audio1.onplay = function() { - audio1.onplay = null; - ok(true, "Audio1 started playing."); - resolve(); - } - }); -} - -function stop_audio1_from_page() { - var audio1 = content.document.getElementById("audio1"); - if (!audio1) { - ok(false, "Can't get the audio element!"); - } - - is(audio1.paused, false, "Audio1 is playing."); - audio1.pause(); - return new Promise(resolve => { - audio1.onpause = function() { - audio1.onpause = null; - ok(true, "Audio1 stopped playing."); - resolve(); - } - }); -} - -function* audio_competing_for_active_agent(url, browser) { - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the default suspended state of all audio should be non-suspened -"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- only pause playing audio in the page -"); - browser.pauseMedia(true /* disposable */); - - info("- page shouldn't have any playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStopped"); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_all_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE_DISPOSABLE, - check_all_audio_suspended); - - info("- resume audio1 from page -"); - yield ContentTask.spawn(browser, null, - play_audio1_from_page); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio1_suspended); - - info("- audio2 should still be suspended -"); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE_DISPOSABLE, - check_audio2_suspended); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_audio2_pause_state); - - info("- stop audio1 from page -"); - yield ContentTask.spawn(browser, null, - stop_audio1_from_page); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio1_suspended); - - info("- audio2 should still be suspended -"); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE_DISPOSABLE, - check_audio2_suspended); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_audio2_pause_state); - -} - -add_task(function* setup_test_preference() { - yield SpecialPowers.pushPrefEnv({"set": [ - ["media.useAudioChannelService.testing", true], - ["dom.audiochannel.audioCompeting", true], - ["dom.audiochannel.audioCompeting.allAgents", true] - ]}); -}); - -add_task(function* test_suspended_pause_disposable() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, audio_competing_for_active_agent.bind(this, PAGE)); -}); diff --git a/toolkit/content/tests/browser/browser_autoscroll_disabled.js b/toolkit/content/tests/browser/browser_autoscroll_disabled.js deleted file mode 100644 index 07c6174ab..000000000 --- a/toolkit/content/tests/browser/browser_autoscroll_disabled.js +++ /dev/null @@ -1,67 +0,0 @@ -add_task(function* () -{ - const kPrefName_AutoScroll = "general.autoScroll"; - Services.prefs.setBoolPref(kPrefName_AutoScroll, false); - - let dataUri = 'data:text/html,
\ - \ -'; - - let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); - gBrowser.loadURI(dataUri); - yield loadedPromise; - - yield BrowserTestUtils.synthesizeMouse("#i", 50, 50, { button: 1 }, - gBrowser.selectedBrowser); - - yield ContentTask.spawn(gBrowser.selectedBrowser, { }, 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); - } - }); - - yield 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. - yield new Promise(resolve => window.requestAnimationFrame(resolve)); - - let msg = yield ContentTask.spawn(gBrowser.selectedBrowser, { }, 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. - yield SimpleTest.promiseFocus(); -}); diff --git a/toolkit/content/tests/browser/browser_block_autoplay_media.js b/toolkit/content/tests/browser/browser_block_autoplay_media.js deleted file mode 100644 index 3b2a309b9..000000000 --- a/toolkit/content/tests/browser/browser_block_autoplay_media.js +++ /dev/null @@ -1,87 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_multipleAudio.html"; - -var SuspendedType = { - NONE_SUSPENDED : 0, - SUSPENDED_PAUSE : 1, - SUSPENDED_BLOCK : 2, - SUSPENDED_PAUSE_DISPOSABLE : 3 -}; - -function* wait_for_tab_playing_event(tab, expectPlaying) { - if (tab.soundPlaying == expectPlaying) { - ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing"); - } else { - yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => { - if (event.detail.changed.indexOf("soundplaying") >= 0) { - is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing"); - return true; - } - return false; - }); - } -} - -function check_audio_suspended(suspendedType) { - var autoPlay = content.document.getElementById('autoplay'); - if (!autoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.computedSuspended, suspendedType, - "The suspeded state of autoplay audio is correct."); -} - -add_task(function* setup_test_preference() { - yield new Promise(resolve => { - SpecialPowers.pushPrefEnv({"set": [ - ["media.useAudioChannelService.testing", true], - ["media.block-autoplay-until-in-foreground", true] - ]}, resolve); - }); -}); - -add_task(function* block_autoplay_media() { - info("- open new background tab1 -"); - let tab1 = window.gBrowser.addTab("about:blank"); - tab1.linkedBrowser.loadURI(PAGE); - yield BrowserTestUtils.browserLoaded(tab1.linkedBrowser); - - info("- should block autoplay media for non-visited tab1 -"); - yield ContentTask.spawn(tab1.linkedBrowser, SuspendedType.SUSPENDED_BLOCK, - check_audio_suspended); - - info("- open new background tab2 -"); - let tab2 = window.gBrowser.addTab("about:blank"); - tab2.linkedBrowser.loadURI(PAGE); - yield BrowserTestUtils.browserLoaded(tab2.linkedBrowser); - - info("- should block autoplay for non-visited tab2 -"); - yield ContentTask.spawn(tab2.linkedBrowser, SuspendedType.SUSPENDED_BLOCK, - check_audio_suspended); - - info("- select tab1 as foreground tab -"); - yield BrowserTestUtils.switchTab(window.gBrowser, tab1); - - info("- media should be unblocked because the tab was visited -"); - yield wait_for_tab_playing_event(tab1, true); - yield ContentTask.spawn(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); - - info("- open another new foreground tab3 -"); - let tab3 = yield BrowserTestUtils.openNewForegroundTab(window.gBrowser, - "about:blank"); - info("- should still play media from tab1 -"); - yield wait_for_tab_playing_event(tab1, true); - yield ContentTask.spawn(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); - - info("- should still block media from tab2 -"); - yield wait_for_tab_playing_event(tab2, false); - yield ContentTask.spawn(tab2.linkedBrowser, SuspendedType.SUSPENDED_BLOCK, - check_audio_suspended); - - info("- remove tabs -"); - yield BrowserTestUtils.removeTab(tab1); - yield BrowserTestUtils.removeTab(tab2); - yield BrowserTestUtils.removeTab(tab3); -}); diff --git a/toolkit/content/tests/browser/browser_bug1170531.js b/toolkit/content/tests/browser/browser_bug1170531.js deleted file mode 100644 index 49df5661a..000000000 --- a/toolkit/content/tests/browser/browser_bug1170531.js +++ /dev/null @@ -1,92 +0,0 @@ -// Test for bug 1170531 -// https://bugzilla.mozilla.org/show_bug.cgi?id=1170531 - -add_task(function* () { - // Get a bunch of DOM nodes - let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor). - getInterface(Ci.nsIDOMWindowUtils); - - let editMenu = document.getElementById("edit-menu"); - let menubar = editMenu.parentNode; - let menuPopup = editMenu.menupopup; - let editMenuIndex = -1; - for (let i = 0; i < menubar.children.length; i++) { - if (menubar.children[i] === editMenu) { - editMenuIndex = i; - break; - } - } - - let closeMenu = function(aCallback) { - if (OS.Constants.Sys.Name == "Darwin") { - executeSoon(aCallback); - return; - } - - menuPopup.addEventListener("popuphidden", function onPopupHidden() { - menuPopup.removeEventListener("popuphidden", onPopupHidden, false); - executeSoon(aCallback); - }, false); - - 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 onPopupShown() { - menuPopup.removeEventListener("popupshown", onPopupShown, false); - executeSoon(aCallback); - }, false); - - executeSoon(function() { - editMenu.open = true; - }); - }; - - yield BrowserTestUtils.withNewTab({ gBrowser: gBrowser, url: "about:blank" }, function* (browser) { - let menu_cut_disabled, menu_copy_disabled; - - yield BrowserTestUtils.loadURI(browser, "data:text/html,
hello!
"); - yield BrowserTestUtils.browserLoaded(browser); - browser.focus(); - yield new Promise(resolve => waitForFocus(resolve, window)); - yield 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"); - yield new Promise(closeMenu); - - yield BrowserTestUtils.loadURI(browser, "data:text/html,
hello!
"); - yield BrowserTestUtils.browserLoaded(browser); - browser.focus(); - yield new Promise(resolve => waitForFocus(resolve, window)); - yield 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"); - yield new Promise(closeMenu); - - yield BrowserTestUtils.loadURI(browser, "about:preferences"); - yield BrowserTestUtils.browserLoaded(browser); - browser.focus(); - yield new Promise(resolve => waitForFocus(resolve, window)); - yield 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"); - yield new Promise(closeMenu); - }); -}); diff --git a/toolkit/content/tests/browser/browser_bug1198465.js b/toolkit/content/tests/browser/browser_bug1198465.js deleted file mode 100644 index a9cc83e12..000000000 --- a/toolkit/content/tests/browser/browser_bug1198465.js +++ /dev/null @@ -1,75 +0,0 @@ -/* 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(function* () { - let aTab = yield 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. - - 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.mInputField, - 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.mInputField, - 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 = ""; - yield BrowserTestUtils.removeTab(aTab); -}); diff --git a/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js b/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js deleted file mode 100644 index 958afc868..000000000 --- a/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js +++ /dev/null @@ -1,214 +0,0 @@ -requestLongerTimeout(2); -add_task(function* () -{ - function pushPref(name, value) { - return new Promise(resolve => SpecialPowers.pushPrefEnv({"set": [[name, value]]}, resolve)); - } - - yield pushPref("general.autoScroll", 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} - ]; - - for (let test of allTests) { - if (test.dataUri) { - let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); - gBrowser.loadURI(test.dataUri); - yield loadedPromise; - continue; - } - - let prefsChanged = (test.middlemousepastepref == false || test.middlemousepastepref == true); - if (prefsChanged) { - yield pushPref("middlemouse.paste", test.middlemousepastepref); - } - - yield 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. - yield ContentTask.spawn(gBrowser.selectedBrowser, { }, 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); - } - }); - - is(document.activeElement, gBrowser.selectedBrowser, "Browser still focused after autoscroll started"); - - yield BrowserTestUtils.synthesizeMouse("#" + test.elem, 100, 100, - { type: "mousemove", clickCount: "0" }, - gBrowser.selectedBrowser); - - if (prefsChanged) { - yield new Promise(resolve => SpecialPowers.popPrefEnv(resolve)); - } - - // Start checking for the scroll. - let firstTimestamp = undefined; - let timeCompensation; - do { - let timestamp = yield 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("VK_ESCAPE", {}); - let scrollVert = test.expected & expectScrollVert; - let scrollHori = test.expected & expectScrollHori; - - yield ContentTask.spawn(gBrowser.selectedBrowser, - { scrollVert : scrollVert, - scrollHori: scrollHori, - elemid : test.elem, - checkWindow: test.testwindow }, - 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.indexOf("Failed") == -1, msg); - } - ); - - // Before continuing the test, we need to ensure that the IPC - // message that stops autoscrolling has had time to arrive. - yield 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. - yield SimpleTest.promiseFocus(); -}); diff --git a/toolkit/content/tests/browser/browser_bug451286.js b/toolkit/content/tests/browser/browser_bug451286.js deleted file mode 100644 index a5dadeb84..000000000 --- a/toolkit/content/tests/browser/browser_bug451286.js +++ /dev/null @@ -1,152 +0,0 @@ -Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js", this); - -add_task(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 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri); - let contentRect = tab.linkedBrowser.getBoundingClientRect(); - let noHighlightSnapshot = snapshotRect(window, contentRect); - ok(noHighlightSnapshot, "Got noHighlightSnapshot"); - - yield openFindBarAndWait(); - gFindBar._findField.value = SEARCH_TEXT; - yield findAgainAndWait(); - var matchCase = gFindBar.getElement("find-case-sensitive"); - if (matchCase.checked) - matchCase.doCommand(); - - // Turn on highlighting - yield toggleHighlightAndWait(true); - yield 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 - yield openFindBarAndWait(); - yield toggleHighlightAndWait(false); - yield closeFindBarAndWait(); - - let unhighlightSnapshot = snapshotRect(window, contentRect); - ok(unhighlightSnapshot, "Got unhighlightSnapshot"); - - // Select the matches that should have been highlighted manually - yield ContentTask.spawn(tab.linkedBrowser, null, 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.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShell); - - 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.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShell); - - 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"); - - yield 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(); - }); -} - -function* openFindBarAndWait() { - let awaitTransitionEnd = BrowserTestUtils.waitForEvent(gFindBar, "transitionend"); - gFindBar.open(); - yield 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. -function* closeFindBarAndWait() { - let awaitTransitionEnd = BrowserTestUtils.waitForEvent(gFindBar, "transitionend", false, event => { - return event.propertyName == "visibility"; - }); - gFindBar.close(); - yield awaitTransitionEnd; -} diff --git a/toolkit/content/tests/browser/browser_bug594509.js b/toolkit/content/tests/browser/browser_bug594509.js deleted file mode 100644 index e67b05f85..000000000 --- a/toolkit/content/tests/browser/browser_bug594509.js +++ /dev/null @@ -1,9 +0,0 @@ -add_task(function* () { - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:rights"); - - yield ContentTask.spawn(tab.linkedBrowser, null, function* () { - Assert.ok(content.document.getElementById("your-rights"), "about:rights content loaded"); - }); - - yield BrowserTestUtils.removeTab(tab); -}); diff --git a/toolkit/content/tests/browser/browser_bug982298.js b/toolkit/content/tests/browser/browser_bug982298.js deleted file mode 100644 index 047340c5c..000000000 --- a/toolkit/content/tests/browser/browser_bug982298.js +++ /dev/null @@ -1,70 +0,0 @@ -const scrollHtml = - "blank"; - -add_task(function*() { - let url = "data:text/html;base64," + btoa(scrollHtml); - yield BrowserTestUtils.withNewTab({gBrowser, url}, 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); - }); - gFindBar.onFindCommand(); - EventUtils.sendString("F"); - info("added result listener and sent string 'F'"); - yield awaitFindResult; - - let awaitScrollDone = BrowserTestUtils.waitForMessage(browser.messageManager, "ScrollDone"); - // scroll textarea to bottom - const scrollTest = - "var textarea = content.document.getElementById(\"textarea1\");" + - "textarea.scrollTop = textarea.scrollHeight;" + - "sendAsyncMessage(\"ScrollDone\", { });" - browser.messageManager.loadFrameScript("data:text/javascript;base64," + - btoa(scrollTest), false); - yield awaitScrollDone; - info("got ScrollDone event"); - yield BrowserTestUtils.loadURI(browser, "about:blank"); - yield 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); - yield awaitFindResult2; - }); -}); diff --git a/toolkit/content/tests/browser/browser_contentTitle.js b/toolkit/content/tests/browser/browser_contentTitle.js deleted file mode 100644 index e7966e565..000000000 --- a/toolkit/content/tests/browser/browser_contentTitle.js +++ /dev/null @@ -1,16 +0,0 @@ -var url = "https://example.com/browser/toolkit/content/tests/browser/file_contentTitle.html"; - -add_task(function*() { - let tab = gBrowser.selectedTab = gBrowser.addTab(url); - let browser = tab.linkedBrowser; - yield new Promise((resolve) => { - addEventListener("TestLocationChange", function listener() { - removeEventListener("TestLocationChange", listener); - resolve(); - }, true, 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 deleted file mode 100644 index 1a4cee4c6..000000000 --- a/toolkit/content/tests/browser/browser_content_url_annotation.js +++ /dev/null @@ -1,73 +0,0 @@ -/* 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, privateNoteIntentionalCrash, - 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(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"; - - yield BrowserTestUtils.withNewTab({ - gBrowser: gBrowser - }, function* (browser) { - ok(browser.isRemoteBrowser, "Should be a remote browser"); - - // file_redirect.html should send us to file_redirect_to.html - let promise = ContentTask.spawn(browser, {}, function* () { - dump('ContentTask starting...\n'); - yield new Promise((resolve) => { - addEventListener("RedirectDone", function listener() { - dump('Got RedirectDone\n'); - removeEventListener("RedirectDone", listener); - resolve(); - }, true, true); - }); - }); - browser.loadURI(url); - yield promise; - - // Crash the tab - let annotations = yield BrowserTestUtils.crashBrowser(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 deleted file mode 100644 index bd50c6ffd..000000000 --- a/toolkit/content/tests/browser/browser_crash_previous_frameloader.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -/** - * Cleans up the .dmp and .extra file from a crash. - * - * @param subject (nsISupports) - * The subject passed through the ipc:content-shutdown - * observer notification when a content process crash has - * occurred. - */ -function cleanUpMinidump(subject) { - Assert.ok(subject instanceof Ci.nsIPropertyBag2, - "Subject needs to be a nsIPropertyBag2 to clean up properly"); - let dumpID = subject.getPropertyAsAString("dumpID"); - - Assert.ok(dumpID, "There should be a dumpID"); - if (dumpID) { - let dir = Services.dirsvc.get("ProfD", Ci.nsIFile); - dir.append("minidumps"); - - let file = dir.clone(); - file.append(dumpID + ".dmp"); - file.remove(true); - - file = dir.clone(); - file.append(dumpID + ".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(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; - } - - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "http://example.com", - }, 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 TabParents - // 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. - yield ContentTask.spawn(browser, null, function() { - const Cu = Components.utils; - Cu.import("resource://gre/modules/ctypes.jsm"); - Cu.import("resource://gre/modules/Timer.jsm"); - - let dies = function() { - 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. - addEventListener("pagehide", function() { - dump("\nEt tu, Brute?\n"); - dies(); - }); - }); - - gBrowser.updateBrowserRemoteness(browser, false); - info("Waiting for content process to go away."); - let [subject, data] = yield contentProcessGone; - - // If we don't clean up the minidump, the harness will - // complain. - cleanUpMinidump(subject); - - 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 deleted file mode 100644 index 966a74e7a..000000000 --- a/toolkit/content/tests/browser/browser_datetime_datepicker.js +++ /dev/null @@ -1,284 +0,0 @@ -/* 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; - -// 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])); -} - -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, "); - - Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(date)); - - 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(); -}); - -/** - * 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, `); - // Click the first item (top-left corner) of the calendar - helper.click(helper.getElement(DAYS_VIEW).children[0]); - await ContentTask.spawn(helper.tab.linkedBrowser, {}, async function() { - let inputEl = content.document.querySelector("input"); - await ContentTaskUtils.waitForEvent(inputEl, "input"); - }); - - Assert.equal(content.document.querySelector("input").value, firstDayOnCalendar); - - await helper.tearDown(); -}); - -/** - * Make sure picker is in correct state when it is reopened. - */ -add_task(async function test_datepicker_reopen_state() { - const inputValue = "2016-12-15"; - const nextMonth = "2017-01-01"; - - await helper.openPicker(`data:text/html, `); - // Navigate to the next month but does not commit the change - Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue))); - helper.click(helper.getElement(BTN_NEXT_MONTH)); - Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(nextMonth))); - EventUtils.synthesizeKey("VK_ESCAPE", {}, window); - - // Ensures the picker opens to the month of the input value - await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser); - await helper.waitForPickerReady(); - Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue))); - - await helper.tearDown(); -}); - -/** - * When min and max attributes are set, calendar should show some dates as - * out-of-range. - */ -add_task(async function test_datepicker_min_max() { - const inputValue = "2016-12-15"; - const inputMin = "2016-12-05"; - const inputMax = "2016-12-25"; - - await helper.openPicker(`data:text/html, `); - - Assert.deepEqual( - getCalendarClassList(), - mergeArrays(calendarClasslist_201612, [ - // R denotes out-of-range - [R], [R], [R], [R], [R], [R], [R], - [R], [], [], [], [], [], [], - [], [], [], [], [], [], [], - [], [], [], [], [], [], [], - [], [R], [R], [R], [R], [R], [R], - [R], [R], [R], [R], [R], [R], [R], - ]), - "2016-12 with min & max", - ); - - await helper.tearDown(); -}); - -/** - * When step attribute is set, calendar should show some dates as off-step. - */ -add_task(async function test_datepicker_step() { - const inputValue = "2016-12-15"; - const inputStep = "5"; - - await helper.openPicker(`data:text/html, `); - - Assert.deepEqual( - getCalendarClassList(), - mergeArrays(calendarClasslist_201612, [ - // P denotes off-step - [P], [P], [P], [], [P], [P], [P], - [P], [], [P], [P], [P], [P], [], - [P], [P], [P], [P], [], [P], [P], - [P], [P], [], [P], [P], [P], [P], - [], [P], [P], [P], [P], [], [P], - [P], [P], [P], [], [P], [P], [P], - ]), - "2016-12 with step", - ); - - await helper.tearDown(); -}); - -add_task(async function test_datepicker_abs_min() { - const inputValue = "0001-01-01"; - await helper.openPicker(`data:text/html, `); - - Assert.deepEqual( - getCalendarText(), - [ - "", "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", "8", "9", "10", - ], - "0001-01", - ); - - await helper.tearDown(); -}); - -add_task(async function test_datepicker_abs_max() { - const inputValue = "275760-09-13"; - await helper.openPicker(`data:text/html, `); - - Assert.deepEqual( - getCalendarText(), - [ - "31", "1", "2", "3", "4", "5", "6", - "7", "8", "9", "10", "11", "12", "13", - "", "", "", "", "", "", "", - "", "", "", "", "", "", "", - "", "", "", "", "", "", "", - "", "", "", "", "", "", "", - ], - "275760-09", - ); - - await helper.tearDown(); -}); diff --git a/toolkit/content/tests/browser/browser_default_image_filename.js b/toolkit/content/tests/browser/browser_default_image_filename.js deleted file mode 100644 index 2859d486f..000000000 --- a/toolkit/content/tests/browser/browser_default_image_filename.js +++ /dev/null @@ -1,45 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); - -/** - * TestCase for bug 564387 - * - */ -add_task(function* () { - let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); - gBrowser.loadURI("data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7"); - yield loadPromise; - - let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown"); - - yield BrowserTestUtils.synthesizeMouseAtCenter("img", - { type: "contextmenu", button: 2 }, - gBrowser.selectedBrowser); - - yield popupShownPromise; - - let showFilePickerPromise = new Promise(resolve => { - MockFilePicker.showCallback = function(fp) { - is(fp.defaultString, "index.gif"); - resolve(); - } - }); - - registerCleanupFunction(function () { - MockFilePicker.cleanup(); - }); - - // Select "Save Image As" option from context menu - var saveImageAsCommand = document.getElementById("context-saveimage"); - saveImageAsCommand.doCommand(); - - yield showFilePickerPromise; - - let contextMenu = document.getElementById("contentAreaContextMenu"); - let popupHiddenPromise = BrowserTestUtils.waitForEvent(contextMenu, "popuphidden"); - contextMenu.hidePopup(); - yield popupHiddenPromise; -}); diff --git a/toolkit/content/tests/browser/browser_f7_caret_browsing.js b/toolkit/content/tests/browser/browser_f7_caret_browsing.js deleted file mode 100644 index c4b6823d4..000000000 --- a/toolkit/content/tests/browser/browser_f7_caret_browsing.js +++ /dev/null @@ -1,227 +0,0 @@ -var gListener = null; -const kURL = "data:text/html;charset=utf-8,Caret browsing is fun."; - -const kPrefShortcutEnabled = "accessibility.browsewithcaret_shortcut.enabled"; -const kPrefWarnOnEnable = "accessibility.warn_on_browsewithcaret"; -const kPrefCaretBrowsingOn = "accessibility.browsewithcaret"; - -var oldPrefs = {}; -for (let pref of [kPrefShortcutEnabled, kPrefWarnOnEnable, kPrefCaretBrowsingOn]) { - oldPrefs[pref] = Services.prefs.getBoolPref(pref); -} - -Services.prefs.setBoolPref(kPrefShortcutEnabled, true); -Services.prefs.setBoolPref(kPrefWarnOnEnable, true); -Services.prefs.setBoolPref(kPrefCaretBrowsingOn, false); - -registerCleanupFunction(function() { - for (let pref of [kPrefShortcutEnabled, kPrefWarnOnEnable, kPrefCaretBrowsingOn]) { - Services.prefs.setBoolPref(pref, oldPrefs[pref]); - } -}); - -// NB: not using BrowserTestUtils.domWindowOpened here because there's no way to -// undo waiting for a window open. If we don't want the window to be opened, and -// wait for it to verify that it indeed does not open, we need to be able to -// then "stop" waiting so that when we next *do* want it to open, our "old" -// listener doesn't fire and do things we don't want (like close the window...). -let gCaretPromptOpeningObserver; -function promiseCaretPromptOpened() { - return new Promise(resolve => { - function observer(subject, topic, data) { - if (topic == "domwindowopened") { - Services.ww.unregisterNotification(observer); - let win = subject.QueryInterface(Ci.nsIDOMWindow); - BrowserTestUtils.waitForEvent(win, "load", false, e => e.target.location.href != "about:blank").then(() => resolve(win)); - gCaretPromptOpeningObserver = null; - } - } - Services.ww.registerNotification(observer); - gCaretPromptOpeningObserver = observer; - }); -} - -function hitF7(async = true) { - let f7 = () => EventUtils.sendKey("F7"); - // Need to not stop execution inside this task: - if (async) { - executeSoon(f7); - } else { - f7(); - } -} - -function syncToggleCaretNoDialog(expected) { - let openedDialog = false; - promiseCaretPromptOpened().then(function(win) { - openedDialog = true; - win.close(); // This will eventually return focus here and allow the test to continue... - }); - // Cause the dialog to appear sync, if it still does. - hitF7(false); - - let expectedStr = expected ? "on." : "off."; - ok(!openedDialog, "Shouldn't open a dialog to turn caret browsing " + expectedStr); - // Need to clean up if the dialog wasn't opened, so the observer doesn't get - // re-triggered later on causing "issues". - if (!openedDialog) { - Services.ww.unregisterNotification(gCaretPromptOpeningObserver); - gCaretPromptOpeningObserver = null; - } - let prefVal = Services.prefs.getBoolPref(kPrefCaretBrowsingOn); - is(prefVal, expected, "Caret browsing should now be " + expectedStr); -} - -function waitForFocusOnInput(browser) -{ - return ContentTask.spawn(browser, null, function* () { - let textEl = content.document.getElementById("in"); - return ContentTaskUtils.waitForCondition(() => { - return content.document.activeElement == textEl; - }, "Input should get focused."); - }); -} - -function focusInput(browser) -{ - return ContentTask.spawn(browser, null, function* () { - let textEl = content.document.getElementById("in"); - textEl.focus(); - }); -} - -add_task(function* checkTogglingCaretBrowsing() { - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, kURL); - yield focusInput(tab.linkedBrowser); - - let promiseGotKey = promiseCaretPromptOpened(); - hitF7(); - let prompt = yield promiseGotKey; - let doc = prompt.document; - is(doc.documentElement.defaultButton, "cancel", "No button should be the default"); - ok(!doc.getElementById("checkbox").checked, "Checkbox shouldn't be checked by default."); - let promiseDialogUnloaded = BrowserTestUtils.waitForEvent(prompt, "unload"); - - doc.documentElement.cancelDialog(); - yield promiseDialogUnloaded; - info("Dialog unloaded"); - yield waitForFocusOnInput(tab.linkedBrowser); - ok(!Services.prefs.getBoolPref(kPrefCaretBrowsingOn), "Caret browsing should still be off after cancelling the dialog."); - - promiseGotKey = promiseCaretPromptOpened(); - hitF7(); - prompt = yield promiseGotKey; - - doc = prompt.document; - is(doc.documentElement.defaultButton, "cancel", "No button should be the default"); - ok(!doc.getElementById("checkbox").checked, "Checkbox shouldn't be checked by default."); - promiseDialogUnloaded = BrowserTestUtils.waitForEvent(prompt, "unload"); - - doc.documentElement.acceptDialog(); - yield promiseDialogUnloaded; - info("Dialog unloaded"); - yield waitForFocusOnInput(tab.linkedBrowser); - ok(Services.prefs.getBoolPref(kPrefCaretBrowsingOn), "Caret browsing should be on after accepting the dialog."); - - syncToggleCaretNoDialog(false); - - promiseGotKey = promiseCaretPromptOpened(); - hitF7(); - prompt = yield promiseGotKey; - doc = prompt.document; - - is(doc.documentElement.defaultButton, "cancel", "No button should be the default"); - ok(!doc.getElementById("checkbox").checked, "Checkbox shouldn't be checked by default."); - - promiseDialogUnloaded = BrowserTestUtils.waitForEvent(prompt, "unload"); - doc.documentElement.cancelDialog(); - yield promiseDialogUnloaded; - info("Dialog unloaded"); - yield waitForFocusOnInput(tab.linkedBrowser); - - ok(!Services.prefs.getBoolPref(kPrefCaretBrowsingOn), "Caret browsing should still be off after cancelling the dialog."); - - Services.prefs.setBoolPref(kPrefShortcutEnabled, true); - Services.prefs.setBoolPref(kPrefWarnOnEnable, true); - Services.prefs.setBoolPref(kPrefCaretBrowsingOn, false); - - yield BrowserTestUtils.removeTab(tab); -}); - -add_task(function* toggleCheckboxNoCaretBrowsing() { - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, kURL); - yield focusInput(tab.linkedBrowser); - - let promiseGotKey = promiseCaretPromptOpened(); - hitF7(); - let prompt = yield promiseGotKey; - let doc = prompt.document; - is(doc.documentElement.defaultButton, "cancel", "No button should be the default"); - let checkbox = doc.getElementById("checkbox"); - ok(!checkbox.checked, "Checkbox shouldn't be checked by default."); - - // Check the box: - checkbox.click(); - - let promiseDialogUnloaded = BrowserTestUtils.waitForEvent(prompt, "unload"); - - // Say no: - doc.documentElement.getButton("cancel").click(); - - yield promiseDialogUnloaded; - info("Dialog unloaded"); - yield waitForFocusOnInput(tab.linkedBrowser); - ok(!Services.prefs.getBoolPref(kPrefCaretBrowsingOn), "Caret browsing should still be off."); - ok(!Services.prefs.getBoolPref(kPrefShortcutEnabled), "Shortcut should now be disabled."); - - syncToggleCaretNoDialog(false); - ok(!Services.prefs.getBoolPref(kPrefShortcutEnabled), "Shortcut should still be disabled."); - - Services.prefs.setBoolPref(kPrefShortcutEnabled, true); - Services.prefs.setBoolPref(kPrefWarnOnEnable, true); - Services.prefs.setBoolPref(kPrefCaretBrowsingOn, false); - - yield BrowserTestUtils.removeTab(tab); -}); - - -add_task(function* toggleCheckboxWantCaretBrowsing() { - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, kURL); - yield focusInput(tab.linkedBrowser); - - let promiseGotKey = promiseCaretPromptOpened(); - hitF7(); - let prompt = yield promiseGotKey; - let doc = prompt.document; - is(doc.documentElement.defaultButton, "cancel", "No button should be the default"); - let checkbox = doc.getElementById("checkbox"); - ok(!checkbox.checked, "Checkbox shouldn't be checked by default."); - - // Check the box: - checkbox.click(); - - let promiseDialogUnloaded = BrowserTestUtils.waitForEvent(prompt, "unload"); - - // Say yes: - doc.documentElement.acceptDialog(); - yield promiseDialogUnloaded; - info("Dialog unloaded"); - yield waitForFocusOnInput(tab.linkedBrowser); - ok(Services.prefs.getBoolPref(kPrefCaretBrowsingOn), "Caret browsing should now be on."); - ok(Services.prefs.getBoolPref(kPrefShortcutEnabled), "Shortcut should still be enabled."); - ok(!Services.prefs.getBoolPref(kPrefWarnOnEnable), "Should no longer warn when enabling."); - - syncToggleCaretNoDialog(false); - syncToggleCaretNoDialog(true); - syncToggleCaretNoDialog(false); - - Services.prefs.setBoolPref(kPrefShortcutEnabled, true); - Services.prefs.setBoolPref(kPrefWarnOnEnable, true); - Services.prefs.setBoolPref(kPrefCaretBrowsingOn, false); - - yield BrowserTestUtils.removeTab(tab); -}); - - - - diff --git a/toolkit/content/tests/browser/browser_findbar.js b/toolkit/content/tests/browser/browser_findbar.js deleted file mode 100644 index 1ab06f632..000000000 --- a/toolkit/content/tests/browser/browser_findbar.js +++ /dev/null @@ -1,249 +0,0 @@ -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/Promise.jsm"); -Components.utils.import("resource://gre/modules/Timer.jsm", this); - -const TEST_PAGE_URI = "data:text/html;charset=utf-8,The letter s."; -// Using 'javascript' schema to bypass E10SUtils.canLoadURIInProcess, because -// it does not allow 'data:' URI to be loaded in the parent process. -const E10S_PARENT_TEST_PAGE_URI = "javascript:document.write('The letter s.');"; - -/** - * Makes sure that the findbar hotkeys (' and /) event listeners - * are added to the system event group and do not get blocked - * by calling stopPropagation on a keypress event on a page. - */ -add_task(function* test_hotkey_event_propagation() { - info("Ensure hotkeys are not affected by stopPropagation."); - - // Opening new tab - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - let browser = gBrowser.getBrowserForTab(tab); - let findbar = gBrowser.getFindBar(); - - // Pressing these keys open the findbar. - const HOTKEYS = ["/", "'"]; - - // Checking if findbar appears when any hotkey is pressed. - for (let key of HOTKEYS) { - is(findbar.hidden, true, "Findbar is hidden now."); - gBrowser.selectedTab = tab; - yield SimpleTest.promiseFocus(gBrowser.selectedBrowser); - yield BrowserTestUtils.sendChar(key, browser); - is(findbar.hidden, false, "Findbar should not be hidden."); - yield closeFindbarAndWait(findbar); - } - - // Stop propagation for all keyboard events. - let frameScript = () => { - const stopPropagation = e => e.stopImmediatePropagation(); - let window = content.document.defaultView; - window.removeEventListener("keydown", stopPropagation); - window.removeEventListener("keypress", stopPropagation); - window.removeEventListener("keyup", stopPropagation); - }; - - let mm = browser.messageManager; - mm.loadFrameScript("data:,(" + frameScript.toString() + ")();", false); - - // Checking if findbar still appears when any hotkey is pressed. - for (let key of HOTKEYS) { - is(findbar.hidden, true, "Findbar is hidden now."); - gBrowser.selectedTab = tab; - yield SimpleTest.promiseFocus(gBrowser.selectedBrowser); - yield BrowserTestUtils.sendChar(key, browser); - is(findbar.hidden, false, "Findbar should not be hidden."); - yield closeFindbarAndWait(findbar); - } - - gBrowser.removeTab(tab); -}); - -add_task(function* test_not_found() { - info("Check correct 'Phrase not found' on new tab"); - - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - - // Search for the first word. - yield promiseFindFinished("--- THIS SHOULD NEVER MATCH ---", false); - let findbar = gBrowser.getFindBar(); - is(findbar._findStatusDesc.textContent, findbar._notFoundStr, - "Findbar status text should be 'Phrase not found'"); - - gBrowser.removeTab(tab); -}); - -add_task(function* test_found() { - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - - // Search for a string that WILL be found, with 'Highlight All' on - yield promiseFindFinished("S", true); - ok(!gBrowser.getFindBar()._findStatusDesc.textContent, - "Findbar status should be empty"); - - gBrowser.removeTab(tab); -}); - -// Setting first findbar to case-sensitive mode should not affect -// new tab find bar. -add_task(function* test_tabwise_case_sensitive() { - let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - let findbar1 = gBrowser.getFindBar(); - - let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - let findbar2 = gBrowser.getFindBar(); - - // Toggle case sensitivity for first findbar - findbar1.getElement("find-case-sensitive").click(); - - gBrowser.selectedTab = tab1; - - // Not found for first tab. - yield promiseFindFinished("S", true); - is(findbar1._findStatusDesc.textContent, findbar1._notFoundStr, - "Findbar status text should be 'Phrase not found'"); - - gBrowser.selectedTab = tab2; - - // But it didn't affect the second findbar. - yield promiseFindFinished("S", true); - ok(!findbar2._findStatusDesc.textContent, "Findbar status should be empty"); - - gBrowser.removeTab(tab1); - gBrowser.removeTab(tab2); -}); - -/** - * Navigating from a web page (for example mozilla.org) to an internal page - * (like about:addons) might trigger a change of browser's remoteness. - * 'Remoteness change' means that rendering page content moves from child - * process into the parent process or the other way around. - * This test ensures that findbar properly handles such a change. - */ -add_task(function* test_reinitialization_at_remoteness_change() { - // This test only makes sence in e10s evironment. - if (!gMultiProcessBrowser) { - info("Skipping this test because of non-e10s environment."); - return; - } - - info("Ensure findbar re-initialization at remoteness change."); - - // Load a remote page and trigger findbar construction. - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - let browser = gBrowser.getBrowserForTab(tab); - let findbar = gBrowser.getFindBar(); - - // Findbar should operate normally. - yield promiseFindFinished("z", false); - is(findbar._findStatusDesc.textContent, findbar._notFoundStr, - "Findbar status text should be 'Phrase not found'"); - - yield promiseFindFinished("s", false); - ok(!findbar._findStatusDesc.textContent, "Findbar status should be empty"); - - // Moving browser into the parent process and reloading sample data. - ok(browser.isRemoteBrowser, "Browser should be remote now."); - yield promiseRemotenessChange(tab, false); - yield BrowserTestUtils.loadURI(browser, E10S_PARENT_TEST_PAGE_URI); - ok(!browser.isRemoteBrowser, "Browser should not be remote any more."); - - // Findbar should keep operating normally after remoteness change. - yield promiseFindFinished("z", false); - is(findbar._findStatusDesc.textContent, findbar._notFoundStr, - "Findbar status text should be 'Phrase not found'"); - - yield promiseFindFinished("s", false); - ok(!findbar._findStatusDesc.textContent, "Findbar status should be empty"); - - yield BrowserTestUtils.removeTab(tab); -}); - -/** - * Ensure that the initial typed characters aren't lost immediately after - * opening the find bar. - */ -add_task(function* () { - // This test only makes sence in e10s evironment. - if (!gMultiProcessBrowser) { - info("Skipping this test because of non-e10s environment."); - return; - } - - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); - let browser = tab.linkedBrowser; - - ok(!gFindBarInitialized, "findbar isn't initialized yet"); - - let findBar = gFindBar; - let initialValue = findBar._findField.value; - - EventUtils.synthesizeKey("f", { accelKey: true }, window); - - let promises = [ - BrowserTestUtils.sendChar("a", browser), - BrowserTestUtils.sendChar("b", browser), - BrowserTestUtils.sendChar("c", browser) - ]; - - isnot(document.activeElement, findBar._findField.inputField, - "findbar is not yet focused"); - is(findBar._findField.value, initialValue, "still has initial find query"); - - yield Promise.all(promises); - is(document.activeElement, findBar._findField.inputField, - "findbar is now focused"); - is(findBar._findField.value, "abc", "abc fully entered as find query"); - - yield BrowserTestUtils.removeTab(tab); -}); - -function promiseFindFinished(searchText, highlightOn) { - let deferred = Promise.defer(); - - let findbar = gBrowser.getFindBar(); - findbar.startFind(findbar.FIND_NORMAL); - let highlightElement = findbar.getElement("highlight"); - if (highlightElement.checked != highlightOn) - highlightElement.click(); - executeSoon(() => { - findbar._findField.value = searchText; - - let resultListener; - // When highlighting is on the finder sends a second "FOUND" message after - // the search wraps. This causes timing problems with e10s. waitMore - // forces foundOrTimeout wait for the second "FOUND" message before - // resolving the promise. - let waitMore = highlightOn; - let findTimeout = setTimeout(() => foundOrTimedout(null), 2000); - let foundOrTimedout = function(aData) { - if (aData !== null && waitMore) { - waitMore = false; - return; - } - if (aData === null) - info("Result listener not called, timeout reached."); - clearTimeout(findTimeout); - findbar.browser.finder.removeResultListener(resultListener); - deferred.resolve(); - } - - resultListener = { - onFindResult: foundOrTimedout - }; - findbar.browser.finder.addResultListener(resultListener); - findbar._find(); - }); - - return deferred.promise; -} - -function promiseRemotenessChange(tab, shouldBeRemote) { - return new Promise((resolve) => { - let browser = gBrowser.getBrowserForTab(tab); - tab.addEventListener("TabRemotenessChange", function listener() { - tab.removeEventListener("TabRemotenessChange", listener); - resolve(); - }); - gBrowser.updateBrowserRemoteness(browser, shouldBeRemote); - }); -} diff --git a/toolkit/content/tests/browser/browser_isSynthetic.js b/toolkit/content/tests/browser/browser_isSynthetic.js deleted file mode 100644 index 15a341461..000000000 --- a/toolkit/content/tests/browser/browser_isSynthetic.js +++ /dev/null @@ -1,72 +0,0 @@ -function LocationChangeListener(browser) { - this.browser = browser; - browser.addProgressListener(this); -} - -LocationChangeListener.prototype = { - wasSynthetic: false, - browser: null, - - destroy: function() { - this.browser.removeProgressListener(this); - }, - - onLocationChange: function(webProgress, request, location, flags) { - this.wasSynthetic = this.browser.isSyntheticDocument; - }, - - QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference]) -} - -const FILES = gTestPath.replace("browser_isSynthetic.js", "") - .replace("chrome://mochitests/content/", "http://example.com/"); - -function waitForPageShow(browser) { - return ContentTask.spawn(browser, null, function*() { - Cu.import("resource://gre/modules/PromiseUtils.jsm"); - yield new Promise(resolve => { - let listener = () => { - removeEventListener("pageshow", listener, true); - resolve(); - } - addEventListener("pageshow", listener, true); - }); - }); -} - -add_task(function*() { - let tab = gBrowser.addTab("about:blank"); - let browser = tab.linkedBrowser; - yield BrowserTestUtils.browserLoaded(browser); - let listener = new LocationChangeListener(browser); - - is(browser.isSyntheticDocument, false, "Should not be synthetic"); - - let loadPromise = waitForPageShow(browser); - browser.loadURI("data:text/html;charset=utf-8,"); - yield loadPromise; - is(listener.wasSynthetic, false, "Should not be synthetic"); - is(browser.isSyntheticDocument, false, "Should not be synthetic"); - - loadPromise = waitForPageShow(browser); - browser.loadURI(FILES + "empty.png"); - yield loadPromise; - is(listener.wasSynthetic, true, "Should be synthetic"); - is(browser.isSyntheticDocument, true, "Should be synthetic"); - - loadPromise = waitForPageShow(browser); - browser.goBack(); - yield loadPromise; - is(listener.wasSynthetic, false, "Should not be synthetic"); - is(browser.isSyntheticDocument, false, "Should not be synthetic"); - - loadPromise = waitForPageShow(browser); - browser.goForward(); - yield loadPromise; - is(listener.wasSynthetic, true, "Should be synthetic"); - is(browser.isSyntheticDocument, true, "Should be synthetic"); - - listener.destroy(); - gBrowser.removeTab(tab); -}); diff --git a/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js b/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js deleted file mode 100644 index 3fce47114..000000000 --- a/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js +++ /dev/null @@ -1,120 +0,0 @@ -add_task(function * () -{ - const kPrefName_AutoScroll = "general.autoScroll"; - Services.prefs.setBoolPref(kPrefName_AutoScroll, true); - - const kNoKeyEvents = 0; - const kKeyDownEvent = 1; - const kKeyPressEvent = 2; - const kKeyUpEvent = 4; - const kAllKeyEvents = 7; - - var expectedKeyEvents; - var dispatchedKeyEvents; - var key; - var root; - - /** - * Encapsulates EventUtils.sendChar(). - */ - function sendChar(aChar) - { - key = aChar; - dispatchedKeyEvents = kNoKeyEvents; - EventUtils.sendChar(key); - is(dispatchedKeyEvents, expectedKeyEvents, - "unexpected key events were dispatched or not dispatched: " + key); - } - - /** - * Encapsulates EventUtils.sendKey(). - */ - function sendKey(aKey) - { - key = aKey; - dispatchedKeyEvents = kNoKeyEvents; - EventUtils.sendKey(key); - is(dispatchedKeyEvents, expectedKeyEvents, - "unexpected key events were dispatched or not dispatched: " + key); - } - - function onKey(aEvent) - { -// if (aEvent.target != root && aEvent.target != root.ownerDocument.body) { -// ok(false, "unknown target: " + aEvent.target.tagName); -// return; -// } - - var keyFlag; - switch (aEvent.type) { - case "keydown": - keyFlag = kKeyDownEvent; - break; - case "keypress": - keyFlag = kKeyPressEvent; - break; - case "keyup": - keyFlag = kKeyUpEvent; - break; - default: - ok(false, "Unknown events: " + aEvent.type); - return; - } - dispatchedKeyEvents |= keyFlag; - is(keyFlag, expectedKeyEvents & keyFlag, aEvent.type + " fired: " + key); - } - - var dataUri = 'data:text/html,'; - - let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); - gBrowser.loadURI(dataUri); - yield loadedPromise; - - yield SimpleTest.promiseFocus(gBrowser.selectedBrowser); - - window.addEventListener("keydown", onKey, false); - window.addEventListener("keypress", onKey, false); - window.addEventListener("keyup", onKey, false); - - // Test whether the key events are handled correctly under normal condition - expectedKeyEvents = kAllKeyEvents; - sendChar("A"); - - // Start autoscrolling by middle button click on the page - let shownPromise = BrowserTestUtils.waitForEvent(window, "popupshown", false, - event => event.originalTarget.className == "autoscroller"); - yield BrowserTestUtils.synthesizeMouseAtPoint(10, 10, { button: 1 }, - gBrowser.selectedBrowser); - yield shownPromise; - - // Most key events should be eaten by the browser. - expectedKeyEvents = kNoKeyEvents; - sendChar("A"); - sendKey("DOWN"); - sendKey("RETURN"); - sendKey("RETURN"); - sendKey("HOME"); - sendKey("END"); - sendKey("TAB"); - sendKey("RETURN"); - - // Finish autoscrolling by ESC key. Note that only keydown and keypress - // events are eaten because keyup event is fired *after* the autoscrolling - // is finished. - expectedKeyEvents = kKeyUpEvent; - sendKey("ESCAPE"); - - // Test whether the key events are handled correctly under normal condition - expectedKeyEvents = kAllKeyEvents; - sendChar("A"); - - window.removeEventListener("keydown", onKey, false); - window.removeEventListener("keypress", onKey, false); - window.removeEventListener("keyup", onKey, false); - - // restore the changed prefs - if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll)) - Services.prefs.clearUserPref(kPrefName_AutoScroll); - - finish(); -}); diff --git a/toolkit/content/tests/browser/browser_label_textlink.js b/toolkit/content/tests/browser/browser_label_textlink.js deleted file mode 100644 index 861086707..000000000 --- a/toolkit/content/tests/browser/browser_label_textlink.js +++ /dev/null @@ -1,38 +0,0 @@ -add_task(function* () { - yield BrowserTestUtils.withNewTab({gBrowser, url: "about:config"}, function*(browser) { - let newTabURL = "http://www.example.com/"; - yield ContentTask.spawn(browser, newTabURL, function*(newTabURL) { - let doc = content.document; - let label = doc.createElement("label"); - label.href = newTabURL; - label.id = "textlink-test"; - label.className = "text-link"; - label.textContent = "click me"; - doc.documentElement.append(label); - }); - - // Test that click will open tab in foreground. - let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL); - yield BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", {}, browser); - let newTab = yield awaitNewTab; - is(newTab.linkedBrowser, gBrowser.selectedBrowser, "selected tab should be example page"); - yield BrowserTestUtils.removeTab(gBrowser.selectedTab); - - // Test that ctrl+shift+click/meta+shift+click will open tab in background. - awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL); - yield BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", - {ctrlKey: true, metaKey: true, shiftKey: true}, - browser); - yield awaitNewTab; - is(gBrowser.selectedBrowser, browser, "selected tab should be original tab"); - yield BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]); - - // Middle-clicking should open tab in foreground. - awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL); - yield BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", - {button: 1}, browser); - newTab = yield awaitNewTab; - is(newTab.linkedBrowser, gBrowser.selectedBrowser, "selected tab should be example page"); - yield BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]); - }); -}); diff --git a/toolkit/content/tests/browser/browser_mediaPlayback.js b/toolkit/content/tests/browser/browser_mediaPlayback.js deleted file mode 100644 index 1a6ebfcb8..000000000 --- a/toolkit/content/tests/browser/browser_mediaPlayback.js +++ /dev/null @@ -1,30 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback.html"; -const FRAME = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlaybackFrame.html"; - -function wait_for_event(browser, event) { - return BrowserTestUtils.waitForEvent(browser, event, false, (event) => { - is(event.originalTarget, browser, "Event must be dispatched to correct browser."); - ok(!event.cancelable, "The event should not be cancelable"); - return true; - }); -} - -function* test_on_browser(url, browser) { - browser.loadURI(url); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - yield wait_for_event(browser, "DOMAudioPlaybackStopped"); -} - -add_task(function* test_page() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank", - }, test_on_browser.bind(undefined, PAGE)); -}); - -add_task(function* test_frame() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank", - }, test_on_browser.bind(undefined, FRAME)); -}); diff --git a/toolkit/content/tests/browser/browser_mediaPlayback_mute.js b/toolkit/content/tests/browser/browser_mediaPlayback_mute.js deleted file mode 100644 index 852fc56fb..000000000 --- a/toolkit/content/tests/browser/browser_mediaPlayback_mute.js +++ /dev/null @@ -1,104 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback2.html"; -const FRAME = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlaybackFrame2.html"; - -function wait_for_event(browser, event) { - return BrowserTestUtils.waitForEvent(browser, event, false, (event) => { - is(event.originalTarget, browser, "Event must be dispatched to correct browser."); - return true; - }); -} - -function* test_audio_in_browser() { - function get_audio_element() { - var doc = content.document; - var list = doc.getElementsByTagName('audio'); - if (list.length == 1) { - return list[0]; - } - - // iframe? - list = doc.getElementsByTagName('iframe'); - - var iframe = list[0]; - list = iframe.contentDocument.getElementsByTagName('audio'); - return list[0]; - } - - var audio = get_audio_element(); - return { - computedVolume: audio.computedVolume, - computedMuted: audio.computedMuted - } -} - -function* test_on_browser(url, browser) { - browser.loadURI(url); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - var result = yield ContentTask.spawn(browser, null, test_audio_in_browser); - is(result.computedVolume, 1, "Audio volume is 1"); - is(result.computedMuted, false, "Audio is not muted"); - - ok(!browser.audioMuted, "Audio should not be muted by default"); - browser.mute(); - ok(browser.audioMuted, "Audio should be muted now"); - - yield wait_for_event(browser, "DOMAudioPlaybackStopped"); - - result = yield ContentTask.spawn(browser, null, test_audio_in_browser); - is(result.computedVolume, 0, "Audio volume is 0 when muted"); - is(result.computedMuted, true, "Audio is muted"); -} - -function* test_visibility(url, browser) { - browser.loadURI(url); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - var result = yield ContentTask.spawn(browser, null, test_audio_in_browser); - is(result.computedVolume, 1, "Audio volume is 1"); - is(result.computedMuted, false, "Audio is not muted"); - - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank", - }, function() {}); - - ok(!browser.audioMuted, "Audio should not be muted by default"); - browser.mute(); - ok(browser.audioMuted, "Audio should be muted now"); - - yield wait_for_event(browser, "DOMAudioPlaybackStopped"); - - result = yield ContentTask.spawn(browser, null, test_audio_in_browser); - is(result.computedVolume, 0, "Audio volume is 0 when muted"); - is(result.computedMuted, true, "Audio is muted"); -} - -add_task(function*() { - yield new Promise((resolve) => { - SpecialPowers.pushPrefEnv({"set": [ - ["media.useAudioChannelService.testing", true] - ]}, resolve); - }); -}); - -add_task(function* test_page() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank", - }, test_on_browser.bind(undefined, PAGE)); -}); - -add_task(function* test_frame() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank", - }, test_on_browser.bind(undefined, FRAME)); -}); - -add_task(function* test_frame() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank", - }, test_visibility.bind(undefined, PAGE)); -}); diff --git a/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js b/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js deleted file mode 100644 index ef8bb9dc8..000000000 --- a/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js +++ /dev/null @@ -1,191 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback2.html"; - -var SuspendedType = { - NONE_SUSPENDED : 0, - SUSPENDED_PAUSE : 1, - SUSPENDED_BLOCK : 2, - SUSPENDED_PAUSE_DISPOSABLE : 3 -}; - -function wait_for_event(browser, event) { - return BrowserTestUtils.waitForEvent(browser, event, false, (event) => { - is(event.originalTarget, browser, "Event must be dispatched to correct browser."); - return true; - }); -} - -function check_audio_onplay() { - var list = content.document.getElementsByTagName('audio'); - if (list.length != 1) { - ok(false, "There should be only one audio element in page!") - } - - var audio = list[0]; - return new Promise((resolve, reject) => { - audio.onplay = () => { - ok(needToReceiveOnPlay, "Should not receive play event!"); - this.onplay = null; - reject(); - }; - - audio.pause(); - audio.play(); - - setTimeout(() => { - ok(true, "Doesn't receive play event when media was blocked."); - audio.onplay = null; - resolve(); - }, 1000) - }); -} - -function check_audio_suspended(suspendedType) { - var list = content.document.getElementsByTagName('audio'); - if (list.length != 1) { - ok(false, "There should be only one audio element in page!") - } - - var audio = list[0]; - is(audio.computedSuspended, suspendedType, - "The suspended state of MediaElement is correct."); -} - -function check_audio_pause_state(expectedPauseState) { - var list = content.document.getElementsByTagName('audio'); - if (list.length != 1) { - ok(false, "There should be only one audio element in page!") - } - - var audio = list[0]; - if (expectedPauseState) { - is(audio.paused, true, "Audio is paused correctly."); - } else { - is(audio.paused, false, "Audio is resumed correctly."); - } -} - -function* suspended_pause(url, browser) { - info("### Start test for suspended-pause ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the suspended state of audio should be non-suspened -"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); - - info("- pause playing audio -"); - browser.pauseMedia(false /* non-disposable */); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE, - check_audio_suspended); - - info("- resume paused audio -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, false /* expect for playing */, - check_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); -} - -function* suspended_pause_disposable(url, browser) { - info("### Start test for suspended-pause-disposable ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the suspended state of audio should be non-suspened -"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); - - info("- pause playing audio -"); - browser.pauseMedia(true /* disposable */); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE_DISPOSABLE, - check_audio_suspended); - - info("- resume paused audio -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, false /* expect for playing */, - check_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); -} - -function* suspended_stop_disposable(url, browser) { - info("### Start test for suspended-stop-disposable ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the suspended state of audio should be non-suspened -"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); - - info("- stop playing audio -"); - browser.stopMedia(); - yield wait_for_event(browser, "DOMAudioPlaybackStopped"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); -} - -function* suspended_block(url, browser) { - info("### Start test for suspended-block ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- block playing audio -"); - browser.blockMedia(); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_BLOCK, - check_audio_suspended); - yield ContentTask.spawn(browser, null, - check_audio_onplay); - - info("- resume blocked audio -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_audio_suspended); -} - -add_task(function* setup_test_preference() { - yield new Promise(resolve => { - SpecialPowers.pushPrefEnv({"set": [ - ["media.useAudioChannelService.testing", true] - ]}, resolve); - }); -}); - -add_task(function* test_suspended_pause() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_pause.bind(this, PAGE)); -}); - -add_task(function* test_suspended_pause_disposable() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_pause_disposable.bind(this, PAGE)); -}); - -add_task(function* test_suspended_stop_disposable() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_stop_disposable.bind(this, PAGE)); -}); - -add_task(function* test_suspended_block() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_block.bind(this, PAGE)); -}); diff --git a/toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js b/toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js deleted file mode 100644 index 12e2ec077..000000000 --- a/toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js +++ /dev/null @@ -1,311 +0,0 @@ -const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_multipleAudio.html"; - -var SuspendedType = { - NONE_SUSPENDED : 0, - SUSPENDED_PAUSE : 1, - SUSPENDED_BLOCK : 2, - SUSPENDED_PAUSE_DISPOSABLE : 3 -}; - -function wait_for_event(browser, event) { - return BrowserTestUtils.waitForEvent(browser, event, false, (event) => { - is(event.originalTarget, browser, "Event must be dispatched to correct browser."); - return true; - }); -} - -function check_all_audio_suspended(suspendedType) { - var autoPlay = content.document.getElementById('autoplay'); - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!autoPlay || !nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.computedSuspended, suspendedType, - "The suspeded state of autoplay audio is correct."); - is(nonAutoPlay.computedSuspended, suspendedType, - "The suspeded state of non-autoplay audio is correct."); -} - -function check_autoplay_audio_suspended(suspendedType) { - var autoPlay = content.document.getElementById('autoplay'); - if (!autoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.computedSuspended, suspendedType, - "The suspeded state of autoplay audio is correct."); -} - -function check_nonautoplay_audio_suspended(suspendedType) { - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(nonAutoPlay.computedSuspended, suspendedType, - "The suspeded state of non-autoplay audio is correct."); -} - -function check_autoplay_audio_pause_state(expectedPauseState) { - var autoPlay = content.document.getElementById('autoplay'); - if (!autoPlay) { - ok(false, "Can't get the audio element!"); - } - - if (autoPlay.paused == expectedPauseState) { - if (expectedPauseState) { - ok(true, "Audio is paused correctly."); - } else { - ok(true, "Audio is resumed correctly."); - } - } else if (expectedPauseState) { - autoPlay.onpause = function () { - autoPlay.onpause = null; - ok(true, "Audio is paused correctly, checking from onpause."); - } - } else { - autoPlay.onplay = function () { - autoPlay.onplay = null; - ok(true, "Audio is resumed correctly, checking from onplay."); - } - } -} - -function play_nonautoplay_audio_should_be_paused() { - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - nonAutoPlay.play(); - return new Promise(resolve => { - nonAutoPlay.onpause = function () { - nonAutoPlay.onpause = null; - is(nonAutoPlay.ended, false, "Audio can't be playback."); - resolve(); - } - }); -} - -function all_audio_onresume() { - var autoPlay = content.document.getElementById('autoplay'); - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!autoPlay || !nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.paused, false, "Autoplay audio is resumed."); - is(nonAutoPlay.paused, false, "Non-AutoPlay audio is resumed."); -} - -function all_audio_onpause() { - var autoPlay = content.document.getElementById('autoplay'); - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!autoPlay || !nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.paused, true, "Autoplay audio is paused."); - is(nonAutoPlay.paused, true, "Non-AutoPlay audio is paused."); -} - -function play_nonautoplay_audio_should_play_until_ended() { - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - nonAutoPlay.play(); - return new Promise(resolve => { - nonAutoPlay.onended = function () { - nonAutoPlay.onended = null; - ok(true, "Audio can be playback until ended."); - resolve(); - } - }); -} - -function no_audio_resumed() { - var autoPlay = content.document.getElementById('autoplay'); - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!autoPlay || !nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - is(autoPlay.paused && nonAutoPlay.paused, true, "No audio was resumed."); -} - -function play_nonautoplay_audio_should_be_blocked(suspendedType) { - var nonAutoPlay = content.document.getElementById('nonautoplay'); - if (!nonAutoPlay) { - ok(false, "Can't get the audio element!"); - } - - nonAutoPlay.play(); - ok(nonAutoPlay.paused, "The blocked audio can't be playback."); -} - -function* suspended_pause(url, browser) { - info("### Start test for suspended-pause ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the default suspended state of all audio should be non-suspened-"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- pause all audio in the page -"); - browser.pauseMedia(false /* non-disposable */); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_autoplay_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE, - check_autoplay_audio_suspended); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_nonautoplay_audio_suspended); - - info("- no audio can be playback during suspended-paused -"); - yield ContentTask.spawn(browser, null, - play_nonautoplay_audio_should_be_paused); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE, - check_nonautoplay_audio_suspended); - - info("- both audio should be resumed at the same time -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, null, - all_audio_onresume); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- both audio should be paused at the same time -"); - browser.pauseMedia(false /* non-disposable */); - yield ContentTask.spawn(browser, null, all_audio_onpause); -} - -function* suspended_pause_disposable(url, browser) { - info("### Start test for suspended-pause-disposable ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the default suspended state of all audio should be non-suspened -"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- only pause playing audio in the page -"); - browser.pauseMedia(true /* non-disposable */); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_autoplay_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_PAUSE_DISPOSABLE, - check_autoplay_audio_suspended); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_nonautoplay_audio_suspended); - - info("- new playing audio should be playback correctly -"); - yield ContentTask.spawn(browser, null, - play_nonautoplay_audio_should_play_until_ended); - - info("- should only resume one audio -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, false /* expect for playing */, - check_autoplay_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); -} - -function* suspended_stop_disposable(url, browser) { - info("### Start test for suspended-stop-disposable ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the default suspended state of all audio should be non-suspened -"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- only stop playing audio in the page -"); - browser.stopMedia(); - yield wait_for_event(browser, "DOMAudioPlaybackStopped"); - yield ContentTask.spawn(browser, true /* expect for pause */, - check_autoplay_audio_pause_state); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- new playing audio should be playback correctly -"); - yield ContentTask.spawn(browser, null, - play_nonautoplay_audio_should_play_until_ended); - - info("- no any audio can be resumed by page -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, null, no_audio_resumed); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); -} - -function* suspended_block(url, browser) { - info("### Start test for suspended-block ###"); - browser.loadURI(url); - - info("- page should have playing audio -"); - yield wait_for_event(browser, "DOMAudioPlaybackStarted"); - - info("- the default suspended state of all audio should be non-suspened-"); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); - - info("- block autoplay audio -"); - browser.blockMedia(); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_BLOCK, - check_autoplay_audio_suspended); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_nonautoplay_audio_suspended); - - info("- no audio can be playback during suspended-block -"); - yield ContentTask.spawn(browser, SuspendedType.SUSPENDED_BLOCK, - play_nonautoplay_audio_should_be_blocked); - - info("- both audio should be resumed at the same time -"); - browser.resumeMedia(); - yield ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED, - check_all_audio_suspended); -} - -add_task(function* setup_test_preference() { - yield new Promise(resolve => { - SpecialPowers.pushPrefEnv({"set": [ - ["media.useAudioChannelService.testing", true] - ]}, resolve); - }); -}); - -add_task(function* test_suspended_pause() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_pause.bind(this, PAGE)); -}); - -add_task(function* test_suspended_pause_disposable() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_pause_disposable.bind(this, PAGE)); -}); - -add_task(function* test_suspended_stop_disposable() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_stop_disposable.bind(this, PAGE)); -}); - -add_task(function* test_suspended_block() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: "about:blank" - }, suspended_block.bind(this, PAGE)); -}); diff --git a/toolkit/content/tests/browser/browser_mute.js b/toolkit/content/tests/browser/browser_mute.js deleted file mode 100644 index f4829b808..000000000 --- a/toolkit/content/tests/browser/browser_mute.js +++ /dev/null @@ -1,16 +0,0 @@ -const PAGE = "data:text/html,page"; - -function* test_on_browser(browser) { - ok(!browser.audioMuted, "Audio should not be muted by default"); - browser.mute(); - ok(browser.audioMuted, "Audio should be muted now"); - browser.unmute(); - ok(!browser.audioMuted, "Audio should be unmuted now"); -} - -add_task(function*() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: PAGE, - }, test_on_browser); -}); diff --git a/toolkit/content/tests/browser/browser_mute2.js b/toolkit/content/tests/browser/browser_mute2.js deleted file mode 100644 index 38f415b71..000000000 --- a/toolkit/content/tests/browser/browser_mute2.js +++ /dev/null @@ -1,26 +0,0 @@ -const PAGE = "data:text/html,page"; - -function* test_on_browser(browser) { - ok(!browser.audioMuted, "Audio should not be muted by default"); - browser.mute(); - ok(browser.audioMuted, "Audio should be muted now"); - - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: PAGE, - }, test_on_browser2); - - browser.unmute(); - ok(!browser.audioMuted, "Audio should be unmuted now"); -} - -function* test_on_browser2(browser) { - ok(!browser.audioMuted, "Audio should not be muted by default"); -} - -add_task(function*() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: PAGE, - }, test_on_browser); -}); diff --git a/toolkit/content/tests/browser/browser_quickfind_editable.js b/toolkit/content/tests/browser/browser_quickfind_editable.js deleted file mode 100644 index d4ab59744..000000000 --- a/toolkit/content/tests/browser/browser_quickfind_editable.js +++ /dev/null @@ -1,47 +0,0 @@ -const PAGE = "data:text/html,
foo
"; -const DESIGNMODE_PAGE = "data:text/html,"; -const HOTKEYS = ["/", "'"]; - -function* test_hotkeys(browser, expected) { - let findbar = gBrowser.getFindBar(); - for (let key of HOTKEYS) { - is(findbar.hidden, true, "findbar is hidden"); - yield BrowserTestUtils.sendChar(key, gBrowser.selectedBrowser); - is(findbar.hidden, expected, "findbar should" + (expected ? "" : " not") + " be hidden"); - if (!expected) { - yield closeFindbarAndWait(findbar); - } - } -} - -function* focus_element(browser, query) { - yield ContentTask.spawn(browser, query, function* focus(query) { - let element = content.document.querySelector(query); - element.focus(); - }); -} - -add_task(function* test_hotkey_on_editable_element() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: PAGE - }, function* do_tests(browser) { - yield test_hotkeys(browser, false); - const ELEMENTS = ["div", "input", "textarea"]; - for (let elem of ELEMENTS) { - yield focus_element(browser, elem); - yield test_hotkeys(browser, true); - yield focus_element(browser, ":root"); - yield test_hotkeys(browser, false); - } - }); -}); - -add_task(function* test_hotkey_on_designMode_document() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: DESIGNMODE_PAGE - }, function* do_tests(browser) { - yield test_hotkeys(browser, true); - }); -}); diff --git a/toolkit/content/tests/browser/browser_saveImageURL.js b/toolkit/content/tests/browser/browser_saveImageURL.js deleted file mode 100644 index 75e1cfdcd..000000000 --- a/toolkit/content/tests/browser/browser_saveImageURL.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -const IMAGE_PAGE = "https://example.com/browser/toolkit/content/tests/browser/image_page.html"; -const PREF_UNSAFE_FORBIDDEN = "dom.ipc.cpows.forbid-unsafe-from-browser"; - -MockFilePicker.init(window); -MockFilePicker.returnValue = MockFilePicker.returnCancel; - -registerCleanupFunction(function() { - MockFilePicker.cleanup(); -}); - -function waitForFilePicker() { - return new Promise((resolve) => { - MockFilePicker.showCallback = () => { - MockFilePicker.showCallback = null; - ok(true, "Saw the file picker"); - resolve(); - } - }) -} - -/** - * Test that saveImageURL works when we pass in the aIsContentWindowPrivate - * argument instead of a document. This is the preferred API. - */ -add_task(function* preferred_API() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: IMAGE_PAGE, - }, function*(browser) { - let url = yield ContentTask.spawn(browser, null, function*() { - let image = content.document.getElementById("image"); - return image.href; - }); - - saveImageURL(url, "image.jpg", null, true, false, null, null, null, null, false); - yield waitForFilePicker(); - }); -}); - -/** - * Test that saveImageURL will still work when passed a document instead - * of the aIsContentWindowPrivate argument. This is the deprecated API, and - * will not work in apps using remote browsers having PREF_UNSAFE_FORBIDDEN - * set to true. - */ -add_task(function* deprecated_API() { - yield BrowserTestUtils.withNewTab({ - gBrowser, - url: IMAGE_PAGE, - }, function*(browser) { - yield pushPrefs([PREF_UNSAFE_FORBIDDEN, false]); - - let url = yield ContentTask.spawn(browser, null, function*() { - let image = content.document.getElementById("image"); - return image.href; - }); - - // Now get the document directly from content. If we run this test with - // e10s-enabled, this will be a CPOW, which is forbidden. We'll just - // pass the XUL document instead to test this interface. - let doc = document; - - saveImageURL(url, "image.jpg", null, true, false, null, doc, null, null); - yield waitForFilePicker(); - }); -}); diff --git a/toolkit/content/tests/browser/browser_save_resend_postdata.js b/toolkit/content/tests/browser/browser_save_resend_postdata.js deleted file mode 100644 index 602a13d22..000000000 --- a/toolkit/content/tests/browser/browser_save_resend_postdata.js +++ /dev/null @@ -1,145 +0,0 @@ -/* 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/. */ - -var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); - -/** - * Test for bug 471962 : - * When saving an inner frame as file only, the POST data of the outer page is - * sent to the address of the inner page. - * - * Test for bug 485196 : - * Web page generated by POST is retried as GET when Save Frame As used, and the - * page is no longer in the cache. - */ -function test() { - waitForExplicitFinish(); - - gBrowser.loadURI("http://mochi.test:8888/browser/toolkit/content/tests/browser/data/post_form_outer.sjs"); - - gBrowser.addEventListener("pageshow", function pageShown(event) { - if (event.target.location == "about:blank") - return; - gBrowser.removeEventListener("pageshow", pageShown); - - // Submit the form in the outer page, then wait for both the outer - // document and the inner frame to be loaded again. - gBrowser.addEventListener("DOMContentLoaded", handleOuterSubmit); - gBrowser.contentDocument.getElementById("postForm").submit(); - }); - - var framesLoaded = 0; - var innerFrame; - - function handleOuterSubmit() { - if (++framesLoaded < 2) - return; - - gBrowser.removeEventListener("DOMContentLoaded", handleOuterSubmit); - - innerFrame = gBrowser.contentDocument.getElementById("innerFrame"); - - // Submit the form in the inner page. - gBrowser.addEventListener("DOMContentLoaded", handleInnerSubmit); - innerFrame.contentDocument.getElementById("postForm").submit(); - } - - function handleInnerSubmit() { - gBrowser.removeEventListener("DOMContentLoaded", handleInnerSubmit); - - // Create the folder the page will be saved into. - var destDir = createTemporarySaveDirectory(); - var file = destDir.clone(); - file.append("no_default_file_name"); - MockFilePicker.returnFiles = [file]; - MockFilePicker.showCallback = function(fp) { - MockFilePicker.filterIndex = 1; // kSaveAsType_URL - }; - - mockTransferCallback = onTransferComplete; - mockTransferRegisterer.register(); - - registerCleanupFunction(function () { - mockTransferRegisterer.unregister(); - MockFilePicker.cleanup(); - destDir.remove(true); - }); - - var docToSave = innerFrame.contentDocument; - // We call internalSave instead of saveDocument to bypass the history - // cache. - internalSave(docToSave.location.href, docToSave, null, null, - docToSave.contentType, false, null, null, - docToSave.referrer ? makeURI(docToSave.referrer) : null, - docToSave, false, null); - } - - function onTransferComplete(downloadSuccess) { - ok(downloadSuccess, "The inner frame should have been downloaded successfully"); - - // Read the entire saved file. - var file = MockFilePicker.returnFiles[0]; - var fileContents = readShortFile(file); - - // Check if outer POST data is found (bug 471962). - is(fileContents.indexOf("inputfield=outer"), -1, - "The saved inner frame does not contain outer POST data"); - - // Check if inner POST data is found (bug 485196). - isnot(fileContents.indexOf("inputfield=inner"), -1, - "The saved inner frame was generated using the correct POST data"); - - finish(); - } -} - -Cc["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Ci.mozIJSSubScriptLoader) - .loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js", - this); - -function createTemporarySaveDirectory() { - var saveDir = Cc["@mozilla.org/file/directory_service;1"] - .getService(Ci.nsIProperties) - .get("TmpD", Ci.nsIFile); - saveDir.append("testsavedir"); - if (!saveDir.exists()) - saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755); - return saveDir; -} - -/** - * Reads the contents of the provided short file (up to 1 MiB). - * - * @param aFile - * nsIFile object pointing to the file to be read. - * - * @return - * String containing the raw octets read from the file. - */ -function readShortFile(aFile) { - var inputStream = Cc["@mozilla.org/network/file-input-stream;1"] - .createInstance(Ci.nsIFileInputStream); - inputStream.init(aFile, -1, 0, 0); - try { - var scrInputStream = Cc["@mozilla.org/scriptableinputstream;1"] - .createInstance(Ci.nsIScriptableInputStream); - scrInputStream.init(inputStream); - try { - // Assume that the file is much shorter than 1 MiB. - return scrInputStream.read(1048576); - } - finally { - // Close the scriptable stream after reading, even if the operation - // failed. - scrInputStream.close(); - } - } - finally { - // Close the stream after reading, if it is still open, even if the read - // operation failed. - inputStream.close(); - } -} diff --git a/toolkit/content/tests/browser/common/mockTransfer.js b/toolkit/content/tests/browser/common/mockTransfer.js deleted file mode 100644 index c8b8fc161..000000000 --- a/toolkit/content/tests/browser/common/mockTransfer.js +++ /dev/null @@ -1,67 +0,0 @@ -/* 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/. */ - -Cc["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Ci.mozIJSSubScriptLoader) - .loadSubScript("chrome://mochikit/content/tests/SimpleTest/MockObjects.js", this); - -var mockTransferCallback; - -/** - * This "transfer" object implementation continues the currently running test - * when the download is completed, reporting true for success or false for - * failure as the first argument of the testRunner.continueTest function. - */ -function MockTransfer() { - this._downloadIsSuccessful = true; -} - -MockTransfer.prototype = { - QueryInterface: XPCOMUtils.generateQI([ - Ci.nsIWebProgressListener, - Ci.nsIWebProgressListener2, - Ci.nsITransfer, - ]), - - /* nsIWebProgressListener */ - onStateChange: function MTFC_onStateChange(aWebProgress, aRequest, - aStateFlags, aStatus) { - // If at least one notification reported an error, the download failed. - if (!Components.isSuccessCode(aStatus)) - this._downloadIsSuccessful = false; - - // If the download is finished - if ((aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) && - (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)) - // Continue the test, reporting the success or failure condition. - mockTransferCallback(this._downloadIsSuccessful); - }, - onProgressChange: function () {}, - onLocationChange: function () {}, - onStatusChange: function MTFC_onStatusChange(aWebProgress, aRequest, aStatus, - aMessage) { - // If at least one notification reported an error, the download failed. - if (!Components.isSuccessCode(aStatus)) - this._downloadIsSuccessful = false; - }, - onSecurityChange: function () {}, - - /* nsIWebProgressListener2 */ - onProgressChange64: function () {}, - onRefreshAttempted: function () {}, - - /* nsITransfer */ - init: function() {}, - setSha256Hash: function() {}, - setSignatureInfo: function() {} -}; - -// Create an instance of a MockObjectRegisterer whose methods can be used to -// temporarily replace the default "@mozilla.org/transfer;1" object factory with -// one that provides the mock implementation above. To activate the mock object -// factory, call the "register" method. Starting from that moment, all the -// transfer objects that are requested will be mock objects, until the -// "unregister" method is called. -var mockTransferRegisterer = - new MockObjectRegisterer("@mozilla.org/transfer;1", MockTransfer); diff --git a/toolkit/content/tests/browser/data/post_form_inner.sjs b/toolkit/content/tests/browser/data/post_form_inner.sjs deleted file mode 100644 index ce72159d8..000000000 --- a/toolkit/content/tests/browser/data/post_form_inner.sjs +++ /dev/null @@ -1,31 +0,0 @@ -/* 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/. */ - -const CC = Components.Constructor; -const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1", - "nsIBinaryInputStream", - "setInputStream"); - -function handleRequest(request, response) -{ - var body = - '\ - \ - Inner POST data: '; - - var bodyStream = new BinaryInputStream(request.bodyInputStream); - var bytes = [], avail = 0; - while ((avail = bodyStream.available()) > 0) - body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail)); - - body += - '
\ - \ - \ -
\ - \ - '; - - response.bodyOutputStream.write(body, body.length); -} diff --git a/toolkit/content/tests/browser/data/post_form_outer.sjs b/toolkit/content/tests/browser/data/post_form_outer.sjs deleted file mode 100644 index 89256fcfb..000000000 --- a/toolkit/content/tests/browser/data/post_form_outer.sjs +++ /dev/null @@ -1,34 +0,0 @@ -/* 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/. */ - -const CC = Components.Constructor; -const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1", - "nsIBinaryInputStream", - "setInputStream"); - -function handleRequest(request, response) -{ - var body = - '\ - \ - Outer POST data: '; - - var bodyStream = new BinaryInputStream(request.bodyInputStream); - var bytes = [], avail = 0; - while ((avail = bodyStream.available()) > 0) - body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail)); - - body += - '
\ - \ - \ -
\ - \ - diff --git a/toolkit/content/tests/browser/file_mediaPlaybackFrame2.html b/toolkit/content/tests/browser/file_mediaPlaybackFrame2.html deleted file mode 100644 index d96a4cd4e..000000000 --- a/toolkit/content/tests/browser/file_mediaPlaybackFrame2.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/toolkit/content/tests/browser/file_multipleAudio.html b/toolkit/content/tests/browser/file_multipleAudio.html deleted file mode 100644 index 5dc37febb..000000000 --- a/toolkit/content/tests/browser/file_multipleAudio.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/toolkit/content/tests/browser/file_multiplePlayingAudio.html b/toolkit/content/tests/browser/file_multiplePlayingAudio.html deleted file mode 100644 index ae122506f..000000000 --- a/toolkit/content/tests/browser/file_multiplePlayingAudio.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - diff --git a/toolkit/content/tests/browser/file_redirect.html b/toolkit/content/tests/browser/file_redirect.html deleted file mode 100644 index 4d5fa9dfd..000000000 --- a/toolkit/content/tests/browser/file_redirect.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -redirecting... - - -redirectin u bro - - diff --git a/toolkit/content/tests/browser/file_redirect_to.html b/toolkit/content/tests/browser/file_redirect_to.html deleted file mode 100644 index 28c0b5371..000000000 --- a/toolkit/content/tests/browser/file_redirect_to.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -redirected! - - -u got redirected, bro - - diff --git a/toolkit/content/tests/browser/head.js b/toolkit/content/tests/browser/head.js deleted file mode 100644 index d7ed7a9ff..000000000 --- a/toolkit/content/tests/browser/head.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/Promise.jsm"); - -/** - * 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(); - }); - findbar.close(); - }); -} - -function pushPrefs(...aPrefs) { - let deferred = Promise.defer(); - SpecialPowers.pushPrefEnv({"set": aPrefs}, deferred.resolve); - return deferred.promise; -} - -/** - * Helper class for testing datetime input picker widget - */ -class DateTimeTestHelper { - constructor() { - this.panel = document.getElementById("DateTimePickerPanel"); - 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 - */ - async openPicker(pageUrl) { - this.tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl); - await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser); - // If dateTimePopupFrame doesn't exist yet, wait for the binding to be attached - if (!this.panel.dateTimePopupFrame) { - await BrowserTestUtils.waitForEvent(this.panel, "DateTimePickerBindingReady") - } - this.frame = this.panel.dateTimePopupFrame; - await this.waitForPickerReady(); - } - - async waitForPickerReady() { - await BrowserTestUtils.waitForEvent(this.frame, "load", true); - // Wait for picker elements to be ready - await BrowserTestUtils.waitForEvent(this.frame.contentDocument, "PickerReady"); - } - - /** - * 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 = new Promise(resolve => { - this.panel.addEventListener("popuphidden", resolve, {once: true}); - }); - this.panel.hidePopup(); - this.panel.closePicker(); - await pickerClosePromise; - } - await 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; - } -} diff --git a/toolkit/content/tests/browser/image.jpg b/toolkit/content/tests/browser/image.jpg deleted file mode 100644 index 5031808ad..000000000 Binary files a/toolkit/content/tests/browser/image.jpg and /dev/null differ diff --git a/toolkit/content/tests/browser/image_page.html b/toolkit/content/tests/browser/image_page.html deleted file mode 100644 index 522a1d8cf..000000000 --- a/toolkit/content/tests/browser/image_page.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - -OHAI - - - - diff --git a/toolkit/content/tests/chrome/.eslintrc.js b/toolkit/content/tests/chrome/.eslintrc.js deleted file mode 100644 index 2c669d844..000000000 --- a/toolkit/content/tests/chrome/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" - ] -}; diff --git a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js deleted file mode 100644 index 34f25d2f8..000000000 --- a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js +++ /dev/null @@ -1,161 +0,0 @@ -/* This code is mostly copied from chrome/test/unit/head_crtestutils.js */ - -const NS_CHROME_MANIFESTS_FILE_LIST = "ChromeML"; -const XUL_CACHE_PREF = "nglayout.debug.disable_xul_cache"; - -var Cc = Components.classes; -var Ci = Components.interfaces; -var Cr = Components.results; - -var gDirSvc = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIDirectoryService).QueryInterface(Ci.nsIProperties); -var gChromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]. - getService(Ci.nsIXULChromeRegistry); -var gPrefs = Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefBranch); - -// 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 = gDirSvc.get("ProfD", Ci.nsIFile); - 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 ioSvc = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); - var testsDir = ioSvc.newURI(directory, null, null) - .QueryInterface(Ci.nsIFileURL).file; - - let en = testsDir.directoryEntries; - while (en.hasMoreElements()) { - let file = en.getNext(); - yield file.QueryInterface(Ci.nsIFile); - } -} - -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 = gDirSvc.get("ProfD", Ci.nsIFile); - tmpdir.append(subdirname); - tmpdir.createUnique(Components.interfaces.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 (f in files) { - files[f].copyTo(tmpdir, ""); - } - return tmpdir; - -} - -function convertChromeURI(chromeURI) -{ - let uri = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService).newURI(chromeURI, null, null); - 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) -{ - gPrefs.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); - - gChromeReg.refreshSkins(); - - return function() { - tempfile.fileSize = 0; // truncate the manifest - gChromeReg.checkForNewChrome(); - gChromeReg.refreshSkins(); - gPrefs.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) -{ - gPrefs.setBoolPref(XUL_CACHE_PREF, true); - - let file = chromeURIToFile(manifestURI); - - let tempfile = copyToTemporaryFile(file); - Components.manager.QueryInterface(Ci.nsIComponentRegistrar). - autoRegister(tempfile); - - gChromeReg.refreshSkins(); - - return function() { - tempfile.fileSize = 0; // truncate the manifest - gChromeReg.checkForNewChrome(); - gChromeReg.refreshSkins(); - gPrefs.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.xul b/toolkit/content/tests/chrome/bug263683_window.xul deleted file mode 100644 index 46985a7ad..000000000 --- a/toolkit/content/tests/chrome/bug263683_window.xul +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug304188_window.xul b/toolkit/content/tests/chrome/bug304188_window.xul deleted file mode 100644 index 931fd5c73..000000000 --- a/toolkit/content/tests/chrome/bug304188_window.xul +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug331215_window.xul b/toolkit/content/tests/chrome/bug331215_window.xul deleted file mode 100644 index 757ce61b8..000000000 --- a/toolkit/content/tests/chrome/bug331215_window.xul +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug360437_window.xul b/toolkit/content/tests/chrome/bug360437_window.xul deleted file mode 100644 index 08498b58b..000000000 --- a/toolkit/content/tests/chrome/bug360437_window.xul +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug366992_window.xul b/toolkit/content/tests/chrome/bug366992_window.xul deleted file mode 100644 index a1e2ae1af..000000000 --- a/toolkit/content/tests/chrome/bug366992_window.xul +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug409624_window.xul b/toolkit/content/tests/chrome/bug409624_window.xul deleted file mode 100644 index 002cbe042..000000000 --- a/toolkit/content/tests/chrome/bug409624_window.xul +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug429723_window.xul b/toolkit/content/tests/chrome/bug429723_window.xul deleted file mode 100644 index 28439ae8e..000000000 --- a/toolkit/content/tests/chrome/bug429723_window.xul +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug451540_window.xul b/toolkit/content/tests/chrome/bug451540_window.xul deleted file mode 100644 index 3c08c95c9..000000000 --- a/toolkit/content/tests/chrome/bug451540_window.xul +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/bug624329_window.xul b/toolkit/content/tests/chrome/bug624329_window.xul deleted file mode 100644 index efca39d3b..000000000 --- a/toolkit/content/tests/chrome/bug624329_window.xul +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/chrome.ini b/toolkit/content/tests/chrome/chrome.ini deleted file mode 100644 index 2b9be4c8e..000000000 --- a/toolkit/content/tests/chrome/chrome.ini +++ /dev/null @@ -1,199 +0,0 @@ -[DEFAULT] -skip-if = os == 'android' -support-files = - ../widgets/popup_shared.js - ../widgets/tree_shared.js - RegisterUnregisterChrome.js - bug263683_window.xul - bug304188_window.xul - bug331215_window.xul - bug360437_window.xul - bug366992_window.xul - bug409624_window.xul - bug429723_window.xul - bug624329_window.xul - dialog_dialogfocus.xul - file_about_networking_wsh.py - file_autocomplete_with_composition.js - findbar_entireword_window.xul - findbar_events_window.xul - findbar_window.xul - frame_popup_anchor.xul - frame_popupremoving_frame.xul - frame_subframe_origin_subframe1.xul - frame_subframe_origin_subframe2.xul - popup_childframe_node.xul - popup_trigger.js - sample_entireword_latin1.html - window_browser_drop.xul - window_keys.xul - window_largemenu.xul - window_panel.xul - window_popup_anchor.xul - window_popup_anchoratrect.xul - window_popup_attribute.xul - window_popup_button.xul - window_popup_preventdefault_chrome.xul - window_preferences.xul - window_preferences2.xul - window_preferences3.xul - window_preferences_commandretarget.xul - window_screenPosSize.xul - window_showcaret.xul - window_subframe_origin.xul - window_titlebar.xul - window_tooltip.xul - xul_selectcontrol.js - rtlchrome/rtl.css - rtlchrome/rtl.dtd - rtlchrome/rtl.manifest - rtltest/righttoleft.manifest - rtltest/content/dirtest.xul - -[test_about_networking.html] -[test_arrowpanel.xul] -[test_autocomplete2.xul] -[test_autocomplete3.xul] -[test_autocomplete4.xul] -[test_autocomplete5.xul] -[test_autocomplete_delayOnPaste.xul] -subsuite = clipboard -[test_autocomplete_emphasis.xul] -[test_autocomplete_with_composition_on_input.html] -[test_autocomplete_with_composition_on_textbox.xul] -[test_autocomplete_placehold_last_complete.xul] -[test_browser_drop.xul] -[test_bug253481.xul] -subsuite = clipboard -[test_bug263683.xul] -[test_bug304188.xul] -[test_bug331215.xul] -[test_bug360220.xul] -[test_bug360437.xul] -skip-if = os == 'linux' # Bug 1264604 -[test_bug365773.xul] -[test_bug366992.xul] -[test_bug382990.xul] -[test_bug409624.xul] -[test_bug418874.xul] -[test_bug429723.xul] -[test_bug437844.xul] -[test_bug457632.xul] -[test_bug460942.xul] -[test_bug471776.xul] -[test_bug509732.xul] -[test_bug554279.xul] -[test_bug557987.xul] -[test_bug562554.xul] -[test_bug570192.xul] -[test_bug585946.xul] -[test_bug624329.xul] -skip-if = (os == 'mac' && os_version == '10.10') # Unexpectedly perma-passes on OSX 10.10 -[test_bug792324.xul] -[test_bug1048178.xul] -skip-if = toolkit == "cocoa" -[test_button.xul] -[test_closemenu_attribute.xul] -[test_colorpicker_popup.xul] -[test_contextmenu_list.xul] -[test_datepicker.xul] -[test_deck.xul] -[test_dialogfocus.xul] -[test_findbar.xul] -subsuite = clipboard -[test_findbar_entireword.xul] -[test_findbar_events.xul] -[test_focus_anons.xul] -[test_hiddenitems.xul] -[test_hiddenpaging.xul] -[test_keys.xul] -[test_labelcontrol.xul] -[test_largemenu.xul] -skip-if = os == 'linux' && !debug #Bug 1207174 -[test_menu.xul] -[test_menu_anchored.xul] -[test_menu_hide.xul] -[test_menuchecks.xul] -[test_menuitem_blink.xul] -[test_menuitem_commands.xul] -[test_menulist.xul] -[test_menulist_keynav.xul] -[test_menulist_null_value.xul] -[test_menulist_paging.xul] -[test_menulist_position.xul] -[test_mousescroll.xul] -[test_notificationbox.xul] -[test_panel.xul] -[test_panelfrommenu.xul] -[test_popup_anchor.xul] -[test_popup_anchoratrect.xul] -skip-if = os == 'linux' # 1167694 -[test_popup_attribute.xul] -skip-if = os == 'linux' && asan #Bug 1131634 -[test_popup_button.xul] -skip-if = os == 'linux' && asan # Bug 1281360 -[test_popup_coords.xul] -[test_popup_keys.xul] -[test_popup_moveToAnchor.xul] -[test_popup_preventdefault.xul] -[test_popup_preventdefault_chrome.xul] -[test_popup_recreate.xul] -[test_popup_scaled.xul] -[test_popup_tree.xul] -[test_popuphidden.xul] -[test_popupincontent.xul] -[test_popupremoving.xul] -[test_popupremoving_frame.xul] -[test_position.xul] -[test_preferences.xul] -[test_preferences_beforeaccept.xul] -support-files = window_preferences_beforeaccept.xul -[test_preferences_onsyncfrompreference.xul] -support-files = window_preferences_onsyncfrompreference.xul -[test_progressmeter.xul] -[test_props.xul] -[test_radio.xul] -[test_richlist_direction.xul] -[test_righttoleft.xul] -[test_scale.xul] -[test_scaledrag.xul] -[test_screenPersistence.xul] -[test_scrollbar.xul] -[test_showcaret.xul] -[test_sorttemplate.xul] -[test_statusbar.xul] -[test_subframe_origin.xul] -[test_tabbox.xul] -[test_tabindex.xul] -[test_textbox_dictionary.xul] -[test_textbox_emptytext.xul] -[test_textbox_number.xul] -[test_textbox_search.xul] -[test_timepicker.xul] -[test_titlebar.xul] -skip-if = os == "linux" -[test_toolbar.xul] -[test_tooltip.xul] -skip-if = (os == 'mac' && os_version == '10.10') # Bug 1141245, frequent timeouts on OSX 10.10 -[test_tooltip_noautohide.xul] -[test_tree.xul] -[test_tree_hier.xul] -[test_tree_hier_cell.xul] -[test_tree_single.xul] -[test_tree_view.xul] -# test_panel_focus.xul 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.xul] -support-files = window_panel_focus.xul -skip-if = toolkit == "cocoa" -[test_chromemargin.xul] -support-files = window_chromemargin.xul -skip-if = toolkit == "cocoa" -[test_bug451540.xul] -support-files = bug451540_window.xul -[test_autocomplete_mac_caret.xul] -skip-if = toolkit != "cocoa" -[test_cursorsnap.xul] -disabled = -#skip-if = os != "win" -support-files = window_cursorsnap_dialog.xul window_cursorsnap_wizard.xul diff --git a/toolkit/content/tests/chrome/dialog_dialogfocus.xul b/toolkit/content/tests/chrome/dialog_dialogfocus.xul deleted file mode 100644 index 770695ed3..000000000 --- a/toolkit/content/tests/chrome/dialog_dialogfocus.xul +++ /dev/null @@ -1,57 +0,0 @@ - - - - - diff --git a/toolkit/content/tests/chrome/file_about_networking_wsh.py b/toolkit/content/tests/chrome/file_about_networking_wsh.py deleted file mode 100644 index 17ad250e5..000000000 --- a/toolkit/content/tests/chrome/file_about_networking_wsh.py +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index 881e772ad..000000000 --- a/toolkit/content/tests/chrome/file_autocomplete_with_composition.js +++ /dev/null @@ -1,540 +0,0 @@ -// 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: function () { return "not initialized"; }, - _onFinish: null, - - _doTests: function () - { - 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); - - waitForCondition(() => { - return this._controller.searchStatus >= - Components.interfaces.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH; - }, - this._checkResult.bind(this)); - }, - - _checkResult: function () - { - 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: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "M", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "M", code: "KeyM", keyCode: KeyboardEvent.DOM_VK_M, - shiftKey: true }, - }, aWindow); - }, popup: false, value: "M", searchString: "" - }, - { description: "modifying composition string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "Mo", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "o", code: "KeyO", keyCode: KeyboardEvent.DOM_VK_O }, - }, aWindow); - }, popup: false, value: "Mo", searchString: "" - }, - { description: "compositionend should open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Enter", code: "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: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "z", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "z", code: "KeyZ", keyCode: KeyboardEvent.DOM_VK_Z }, - }, aWindow); - }, popup: false, value: "Moz", searchString: "Mo" - }, - { description: "modifying composition string shouldn't reopen the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "zi", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "i", code: "KeyI", keyCode: KeyboardEvent.DOM_VK_I }, - }, aWindow); - }, popup: false, value: "Mozi", searchString: "Mo" - }, - { description: "compositionend should research the result and open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Enter", code: "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: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "l", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "l", code: "KeyL", keyCode: KeyboardEvent.DOM_VK_L }, - }, aWindow); - }, popup: false, value: "Mozil", searchString: "Mozi" - }, - { description: "modifying composition string shouldn't reopen the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "ll", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "l", code: "KeyL", keyCode: KeyboardEvent.DOM_VK_L }, - }, aWindow); - }, popup: false, value: "Mozill", searchString: "Mozi" - }, - { description: "modifying composition string to empty string shouldn't reopen the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "", - "clauses": - [ - { "length": 0, "attr": 0 } - ] - }, - "caret": { "start": 0, "length": 0 } - }, aWindow); - }, popup: false, value: "Mozi", searchString: "Mozi" - }, - { description: "cancled compositionend should reopen the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommit", data: "", - key: { key: "KEY_Escape", code: "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: function (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", code: "KeyZ", keyCode: KeyboardEvent.DOM_VK_Z }, - }, aWindow); - }, popup: false, value: "Moz", searchString: "Mozi" - }, - { description: "modifying composition string shouldn't reopen the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "zi", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "i", code: "KeyI", keyCode: KeyboardEvent.DOM_VK_I }, - }, aWindow); - }, popup: false, value: "Mozi", searchString: "Mozi" - }, - { description: "modifying composition string to empty string shouldn't reopen the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "", - "clauses": - [ - { "length": 0, "attr": 0 } - ] - }, - "caret": { "start": 0, "length": 0 } - }, aWindow); - }, popup: false, value: "Mo", searchString: "Mozi" - }, - { description: "canceled compositionend should search the result with the latest value", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Escape", code: "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: function (aWindow) { - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, 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: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "M", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "m", code: "KeyM", keyCode: KeyboardEvent.DOM_VK_M, - shiftKey: true }, - }, aWindow); - }, popup: false, value: "M", searchString: "" - }, - { description: "modifying composition string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "Mo", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "o", code: "KeyO", keyCode: KeyboardEvent.DOM_VK_O }, - }, aWindow); - }, popup: false, value: "Mo", searchString: "" - }, - { description: "modifying composition string to empty string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "", - "clauses": - [ - { "length": 0, "attr": 0 } - ] - }, - "caret": { "start": 0, "length": 0 } - }, aWindow); - }, popup: false, value: "", searchString: "" - }, - { description: "canceled compositionend shouldn't open the popup if it was closed", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Escape", code: "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: function (aWindow) { - synthesizeKey("VK_DOWN", {}, 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: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "M", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "M", code: "KeyM", keyCode: KeyboardEvent.DOM_VK_M, - shiftKey: true }, - }, aWindow); - }, popup: false, value: "M", searchString: "" - }, - { description: "modifying composition string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "Mo", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "o", code: "KeyO", keyCode: KeyboardEvent.DOM_VK_O }, - }, aWindow); - }, popup: false, value: "Mo", searchString: "" - }, - { description: "modifying composition string to empty string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "", - "clauses": - [ - { "length": 0, "attr": 0 } - ] - }, - "caret": { "start": 0, "length": 0 } - }, aWindow); - }, popup: false, value: "", searchString: "" - }, - { description: "canceled compositionend should open the popup if it was opened", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Escape", code: "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: function (aWindow) { - synthesizeKey("M", { shiftKey: true }, aWindow); - synthesizeKey("o", { shiftKey: true }, aWindow); - synthesizeKey("VK_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: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "z", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "z", code: "KeyZ", keyCode: KeyboardEvent.DOM_VK_Z }, - }, aWindow); - }, popup: false, value: "Moz", searchString: "Mo" - }, - { description: "modifying composition string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "zi", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "i", code: "KeyI", keyCode: KeyboardEvent.DOM_VK_I }, - }, aWindow); - }, popup: false, value: "Mozi", searchString: "Mo" - }, - { description: "modifying composition string to empty string shouldn't open the popup", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "", - "clauses": - [ - { "length": 0, "attr": 0 } - ] - }, - "caret": { "start": 0, "length": 0 } - }, aWindow); - }, popup: false, value: "Mo", searchString: "Mo" - }, - { description: "canceled compositionend shouldn't open the popup if the popup was closed", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Escape", code: "Escape" } }, aWindow); - }, popup: true, value: "Mo", searchString: "Mo" - }, - // House keeping... - { description: "house keeping for next tests", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - }, popup: false, value: "", searchString: "" - }, - // Testing for nsIAutoCompleteInput.completeDefaultIndex being true. - { description: "compositionstart shouldn't open the popup (completeDefaultIndex is true)", - completeDefaultIndex: true, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "M", - "clauses": - [ - { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 1, "length": 0 }, - "key": { key: "M", code: "KeyM", keyCode: KeyboardEvent.DOM_VK_M, - shiftKey: true }, - }, aWindow); - }, popup: false, value: "M", searchString: "" - }, - { description: "modifying composition string shouldn't open the popup (completeDefaultIndex is true)", - completeDefaultIndex: true, - execute: function (aWindow) { - synthesizeCompositionChange( - { "composition": - { "string": "Mo", - "clauses": - [ - { "length": 2, "attr": COMPOSITION_ATTR_RAW_CLAUSE } - ] - }, - "caret": { "start": 2, "length": 0 }, - "key": { key: "o", code: "KeyO", keyCode: KeyboardEvent.DOM_VK_O }, - }, aWindow); - }, popup: false, value: "Mo", searchString: "" - }, - { description: "compositionend should open the popup (completeDefaultIndex is true)", - completeDefaultIndex: true, - execute: function (aWindow) { - synthesizeComposition({ type: "compositioncommitasis", - key: { key: "KEY_Enter", code: "Enter" } }, aWindow); - }, popup: true, value: "Mozilla", searchString: "Mo" - }, - // House keeping... - { description: "house keeping for next tests", - completeDefaultIndex: false, - execute: function (aWindow) { - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - synthesizeKey("VK_BACK_SPACE", {}, aWindow); - }, popup: false, value: "", searchString: "" - } - ] -}; diff --git a/toolkit/content/tests/chrome/findbar_entireword_window.xul b/toolkit/content/tests/chrome/findbar_entireword_window.xul deleted file mode 100644 index f0da61081..000000000 --- a/toolkit/content/tests/chrome/findbar_entireword_window.xul +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/findbar_events_window.xul b/toolkit/content/tests/chrome/findbar_events_window.xul deleted file mode 100644 index 2bfc52c14..000000000 --- a/toolkit/content/tests/chrome/findbar_events_window.xul +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/findbar_window.xul b/toolkit/content/tests/chrome/findbar_window.xul deleted file mode 100644 index f17f760fe..000000000 --- a/toolkit/content/tests/chrome/findbar_window.xul +++ /dev/null @@ -1,756 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/frame_popup_anchor.xul b/toolkit/content/tests/chrome/frame_popup_anchor.xul deleted file mode 100644 index be6254ce0..000000000 --- a/toolkit/content/tests/chrome/frame_popup_anchor.xul +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - diff --git a/toolkit/content/tests/chrome/frame_popupremoving_frame.xul b/toolkit/content/tests/chrome/frame_popupremoving_frame.xul deleted file mode 100644 index e8f00ce7a..000000000 --- a/toolkit/content/tests/chrome/frame_popupremoving_frame.xul +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xul b/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xul deleted file mode 100644 index c85083cb7..000000000 --- a/toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xul +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - diff --git a/toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xul b/toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xul deleted file mode 100644 index 92ef64b89..000000000 --- a/toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xul +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - diff --git a/toolkit/content/tests/chrome/popup_childframe_node.xul b/toolkit/content/tests/chrome/popup_childframe_node.xul deleted file mode 100644 index 512f5f8c2..000000000 --- a/toolkit/content/tests/chrome/popup_childframe_node.xul +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/toolkit/content/tests/chrome/popup_trigger.js b/toolkit/content/tests/chrome/popup_trigger.js deleted file mode 100644 index 920d4d070..000000000 --- a/toolkit/content/tests/chrome/popup_trigger.js +++ /dev/null @@ -1,859 +0,0 @@ -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, false); - synthesizeMouse(document.documentElement, 0, 0, modifiers); - window.removeEventListener("mousedown", mouseFn, false); - - 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.boxObject instanceof MenuBoxObject; - - // 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: function() { - // 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, { }); - }, - result: function (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"); - - // 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: function() { synthesizeKey("VK_DOWN", { }); }, - result: function(testname) { checkActive(gMenuPopup, "item1", testname); } -}, -{ - // check that pressing cursor up wraps and highlights the last item - testname: "cursor up wrap", - events: [ "DOMMenuItemInactive item1", "DOMMenuItemActive last" ], - test: function() { synthesizeKey("VK_UP", { }); }, - result: function(testname) { - checkActive(gMenuPopup, "last", testname); - } -}, -{ - // check that pressing cursor down wraps and highlights the first item - testname: "cursor down wrap", - events: [ "DOMMenuItemInactive last", "DOMMenuItemActive item1" ], - test: function() { synthesizeKey("VK_DOWN", { }); }, - result: function(testname) { checkActive(gMenuPopup, "item1", testname); } -}, -{ - // check that pressing cursor down highlights the second item - testname: "cursor down", - events: [ "DOMMenuItemInactive item1", "DOMMenuItemActive item2" ], - test: function() { synthesizeKey("VK_DOWN", { }); }, - result: function(testname) { checkActive(gMenuPopup, "item2", testname); } -}, -{ - // check that pressing cursor up highlights the second item - testname: "cursor up", - events: [ "DOMMenuItemInactive item2", "DOMMenuItemActive item1" ], - test: function() { synthesizeKey("VK_UP", { }); }, - result: function(testname) { checkActive(gMenuPopup, "item1", testname); } -}, -{ - // cursor left should not do anything - testname: "cursor left", - test: function() { synthesizeKey("VK_LEFT", { }); }, - result: function(testname) { checkActive(gMenuPopup, "item1", testname); } -}, -{ - // cursor right should not do anything - testname: "cursor right", - test: function() { synthesizeKey("VK_RIGHT", { }); }, - result: function(testname) { checkActive(gMenuPopup, "item1", testname); } -}, -{ - // check cursor down when a disabled item exists in the menu - testname: "cursor down disabled", - events: function() { - // 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: function() { - document.getElementById("item2").disabled = true; - synthesizeKey("VK_DOWN", { }); - } -}, -{ - // check cursor up when a disabled item exists in the menu - testname: "cursor up disabled", - events: function() { - 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: function() { - if (navigator.platform.indexOf("Win") == 0) - synthesizeKey("VK_DOWN", { }); - synthesizeKey("VK_UP", { }); - if (navigator.platform.indexOf("Win") == 0) - synthesizeKey("VK_UP", { }); - } -}, -{ - testname: "mouse click outside", - events: [ "popuphiding thepopup", "popuphidden thepopup", - "DOMMenuItemInactive item1", "DOMMenuInactive thepopup" ], - test: function() { - 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: function(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: function(testname, step) { - gExpectedTriggerNode = "notset"; - gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false); - }, - result: function(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: function(testname, step) { - gMenuPopup.setAttribute("style", "margin: 10px;"); - gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false); - }, - result: function(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: function(testname, step) { - gMenuPopup.setAttribute("style", "margin: -8px;"); - gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false); - }, - result: function(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: function(testname, step) { - gMenuPopup.setAttribute("style", "margin: 1000px;"); - gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false); - }, - result: function(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: function(testname, step) { - gMenuPopup.setAttribute("style", "margin: -1000px;"); - gMenuPopup.openPopup(gTrigger, step, 0, 0, false, false); - }, - result: function(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: function() { - gMenuPopup.openPopup(gTrigger, "other", 0, 0, false, false); - }, - result: function (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: function(testname, step) { - gMenuPopup.setAttribute("position", step); - gMenuPopup.openPopup(gTrigger, "", 0, 0, false, false); - }, - result: function(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: function(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: function(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: function(testname, step) { - synthesizeKey("VK_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: function(testname, step) { - // attribute is empty so does not override - gMenuPopup.setAttribute("position", ""); - gMenuPopup.openPopup(gTrigger, "before_start", 5, 10, true, true); - }, - result: function(testname, step) { compareEdge(gTrigger, gMenuPopup, "before_start", 5, 10, testname); } -}, -{ - // these tests check to ensure that passing an anchor and position - // puts the popup in the right place - testname: "show popup anchored", - condition: function() { - // only perform this test for popups not in a menu, such as those using - // the popup attribute, as the showPopup implementation in popup.xml - // calls openMenu if the popup is inside a menu - return !gIsMenu; - }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - autohide: "thepopup", - steps: [["topleft", "topleft"], - ["topleft", "topright"], ["topleft", "bottomleft"], - ["topright", "topleft"], ["topright", "bottomright"], - ["bottomleft", "bottomright"], ["bottomleft", "topleft"], - ["bottomright", "bottomleft"], ["bottomright", "topright"]], - test: function(testname, step) { - // the attributes should be ignored - gMenuPopup.setAttribute("popupanchor", "topright"); - gMenuPopup.setAttribute("popupalign", "bottomright"); - gMenuPopup.setAttribute("position", "end_after"); - gMenuPopup.showPopup(gTrigger, -1, -1, "popup", step[0], step[1]); - }, - result: function(testname, step) { - var pos = convertPosition(step[0], step[1]); - compareEdge(gTrigger, gMenuPopup, pos, 0, 0, testname); - gMenuPopup.removeAttribute("popupanchor"); - gMenuPopup.removeAttribute("popupalign"); - gMenuPopup.removeAttribute("position"); - } -}, -{ - testname: "show popup with position", - condition: function() { return !gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - autohide: "thepopup", - test: function(testname, step) { - gMenuPopup.showPopup(gTrigger, gScreenX + 60, gScreenY + 15, - "context", "topleft", "bottomright"); - }, - result: function(testname, step) { - var rect = gMenuPopup.getBoundingClientRect(); - ok(true, gScreenX + "," + gScreenY); - is(rect.left, 60, testname + " left"); - is(rect.top, 15, testname + " top"); - ok(rect.right, testname + " right is " + rect.right); - ok(rect.bottom, testname + " bottom is " + rect.bottom); - } -}, -{ - // 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: function(testname, step) { gMenuPopup.openPopup(null, "after_start", 6, 8, false); }, - result: function(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: function(testname, step) { - var item3 = document.getElementById("item3"); - synthesizeMouse(item3, 4, 4, { }); - }, - result: function(testname, step) { checkClosed("trigger", testname); } -}, -{ - testname: "close popup", - condition: function() { return false; }, - events: [ "popuphiding thepopup", "popuphidden thepopup", - "DOMMenuInactive thepopup" ], - test: function(testname, step) { gMenuPopup.hidePopup(); } -}, -{ - testname: "open popup at screen", - events: [ "popupshowing thepopup", "popupshown thepopup" ], - test: function(testname, step) { - gExpectedTriggerNode = "notset"; - gMenuPopup.openPopupAtScreen(gScreenX + 24, gScreenY + 20, false); - }, - result: function(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: function() { synthesizeKey("M", { }); }, - result: function(testname) { checkClosed("trigger", testname); } -}, -{ - testname: "open context popup at screen", - events: [ "popupshowing thepopup 0010", "popupshown thepopup" ], - test: function(testname, step) { - gExpectedTriggerNode = gCachedEvent.target; - gMenuPopup.openPopupAtScreen(gScreenX + 8, gScreenY + 16, true, gCachedEvent); - }, - result: function(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"), "xnull", - "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: function() { synthesizeKey("O", { }); }, - result: function(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: function() { synthesizeKey("O", { }); }, - result: function(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: function() { synthesizeKey("VK_RIGHT", { }); }, - result: function(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: function() { synthesizeKey("VK_LEFT", { }); }, - result: function(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: function() { synthesizeKey("VK_RETURN", { }); }, - result: function(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: function() { synthesizeKey("VK_ESCAPE", { }); }, - result: function(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: function() { - 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: function() { synthesizeKey("O", { }); synthesizeKey("F", { }); }, - result: function(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: function() { synthesizeKey("G", { }); }, - result: function(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: function() { synthesizeKey("M", { }); }, - result: function(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: function(testname, step) { - gMenuPopup.openPopupAtScreen(gScreenX + 8, gScreenY + 16, true, gCachedEvent2); - } -}, -{ - testname: "open popup with open property", - events: [ "popupshowing thepopup", "popupshown thepopup" ], - test: function(testname, step) { openMenu(gTrigger); }, - result: function(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: function(testname, step) { openMenu(document.getElementById("submenu")); }, - result: function(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: function() { gMenuPopup.hidePopup(); }, - result: function(testname, step) { - checkClosed("trigger", testname); - checkClosed("submenu", testname); - } -}, -{ - testname: "open submenu with open property without parent open", - test: function(testname, step) { openMenu(document.getElementById("submenu")); }, - result: function(testname, step) { - checkClosed("trigger", testname); - checkClosed("submenu", testname); - } -}, -{ - testname: "open popup with open property and position", - condition: function() { return gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - test: function(testname, step) { - gMenuPopup.setAttribute("position", "before_start"); - openMenu(gTrigger); - }, - result: function(testname, step) { - compareEdge(gTrigger, gMenuPopup, "before_start", 0, 0, testname); - } -}, -{ - testname: "close popup with open property", - condition: function() { return gIsMenu; }, - events: [ "popuphiding thepopup", "popuphidden thepopup", - "DOMMenuInactive thepopup" ], - test: function(testname, step) { closeMenu(gTrigger, gMenuPopup); }, - result: function(testname, step) { checkClosed("trigger", testname); } -}, -{ - testname: "open popup with open property, position, anchor and alignment", - condition: function() { return gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - autohide: "thepopup", - test: function(testname, step) { - gMenuPopup.setAttribute("position", "start_after"); - gMenuPopup.setAttribute("popupanchor", "topright"); - gMenuPopup.setAttribute("popupalign", "bottomright"); - openMenu(gTrigger); - }, - result: function(testname, step) { - compareEdge(gTrigger, gMenuPopup, "start_after", 0, 0, testname); - } -}, -{ - testname: "open popup with open property, anchor and alignment", - condition: function() { return gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - autohide: "thepopup", - test: function(testname, step) { - gMenuPopup.removeAttribute("position"); - gMenuPopup.setAttribute("popupanchor", "bottomright"); - gMenuPopup.setAttribute("popupalign", "topright"); - openMenu(gTrigger); - }, - result: function(testname, step) { - compareEdge(gTrigger, gMenuPopup, "after_end", 0, 0, testname); - gMenuPopup.removeAttribute("popupanchor"); - gMenuPopup.removeAttribute("popupalign"); - } -}, -{ - testname: "focus and cursor down on trigger", - condition: function() { return gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - autohide: "thepopup", - test: function(testname, step) { - gTrigger.focus(); - synthesizeKey("VK_DOWN", { altKey: !platformIsMac() }); - }, - result: function(testname, step) { - checkOpen("trigger", testname); - checkActive(gMenuPopup, "", testname); - } -}, -{ - testname: "focus and cursor up on trigger", - condition: function() { return gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - test: function(testname, step) { - gTrigger.focus(); - synthesizeKey("VK_UP", { altKey: !platformIsMac() }); - }, - result: function(testname, step) { - checkOpen("trigger", testname); - checkActive(gMenuPopup, "", testname); - } -}, -{ - testname: "select and enter on menuitem", - condition: function() { return gIsMenu; }, - events: [ "DOMMenuItemActive item1", "DOMMenuItemInactive item1", - "DOMMenuInactive thepopup", "command item1", - "popuphiding thepopup", "popuphidden thepopup", - "DOMMenuItemInactive item1" ], - test: function(testname, step) { - synthesizeKey("VK_DOWN", { }); - synthesizeKey("VK_RETURN", { }); - }, - result: function(testname, step) { checkClosed("trigger", testname); } -}, -{ - testname: "focus trigger and key to open", - condition: function() { return gIsMenu; }, - events: [ "popupshowing thepopup", "popupshown thepopup" ], - autohide: "thepopup", - test: function(testname, step) { - gTrigger.focus(); - synthesizeKey(platformIsMac() ? " " : "VK_F4", { }); - }, - result: function(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: function() { return gIsMenu; }, - test: function(testname, step) { - gTrigger.focus(); - if (platformIsMac()) - synthesizeKey("VK_F4", { altKey: true }); - else - synthesizeKey("", { metaKey: true }); - }, - result: function(testname, step) { - checkClosed("trigger", testname); - } -}, -{ - testname: "mouse click on disabled menu", - condition: function() { return gIsMenu; }, - test: function(testname, step) { - gTrigger.setAttribute("disabled", "true"); - synthesizeMouse(gTrigger, 4, 4, { }); - }, - result: function(testname, step) { - checkClosed("trigger", testname); - gTrigger.removeAttribute("disabled"); - } -}, -{ - // 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: function(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: function(testname, step) { - var submenupopup = document.getElementById("submenupopup"); - submenupopup.parentNode.removeChild(submenupopup); - var popup = document.getElementById("thepopup"); - popup.parentNode.removeChild(popup); - } -} - -]; - -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 deleted file mode 100644 index 0fea01001..000000000 --- a/toolkit/content/tests/chrome/rtlchrome/rtl.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Imitate RTL UI */ -window { direction: rtl; } diff --git a/toolkit/content/tests/chrome/rtlchrome/rtl.dtd b/toolkit/content/tests/chrome/rtlchrome/rtl.dtd deleted file mode 100644 index 8b32de674..000000000 --- a/toolkit/content/tests/chrome/rtlchrome/rtl.dtd +++ /dev/null @@ -1 +0,0 @@ - diff --git a/toolkit/content/tests/chrome/rtlchrome/rtl.manifest b/toolkit/content/tests/chrome/rtlchrome/rtl.manifest deleted file mode 100644 index a4cc6929b..000000000 --- a/toolkit/content/tests/chrome/rtlchrome/rtl.manifest +++ /dev/null @@ -1,5 +0,0 @@ -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/rtltest/content/dirtest.xul b/toolkit/content/tests/chrome/rtltest/content/dirtest.xul deleted file mode 100644 index b75d41eaa..000000000 --- a/toolkit/content/tests/chrome/rtltest/content/dirtest.xul +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -hbox, vbox { background-color: white; } -hbox:-moz-locale-dir(ltr) { background-color: yellow; } -vbox:-moz-locale-dir(rtl) { background-color: green; } - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_colorpicker_popup.xul b/toolkit/content/tests/chrome/test_colorpicker_popup.xul deleted file mode 100644 index 3ac84260b..000000000 --- a/toolkit/content/tests/chrome/test_colorpicker_popup.xul +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_contextmenu_list.xul b/toolkit/content/tests/chrome/test_contextmenu_list.xul deleted file mode 100644 index 157831a58..000000000 --- a/toolkit/content/tests/chrome/test_contextmenu_list.xul +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_menuitem_blink.xul b/toolkit/content/tests/chrome/test_menuitem_blink.xul deleted file mode 100644 index 319c284fd..000000000 --- a/toolkit/content/tests/chrome/test_menuitem_blink.xul +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_menuitem_commands.xul b/toolkit/content/tests/chrome/test_menuitem_commands.xul deleted file mode 100644 index e31774ccc..000000000 --- a/toolkit/content/tests/chrome/test_menuitem_commands.xul +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - diff --git a/toolkit/content/tests/chrome/test_popup_anchor.xul b/toolkit/content/tests/chrome/test_popup_anchor.xul deleted file mode 100644 index 5839c52a3..000000000 --- a/toolkit/content/tests/chrome/test_popup_anchor.xul +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_anchoratrect.xul b/toolkit/content/tests/chrome/test_popup_anchoratrect.xul deleted file mode 100644 index c12e22502..000000000 --- a/toolkit/content/tests/chrome/test_popup_anchoratrect.xul +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_attribute.xul b/toolkit/content/tests/chrome/test_popup_attribute.xul deleted file mode 100644 index 2a256078d..000000000 --- a/toolkit/content/tests/chrome/test_popup_attribute.xul +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_button.xul b/toolkit/content/tests/chrome/test_popup_button.xul deleted file mode 100644 index 3803e465f..000000000 --- a/toolkit/content/tests/chrome/test_popup_button.xul +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_coords.xul b/toolkit/content/tests/chrome/test_popup_coords.xul deleted file mode 100644 index 4597b5cc0..000000000 --- a/toolkit/content/tests/chrome/test_popup_coords.xul +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_preventdefault_chrome.xul b/toolkit/content/tests/chrome/test_popup_preventdefault_chrome.xul deleted file mode 100644 index 46f14cd6a..000000000 --- a/toolkit/content/tests/chrome/test_popup_preventdefault_chrome.xul +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_recreate.xul b/toolkit/content/tests/chrome/test_popup_recreate.xul deleted file mode 100644 index 14822acbd..000000000 --- a/toolkit/content/tests/chrome/test_popup_recreate.xul +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -

-

- -
-
- - -
diff --git a/toolkit/content/tests/chrome/test_popup_scaled.xul b/toolkit/content/tests/chrome/test_popup_scaled.xul deleted file mode 100644 index 6bbf6c653..000000000 --- a/toolkit/content/tests/chrome/test_popup_scaled.xul +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/toolkit/content/tests/chrome/window_titlebar.xul b/toolkit/content/tests/chrome/window_titlebar.xul deleted file mode 100644 index e27782153..000000000 --- a/toolkit/content/tests/chrome/window_titlebar.xul +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - diff --git a/toolkit/content/tests/chrome/window_tooltip.xul b/toolkit/content/tests/chrome/window_tooltip.xul deleted file mode 100644 index 087c91c3e..000000000 --- a/toolkit/content/tests/chrome/window_tooltip.xul +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - -
- -
-
-
- - diff --git a/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html b/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html deleted file mode 100644 index f57cda063..000000000 --- a/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - Video controls test - - - - - - -
-
-
- - diff --git a/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html b/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html deleted file mode 100644 index d681b3158..000000000 --- a/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - Video controls test - - - - - - -

- -
- -
- -
-
-
- - diff --git a/toolkit/content/tests/widgets/test_videocontrols_standalone.html b/toolkit/content/tests/widgets/test_videocontrols_standalone.html deleted file mode 100644 index 8d1ce8984..000000000 --- a/toolkit/content/tests/widgets/test_videocontrols_standalone.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - Video controls test - - - - - - -

- -
-
-
- - diff --git a/toolkit/content/tests/widgets/test_videocontrols_video_direction.html b/toolkit/content/tests/widgets/test_videocontrols_video_direction.html deleted file mode 100644 index 54e0d5e72..000000000 --- a/toolkit/content/tests/widgets/test_videocontrols_video_direction.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - Video controls directionality test - - - - - - -

- -
-
- -
-
-
-
- - diff --git a/toolkit/content/tests/widgets/test_videocontrols_vtt.html b/toolkit/content/tests/widgets/test_videocontrols_vtt.html deleted file mode 100644 index 27052b770..000000000 --- a/toolkit/content/tests/widgets/test_videocontrols_vtt.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - Video controls test - VTT - - - - - -

- -
- -
- -
-
-
- - diff --git a/toolkit/content/tests/widgets/tree_shared.js b/toolkit/content/tests/widgets/tree_shared.js deleted file mode 100644 index b157bdf56..000000000 --- a/toolkit/content/tests/widgets/tree_shared.js +++ /dev/null @@ -1,1405 +0,0 @@ -var columns_simpletree = -[ - { name: "name", label: "Name", key: true, properties: "one two" }, - { name: "address", label: "Address" } -]; - -var columns_hiertree = -[ - { name: "name", label: "Name", primary: true, key: true, properties: "one two" }, - { name: "address", label: "Address" }, - { name: "planet", label: "Planet" }, - { name: "gender", label: "Gender", cycler: true } -]; - -// XXXndeakin still to add some tests for: -// cycler columns, checkbox cells, progressmeter cells - -// this test function expects a tree to have 8 rows in it when it isn't -// expanded. The tree should only display four rows at a time. If editable, -// the cell at row 1 and column 0 must be editable, and the cell at row 2 and -// column 1 must not be editable. -function testtag_tree(treeid, treerowinfoid, seltype, columnstype, testid) -{ - // Stop keystrokes that aren't handled by the tree from leaking out and - // scrolling the main Mochitests window! - function preventDefault(event) { - event.preventDefault(); - } - document.addEventListener("keypress", preventDefault, false); - - var multiple = (seltype == "multiple"); - - var tree = document.getElementById(treeid); - var treerowinfo = document.getElementById(treerowinfoid); - var rowInfo; - if (testid =="tree view") - rowInfo = getCustomTreeViewCellInfo(); - else - rowInfo = convertDOMtoTreeRowInfo(treerowinfo, 0, { value: -1 }); - var columnInfo = (columnstype == "simple") ? columns_simpletree : columns_hiertree; - - is(tree.view.selection.currentColumn, null, testid + " initial currentColumn"); - is(tree.selType, seltype == "multiple" ? "" : seltype, testid + " seltype"); - - // note: the functions below should be in this order due to changes made in later tests - - // select the first column in cell selection mode so that the selection - // functions can be tested - if (seltype == "cell") - tree.view.selection.currentColumn = tree.columns[0]; - - testtag_tree_columns(tree, columnInfo, testid); - testtag_tree_TreeSelection(tree, testid, multiple); - testtag_tree_TreeSelection_UI(tree, testid, multiple); - if (seltype == "cell") - testtag_tree_TreeSelection_UI_cell(tree, testid, rowInfo); - - testtag_tree_TreeView(tree, testid, rowInfo); - - is(tree.editable, false, "tree should not be editable"); - // currently, the editable flag means that tree editing cannot be invoked - // by the user. However, editing can still be started with a script. - is(tree.editingRow, -1, testid + " initial editingRow"); - is(tree.editingColumn, null, testid + " initial editingColumn"); - - testtag_tree_UI_editing(tree, testid, rowInfo); - - is(tree.editable, false, "tree should not be editable after testtag_tree_UI_editing"); - // currently, the editable flag means that tree editing cannot be invoked - // by the user. However, editing can still be started with a script. - is(tree.editingRow, -1, testid + " initial editingRow (continued)"); - is(tree.editingColumn, null, testid + " initial editingColumn (continued)"); - - var ecolumn = tree.columns[0]; - ok(!tree.startEditing(1, ecolumn), "non-editable trees shouldn't start editing"); - is(tree.editingRow, -1, testid + " failed startEditing shouldn't set editingRow"); - is(tree.editingColumn, null, testid + " failed startEditing shouldn't set editingColumn"); - - tree.editable = true; - - ok(tree.startEditing(1, ecolumn), "startEditing should have returned true"); - is(tree.editingRow, 1, testid + " startEditing editingRow"); - is(tree.editingColumn, ecolumn, testid + " startEditing editingColumn"); - is(tree.getAttribute("editing"), "true", testid + " startEditing editing attribute"); - - tree.stopEditing(true); - is(tree.editingRow, -1, testid + " stopEditing editingRow"); - is(tree.editingColumn, null, testid + " stopEditing editingColumn"); - is(tree.hasAttribute("editing"), false, testid + " stopEditing editing attribute"); - - tree.startEditing(-1, ecolumn); - is(tree.editingRow == -1 && tree.editingColumn == null, true, testid + " startEditing -1 editingRow"); - tree.startEditing(15, ecolumn); - is(tree.editingRow == -1 && tree.editingColumn == null, true, testid + " startEditing 15 editingRow"); - tree.startEditing(1, null); - is(tree.editingRow == -1 && tree.editingColumn == null, true, testid + " startEditing null column editingRow"); - tree.startEditing(2, tree.columns[1]); - is(tree.editingRow == -1 && tree.editingColumn == null, true, testid + " startEditing non editable cell editingRow"); - - tree.startEditing(1, ecolumn); - var inputField = tree.inputField; - is(inputField instanceof Components.interfaces.nsIDOMXULTextBoxElement, true, testid + "inputField"); - inputField.value = "Changed Value"; - tree.stopEditing(true); - is(tree.view.getCellText(1, ecolumn), "Changed Value", testid + "edit cell accept"); - - // this cell can be edited, but stopEditing(false) means don't accept the change. - tree.startEditing(1, ecolumn); - inputField.value = "Second Value"; - tree.stopEditing(false); - is(tree.view.getCellText(1, ecolumn), "Changed Value", testid + "edit cell no accept"); - - tree.editable = false; - - // do the sorting tests last as it will cause the rows to rearrange - // skip them for the custom tree view - if (testid !="tree view") - testtag_tree_TreeView_rows_sort(tree, testid, rowInfo); - - testtag_tree_wheel(tree); - - document.removeEventListener("keypress", preventDefault, false); - - SimpleTest.finish(); -} - -function testtag_tree_columns(tree, expectedColumns, testid) -{ - testid += " "; - - var columns = tree.columns; - - is(columns instanceof TreeColumns, true, testid + "columns is a TreeColumns"); - is(columns.count, expectedColumns.length, testid + "TreeColumns count"); - is(columns.length, expectedColumns.length, testid + "TreeColumns length"); - - var treecols = tree.getElementsByTagName("treecols")[0]; - var treecol = treecols.getElementsByTagName("treecol"); - - var x = 0; - var primary = null, sorted = null, key = null; - for (var c = 0; c < expectedColumns.length; c++) { - var adjtestid = testid + " column " + c + " "; - var column = columns[c]; - var expectedColumn = expectedColumns[c]; - is(columns.getColumnAt(c), column, adjtestid + "getColumnAt"); - is(columns.getNamedColumn(expectedColumn.name), column, adjtestid + "getNamedColumn"); - is(columns.getColumnFor(treecol[c]), column, adjtestid + "getColumnFor"); - if (expectedColumn.primary) - primary = column; - if (expectedColumn.sorted) - sorted = column; - if (expectedColumn.key) - key = column; - - // XXXndeakin on Windows and Linux, some columns are one pixel to the - // left of where they should be. Could just be a rounding issue. - var adj = 1; - is(column.x + adj >= x, true, adjtestid + "position is after last column " + - column.x + "," + column.width + "," + x); - is(column.width > 0, true, adjtestid + "width is greater than 0"); - x = column.x + column.width; - - // now check the TreeColumn properties - is(column instanceof TreeColumn, true, adjtestid + "is a TreeColumn"); - is(column.element, treecol[c], adjtestid + "element is treecol"); - is(column.columns, columns, adjtestid + "columns is TreeColumns"); - is(column.id, expectedColumn.name, adjtestid + "name"); - is(column.index, c, adjtestid + "index"); - is(column.primary, primary == column, adjtestid + "column is primary"); - - is(column.cycler, "cycler" in expectedColumn && expectedColumn.cycler, - adjtestid + "column is cycler"); - is(column.selectable, true, adjtestid + "column is selectable"); - is(column.editable, "editable" in expectedColumn && expectedColumn.editable, - adjtestid + "column is editable"); - - is(column.type, "type" in expectedColumn ? expectedColumn.type : 1, adjtestid + "type"); - - is(column.getPrevious(), c > 0 ? columns[c - 1] : null, adjtestid + "getPrevious"); - is(column.getNext(), c < columns.length - 1 ? columns[c + 1] : null, adjtestid + "getNext"); - - // check the view's getColumnProperties method - var properties = tree.view.getColumnProperties(column); - var expectedProperties = expectedColumn.properties; - is(properties, expectedProperties ? expectedProperties : "", adjtestid + "getColumnProperties"); - } - - is(columns.getFirstColumn(), columns[0], testid + "getFirstColumn"); - is(columns.getLastColumn(), columns[columns.length - 1], testid + "getLastColumn"); - is(columns.getPrimaryColumn(), primary, testid + "getPrimaryColumn"); - is(columns.getSortedColumn(), sorted, testid + "getSortedColumn"); - is(columns.getKeyColumn(), key, testid + "getKeyColumn"); - - is(columns.getColumnAt(-1), null, testid + "getColumnAt under"); - is(columns.getColumnAt(columns.length), null, testid + "getColumnAt over"); - is(columns.getNamedColumn(""), null, testid + "getNamedColumn null"); - is(columns.getNamedColumn("unknown"), null, testid + "getNamedColumn unknown"); - is(columns.getColumnFor(null), null, testid + "getColumnFor null"); - is(columns.getColumnFor(tree), null, testid + "getColumnFor other"); -} - -function testtag_tree_TreeSelection(tree, testid, multiple) -{ - testid += " selection "; - - var selection = tree.view.selection; - is(selection instanceof Components.interfaces.nsITreeSelection, true, - testid + "selection is a TreeSelection"); - is(selection.single, !multiple, testid + "single"); - - testtag_tree_TreeSelection_State(tree, testid + "initial", -1, []); - is(selection.shiftSelectPivot, -1, testid + "initial shiftSelectPivot"); - - selection.currentIndex = 2; - testtag_tree_TreeSelection_State(tree, testid + "set currentIndex", 2, []); - tree.currentIndex = 3; - testtag_tree_TreeSelection_State(tree, testid + "set tree.currentIndex", 3, []); - - // test the select() method, which should deselect all rows and select - // a single row - selection.select(1); - testtag_tree_TreeSelection_State(tree, testid + "select 1", 1, [1]); - selection.select(3); - testtag_tree_TreeSelection_State(tree, testid + "select 2", 3, [3]); - selection.select(3); - testtag_tree_TreeSelection_State(tree, testid + "select same", 3, [3]); - - selection.currentIndex = 1; - testtag_tree_TreeSelection_State(tree, testid + "set currentIndex with single selection", 1, [3]); - - tree.currentIndex = 2; - testtag_tree_TreeSelection_State(tree, testid + "set tree.currentIndex with single selection", 2, [3]); - - // check the toggleSelect method. In single selection mode, it only toggles on when - // there isn't currently a selection. - selection.toggleSelect(2); - testtag_tree_TreeSelection_State(tree, testid + "toggleSelect 1", 2, multiple ? [2, 3] : [3]); - selection.toggleSelect(2); - selection.toggleSelect(3); - testtag_tree_TreeSelection_State(tree, testid + "toggleSelect 2", 3, []); - - // the current index doesn't change after a selectAll, so it should still be set to 1 - // selectAll has no effect on single selection trees - selection.currentIndex = 1; - selection.selectAll(); - testtag_tree_TreeSelection_State(tree, testid + "selectAll 1", 1, multiple ? [0, 1, 2, 3, 4, 5, 6, 7] : []); - selection.toggleSelect(2); - testtag_tree_TreeSelection_State(tree, testid + "toggleSelect after selectAll", 2, - multiple ? [0, 1, 3, 4, 5, 6, 7] : [2]); - selection.clearSelection(); - testtag_tree_TreeSelection_State(tree, testid + "clearSelection", 2, []); - selection.toggleSelect(3); - selection.toggleSelect(1); - if (multiple) { - selection.selectAll(); - testtag_tree_TreeSelection_State(tree, testid + "selectAll 2", 1, [0, 1, 2, 3, 4, 5, 6, 7]); - } - selection.currentIndex = 2; - selection.clearSelection(); - testtag_tree_TreeSelection_State(tree, testid + "clearSelection after selectAll", 2, []); - - // XXXndeakin invertSelection isn't implemented - // selection.invertSelection(); - - is(selection.shiftSelectPivot, -1, testid + "shiftSelectPivot set to -1"); - - // rangedSelect and clearRange set the currentIndex to the endIndex. The - // shiftSelectPivot property will be set to startIndex. - selection.rangedSelect(1, 3, false); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect no augment", - multiple ? 3 : 2, multiple ? [1, 2, 3] : []); - is(selection.shiftSelectPivot, multiple ? 1 : -1, - testid + "shiftSelectPivot after rangedSelect no augment"); - if (multiple) { - selection.select(1); - selection.rangedSelect(0, 2, true); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect augment", 2, [0, 1, 2]); - is(selection.shiftSelectPivot, 0, testid + "shiftSelectPivot after rangedSelect augment"); - - selection.clearRange(1, 3); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect augment", 3, [0]); - - // check that rangedSelect can take a start value higher than end - selection.rangedSelect(3, 1, false); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect reverse", 1, [1, 2, 3]); - is(selection.shiftSelectPivot, 3, testid + "shiftSelectPivot after rangedSelect reverse"); - - // check that setting the current index doesn't change the selection - selection.currentIndex = 0; - testtag_tree_TreeSelection_State(tree, testid + "currentIndex with range selection", 0, [1, 2, 3]); - } - - // both values of rangedSelect may be the same - selection.rangedSelect(2, 2, false); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect one row", 2, [2]); - is(selection.shiftSelectPivot, 2, testid + "shiftSelectPivot after selecting one row"); - - if (multiple) { - selection.rangedSelect(2, 3, true); - - // a start index of -1 means from the last point - selection.rangedSelect(-1, 0, true); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect -1 existing selection", 0, [0, 1, 2, 3]); - is(selection.shiftSelectPivot, 2, testid + "shiftSelectPivot after -1 existing selection"); - - selection.currentIndex = 2; - selection.rangedSelect(-1, 0, false); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect -1 from currentIndex", 0, [0, 1, 2]); - is(selection.shiftSelectPivot, 2, testid + "shiftSelectPivot -1 from currentIndex"); - } - - // XXXndeakin need to test out of range values but these don't work properly -/* - selection.select(-1); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect augment -1", -1, []); - - selection.select(8); - testtag_tree_TreeSelection_State(tree, testid + "rangedSelect augment 8", 3, [0]); -*/ -} - -function testtag_tree_TreeSelection_UI(tree, testid, multiple) -{ - testid += " selection UI "; - - var selection = tree.view.selection; - selection.clearSelection(); - selection.currentIndex = 0; - tree.focus(); - - var keydownFired = 0; - var keypressFired = 0; - function keydownListener(event) - { - keydownFired++; - } - function keypressListener(event) { - keypressFired++; - } - - // check that cursor up and down keys navigate up and down - // select event fires after a delay so don't expect it. The reason it fires after a delay - // is so that cursor navigation allows quicking skimming over a set of items without - // actually firing events in-between, improving performance. The select event will only - // be fired on the row where the cursor stops. - window.addEventListener("keydown", keydownListener, false); - window.addEventListener("keypress", keypressListener, false); - - synthesizeKeyExpectEvent("VK_DOWN", {}, tree, "!select", "key down"); - testtag_tree_TreeSelection_State(tree, testid + "key down", 1, [1], 0); - - synthesizeKeyExpectEvent("VK_UP", {}, tree, "!select", "key up"); - testtag_tree_TreeSelection_State(tree, testid + "key up", 0, [0], 0); - - synthesizeKeyExpectEvent("VK_UP", {}, tree, "!select", "key up at start"); - testtag_tree_TreeSelection_State(tree, testid + "key up at start", 0, [0], 0); - - // pressing down while the last row is selected should not fire a select event, - // as the selection won't have changed. Also the view is not scrolled in this case. - selection.select(7); - synthesizeKeyExpectEvent("VK_DOWN", {}, tree, "!select", "key down at end"); - testtag_tree_TreeSelection_State(tree, testid + "key down at end", 7, [7], 0); - - // pressing keys while at the edge of the visible rows should scroll the list - tree.treeBoxObject.scrollToRow(4); - selection.select(4); - synthesizeKeyExpectEvent("VK_UP", {}, tree, "!select", "key up with scroll"); - is(tree.treeBoxObject.getFirstVisibleRow(), 3, testid + "key up with scroll"); - - tree.treeBoxObject.scrollToRow(0); - selection.select(3); - synthesizeKeyExpectEvent("VK_DOWN", {}, tree, "!select", "key down with scroll"); - is(tree.treeBoxObject.getFirstVisibleRow(), 1, testid + "key down with scroll"); - - // accel key and cursor movement adjust currentIndex but should not change - // the selection. In single selection mode, the selection will not change, - // but instead will just scroll up or down a line - tree.treeBoxObject.scrollToRow(0); - selection.select(1); - synthesizeKeyExpectEvent("VK_DOWN", { accelKey: true }, tree, "!select", "key down with accel"); - testtag_tree_TreeSelection_State(tree, testid + "key down with accel", multiple ? 2 : 1, [1]); - if (!multiple) - is(tree.treeBoxObject.getFirstVisibleRow(), 1, testid + "key down with accel and scroll"); - - tree.treeBoxObject.scrollToRow(4); - selection.select(4); - synthesizeKeyExpectEvent("VK_UP", { accelKey: true }, tree, "!select", "key up with accel"); - testtag_tree_TreeSelection_State(tree, testid + "key up with accel", multiple ? 3 : 4, [4]); - if (!multiple) - is(tree.treeBoxObject.getFirstVisibleRow(), 3, testid + "key up with accel and scroll"); - - // do this three times, one for each state of pageUpOrDownMovesSelection, - // and then once with the accel key pressed - for (let t = 0; t < 3; t++) { - let testidmod = ""; - if (t == 2) - testidmod = " with accel" - else if (t == 1) - testidmod = " rev"; - var keymod = (t == 2) ? { accelKey: true } : { }; - - var moveselection = tree.pageUpOrDownMovesSelection; - if (t == 2) - moveselection = !moveselection; - - tree.treeBoxObject.scrollToRow(4); - selection.currentIndex = 6; - selection.select(6); - var expected = moveselection ? 4 : 6; - synthesizeKeyExpectEvent("VK_PAGE_UP", keymod, tree, "!select", "key page up"); - testtag_tree_TreeSelection_State(tree, testid + "key page up" + testidmod, - expected, [expected], moveselection ? 4 : 0); - - expected = moveselection ? 0 : 6; - synthesizeKeyExpectEvent("VK_PAGE_UP", keymod, tree, "!select", "key page up again"); - testtag_tree_TreeSelection_State(tree, testid + "key page up again" + testidmod, - expected, [expected], 0); - - expected = moveselection ? 0 : 6; - synthesizeKeyExpectEvent("VK_PAGE_UP", keymod, tree, "!select", "key page up at start"); - testtag_tree_TreeSelection_State(tree, testid + "key page up at start" + testidmod, - expected, [expected], 0); - - tree.treeBoxObject.scrollToRow(0); - selection.currentIndex = 1; - selection.select(1); - expected = moveselection ? 3 : 1; - synthesizeKeyExpectEvent("VK_PAGE_DOWN", keymod, tree, "!select", "key page down"); - testtag_tree_TreeSelection_State(tree, testid + "key page down" + testidmod, - expected, [expected], moveselection ? 0 : 4); - - expected = moveselection ? 7 : 1; - synthesizeKeyExpectEvent("VK_PAGE_DOWN", keymod, tree, "!select", "key page down again"); - testtag_tree_TreeSelection_State(tree, testid + "key page down again" + testidmod, - expected, [expected], 4); - - expected = moveselection ? 7 : 1; - synthesizeKeyExpectEvent("VK_PAGE_DOWN", keymod, tree, "!select", "key page down at start"); - testtag_tree_TreeSelection_State(tree, testid + "key page down at start" + testidmod, - expected, [expected], 4); - - if (t < 2) - tree.pageUpOrDownMovesSelection = !tree.pageUpOrDownMovesSelection; - } - - tree.treeBoxObject.scrollToRow(4); - selection.select(6); - synthesizeKeyExpectEvent("VK_HOME", {}, tree, "!select", "key home"); - testtag_tree_TreeSelection_State(tree, testid + "key home", 0, [0], 0); - - tree.treeBoxObject.scrollToRow(0); - selection.select(1); - synthesizeKeyExpectEvent("VK_END", {}, tree, "!select", "key end"); - testtag_tree_TreeSelection_State(tree, testid + "key end", 7, [7], 4); - - // in single selection mode, the selection doesn't change in this case - tree.treeBoxObject.scrollToRow(4); - selection.select(6); - synthesizeKeyExpectEvent("VK_HOME", { accelKey: true }, tree, "!select", "key home with accel"); - testtag_tree_TreeSelection_State(tree, testid + "key home with accel", multiple ? 0 : 6, [6], 0); - - tree.treeBoxObject.scrollToRow(0); - selection.select(1); - synthesizeKeyExpectEvent("VK_END", { accelKey: true }, tree, "!select", "key end with accel"); - testtag_tree_TreeSelection_State(tree, testid + "key end with accel", multiple ? 7 : 1, [1], 4); - - // next, test cursor navigation with selection. Here the select event will be fired - selection.select(1); - var eventExpected = multiple ? "select" : "!select"; - synthesizeKeyExpectEvent("VK_DOWN", { shiftKey: true }, tree, eventExpected, "key shift down to select"); - testtag_tree_TreeSelection_State(tree, testid + "key shift down to select", - multiple ? 2 : 1, multiple ? [1, 2] : [1]); - is(selection.shiftSelectPivot, multiple ? 1 : -1, - testid + "key shift down to select shiftSelectPivot"); - synthesizeKeyExpectEvent("VK_UP", { shiftKey: true }, tree, eventExpected, "key shift up to unselect"); - testtag_tree_TreeSelection_State(tree, testid + "key shift up to unselect", 1, [1]); - is(selection.shiftSelectPivot, multiple ? 1 : -1, - testid + "key shift up to unselect shiftSelectPivot"); - if (multiple) { - synthesizeKeyExpectEvent("VK_UP", { shiftKey: true }, tree, "select", "key shift up to select"); - testtag_tree_TreeSelection_State(tree, testid + "key shift up to select", 0, [0, 1]); - is(selection.shiftSelectPivot, 1, testid + "key shift up to select shiftSelectPivot"); - synthesizeKeyExpectEvent("VK_DOWN", { shiftKey: true }, tree, "select", "key shift down to unselect"); - testtag_tree_TreeSelection_State(tree, testid + "key shift down to unselect", 1, [1]); - is(selection.shiftSelectPivot, 1, testid + "key shift down to unselect shiftSelectPivot"); - } - - // do this twice, one for each state of pageUpOrDownMovesSelection, however - // when selecting with the shift key, pageUpOrDownMovesSelection is ignored - // and the selection always changes - var lastidx = tree.view.rowCount - 1; - for (let t = 0; t < 2; t++) { - let testidmod = (t == 0) ? "" : " rev"; - - // If the top or bottom visible row is the current row, pressing shift and - // page down / page up selects one page up or one page down. Otherwise, the - // selection is made to the top or bottom of the visible area. - tree.treeBoxObject.scrollToRow(lastidx - 3); - selection.currentIndex = 6; - selection.select(6); - synthesizeKeyExpectEvent("VK_PAGE_UP", { shiftKey: true }, tree, eventExpected, "key shift page up"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page up" + testidmod, - multiple ? 4 : 6, multiple ? [4, 5, 6] : [6]); - if (multiple) { - synthesizeKeyExpectEvent("VK_PAGE_UP", { shiftKey: true }, tree, "select", "key shift page up again"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page up again" + testidmod, - 0, [0, 1, 2, 3, 4, 5, 6]); - // no change in the selection, so no select event should be fired - synthesizeKeyExpectEvent("VK_PAGE_UP", { shiftKey: true }, tree, "!select", "key shift page up at start"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page up at start" + testidmod, - 0, [0, 1, 2, 3, 4, 5, 6]); - // deselect by paging down again - synthesizeKeyExpectEvent("VK_PAGE_DOWN", { shiftKey: true }, tree, "select", "key shift page down deselect"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page down deselect" + testidmod, - 3, [3, 4, 5, 6]); - } - - tree.treeBoxObject.scrollToRow(1); - selection.currentIndex = 2; - selection.select(2); - synthesizeKeyExpectEvent("VK_PAGE_DOWN", { shiftKey: true }, tree, eventExpected, "key shift page down"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page down" + testidmod, - multiple ? 4 : 2, multiple ? [2, 3, 4] : [2]); - if (multiple) { - synthesizeKeyExpectEvent("VK_PAGE_DOWN", { shiftKey: true }, tree, "select", "key shift page down again"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page down again" + testidmod, - 7, [2, 3, 4, 5, 6, 7]); - synthesizeKeyExpectEvent("VK_PAGE_DOWN", { shiftKey: true }, tree, "!select", "key shift page down at start"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page down at start" + testidmod, - 7, [2, 3, 4, 5, 6, 7]); - synthesizeKeyExpectEvent("VK_PAGE_UP", { shiftKey: true }, tree, "select", "key shift page up deselect"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page up deselect" + testidmod, - 4, [2, 3, 4]); - } - - // test when page down / page up is pressed when the view is scrolled such - // that the selection is not visible - if (multiple) { - tree.treeBoxObject.scrollToRow(3); - selection.currentIndex = 1; - selection.select(1); - synthesizeKeyExpectEvent("VK_PAGE_DOWN", { shiftKey: true }, tree, eventExpected, - "key shift page down with view scrolled down"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page down with view scrolled down" + testidmod, - 6, [1, 2, 3, 4, 5, 6], 3); - - tree.treeBoxObject.scrollToRow(2); - selection.currentIndex = 6; - selection.select(6); - synthesizeKeyExpectEvent("VK_PAGE_UP", { shiftKey: true }, tree, eventExpected, - "key shift page up with view scrolled up"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page up with view scrolled up" + testidmod, - 2, [2, 3, 4, 5, 6], 2); - - tree.treeBoxObject.scrollToRow(2); - selection.currentIndex = 0; - selection.select(0); - // don't expect the select event, as the selection won't have changed - synthesizeKeyExpectEvent("VK_PAGE_UP", { shiftKey: true }, tree, "!select", - "key shift page up at start with view scrolled down"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page up at start with view scrolled down" + testidmod, - 0, [0], 0); - - tree.treeBoxObject.scrollToRow(0); - selection.currentIndex = 7; - selection.select(7); - // don't expect the select event, as the selection won't have changed - synthesizeKeyExpectEvent("VK_PAGE_DOWN", { shiftKey: true }, tree, "!select", - "key shift page down at end with view scrolled up"); - testtag_tree_TreeSelection_State(tree, testid + "key shift page down at end with view scrolled up" + testidmod, - 7, [7], 4); - } - - tree.pageUpOrDownMovesSelection = !tree.pageUpOrDownMovesSelection; - } - - tree.treeBoxObject.scrollToRow(4); - selection.select(5); - synthesizeKeyExpectEvent("VK_HOME", { shiftKey: true }, tree, eventExpected, "key shift home"); - testtag_tree_TreeSelection_State(tree, testid + "key shift home", - multiple ? 0 : 5, multiple ? [0, 1, 2, 3, 4, 5] : [5], multiple ? 0 : 4); - - tree.treeBoxObject.scrollToRow(0); - selection.select(3); - synthesizeKeyExpectEvent("VK_END", { shiftKey: true }, tree, eventExpected, "key shift end"); - testtag_tree_TreeSelection_State(tree, testid + "key shift end", - multiple ? 7 : 3, multiple ? [3, 4, 5, 6, 7] : [3], multiple ? 4 : 0); - - // pressing space selects a row, pressing accel + space unselects a row - selection.select(2); - selection.currentIndex = 4; - synthesizeKeyExpectEvent(" ", {}, tree, "select", "key space on"); - // in single selection mode, space shouldn't do anything - testtag_tree_TreeSelection_State(tree, testid + "key space on", 4, multiple ? [2, 4] : [2]); - - if (multiple) { - synthesizeKeyExpectEvent(" ", { accelKey: true }, tree, "select", "key space off"); - testtag_tree_TreeSelection_State(tree, testid + "key space off", 4, [2]); - } - - // check that clicking on a row selects it - tree.treeBoxObject.scrollToRow(0); - selection.select(2); - selection.currentIndex = 2; - if (0) { // XXXndeakin disable these tests for now - mouseOnCell(tree, 1, tree.columns[1], "mouse on row"); - testtag_tree_TreeSelection_State(tree, testid + "mouse on row", 1, [1], 0, - tree.selType == "cell" ? tree.columns[1] : null); - } - - // restore the scroll position to the start of the page - sendKey("HOME"); - - window.removeEventListener("keydown", keydownListener, false); - window.removeEventListener("keypress", keypressListener, false); - is(keydownFired, multiple ? 63 : 40, "keydown event wasn't fired properly"); - is(keypressFired, multiple ? 2 : 1, "keypress event wasn't fired properly"); -} - -function testtag_tree_UI_editing(tree, testid, rowInfo) -{ - testid += " editing UI "; - - // check editing UI - var ecolumn = tree.columns[0]; - var rowIndex = 2; - var inputField = tree.inputField; - - // temporary make the tree editable to test mouse double click - var wasEditable = tree.editable; - if (!wasEditable) - tree.editable = true; - - // if this is a container save its current open status - var row = rowInfo.rows[rowIndex]; - var wasOpen = null; - if (tree.view.isContainer(row)) - wasOpen = tree.view.isContainerOpen(row); - - // Test whether a keystroke can enter text entry, and another can exit. - if (tree.selType == "cell") - { - tree.stopEditing(false); - ok(!tree.editingColumn, "Should not be editing tree cell now"); - tree.view.selection.currentColumn = ecolumn; - tree.currentIndex = rowIndex; - - const isMac = (navigator.platform.indexOf("Mac") >= 0); - const StartEditingKey = isMac ? "RETURN" : "F2"; - sendKey(StartEditingKey); - is(tree.editingColumn, ecolumn, "Should be editing tree cell now"); - sendKey("ESCAPE"); - ok(!tree.editingColumn, "Should not be editing tree cell now"); - is(tree.currentIndex, rowIndex, "Current index should not have changed"); - is(tree.view.selection.currentColumn, ecolumn, "Current column should not have changed"); - } - - mouseDblClickOnCell(tree, rowIndex, ecolumn, testid + "edit on double click"); - is(tree.editingColumn, ecolumn, testid + "editing column"); - is(tree.editingRow, rowIndex, testid + "editing row"); - - // ensure that we don't expand an expandable container on edit - if (wasOpen != null) - is(tree.view.isContainerOpen(row), wasOpen, testid + "opened container node on edit"); - - // ensure to restore editable attribute - if (!wasEditable) - tree.editable = false; - - var ci = tree.currentIndex; - - // cursor navigation should not change the selection while editing - var testKey = function(key) { - synthesizeKeyExpectEvent(key, {}, tree, "!select", "key " + key + " with editing"); - is(tree.editingRow == rowIndex && tree.editingColumn == ecolumn && tree.currentIndex == ci, - true, testid + "key " + key + " while editing"); - } - - testKey("VK_DOWN"); - testKey("VK_UP"); - testKey("VK_PAGE_DOWN"); - testKey("VK_PAGE_UP"); - testKey("VK_HOME"); - testKey("VK_END"); - - // XXXndeakin figure out how to send characters to the textbox - // inputField.inputField.focus() - // synthesizeKeyExpectEvent(inputField.inputField, "b", null, ""); - // tree.stopEditing(true); - // is(tree.view.getCellText(0, ecolumn), "b", testid + "edit cell"); - - // Restore initial state. - tree.stopEditing(false); -} - -function testtag_tree_TreeSelection_UI_cell(tree, testid, rowInfo) -{ - testid += " selection UI cell "; - - var columns = tree.columns; - var firstcolumn = columns[0]; - var secondcolumn = columns[1]; - var lastcolumn = columns[columns.length - 1]; - var secondlastcolumn = columns[columns.length - 2]; - var selection = tree.view.selection; - - selection.clearSelection(); - selection.currentIndex = -1; - selection.currentColumn = firstcolumn; - is(selection.currentColumn, firstcolumn, testid + " first currentColumn"); - - // no selection yet so nothing should happen when the left and right cursor keys are pressed - synthesizeKeyExpectEvent("VK_RIGHT", {}, tree, "!select", "key right no selection"); - testtag_tree_TreeSelection_State(tree, testid + "key right no selection", -1, [], null, firstcolumn); - - selection.currentColumn = secondcolumn; - synthesizeKeyExpectEvent("VK_LEFT", {}, tree, "!select", "key left no selection"); - testtag_tree_TreeSelection_State(tree, testid + "key left no selection", -1, [], null, secondcolumn); - - selection.select(2); - selection.currentIndex = 2; - if (0) { // XXXndeakin disable these tests for now - mouseOnCell(tree, 1, secondlastcolumn, "mouse on cell"); - testtag_tree_TreeSelection_State(tree, testid + "mouse on cell", 1, [1], null, secondlastcolumn); - } - - tree.focus(); - - // selection is set, so it should move when the left and right cursor keys are pressed - tree.treeBoxObject.scrollToRow(0); - selection.select(1); - selection.currentIndex = 1; - selection.currentColumn = secondcolumn; - synthesizeKeyExpectEvent("VK_LEFT", {}, tree, "!select", "key left in second column"); - testtag_tree_TreeSelection_State(tree, testid + "key left in second column", 1, [1], 0, firstcolumn); - - synthesizeKeyExpectEvent("VK_LEFT", {}, tree, "!select", "key left in first column"); - testtag_tree_TreeSelection_State(tree, testid + "key left in first column", 1, [1], 0, firstcolumn); - - selection.currentColumn = secondlastcolumn; - synthesizeKeyExpectEvent("VK_RIGHT", {}, tree, "!select", "key right in second last column"); - testtag_tree_TreeSelection_State(tree, testid + "key right in second last column", 1, [1], 0, lastcolumn); - - synthesizeKeyExpectEvent("VK_RIGHT", {}, tree, "!select", "key right in last column"); - testtag_tree_TreeSelection_State(tree, testid + "key right in last column", 1, [1], 0, lastcolumn); - - synthesizeKeyExpectEvent("VK_UP", {}, tree, "!select", "key up in second row"); - testtag_tree_TreeSelection_State(tree, testid + "key up in second row", 0, [0], 0, lastcolumn); - - synthesizeKeyExpectEvent("VK_UP", {}, tree, "!select", "key up in first row"); - testtag_tree_TreeSelection_State(tree, testid + "key up in first row", 0, [0], 0, lastcolumn); - - synthesizeKeyExpectEvent("VK_DOWN", {}, tree, "!select", "key down in first row"); - testtag_tree_TreeSelection_State(tree, testid + "key down in first row", 1, [1], 0, lastcolumn); - - var lastidx = tree.view.rowCount - 1; - tree.treeBoxObject.scrollToRow(lastidx - 3); - selection.select(lastidx); - selection.currentIndex = lastidx; - synthesizeKeyExpectEvent("VK_DOWN", {}, tree, "!select", "key down in last row"); - testtag_tree_TreeSelection_State(tree, testid + "key down in last row", lastidx, [lastidx], lastidx - 3, lastcolumn); - - synthesizeKeyExpectEvent("VK_HOME", {}, tree, "!select", "key home"); - testtag_tree_TreeSelection_State(tree, testid + "key home", 0, [0], 0, lastcolumn); - - synthesizeKeyExpectEvent("VK_END", {}, tree, "!select", "key end"); - testtag_tree_TreeSelection_State(tree, testid + "key end", lastidx, [lastidx], lastidx - 3, lastcolumn); - - for (var t = 0; t < 2; t++) { - var testidmod = (t == 0) ? "" : " rev"; - - // scroll to the end, subtract 3 because we want lastidx to appear - // at the end of view - tree.treeBoxObject.scrollToRow(lastidx - 3); - selection.select(lastidx); - selection.currentIndex = lastidx; - var expectedrow = tree.pageUpOrDownMovesSelection ? lastidx - 3 : lastidx; - synthesizeKeyExpectEvent("VK_PAGE_UP", {}, tree, "!select", "key page up"); - testtag_tree_TreeSelection_State(tree, testid + "key page up" + testidmod, - expectedrow, [expectedrow], - tree.pageUpOrDownMovesSelection ? lastidx - 3 : 0, lastcolumn); - - tree.treeBoxObject.scrollToRow(1); - selection.select(1); - selection.currentIndex = 1; - expectedrow = tree.pageUpOrDownMovesSelection ? 4 : 1; - synthesizeKeyExpectEvent("VK_PAGE_DOWN", {}, tree, "!select", "key page down"); - testtag_tree_TreeSelection_State(tree, testid + "key page down" + testidmod, - expectedrow, [expectedrow], - tree.pageUpOrDownMovesSelection ? 1 : lastidx - 3, lastcolumn); - - tree.pageUpOrDownMovesSelection = !tree.pageUpOrDownMovesSelection; - } - - // now check navigation when there is unselctable column - secondcolumn.element.setAttribute("selectable", "false"); - secondcolumn.invalidate(); - is(secondcolumn.selectable, false, testid + "set selectable attribute"); - - if (columns.length >= 3) { - selection.select(3); - selection.currentIndex = 3; - // check whether unselectable columns are skipped over - selection.currentColumn = firstcolumn; - synthesizeKeyExpectEvent("VK_RIGHT", {}, tree, "!select", "key right unselectable column"); - testtag_tree_TreeSelection_State(tree, testid + "key right unselectable column", - 3, [3], null, secondcolumn.getNext()); - - synthesizeKeyExpectEvent("VK_LEFT", {}, tree, "!select", "key left unselectable column"); - testtag_tree_TreeSelection_State(tree, testid + "key left unselectable column", - 3, [3], null, firstcolumn); - } - - secondcolumn.element.removeAttribute("selectable"); - secondcolumn.invalidate(); - is(secondcolumn.selectable, true, testid + "clear selectable attribute"); - - // check to ensure that navigation isn't allowed if the first column is not selectable - selection.currentColumn = secondcolumn; - firstcolumn.element.setAttribute("selectable", "false"); - firstcolumn.invalidate(); - synthesizeKeyExpectEvent("VK_LEFT", {}, tree, "!select", "key left unselectable first column"); - testtag_tree_TreeSelection_State(tree, testid + "key left unselectable first column", - 3, [3], null, secondcolumn); - firstcolumn.element.removeAttribute("selectable"); - firstcolumn.invalidate(); - - // check to ensure that navigation isn't allowed if the last column is not selectable - selection.currentColumn = secondlastcolumn; - lastcolumn.element.setAttribute("selectable", "false"); - lastcolumn.invalidate(); - synthesizeKeyExpectEvent("VK_RIGHT", {}, tree, "!select", "key right unselectable last column"); - testtag_tree_TreeSelection_State(tree, testid + "key right unselectable last column", - 3, [3], null, secondlastcolumn); - lastcolumn.element.removeAttribute("selectable"); - lastcolumn.invalidate(); - - // now check for cells with selectable false - if (!rowInfo.rows[4].cells[1].selectable && columns.length >= 3) { - // check whether unselectable cells are skipped over - selection.select(4); - selection.currentIndex = 4; - - selection.currentColumn = firstcolumn; - synthesizeKeyExpectEvent("VK_RIGHT", {}, tree, "!select", "key right unselectable cell"); - testtag_tree_TreeSelection_State(tree, testid + "key right unselectable cell", - 4, [4], null, secondcolumn.getNext()); - - synthesizeKeyExpectEvent("VK_LEFT", {}, tree, "!select", "key left unselectable cell"); - testtag_tree_TreeSelection_State(tree, testid + "key left unselectable cell", - 4, [4], null, firstcolumn); - - tree.treeBoxObject.scrollToRow(1); - selection.select(3); - selection.currentIndex = 3; - selection.currentColumn = secondcolumn; - - synthesizeKeyExpectEvent("VK_DOWN", {}, tree, "!select", "key down unselectable cell"); - testtag_tree_TreeSelection_State(tree, testid + "key down unselectable cell", - 5, [5], 2, secondcolumn); - - tree.treeBoxObject.scrollToRow(4); - synthesizeKeyExpectEvent("VK_UP", {}, tree, "!select", "key up unselectable cell"); - testtag_tree_TreeSelection_State(tree, testid + "key up unselectable cell", - 3, [3], 3, secondcolumn); - } - - // restore the scroll position to the start of the page - sendKey("HOME"); -} - -function testtag_tree_TreeView(tree, testid, rowInfo) -{ - testid += " view "; - - var columns = tree.columns; - var view = tree.view; - - is(view instanceof Components.interfaces.nsITreeView, true, testid + "view is a TreeView"); - is(view.rowCount, rowInfo.rows.length, testid + "rowCount"); - - testtag_tree_TreeView_rows(tree, testid, rowInfo, 0); - - // note that this will only work for content trees currently - view.setCellText(0, columns[1], "Changed Value"); - is(view.getCellText(0, columns[1]), "Changed Value", "setCellText"); - - view.setCellValue(1, columns[0], "Another Changed Value"); - is(view.getCellValue(1, columns[0]), "Another Changed Value", "setCellText"); -} - -function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) -{ - var r; - var columns = tree.columns; - var view = tree.view; - var length = rowInfo.rows.length; - - // methods to test along with the functions which determine the expected value - var checkRowMethods = - { - isContainer: function(row) { return row.container }, - isContainerOpen: function(row) { return false }, - isContainerEmpty: function(row) { return (row.children != null && row.children.rows.length == 0) }, - isSeparator: function(row) { return row.separator }, - getRowProperties: function(row) { return row.properties }, - getLevel: function(row) { return row.level }, - getParentIndex: function(row) { return row.parent }, - hasNextSibling: function(row) { return r < startRow + length - 1; } - }; - - var checkCellMethods = - { - getCellText: function(row, cell) { return cell.label }, - getCellValue: function(row, cell) { return cell.value }, - getCellProperties: function(row, cell) { return cell.properties }, - isEditable: function(row, cell) { return cell.editable }, - isSelectable: function(row, cell) { return cell.selectable }, - getImageSrc: function(row, cell) { return cell.image }, - getProgressMode: function(row, cell) { return cell.mode } - }; - - var failedMethods = { }; - var checkMethod, actual, expected; - var containerInfo = null; - var toggleOpenStateOK = true; - - for (r = startRow; r < length; r++) { - var row = rowInfo.rows[r]; - for (var c = 0; c < row.cells.length; c++) { - var cell = row.cells[c]; - - for (checkMethod in checkCellMethods) { - expected = checkCellMethods[checkMethod](row, cell); - actual = view[checkMethod](r, columns[c]); - if (actual !== expected) { - failedMethods[checkMethod] = true; - is(actual, expected, testid + "row " + r + " column " + c + " " + checkMethod + " is incorrect"); - } - } - } - - // compare row properties - for (checkMethod in checkRowMethods) { - expected = checkRowMethods[checkMethod](row, r); - if (checkMethod == "hasNextSibling") { - actual = view[checkMethod](r, r); - } - else { - actual = view[checkMethod](r); - } - if (actual !== expected) { - failedMethods[checkMethod] = true; - is(actual, expected, testid + "row " + r + " " + checkMethod + " is incorrect"); - } - } -/* - // open and recurse into containers - if (row.container) { - view.toggleOpenState(r); - if (!view.isContainerOpen(r)) { - toggleOpenStateOK = false; - is(view.isContainerOpen(r), true, testid + "row " + r + " toggleOpenState open"); - } - testtag_tree_TreeView_rows(tree, testid + "container " + r + " ", row.children, r + 1); - view.toggleOpenState(r); - if (view.isContainerOpen(r)) { - toggleOpenStateOK = false; - is(view.isContainerOpen(r), false, testid + "row " + r + " toggleOpenState close"); - } - } -*/ - } - - for (var failedMethod in failedMethods) { - if (failedMethod in checkRowMethods) - delete checkRowMethods[failedMethod]; - if (failedMethod in checkCellMethods) - delete checkCellMethods[failedMethod]; - } - - for (checkMethod in checkRowMethods) - is(checkMethod + " ok", checkMethod + " ok", testid + checkMethod); - for (checkMethod in checkCellMethods) - is(checkMethod + " ok", checkMethod + " ok", testid + checkMethod); - if (toggleOpenStateOK) - is("toggleOpenState ok", "toggleOpenState ok", testid + "toggleOpenState"); -} - -function testtag_tree_TreeView_rows_sort(tree, testid, rowInfo) -{ - // check if cycleHeader sorts the columns - var columnIndex = 0; - var view = tree.view; - var column = tree.columns[columnIndex]; - var columnElement = column.element; - var sortkey = columnElement.getAttribute("sort"); - if (sortkey) { - view.cycleHeader(column); - is(tree.getAttribute("sort"), sortkey, "cycleHeader sort"); - is(tree.getAttribute("sortDirection"), "ascending", "cycleHeader sortDirection ascending"); - is(columnElement.getAttribute("sortDirection"), "ascending", "cycleHeader column sortDirection"); - is(columnElement.getAttribute("sortActive"), "true", "cycleHeader column sortActive"); - view.cycleHeader(column); - is(tree.getAttribute("sortDirection"), "descending", "cycleHeader sortDirection descending"); - is(columnElement.getAttribute("sortDirection"), "descending", "cycleHeader column sortDirection descending"); - view.cycleHeader(column); - is(tree.getAttribute("sortDirection"), "", "cycleHeader sortDirection natural"); - is(columnElement.getAttribute("sortDirection"), "", "cycleHeader column sortDirection natural"); - // XXXndeakin content view isSorted needs to be tested - } - - // Check that clicking on column header sorts the column. - var columns = getSortedColumnArray(tree); - is(columnElement.getAttribute("sortDirection"), "", - "cycleHeader column sortDirection"); - - // Click once on column header and check sorting has cycled once. - mouseClickOnColumnHeader(columns, columnIndex, 0, 1); - is(columnElement.getAttribute("sortDirection"), "ascending", - "single click cycleHeader column sortDirection ascending"); - - // Now simulate a double click. - mouseClickOnColumnHeader(columns, columnIndex, 0, 2); - if (navigator.platform.indexOf("Win") == 0) { - // Windows cycles only once on double click. - is(columnElement.getAttribute("sortDirection"), "descending", - "double click cycleHeader column sortDirection descending"); - // 1 single clicks should restore natural sorting. - mouseClickOnColumnHeader(columns, columnIndex, 0, 1); - } - - // Check we have gone back to natural sorting. - is(columnElement.getAttribute("sortDirection"), "", - "cycleHeader column sortDirection"); - - columnElement.setAttribute("sorthints", "twostate"); - view.cycleHeader(column); - is(tree.getAttribute("sortDirection"), "ascending", "cycleHeader sortDirection ascending twostate"); - view.cycleHeader(column); - is(tree.getAttribute("sortDirection"), "descending", "cycleHeader sortDirection ascending twostate"); - view.cycleHeader(column); - is(tree.getAttribute("sortDirection"), "ascending", "cycleHeader sortDirection ascending twostate again"); - columnElement.removeAttribute("sorthints"); - view.cycleHeader(column); - view.cycleHeader(column); - - is(columnElement.getAttribute("sortDirection"), "", - "cycleHeader column sortDirection reset"); -} - -// checks if the current and selected rows are correct -// current is the index of the current row -// selected is an array of the indicies of the selected rows -// column is the selected column -// viewidx is the row that should be visible at the top of the tree -function testtag_tree_TreeSelection_State(tree, testid, current, selected, viewidx, column) -{ - var selection = tree.view.selection; - - if (!column) - column = (tree.selType == "cell") ? tree.columns[0] : null; - - is(selection.count, selected.length, testid + " count"); - is(tree.currentIndex, current, testid + " currentIndex"); - is(selection.currentIndex, current, testid + " TreeSelection currentIndex"); - is(selection.currentColumn, column, testid + " currentColumn"); - if (viewidx !== null && viewidx !== undefined) - is(tree.treeBoxObject.getFirstVisibleRow(), viewidx, testid + " first visible row"); - - var actualSelected = []; - var count = tree.view.rowCount; - for (var s = 0; s < count; s++) { - if (selection.isSelected(s)) - actualSelected.push(s); - } - - is(compareArrays(selected, actualSelected), true, testid + " selection [" + selected + "]"); - - actualSelected = []; - var rangecount = selection.getRangeCount(); - for (var r = 0; r < rangecount; r++) { - var start = {}, end = {}; - selection.getRangeAt(r, start, end); - for (var rs = start.value; rs <= end.value; rs++) - actualSelected.push(rs); - } - - is(compareArrays(selected, actualSelected), true, testid + " range selection [" + selected + "]"); -} - -function testtag_tree_column_reorder() -{ - // Make sure the tree is scrolled into the view, otherwise the test will - // fail - var testframe = window.parent.document.getElementById("testframe"); - if (testframe) { - testframe.scrollIntoView(); - } - - var tree = document.getElementById("tree-column-reorder"); - var numColumns = tree.columns.count; - - var reference = []; - for (let i = 0; i < numColumns; i++) { - reference.push("col_" + i); - } - - // Drag the first column to each position - for (let i = 0; i < numColumns - 1; i++) { - synthesizeColumnDrag(tree, i, i + 1, true); - arrayMove(reference, i, i + 1, true); - checkColumns(tree, reference, "drag first column right"); - } - - // And back - for (let i = numColumns - 1; i >= 1; i--) { - synthesizeColumnDrag(tree, i, i - 1, false); - arrayMove(reference, i, i - 1, false); - checkColumns(tree, reference, "drag last column left"); - } - - // Drag each column one column left - for (let i = 1; i < numColumns; i++) { - synthesizeColumnDrag(tree, i, i - 1, false); - arrayMove(reference, i, i - 1, false); - checkColumns(tree, reference, "drag each column left"); - } - - // And back - for (let i = numColumns - 2; i >= 0; i--) { - synthesizeColumnDrag(tree, i, i + 1, true); - arrayMove(reference, i, i + 1, true); - checkColumns(tree, reference, "drag each column right"); - } - - // Drag each column 5 to the right - for (let i = 0; i < numColumns - 5; i++) { - synthesizeColumnDrag(tree, i, i + 5, true); - arrayMove(reference, i, i + 5, true); - checkColumns(tree, reference, "drag each column 5 to the right"); - } - - // And to the left - for (let i = numColumns - 6; i >= 5; i--) { - synthesizeColumnDrag(tree, i, i - 5, false); - arrayMove(reference, i, i - 5, false); - checkColumns(tree, reference, "drag each column 5 to the left"); - } - - // Test that moving a column after itself does not move anything - synthesizeColumnDrag(tree, 0, 0, true); - checkColumns(tree, reference, "drag to itself"); - is(document.treecolDragging, null, "drag to itself completed"); - - // XXX roc should this be here??? - SimpleTest.finish(); -} - -function testtag_tree_wheel(aTree) -{ - const deltaModes = [ - WheelEvent.DOM_DELTA_PIXEL, // 0 - WheelEvent.DOM_DELTA_LINE, // 1 - WheelEvent.DOM_DELTA_PAGE // 2 - ]; - function helper(aStart, aDelta, aIntDelta, aDeltaMode) - { - aTree.treeBoxObject.scrollToRow(aStart); - var expected; - if (!aIntDelta) { - expected = aStart; - } - else if (aDeltaMode != WheelEvent.DOM_DELTA_PAGE) { - expected = aStart + aIntDelta; - } - else if (aIntDelta > 0) { - expected = aStart + aTree.treeBoxObject.getPageLength(); - } - else { - expected = aStart - aTree.treeBoxObject.getPageLength(); - } - - if (expected < 0) { - expected = 0; - } - if (expected > aTree.view.rowCount - aTree.treeBoxObject.getPageLength()) { - expected = aTree.view.rowCount - aTree.treeBoxObject.getPageLength(); - } - synthesizeWheel(aTree.body, 1, 1, - { deltaMode: aDeltaMode, deltaY: aDelta, - lineOrPageDeltaY: aIntDelta }); - is(aTree.treeBoxObject.getFirstVisibleRow(), expected, - "testtag_tree_wheel: vertical, starting " + aStart + - " delta " + aDelta + " lineOrPageDelta " + aIntDelta + - " aDeltaMode " + aDeltaMode); - - aTree.treeBoxObject.scrollToRow(aStart); - // Check that horizontal scrolling has no effect - synthesizeWheel(aTree.body, 1, 1, - { deltaMode: aDeltaMode, deltaX: aDelta, - lineOrPageDeltaX: aIntDelta }); - is(aTree.treeBoxObject.getFirstVisibleRow(), aStart, - "testtag_tree_wheel: horizontal, starting " + aStart + - " delta " + aDelta + " lineOrPageDelta " + aIntDelta + - " aDeltaMode " + aDeltaMode); - } - - var defaultPrevented = 0; - - function wheelListener(event) { - defaultPrevented++; - } - window.addEventListener("wheel", wheelListener, false); - - deltaModes.forEach(function(aDeltaMode) { - var delta = (aDeltaMode == WheelEvent.DOM_DELTA_PIXEL) ? 5.0 : 0.3; - helper(2, -delta, 0, aDeltaMode); - helper(2, -delta, -1, aDeltaMode); - helper(2, delta, 0, aDeltaMode); - helper(2, delta, 1, aDeltaMode); - helper(2, -2 * delta, 0, aDeltaMode); - helper(2, -2 * delta, -1, aDeltaMode); - helper(2, 2 * delta, 0, aDeltaMode); - helper(2, 2 * delta, 1, aDeltaMode); - }); - - window.removeEventListener("wheel", wheelListener, false); - is(defaultPrevented, 48, "wheel event default prevented"); -} - -function synthesizeColumnDrag(aTree, aMouseDownColumnNumber, aMouseUpColumnNumber, aAfter) -{ - var columns = getSortedColumnArray(aTree); - - var down = columns[aMouseDownColumnNumber].element; - var up = columns[aMouseUpColumnNumber].element; - - // Target the initial mousedown in the middle of the column header so we - // avoid the extra hit test space given to the splitter - var columnWidth = down.boxObject.width; - var splitterHitWidth = columnWidth / 2; - synthesizeMouse(down, splitterHitWidth, 3, { type: "mousedown"}); - - var offsetX = 0; - if (aAfter) { - offsetX = columnWidth; - } - - if (aMouseUpColumnNumber > aMouseDownColumnNumber) { - for (let i = aMouseDownColumnNumber; i <= aMouseUpColumnNumber; i++) { - let move = columns[i].element; - synthesizeMouse(move, offsetX, 3, { type: "mousemove"}); - } - } - else { - for (let i = aMouseDownColumnNumber; i >= aMouseUpColumnNumber; i--) { - let move = columns[i].element; - synthesizeMouse(move, offsetX, 3, { type: "mousemove"}); - } - } - - synthesizeMouse(up, offsetX, 3, { type: "mouseup"}); -} - -function arrayMove(aArray, aFrom, aTo, aAfter) -{ - var o = aArray.splice(aFrom, 1)[0]; - if (aTo > aFrom) { - aTo--; - } - - if (aAfter) { - aTo++; - } - - aArray.splice(aTo, 0, o); -} - -function getSortedColumnArray(aTree) -{ - var columns = aTree.columns; - var array = []; - for (let i = 0; i < columns.length; i++) { - array.push(columns.getColumnAt(i)); - } - - array.sort(function(a, b) { - var o1 = parseInt(a.element.getAttribute("ordinal")); - var o2 = parseInt(b.element.getAttribute("ordinal")); - return o1 - o2; - }); - return array; -} - -function checkColumns(aTree, aReference, aMessage) -{ - var columns = getSortedColumnArray(aTree); - var ids = []; - columns.forEach(function(e) { - ids.push(e.element.id); - }); - is(compareArrays(ids, aReference), true, aMessage); -} - -function mouseOnCell(tree, row, column, testname) -{ - var rect = tree.boxObject.getCoordsForCellItem(row, column, "text"); - - synthesizeMouseExpectEvent(tree.body, rect.x, rect.y, {}, tree, "select", testname); -} - -function mouseClickOnColumnHeader(aColumns, aColumnIndex, aButton, aClickCount) -{ - var columnHeader = aColumns[aColumnIndex].element; - var columnHeaderRect = columnHeader.getBoundingClientRect(); - var columnWidth = columnHeaderRect.right - columnHeaderRect.left; - // For multiple click we send separate click events, with increasing - // clickCount. This simulates the common behavior of multiple clicks. - for (let i = 1; i <= aClickCount; i++) { - // Target the middle of the column header. - synthesizeMouse(columnHeader, columnWidth / 2, 3, - { button: aButton, - clickCount: i }, null); - } -} - -function mouseDblClickOnCell(tree, row, column, testname) -{ - // select the row we will edit - var selection = tree.view.selection; - selection.select(row); - tree.treeBoxObject.ensureRowIsVisible(row); - - // get cell coordinates - var rect = tree.treeBoxObject.getCoordsForCellItem(row, column, "text"); - - synthesizeMouse(tree.body, rect.x, rect.y, { clickCount: 2 }, null); -} - -function compareArrays(arr1, arr2) -{ - if (arr1.length != arr2.length) - return false; - - for (let i = 0; i < arr1.length; i++) { - if (arr1[i] != arr2[i]) - return false; - } - - return true; -} - -function convertProperties(arr) -{ - var results = []; - var count = arr.Count(); - for (let i = 0; i < count; i++) - results.push(arr.GetElementAt(i).QueryInterface(Components.interfaces.nsIAtom).toString()); - - results.sort(); - return results.join(" "); -} - -function convertDOMtoTreeRowInfo(treechildren, level, rowidx) -{ - var obj = { rows: [] }; - - var parentidx = rowidx.value; - - treechildren = treechildren.childNodes; - for (var r = 0; r < treechildren.length; r++) { - rowidx.value++; - - var treeitem = treechildren[r]; - if (treeitem.hasChildNodes()) { - var treerow = treeitem.firstChild; - var cellInfo = []; - for (var c = 0; c < treerow.childNodes.length; c++) { - var cell = treerow.childNodes[c]; - cellInfo.push({ label: "" + cell.getAttribute("label"), - value: cell.getAttribute("value"), - properties: cell.getAttribute("properties"), - editable: cell.getAttribute("editable") != "false", - selectable: cell.getAttribute("selectable") != "false", - image: cell.getAttribute("src"), - mode: cell.hasAttribute("mode") ? parseInt(cell.getAttribute("mode")) : 3 }); - } - - var descendants = treeitem.lastChild; - var children = (treerow == descendants) ? null : - convertDOMtoTreeRowInfo(descendants, level + 1, rowidx); - obj.rows.push({ cells: cellInfo, - properties: treerow.getAttribute("properties"), - container: treeitem.getAttribute("container") == "true", - separator: treeitem.localName == "treeseparator", - children: children, - level: level, - parent: parentidx }); - } - } - - return obj; -} diff --git a/toolkit/content/tests/widgets/video.ogg b/toolkit/content/tests/widgets/video.ogg deleted file mode 100644 index ac7ece351..000000000 Binary files a/toolkit/content/tests/widgets/video.ogg and /dev/null differ diff --git a/toolkit/content/tests/widgets/videocontrols_direction-1-ref.html b/toolkit/content/tests/widgets/videocontrols_direction-1-ref.html deleted file mode 100644 index 1f7e76a7d..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-1-ref.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-1a.html b/toolkit/content/tests/widgets/videocontrols_direction-1a.html deleted file mode 100644 index a4d354629..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-1a.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-1b.html b/toolkit/content/tests/widgets/videocontrols_direction-1b.html deleted file mode 100644 index a14b11d5f..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-1b.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-1c.html b/toolkit/content/tests/widgets/videocontrols_direction-1c.html deleted file mode 100644 index 0885ebd89..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-1c.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-1d.html b/toolkit/content/tests/widgets/videocontrols_direction-1d.html deleted file mode 100644 index a39accec7..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-1d.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-1e.html b/toolkit/content/tests/widgets/videocontrols_direction-1e.html deleted file mode 100644 index 25e7c2c1f..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-1e.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-2-ref.html b/toolkit/content/tests/widgets/videocontrols_direction-2-ref.html deleted file mode 100644 index 630177883..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-2-ref.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-2a.html b/toolkit/content/tests/widgets/videocontrols_direction-2a.html deleted file mode 100644 index 2e40cdc1a..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-2a.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-2b.html b/toolkit/content/tests/widgets/videocontrols_direction-2b.html deleted file mode 100644 index 2e4dadb6f..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-2b.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-2c.html b/toolkit/content/tests/widgets/videocontrols_direction-2c.html deleted file mode 100644 index a43b03e8f..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-2c.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-2d.html b/toolkit/content/tests/widgets/videocontrols_direction-2d.html deleted file mode 100644 index 52d56f1cc..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-2d.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction-2e.html b/toolkit/content/tests/widgets/videocontrols_direction-2e.html deleted file mode 100644 index 58bc30e2b..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction-2e.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -
- - diff --git a/toolkit/content/tests/widgets/videocontrols_direction_test.js b/toolkit/content/tests/widgets/videocontrols_direction_test.js deleted file mode 100644 index 8ad76c064..000000000 --- a/toolkit/content/tests/widgets/videocontrols_direction_test.js +++ /dev/null @@ -1,90 +0,0 @@ -var RemoteCanvas = function(url, id) { - this.url = url; - this.id = id; - this.snapshot = null; -}; - -RemoteCanvas.CANVAS_WIDTH = 200; -RemoteCanvas.CANVAS_HEIGHT = 200; - -RemoteCanvas.prototype.compare = function(otherCanvas, expected) { - return compareSnapshots(this.snapshot, otherCanvas.snapshot, expected)[0]; -} - -RemoteCanvas.prototype.load = function(callback) { - var iframe = document.createElement("iframe"); - iframe.id = this.id + "-iframe"; - iframe.width = RemoteCanvas.CANVAS_WIDTH + "px"; - iframe.height = RemoteCanvas.CANVAS_HEIGHT + "px"; - iframe.src = this.url; - var me = this; - iframe.addEventListener("load", function() { - info("iframe loaded"); - var m = iframe.contentDocument.getElementById("av"); - m.addEventListener("suspend", function(aEvent) { - m.removeEventListener("suspend", arguments.callee, false); - setTimeout(function() { - me.remotePageLoaded(callback); - }, 0); - }, false); - m.src = m.getAttribute("source"); - }, false); - window.document.body.appendChild(iframe); -}; - -RemoteCanvas.prototype.remotePageLoaded = function(callback) { - var ldrFrame = document.getElementById(this.id + "-iframe"); - this.snapshot = snapshotWindow(ldrFrame.contentWindow); - this.snapshot.id = this.id + "-canvas"; - window.document.body.appendChild(this.snapshot); - callback(this); -}; - -RemoteCanvas.prototype.cleanup = function() { - var iframe = document.getElementById(this.id + "-iframe"); - iframe.parentNode.removeChild(iframe); - var canvas = document.getElementById(this.id + "-canvas"); - canvas.parentNode.removeChild(canvas); -}; - -function runTest(index) { - var canvases = []; - function testCallback(canvas) { - canvases.push(canvas); - - if (canvases.length == 2) { // when both canvases are loaded - var expectedEqual = currentTest.op == "=="; - var result = canvases[0].compare(canvases[1], expectedEqual); - ok(result, "Rendering of reftest " + currentTest.test + " should " + - (expectedEqual ? "not " : "") + "be different to the reference"); - - if (result) { - canvases[0].cleanup(); - canvases[1].cleanup(); - } - else { - info("Snapshot of canvas 1: " + canvases[0].snapshot.toDataURL()); - info("Snapshot of canvas 2: " + canvases[1].snapshot.toDataURL()); - } - - if (index < tests.length - 1) - runTest(index + 1); - else - SimpleTest.finish(); - } - } - - var currentTest = tests[index]; - var testCanvas = new RemoteCanvas(currentTest.test, "test-" + index); - testCanvas.load(testCallback); - - var refCanvas = new RemoteCanvas(currentTest.ref, "ref-" + index); - refCanvas.load(testCallback); -} - -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestCompleteLog(); - -window.addEventListener("load", function() { - SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function() { runTest(0); }); -}, true); diff --git a/toolkit/content/tests/widgets/videomask.css b/toolkit/content/tests/widgets/videomask.css deleted file mode 100644 index 066d44138..000000000 --- a/toolkit/content/tests/widgets/videomask.css +++ /dev/null @@ -1,23 +0,0 @@ -html, body { - margin: 0; - padding: 0; -} - -audio, video { - width: 140px; - height: 100px; - background-color: black; -} - -/** - * Create a mask for the video direction tests which covers up the throbber. - */ -#mask { - position: absolute; - z-index: 3; - width: 140px; - height: 72px; - background-color: green; - top: 0; - right: 0; -} diff --git a/toolkit/content/tests/widgets/window_menubar.xul b/toolkit/content/tests/widgets/window_menubar.xul deleted file mode 100644 index b7669e0b3..000000000 --- a/toolkit/content/tests/widgets/window_menubar.xul +++ /dev/null @@ -1,820 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From d20ca24a070d547be3bce4d513ef151b6be5f955 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 25 Feb 2020 19:45:39 -0500 Subject: Issue #1053 - Remove android support from toolkit Note: Does not remove support completely from toolkit/mozapps/installer or from telemetry or AppConstants.jsm --- toolkit/content/aboutSupport.js | 10 ---------- toolkit/content/aboutSupport.xhtml | 5 ----- toolkit/content/aboutTelemetry.js | 8 -------- toolkit/content/buildconfig.html | 4 ---- toolkit/content/contentAreaUtils.js | 34 +--------------------------------- toolkit/content/jar.mn | 2 -- toolkit/content/moz.build | 3 --- 7 files changed, 1 insertion(+), 65 deletions(-) (limited to 'toolkit/content') diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index f49172230..f9a0abcb0 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -599,16 +599,6 @@ function copyContentsToClipboard() { let clipboard = Cc["@mozilla.org/widget/clipboard;1"] .getService(Ci.nsIClipboard); clipboard.setData(transferable, null, clipboard.kGlobalClipboard); - -#ifdef MOZ_WIDGET_ANDROID - // Present a toast notification. - let message = { - type: "Toast:Show", - message: stringBundle().GetStringFromName("textCopied"), - duration: "short" - }; - Services.androidBridge.handleGeckoMessage(message); -#endif } // Return the plain text representation of an element. Do a little bit diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index 0b7b52164..8afee1867 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -101,7 +101,6 @@ -#ifndef ANDROID #ifdef MOZ_UPDATER @@ -115,7 +114,6 @@ #endif -#endif #ifdef MOZ_UPDATER @@ -240,7 +238,6 @@ -#ifndef ANDROID &aboutSupport.appBasicsProfiles; @@ -250,8 +247,6 @@ about:profiles -#endif - diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js index 0829fe7e2..97dcba9e2 100644 --- a/toolkit/content/aboutTelemetry.js +++ b/toolkit/content/aboutTelemetry.js @@ -233,17 +233,9 @@ var Settings = { let elements = document.getElementsByClassName("change-data-choices-link"); for (let el of elements) { el.addEventListener("click", function() { -#ifdef MOZ_WIDGET_ANDROID - Cu.import("resource://gre/modules/Messaging.jsm"); - Messaging.sendRequest({ - type: "Settings:Show", - resource: "preferences_privacy", - }); -#else // Show the data choices preferences on desktop. let mainWindow = getMainWindowWithPreferencesPane(); mainWindow.openAdvancedPreferences("dataChoicesTab"); -#endif }, false); } }, diff --git a/toolkit/content/buildconfig.html b/toolkit/content/buildconfig.html index d3373f54c..322208189 100644 --- a/toolkit/content/buildconfig.html +++ b/toolkit/content/buildconfig.html @@ -58,9 +58,5 @@

Configure options

@MOZ_CONFIGURE_OPTIONS@

-#ifdef ANDROID -

Package name

-

@ANDROID_PACKAGE_NAME@

-#endif diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index 2512804fa..17e463325 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -1115,40 +1115,8 @@ function validateFileName(aFileName) aFileName = aFileName.replace(/[\<]+/g, "("); aFileName = aFileName.replace(/[\>]+/g, ")"); } - else if (navigator.appVersion.indexOf("Macintosh") != -1) + else if (navigator.appVersion.indexOf("Macintosh") != -1) { re = /[\:\/]+/g; - else if (navigator.appVersion.indexOf("Android") != -1) { - // On mobile devices, the filesystem may be very limited in what - // it considers valid characters. To avoid errors, we sanitize - // conservatively. - const dangerousChars = "*?<>|\":/\\[];,+="; - var processed = ""; - for (var i = 0; i < aFileName.length; i++) - processed += aFileName.charCodeAt(i) >= 32 && - !(dangerousChars.indexOf(aFileName[i]) >= 0) ? aFileName[i] - : "_"; - - // Last character should not be a space - processed = processed.trim(); - - // If a large part of the filename has been sanitized, then we - // will use a default filename instead - if (processed.replace(/_/g, "").length <= processed.length/2) { - // We purposefully do not use a localized default filename, - // which we could have done using - // ContentAreaUtils.stringBundle.GetStringFromName("DefaultSaveFileName") - // since it may contain invalid characters. - var original = processed; - processed = "download"; - - // Preserve a suffix, if there is one - if (original.indexOf(".") >= 0) { - var suffix = original.split(".").slice(-1)[0]; - if (suffix && suffix.indexOf("_") < 0) - processed += "." + suffix; - } - } - return processed; } return aFileName.replace(re, "_"); diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index 96c559bb2..c73427a31 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -19,10 +19,8 @@ toolkit.jar: #endif content/global/aboutNetworking.js content/global/aboutNetworking.xhtml -#ifndef ANDROID * content/global/aboutProfiles.js content/global/aboutProfiles.xhtml -#endif content/global/aboutServiceWorkers.js content/global/aboutServiceWorkers.xhtml #ifdef MOZ_WEBRTC diff --git a/toolkit/content/moz.build b/toolkit/content/moz.build index b1f6b6419..0a08483b4 100644 --- a/toolkit/content/moz.build +++ b/toolkit/content/moz.build @@ -14,9 +14,6 @@ for var in ('target', DEFINES['CFLAGS'] = CONFIG['OS_CFLAGS'] DEFINES['TOPOBJDIR'] = TOPOBJDIR -if CONFIG['OS_TARGET'] == 'Android': - DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'] - if CONFIG['MOZ_ANDROID_CXX_STL'] == 'libc++': DEFINES['MOZ_USE_LIBCXX'] = True -- cgit v1.2.3 From 3bec218684f77267f1c679bb5b483af5ef25600f Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 7 Apr 2020 22:41:34 -0400 Subject: Take files out of preprocessing that no longer require it --- toolkit/content/jar.mn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolkit/content') diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index c73427a31..8b7b35b61 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -30,13 +30,13 @@ toolkit.jar: #endif * content/global/aboutSupport.js * content/global/aboutSupport.xhtml -* content/global/aboutTelemetry.js + content/global/aboutTelemetry.js content/global/aboutTelemetry.xhtml content/global/aboutTelemetry.css content/global/directionDetector.html content/global/plugins.html content/global/plugins.css -* content/global/browser-child.js + content/global/browser-child.js content/global/browser-content.js * content/global/buildconfig.html * content/global/contentAreaUtils.js -- cgit v1.2.3