Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gk/tor-browser
  • peterstory/tor-browser
  • sanketh/tor-browser
  • acat/tor-browser
  • sysrqb/tor-browser
  • boklm/tor-browser
  • dan/tor-browser
  • fabrizio/tor-browser
  • victorvw/tor-browser
  • aguestuser/tor-browser
  • WofWca/tor-browser
  • p13dz/tor-browser
  • mwolfe/tor-browser
  • tpo/applications/tor-browser
  • brade/tor-browser
  • pierov/tor-browser
  • ma1/tor-browser
  • JeremyRand/tor-browser
  • henry/tor-browser
  • msimonelli/tor-browser
  • cypherpunks1/tor-browser
  • blackZwork/tor-browser
  • starlingroot/tor-browser
  • cohosh/tor-browser
  • t-m-w/tor-browser
  • trinity-1686a/tor-browser
  • HHN/tor-browser
  • emmapeel/tor-browser
  • Achintya_Sharma/tor-browser
  • guest475646844/tor-browser
  • Mima/tor-browser
  • morgan/tor-browser
  • clairehurst/tor-browser
  • NoisyCoil/tor-browser
  • gus/tor-browser
  • Francewhoa/tor-browser
  • novialriptide/tor-browser
  • jwilde/tor-browser
  • brizental/tor-browser
  • ourhopeforfreedom/tor-browser
  • onyinyang/tor-browser
  • Noino/tor-browser
  • murmelurmel/tor-browser
43 results
Show changes
Showing
with 278 additions and 218 deletions
......@@ -2094,7 +2094,6 @@
contextmenu: "contentAreaContextMenu",
message: "true",
messagemanagergroup: "browsers",
selectmenulist: "ContentSelectDropdown",
tooltip: "aHTMLTooltip",
type: "content",
};
......
......@@ -113,8 +113,12 @@ add_task(async function testCaptivePortalAdvancedPanel() {
let tab = await openCaptivePortalErrorTab();
let browser = tab.linkedBrowser;
const waitForLocationChange = (async () => {
await BrowserTestUtils.waitForLocationChange(gBrowser, BAD_CERT_PAGE);
info("(waitForLocationChange resolved)");
})();
await SpecialPowers.spawn(browser, [BAD_CERT_PAGE], async expectedURL => {
let doc = content.document;
const doc = content.document;
let advancedButton = doc.getElementById("advancedButton");
await ContentTaskUtils.waitForCondition(
() => ContentTaskUtils.is_visible(advancedButton),
......@@ -122,12 +126,13 @@ add_task(async function testCaptivePortalAdvancedPanel() {
);
info("Clicking on the advanced button");
await EventUtils.synthesizeMouseAtCenter(advancedButton, {}, content);
let advPanelContainer = doc.getElementById("advancedPanelContainer");
const advPanel = doc.getElementById("badCertAdvancedPanel");
ok(
ContentTaskUtils.is_visible(advPanelContainer),
"Advanced panel is now visible"
!ContentTaskUtils.is_visible(advPanel),
"Advanced panel is not yet visible"
);
await EventUtils.synthesizeMouseAtCenter(advancedButton, {}, content);
ok(ContentTaskUtils.is_visible(advPanel), "Advanced panel is now visible");
let advPanelContent = doc.getElementById("badCertTechnicalInfo");
ok(
......@@ -142,17 +147,58 @@ add_task(async function testCaptivePortalAdvancedPanel() {
"Cert error code is visible in the advanced panel"
);
let advPanelExceptionButton = doc.getElementById("exceptionDialogButton");
// -
const advPanelExceptionButton = doc.getElementById("exceptionDialogButton");
function isOnCertErrorPage() {
return ContentTaskUtils.is_visible(advPanel);
}
ok(isOnCertErrorPage(), "On cert error page before adding exception");
ok(
advPanelExceptionButton.disabled,
"Exception button should start disabled"
);
await EventUtils.synthesizeMouseAtCenter(
advPanelExceptionButton,
{},
content
); // Click
const clickTime = content.performance.now();
ok(
isOnCertErrorPage(),
"Still on cert error page because clicked too early"
);
// Now waitForCondition now that it's possible.
try {
await ContentTaskUtils.waitForCondition(
() => !advPanelExceptionButton.disabled,
"Wait for exception button enabled"
);
} catch (rejected) {
ok(false, rejected);
return;
}
ok(
doc.location.href.startsWith(expectedURL),
"Accept the risk and continue button works on the captive portal page"
!advPanelExceptionButton.disabled,
"Exception button should be enabled after waiting"
);
const msSinceClick = content.performance.now() - clickTime;
const expr = `${msSinceClick} > 1000`;
/* eslint-disable no-eval */
ok(eval(expr), `Exception button should stay disabled for ${expr} ms`);
await EventUtils.synthesizeMouseAtCenter(
advPanelExceptionButton,
{},
content
); // Click
info("Clicked");
});
await waitForLocationChange;
info("Page reloaded after adding cert exception");
// Clear the certificate exception.
let certOverrideService = Cc[
......@@ -160,9 +206,16 @@ add_task(async function testCaptivePortalAdvancedPanel() {
].getService(Ci.nsICertOverrideService);
certOverrideService.clearValidityOverride("expired.example.com", -1, {});
let errorTabReloaded = BrowserTestUtils.waitForErrorPage(browser);
Services.obs.notifyObservers(null, "captive-portal-login-success");
await errorTabReloaded;
info("After clearing cert override, asking for reload...");
const waitForErrorPage = BrowserTestUtils.waitForErrorPage(browser);
await SpecialPowers.spawn(browser, [], async () => {
info("reload...");
content.location.reload();
});
info("waitForErrorPage...");
await waitForErrorPage;
info("removeTab...");
await BrowserTestUtils.removeTab(tab);
info("Done!");
});
......@@ -672,10 +672,6 @@ add_task(async function test_iframe() {
true,
"---",
null,
"context-take-frame-screenshot",
true,
"---",
null,
"context-viewframesource",
true,
"context-viewframeinfo",
......@@ -763,10 +759,6 @@ add_task(async function test_video_in_iframe() {
true,
"---",
null,
"context-take-frame-screenshot",
true,
"---",
null,
"context-viewframeinfo",
true,
]),
......@@ -846,10 +838,6 @@ add_task(async function test_video_in_iframe() {
true,
"---",
null,
"context-take-frame-screenshot",
true,
"---",
null,
"context-viewframeinfo",
true,
]),
......@@ -917,10 +905,6 @@ add_task(async function test_audio_in_iframe() {
true,
"---",
null,
"context-take-frame-screenshot",
true,
"---",
null,
"context-viewframeinfo",
true,
]),
......@@ -974,10 +958,6 @@ add_task(async function test_image_in_iframe() {
true,
"---",
null,
"context-take-frame-screenshot",
true,
"---",
null,
"context-viewframeinfo",
true,
]),
......@@ -1672,10 +1652,6 @@ add_task(async function test_srcdoc() {
true,
"---",
null,
"context-take-frame-screenshot",
true,
"---",
null,
"context-viewframesource",
true,
"context-viewframeinfo",
......
......@@ -5,6 +5,7 @@
// This test tests <select> in a child process. This is different than
// single-process as a <menulist> is used to implement the dropdown list.
// FIXME(bug 1774835): This test should be split.
requestLongerTimeout(2);
const XHTML_DTD =
......@@ -92,17 +93,13 @@ const PAGECONTENT_TRANSLATED =
"</iframe>" +
"</div></body></html>";
function openSelectPopup(
selectPopup,
async function openSelectPopup(
mode = "key",
selector = "select",
win = window
) {
let popupShownPromise = BrowserTestUtils.waitForEvent(
selectPopup,
"popupshown"
);
info("Opening select popup");
let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(win);
if (mode == "click" || mode == "mousedown") {
let mousePromise;
if (mode == "click") {
......@@ -120,11 +117,10 @@ function openSelectPopup(
win.gBrowser.selectedBrowser
);
}
return Promise.all([popupShownPromise, mousePromise]);
await mousePromise;
} else {
EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true }, win);
}
EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true }, win);
return popupShownPromise;
}
......@@ -150,10 +146,8 @@ async function doSelectTests(contentType, content) {
const pageUrl = "data:" + contentType + "," + encodeURIComponent(content);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
await openSelectPopup(selectPopup);
let selectPopup = await openSelectPopup();
let menulist = selectPopup.parentNode;
let isWindows = navigator.platform.includes("Win");
......@@ -228,7 +222,7 @@ async function doSelectTests(contentType, content) {
EventUtils.synthesizeKey("KEY_Backspace");
window.removeEventListener("keypress", handleKeyPress);
await hideSelectPopup(selectPopup);
await hideSelectPopup();
is(menulist.selectedIndex, 3, "Item 3 still selected");
is(await getInputEvents(), 1, "After closed - number of input events");
......@@ -236,8 +230,8 @@ async function doSelectTests(contentType, content) {
is(await getClickEvents(), 0, "After closed - number of click events");
// Opening and closing the popup without changing the value should not fire a change event.
await openSelectPopup(selectPopup, "click");
await hideSelectPopup(selectPopup, "escape");
await openSelectPopup("click");
await hideSelectPopup("escape");
is(
await getInputEvents(),
1,
......@@ -271,9 +265,9 @@ async function doSelectTests(contentType, content) {
"Tab away from select with no change - number of click events"
);
await openSelectPopup(selectPopup, "click");
await openSelectPopup("click");
EventUtils.synthesizeKey("KEY_ArrowDown");
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
is(
await getInputEvents(),
isWindows ? 2 : 1,
......@@ -345,11 +339,8 @@ add_task(async function() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
// First, try it when a different <select> element than the one that is open is removed
await openSelectPopup(selectPopup, "click", "#one");
const selectPopup = await openSelectPopup("click", "#one");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
content.document.body.removeChild(content.document.getElementById("two"));
......@@ -360,10 +351,10 @@ add_task(async function() {
is(selectPopup.state, "open", "Different popup did not affect open popup");
await hideSelectPopup(selectPopup);
await hideSelectPopup();
// Next, try it when the same <select> element than the one that is open is removed
await openSelectPopup(selectPopup, "click", "#three");
await openSelectPopup("click", "#three");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(
selectPopup,
......@@ -377,7 +368,7 @@ add_task(async function() {
ok(true, "Popup hidden when select is removed");
// Finally, try it when the tab is closed while the select popup is open.
await openSelectPopup(selectPopup, "click", "#one");
await openSelectPopup("click", "#one");
popupHiddenPromise = BrowserTestUtils.waitForEvent(
selectPopup,
......@@ -408,17 +399,14 @@ add_task(async function() {
await focusPromise;
});
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
// First, get the position of the select popup when no translations have been applied.
await openSelectPopup(selectPopup);
const selectPopup = await openSelectPopup();
let rect = selectPopup.getBoundingClientRect();
let expectedX = rect.left;
let expectedY = rect.top;
await hideSelectPopup(selectPopup);
await hideSelectPopup();
// Iterate through a set of steps which each add more translation to the select's expected position.
let steps = [
......@@ -468,7 +456,7 @@ add_task(async function() {
});
});
await openSelectPopup(selectPopup);
await openSelectPopup();
expectedX += step[2];
expectedY += step[3];
......@@ -477,7 +465,7 @@ add_task(async function() {
is(popupRect.left, expectedX, "step " + (stepIndex + 1) + " x");
is(popupRect.top, expectedY, "step " + (stepIndex + 1) + " y");
await hideSelectPopup(selectPopup);
await hideSelectPopup();
}
BrowserTestUtils.removeTab(tab);
......@@ -492,9 +480,6 @@ add_task(async function test_event_order() {
url: URL,
},
async function(browser) {
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
// According to https://html.spec.whatwg.org/#the-select-element,
// we want to fire input, change, and then click events on the
// <select> (in that order) when it has changed.
......@@ -548,11 +533,7 @@ add_task(async function test_event_order() {
for (let mode of ["enter", "click"]) {
let expected = mode == "enter" ? expectedEnter : expectedClick;
await openSelectPopup(
selectPopup,
"click",
mode == "enter" ? "#one" : "#two"
);
await openSelectPopup("click", mode == "enter" ? "#one" : "#two");
let eventsPromise = SpecialPowers.spawn(
browser,
......@@ -609,7 +590,7 @@ add_task(async function test_event_order() {
);
EventUtils.synthesizeKey("KEY_ArrowDown");
await hideSelectPopup(selectPopup, mode);
await hideSelectPopup(mode);
await eventsPromise;
}
}
......@@ -630,12 +611,9 @@ async function performLargePopupTests(win) {
select.focus();
});
let selectPopup = win.document.getElementById("ContentSelectDropdown")
.menupopup;
let browserRect = browser.getBoundingClientRect();
// Check if a drag-select works and scrolls the list.
await openSelectPopup(selectPopup, "mousedown", "select", win);
const selectPopup = await openSelectPopup("mousedown", "select", win);
const browserRect = browser.getBoundingClientRect();
let getScrollPos = () => selectPopup.scrollBox.scrollbox.scrollTop;
let scrollPos = getScrollPos();
......@@ -801,7 +779,7 @@ async function performLargePopupTests(win) {
"scroll position at mousemove after mouseup should not change"
);
await hideSelectPopup(selectPopup, "escape", win);
await hideSelectPopup("escape", win);
let positions = [
"margin-top: 300px;",
......@@ -811,7 +789,7 @@ async function performLargePopupTests(win) {
let position;
while (positions.length) {
await openSelectPopup(selectPopup, "key", "select", win);
await openSelectPopup("key", "select", win);
let rect = selectPopup.getBoundingClientRect();
let marginBottom = parseFloat(getComputedStyle(selectPopup).marginBottom);
......@@ -854,7 +832,7 @@ async function performLargePopupTests(win) {
);
}
await hideSelectPopup(selectPopup, "enter", win);
await hideSelectPopup("enter", win);
position = positions.shift();
......@@ -882,7 +860,7 @@ async function performLargePopupTests(win) {
select.focus();
});
await openSelectPopup(selectPopup, "key", "select", win);
await openSelectPopup("key", "select", win);
ok(
selectPopup.getBoundingClientRect().top >
......@@ -890,7 +868,7 @@ async function performLargePopupTests(win) {
"select popup appears over selected item"
);
await hideSelectPopup(selectPopup, "escape", win);
await hideSelectPopup("escape", win);
}
}
......@@ -949,9 +927,7 @@ async function performSelectSearchTests(win) {
select.focus();
});
let selectPopup = win.document.getElementById("ContentSelectDropdown")
.menupopup;
await openSelectPopup(selectPopup, false, "select", win);
let selectPopup = await openSelectPopup(false, "select", win);
let searchElement = selectPopup.querySelector(
".contentSelectDropdown-searchbox"
......@@ -1013,7 +989,7 @@ async function performSelectSearchTests(win) {
"Option hidden by content should remain hidden"
);
await hideSelectPopup(selectPopup, "escape", win);
await hideSelectPopup("escape", win);
}
// This test checks the functionality of search in select elements with groups
......@@ -1038,18 +1014,7 @@ add_task(async function test_mousemove_correcttarget() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let selectPopup = document.getElementById("ContentSelectDropdown").menupopup;
let popupShownPromise = BrowserTestUtils.waitForEvent(
selectPopup,
"popupshown"
);
await BrowserTestUtils.synthesizeMouseAtCenter(
"#one",
{ type: "mousedown" },
gBrowser.selectedBrowser
);
await popupShownPromise;
const selectPopup = await openSelectPopup("mousedown");
await new Promise(resolve => {
window.addEventListener(
......@@ -1073,11 +1038,11 @@ add_task(async function test_mousemove_correcttarget() {
gBrowser.selectedBrowser
);
await hideSelectPopup(selectPopup);
await hideSelectPopup();
// The popup should be closed when fullscreen mode is entered or exited.
for (let steps = 0; steps < 2; steps++) {
await openSelectPopup(selectPopup, "click");
await openSelectPopup("click");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(
selectPopup,
"popuphidden"
......@@ -1099,20 +1064,9 @@ add_task(async function test_somehidden() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SOMEHIDDEN);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let selectPopup = document.getElementById("ContentSelectDropdown").menupopup;
let popupShownPromise = BrowserTestUtils.waitForEvent(
selectPopup,
"popupshown"
);
await BrowserTestUtils.synthesizeMouseAtCenter(
"#one",
{ type: "mousedown" },
gBrowser.selectedBrowser
);
await popupShownPromise;
let selectPopup = await openSelectPopup("click");
// The exact number is not needed; just ensure the height is larger than 4 items to accomodate any popup borders.
// The exact number is not needed; just ensure the height is larger than 4 items to accommodate any popup borders.
ok(
selectPopup.getBoundingClientRect().height >=
selectPopup.lastElementChild.getBoundingClientRect().height * 4,
......@@ -1138,7 +1092,7 @@ add_task(async function test_somehidden() {
child = child.nextElementSibling;
}
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
});
......@@ -1160,10 +1114,7 @@ add_task(async function test_blur_hides_popup() {
content.document.getElementById("one").focus();
});
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
await openSelectPopup(selectPopup);
let selectPopup = await openSelectPopup();
let popupHiddenPromise = BrowserTestUtils.waitForEvent(
selectPopup,
......@@ -1186,11 +1137,8 @@ add_task(async function test_zoom() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
info("Opening the popup");
await openSelectPopup(selectPopup, "click");
const selectPopup = await openSelectPopup("click");
info("Opened the popup");
let nonZoomedFontSize = parseFloat(
......@@ -1199,9 +1147,9 @@ add_task(async function test_zoom() {
);
info("font-size is " + nonZoomedFontSize);
await hideSelectPopup(selectPopup);
await hideSelectPopup();
info("Hid the popup");
info("Hide the popup");
for (let i = 0; i < 2; ++i) {
info("Testing with full zoom: " + ZoomManager.useFullZoom);
......@@ -1210,7 +1158,7 @@ add_task(async function test_zoom() {
FullZoom.setZoom(2.0, tab.linkedBrowser);
info("Opening popup again");
await openSelectPopup(selectPopup, "click");
await openSelectPopup("click");
let zoomedFontSize = parseFloat(
getComputedStyle(selectPopup.querySelector("menuitem")).fontSize,
......@@ -1224,7 +1172,7 @@ add_task(async function test_zoom() {
`expected ${nonZoomedFontSize * 2.0}`
);
await hideSelectPopup(selectPopup);
await hideSelectPopup();
info("Hid the popup again");
ZoomManager.toggleZoom();
......@@ -1255,24 +1203,21 @@ add_task(async function test_handling_user_input() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
// Test onchange event when changing value via keyboard.
await openSelectPopup(selectPopup, "click", "#one");
const selectPopup = await openSelectPopup("click", "#one");
let getPromise = getIsHandlingUserInput(tab.linkedBrowser, "one", "change");
EventUtils.synthesizeKey("KEY_ArrowDown");
await hideSelectPopup(selectPopup);
await hideSelectPopup();
is(await getPromise, true, "isHandlingUserInput should be true");
// Test onchange event when changing value via mouse click
await openSelectPopup(selectPopup, "click", "#two");
await openSelectPopup("click", "#two");
getPromise = getIsHandlingUserInput(tab.linkedBrowser, "two", "change");
EventUtils.synthesizeMouseAtCenter(selectPopup.lastElementChild, {});
is(await getPromise, true, "isHandlingUserInput should be true");
// Test onclick event fired from clicking select popup.
await openSelectPopup(selectPopup, "click", "#three");
await openSelectPopup("click", "#three");
getPromise = getIsHandlingUserInput(tab.linkedBrowser, "three", "click");
EventUtils.synthesizeMouseAtCenter(selectPopup.firstElementChild, {});
is(await getPromise, true, "isHandlingUserInput should be true");
......@@ -1305,13 +1250,10 @@ let select = document.querySelector("select");
const pageUrl = "data:text/html," + escape(PAGE_CONTENT);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
// Test change and input events get handled consistently
await openSelectPopup(selectPopup, "click");
await openSelectPopup("click");
EventUtils.synthesizeKey("KEY_ArrowDown");
await hideSelectPopup(selectPopup);
await hideSelectPopup();
is(
await getChangeEvents(),
......@@ -1339,10 +1281,7 @@ add_task(async function test_label_not_text() {
const pageUrl = "data:text/html," + escape(PAGE_CONTENT);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
await openSelectPopup(selectPopup, "click");
const selectPopup = await openSelectPopup("click");
is(
selectPopup.children[0].label,
......
......@@ -332,19 +332,14 @@ async function openSelectPopup(select) {
await computeLabels(tab);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
let popupShownPromise = BrowserTestUtils.waitForEvent(
selectPopup,
"popupshown"
);
let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(window);
await BrowserTestUtils.synthesizeMouseAtCenter(
"#one",
{ type: "mousedown" },
gBrowser.selectedBrowser
);
await popupShownPromise;
let selectPopup = await popupShownPromise;
let menulist = selectPopup.parentNode;
return { tab, menulist, selectPopup };
}
......@@ -451,7 +446,7 @@ async function testSelectColors(selectID, itemCount, options) {
}
if (!options.leaveOpen) {
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
}
}
......@@ -683,8 +678,8 @@ add_task(
await testSelectColors("SELECT_LONG_WITH_TRANSITION", 76, options);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
let selectPopup = document.getElementById("ContentSelectDropdown")
.menupopup;
let scrollBox = selectPopup.scrollBox;
is(
scrollBox.scrollTop,
......@@ -692,7 +687,7 @@ add_task(
"The popup should be scrolled to the bottom of the list (where the selected item is)"
);
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
}
);
......@@ -743,9 +738,7 @@ add_task(
);
}
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
}
);
......@@ -772,7 +765,7 @@ add_task(async function test_select_font_inherits_to_option() {
"Second menuitem's font should be the author specified one"
);
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
});
......@@ -790,7 +783,7 @@ add_task(async function test_scrollbar_props() {
is(scrollBoxStyle.scrollbarWidth, "thin");
is(scrollBoxStyle.scrollbarColor, "rgb(255, 0, 0) rgb(0, 0, 255)");
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
});
......@@ -812,17 +805,17 @@ if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
);
// Check that by default, we use the dark mode styles:
let { tab, selectPopup } = await openSelectPopup(gSelects.DEFAULT_DARKMODE);
let { tab } = await openSelectPopup(gSelects.DEFAULT_DARKMODE);
await testSelectColors("DEFAULT_DARKMODE", 3, {
selectColor,
selectBgColor,
});
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
({ tab, selectPopup } = await openSelectPopup(
({ tab } = await openSelectPopup(
gSelects.IDENTICAL_BG_DIFF_FG_OPTION_DARKMODE
));
......@@ -834,12 +827,10 @@ if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
selectBgColor: "rgb(255, 255, 255)",
});
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
({ tab, selectPopup } = await openSelectPopup(
gSelects.SPLIT_FG_BG_OPTION_DARKMODE
));
({ tab } = await openSelectPopup(gSelects.SPLIT_FG_BG_OPTION_DARKMODE));
// Like the previous case, but here the bg colour is defined on the
// select, and the fg colour on the option. The behaviour should be the
......@@ -849,7 +840,7 @@ if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
selectBgColor: "rgb(255, 255, 255)",
});
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
});
}
......@@ -16,19 +16,14 @@ add_task(async function test_focus_on_search_shouldnt_close_popup() {
const pageUrl = "data:text/html," + escape(SELECT);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
let menulist = document.getElementById("ContentSelectDropdown");
let selectPopup = menulist.menupopup;
let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(window);
let popupShownPromise = BrowserTestUtils.waitForEvent(
selectPopup,
"popupshown"
);
await BrowserTestUtils.synthesizeMouseAtCenter(
"#one",
{ type: "mousedown" },
gBrowser.selectedBrowser
);
await popupShownPromise;
let selectPopup = await popupShownPromise;
let searchInput = selectPopup.querySelector(
".contentSelectDropdown-searchbox"
......@@ -44,6 +39,6 @@ add_task(async function test_focus_on_search_shouldnt_close_popup() {
"select popup should still be open after clicking on the search field"
);
await hideSelectPopup(selectPopup, "escape");
await hideSelectPopup("escape");
BrowserTestUtils.removeTab(tab);
});
function hideSelectPopup(selectPopup, mode = "enter", win = window) {
function hideSelectPopup(mode = "enter", win = window) {
let browser = win.gBrowser.selectedBrowser;
let selectClosedPromise = SpecialPowers.spawn(browser, [], async function() {
let { SelectContentHelper } = ChromeUtils.import(
......@@ -12,7 +12,8 @@ function hideSelectPopup(selectPopup, mode = "enter", win = window) {
} else if (mode == "enter") {
EventUtils.synthesizeKey("KEY_Enter", {}, win);
} else if (mode == "click") {
EventUtils.synthesizeMouseAtCenter(selectPopup.lastElementChild, {}, win);
let popup = win.document.getElementById("ContentSelectDropdown").menupopup;
EventUtils.synthesizeMouseAtCenter(popup.lastElementChild, {}, win);
}
return selectClosedPromise;
......
......@@ -15,7 +15,9 @@ skip-if =
[browser_fullscreen_enterInUrlbar.js]
skip-if = (os == 'mac') || (os == 'linux') #Bug 1648649
[browser_fullscreen_window_open.js]
skip-if = debug && os == 'mac' # Bug 1568570
skip-if =
debug && os == 'mac' # Bug 1568570
swgl
[browser_fullscreen_window_focus.js]
skip-if =
os == 'mac' # Bug 1568570
......
......@@ -28,6 +28,26 @@ async function testWindowOpen(iframeID) {
BrowserTestUtils.removeTab(tab);
}
async function testWindowOpenExistingWindow() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
let popup = await jsWindowOpen(tab.linkedBrowser, true);
info("re-focusing main window");
await waitForFocus(tab.linkedBrowser);
info("Entering full-screen");
await changeFullscreen(tab.linkedBrowser, true);
await testExpectFullScreenExit(tab.linkedBrowser, true, async () => {
info("Calling window.open() again should reuse the existing window");
jsWindowOpen(tab.linkedBrowser, true);
});
// Cleanup
await BrowserTestUtils.closeWindow(popup);
BrowserTestUtils.removeTab(tab);
}
add_setup(async function() {
await SpecialPowers.pushPrefEnv({
set: [
......@@ -44,3 +64,7 @@ add_task(function test_parentWindowOpen() {
add_task(function test_iframeWindowOpen() {
return testWindowOpen(IFRAME_ID);
});
add_task(function test_parentWindowOpenExistWindow() {
return testWindowOpenExistingWindow();
});
......@@ -35,7 +35,7 @@
window.openedWindow = window.open('https://example.com' + window.location.pathname);
if (canReply) event.ports[0].postMessage('opened');
} else if(event.data === "openpopup") {
window.openedWindow = window.open('https://example.com' + window.location.pathname, '', 'top=0,height=1, width=300');
window.openedWindow = window.open('https://example.com' + window.location.pathname, 'test', 'top=0,height=1, width=300');
if (canReply) event.ports[0].postMessage('popupopened');
} else if(event.data === "focus") {
window.openedWindow.focus();
......
......@@ -10,5 +10,8 @@ https_first_disabled = true
support-files = focusableContent.html
[browser_toolbarButtonKeyPress.js]
skip-if = os == "linux" #Bug 1532501
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
[browser_toolbarKeyNav.js]
support-files = !/browser/base/content/test/permissions/permissions.html
skip-if =
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
\ No newline at end of file
......@@ -5,13 +5,18 @@ support-files=
temporary_permissions_subframe.html
temporary_permissions_frame.html
[browser_canvas_fingerprinting_resistance.js]
skip-if = debug || os == "linux" && asan # Bug 1522069
skip-if =
debug
os == "linux" && asan # Bug 1522069
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
[browser_canvas_rfp_exclusion.js]
[browser_permissions.js]
[browser_permissions_delegate_vibrate.js]
support-files=
empty.html
[browser_permission_delegate_geo.js]
skip-if =
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
[browser_permissions_postPrompt.js]
support-files=
dummy.js
......
......@@ -7,8 +7,9 @@
"use strict";
const kUrl = "https://example.com/";
var gPlacedData = false;
function initTab() {
function initTab(performReadbackTest) {
let contentWindow = content.wrappedJSObject;
let drawCanvas = (fillStyle, id) => {
......@@ -30,12 +31,17 @@ function initTab() {
};
let canvas = drawCanvas("cyan", "canvas-id-canvas");
contentWindow.kPlacedData = canvas.toDataURL();
is(
canvas.toDataURL(),
contentWindow.kPlacedData,
"no RFP, canvas data == placed data"
);
let placedData = canvas.toDataURL();
if (performReadbackTest) {
is(
canvas.toDataURL(),
placedData,
"Reading the placed data twice didn't match"
);
return placedData;
}
return undefined;
}
function disableResistFingerprinting() {
......@@ -77,7 +83,12 @@ function enableResistFingerprinting(RfpNonPbmExclusion, RfpDomainExclusion) {
});
}
function extractCanvasData(isPbm, RfpNonPbmExclusion, RfpDomainExclusion) {
function extractCanvasData(
placedData,
isPbm,
RfpNonPbmExclusion,
RfpDomainExclusion
) {
let contentWindow = content.wrappedJSObject;
let canvas = contentWindow.document.getElementById("canvas-id-canvas");
let canvasData = canvas.toDataURL();
......@@ -85,43 +96,66 @@ function extractCanvasData(isPbm, RfpNonPbmExclusion, RfpDomainExclusion) {
if (RfpDomainExclusion) {
is(
canvasData,
contentWindow.kPlacedData,
`RFP, domain exempted, canvas data == placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
placedData,
`A: RFP, domain exempted, canvas data == placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
);
} else if (!isPbm && RfpNonPbmExclusion) {
is(
canvasData,
contentWindow.kPlacedData,
`RFP, nonPBM exempted, not in PBM, canvas data == placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
placedData,
`B: RFP, nonPBM exempted, not in PBM, canvas data == placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
);
} else if (isPbm && RfpNonPbmExclusion) {
isnot(
canvasData,
contentWindow.kPlacedData,
`RFP, nonPBM exempted, in PBM, canvas data != placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
placedData,
`C: RFP, nonPBM exempted, in PBM, canvas data != placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
);
} else {
isnot(
canvasData,
contentWindow.kPlacedData,
`RFP, domain not exempted, nonPBM not exempted, canvas data != placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
placedData,
`D: RFP, domain not exempted, nonPBM not exempted, canvas data != placed data (isPbm: ${isPbm}, RfpNonPbmExclusion: ${RfpNonPbmExclusion}, RfpDomainExclusion: ${RfpDomainExclusion})`
);
}
}
async function populatePlacedData() {
let win = await BrowserTestUtils.openNewBrowserWindow();
await disableResistFingerprinting();
await BrowserTestUtils.withNewTab(
{
gBrowser: win.gBrowser,
url: kUrl,
},
async function() {
let browser = win.gBrowser.selectedBrowser;
gPlacedData = await SpecialPowers.spawn(
browser,
[/* performReadbackTest= */ true],
initTab
);
}
);
await BrowserTestUtils.closeWindow(win);
}
async function rfpExclusionTestOnCanvas(
win,
placedData,
isPbm,
RfpNonPbmExclusion,
RfpDomainExclusion
) {
let browser = win.gBrowser.selectedBrowser;
await disableResistFingerprinting(); /* we need to disable RFP to capture the placed data */
await SpecialPowers.spawn(browser, [], initTab);
await enableResistFingerprinting(RfpNonPbmExclusion, RfpDomainExclusion);
await SpecialPowers.spawn(
browser,
[isPbm, RfpNonPbmExclusion, RfpDomainExclusion],
[/* performReadbackTest= */ false],
initTab
);
await SpecialPowers.spawn(
browser,
[placedData, isPbm, RfpNonPbmExclusion, RfpDomainExclusion],
extractCanvasData
);
}
......@@ -134,6 +168,7 @@ async function testCanvasRfpExclusion(
let win = await BrowserTestUtils.openNewBrowserWindow({
private: isPbm,
});
await enableResistFingerprinting(RfpNonPbmExclusion, RfpDomainExclusion);
await BrowserTestUtils.withNewTab(
{
gBrowser: win.gBrowser,
......@@ -142,6 +177,7 @@ async function testCanvasRfpExclusion(
rfpExclusionTestOnCanvas.bind(
null,
win,
gPlacedData,
isPbm,
RfpNonPbmExclusion,
RfpDomainExclusion
......@@ -150,6 +186,7 @@ async function testCanvasRfpExclusion(
await BrowserTestUtils.closeWindow(win);
}
add_task(populatePlacedData.bind(null));
add_task(testCanvasRfpExclusion.bind(null, false, false, false));
add_task(testCanvasRfpExclusion.bind(null, false, false, true));
add_task(testCanvasRfpExclusion.bind(null, false, true, false));
......
......@@ -35,3 +35,4 @@ support-files =
popup_blocker_a.html
popup_blocker_b.html
skip-if = debug # This test triggers Bug 1578794 due to opening many popups.
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
......@@ -128,6 +128,8 @@ support-files =
test_no_mcb_for_onions.html
[browser_check_identity_state.js]
https_first_disabled = true
skip-if =
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
[browser_check_identity_state_pdf.js]
https_first_disabled = true
support-files =
......
......@@ -224,10 +224,11 @@ var whitelist = [
platforms: ["linux", "macosx"],
},
// Bug 1344267
{ file: "chrome://remote/content/marionette/test.xhtml" },
{ file: "chrome://remote/content/marionette/test_dialog.properties" },
{ file: "chrome://remote/content/marionette/test_dialog.xhtml" },
{ file: "chrome://remote/content/marionette/test_menupopup.xhtml" },
{ file: "chrome://remote/content/marionette/test_no_xul.xhtml" },
{ file: "chrome://remote/content/marionette/test.xhtml" },
// Bug 1348559
{ file: "chrome://pippki/content/resetpassword.xhtml" },
// Bug 1337345
......
......@@ -145,9 +145,6 @@ let propNameWhitelist = [
// This variable is used from CSS embedded in JS in adjustableTitle.js
{ propName: "--icon-url", isFromDevTools: false },
// This variable is used from CSS embedded in JS in pdf.js
{ propName: "--zoom-factor", isFromDevTools: false },
];
// Add suffix to stylesheets' URI so that we always load them here and
......
......@@ -79,20 +79,16 @@ add_task(async function test_subdialog_esc_on_dropdown_does_not_close_dialog() {
// Open dropdown
let select = dialog._frame.contentDocument.getElementById("select");
let shownPromise = BrowserTestUtils.waitForEvent(
document.getElementById("ContentSelectDropdown"),
"popupshowing",
true
);
let shownPromise = BrowserTestUtils.waitForSelectPopupShown(window);
info("Opening dropdown");
select.focus();
EventUtils.synthesizeKey("VK_SPACE", {}, dialog._frame.contentWindow);
await shownPromise;
let selectPopup = await shownPromise;
let hiddenPromise = BrowserTestUtils.waitForEvent(
document.getElementById("ContentSelectDropdown"),
selectPopup,
"popuphiding",
true
);
......
......@@ -61,6 +61,7 @@ support-files = tab_that_closes.html
[browser_multiselect_tabs_move_to_another_window_drag.js]
[browser_multiselect_tabs_move_to_new_window_contextmenu.js]
https_first_disabled = true
[browser_tab_manager_keyboard_access.js]
[browser_tab_play.js]
[browser_multiselect_tabs_move.js]
[browser_multiselect_tabs_mute_unmute.js]
......
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check we can open the tab manager using the keyboard.
* Note that navigation to buttons in the toolbar is covered
* by other tests.
*/
add_task(async function test_open_tabmanager_keyboard() {
await SpecialPowers.pushPrefEnv({
set: [["browser.tabs.tabmanager.enabled", true]],
});
let newWindow = await BrowserTestUtils.openNewWindowWithFlushedCacheForMozSupports();
let elem = newWindow.document.getElementById("alltabs-button");
// Borrowed from forceFocus() in the keyboard directory head.js
elem.setAttribute("tabindex", "-1");
elem.focus();
elem.removeAttribute("tabindex");
let focused = BrowserTestUtils.waitForEvent(newWindow, "focus", true);
EventUtils.synthesizeKey(" ", {}, newWindow);
let event = await focused;
ok(
event.originalTarget.closest("#allTabsMenu-allTabsView"),
"Focus inside all tabs menu after toolbar button pressed"
);
let hidden = BrowserTestUtils.waitForEvent(
event.target.closest("panel"),
"popuphidden"
);
EventUtils.synthesizeKey("KEY_Escape", { shiftKey: false }, newWindow);
await hidden;
await BrowserTestUtils.closeWindow(newWindow);
});