Bug 1453528 - Fix opening of synced tabs with correct principal. r=markh

MozReview-Commit-ID: 6MGXjsg3HmV

--HG--
extra : rebase_source : bc2782dbf14131325fd7ee4564524794350a1bc3
This commit is contained in:
Jonathan Kingston 2018-04-12 18:06:13 +01:00
Родитель 65ee12984d
Коммит fea68cb968
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -744,7 +744,9 @@ if (Services.prefs.getBoolPref("identity.fxaccounts.enabled")) {
// We need to use "click" instead of "command" here so openUILink
// respects different buttons (eg, to open in a new tab).
item.addEventListener("click", e => {
doc.defaultView.openWebLinkIn(tabInfo.url, e);
doc.defaultView.openUILink(tabInfo.url, e, {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})
});
if (doc.defaultView.whereToOpenLink(e) != "current") {
e.preventDefault();
e.stopPropagation();

Просмотреть файл

@ -19,6 +19,8 @@ const DECKINDEX_TABSDISABLED = 1;
const DECKINDEX_FETCHING = 2;
const DECKINDEX_NOCLIENTS = 3;
const SAMPLE_TAB_URL = "https://example.com/";
var initialLocation = gBrowser.currentURI.spec;
var newTab = null;
@ -335,7 +337,7 @@ add_task(async function() {
// on the second to last page we should have 22 items shown
// (because we have to show at least NEXT_PAGE_MIN_TABS=5 tabs on the last page)
for (let i = 1; i <= 77; i++) {
allTabsDesktop.push({ title: "Tab #" + i });
allTabsDesktop.push({ title: "Tab #" + i, url: SAMPLE_TAB_URL });
}
return allTabsDesktop;
}(),
@ -343,6 +345,7 @@ add_task(async function() {
]);
};
gSync.updateAllUI({ status: UIState.STATUS_SIGNED_IN, lastSync: new Date(),
email: "foo@bar.com" });
@ -370,6 +373,7 @@ add_task(async function() {
node = node.nextSibling;
is(node.getAttribute("itemtype"), "tab", "node is a tab");
is(node.getAttribute("label"), "Tab #" + (i + 1), "the tab is the correct one");
is(node.getAttribute("targetURI"), SAMPLE_TAB_URL, "url is the correct one");
}
let showMoreButton;
if (showMoreLabel) {
@ -383,6 +387,14 @@ add_task(async function() {
return showMoreButton;
}
async function checkCanOpenURL() {
let tabList = document.getElementById("PanelUI-remotetabs-tabslist");
let node = tabList.firstChild.nextSibling;
let promiseTabOpened = BrowserTestUtils.waitForLocationChange(gBrowser, SAMPLE_TAB_URL);
node.click();
await promiseTabOpened;
}
let showMoreButton;
function clickShowMoreButton() {
let promise = promiseObserverNotified("synced-tabs-menu:test:tabs-updated");
@ -400,6 +412,6 @@ add_task(async function() {
await clickShowMoreButton();
checkTabsPage(77, null);
await hideOverflow();
/* calling this will close the overflow menu */
await checkCanOpenURL();
});