"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