From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../content/test/general/browser_contextmenu.js | 996 +++++++++++++++++++++ 1 file changed, 996 insertions(+) create mode 100644 browser/base/content/test/general/browser_contextmenu.js (limited to 'browser/base/content/test/general/browser_contextmenu.js') diff --git a/browser/base/content/test/general/browser_contextmenu.js b/browser/base/content/test/general/browser_contextmenu.js new file mode 100644 index 000000000..3e0135848 --- /dev/null +++ b/browser/base/content/test/general/browser_contextmenu.js @@ -0,0 +1,996 @@ +"use strict"; + +let contextMenu; +let LOGIN_FILL_ITEMS = [ + "---", null, + "fill-login", null, + [ + "fill-login-no-logins", false, + "---", null, + "fill-login-saved-passwords", true + ], null, +]; +let hasPocket = Services.prefs.getBoolPref("extensions.pocket.enabled"); +let hasContainers = Services.prefs.getBoolPref("privacy.userContext.enabled"); + +const example_base = "http://example.com/browser/browser/base/content/test/general/"; +const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/"; + +Services.scriptloader.loadSubScript(chrome_base + "contextmenu_common.js", this); + +// Below are test cases for XUL element +add_task(function* test_xul_text_link_label() { + let url = chrome_base + "subtst_contextmenu_xul.xul"; + + yield BrowserTestUtils.openNewForegroundTab(gBrowser, url); + + yield test_contextmenu("#test-xul-text-link-label", + ["context-openlinkintab", true, + ...(hasContainers ? ["context-openlinkinusercontext-menu", true] : []), + // We need a blank entry here because the containers submenu is + // dynamically generated with no ids. + ...(hasContainers ? ["", null] : []), + "context-openlink", true, + "context-openlinkprivate", true, + "---", null, + "context-bookmarklink", true, + "context-savelink", true, + ...(hasPocket ? ["context-savelinktopocket", true] : []), + "context-copylink", true, + "context-searchselect", true + ] + ); + + // Clean up so won't affect HTML element test cases + lastElementSelector = null; + gBrowser.removeCurrentTab(); +}); + +// Below are test cases for HTML element + +add_task(function* test_setup_html() { + let url = example_base + "subtst_contextmenu.html"; + + yield BrowserTestUtils.openNewForegroundTab(gBrowser, url); + + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() { + let doc = content.document; + let videoIframe = doc.querySelector("#test-video-in-iframe"); + let video = videoIframe.contentDocument.querySelector("video"); + let awaitPause = ContentTaskUtils.waitForEvent(video, "pause"); + video.pause(); + yield awaitPause; + + let audioIframe = doc.querySelector("#test-audio-in-iframe"); + // media documents always use a