Skip to content

Commit

Permalink
Merge autoland to mozilla-central. a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Moraru committed May 6, 2022
2 parents 40d4166 + eb58d0a commit 4f14eca
Show file tree
Hide file tree
Showing 337 changed files with 6,365 additions and 4,478 deletions.
4 changes: 4 additions & 0 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,11 @@ pref("browser.esedbreader.loglevel", "Error");

pref("browser.laterrun.enabled", false);

#ifdef FUZZING_SNAPSHOT
pref("dom.ipc.processPrelaunch.enabled", false);
#else
pref("dom.ipc.processPrelaunch.enabled", true);
#endif

// See comments in bug 1340115 on how we got to these numbers.
pref("browser.migrate.chrome.history.limit", 2000);
Expand Down
9 changes: 0 additions & 9 deletions browser/base/content/browser-places.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,15 +931,6 @@ var BookmarksEventHandler = {
return false;
}

if (
gProtonPlacesTooltip &&
tooltipNode &&
!tooltipNode.closest("menupopup")
) {
aEvent.target.setAttribute("position", "after_start");
aEvent.target.moveToAnchor(tooltipNode, "after_start");
}

let tooltipTitle = aEvent.target.querySelector(".places-tooltip-title");
tooltipTitle.hidden = !title || title == url;
if (!tooltipTitle.hidden) {
Expand Down
11 changes: 0 additions & 11 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,17 +533,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);

/* Temporary pref while the dust settles around the updated tooltip design
for tabs and bookmarks toolbar. This is a bit of an orphan from the
proton project. We should figure out what happens with this in
bug 1746909. */
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gProtonPlacesTooltip",
"browser.proton.places-tooltip.enabled",
false
);

customElements.setElementCreationCallback("translation-notification", () => {
Services.scriptloader.loadSubScript(
"chrome://browser/content/translation-notification.js",
Expand Down
23 changes: 1 addition & 22 deletions browser/base/content/tabbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5561,15 +5561,13 @@
.replace("#1", pluralCount);
};

let alignToTab = true;
let label;
const selectedTabs = this.selectedTabs;
const contextTabInSelection = selectedTabs.includes(tab);
const affectedTabsLength = contextTabInSelection
? selectedTabs.length
: 1;
if (tab.mOverCloseButton) {
alignToTab = false;
label = tab.selected
? stringWithShortcut(
"tabs.closeTabs.tooltip",
Expand Down Expand Up @@ -5605,30 +5603,11 @@
gTabBrowserBundle.GetStringFromName(stringID)
).replace("#1", affectedTabsLength);
}
alignToTab = false;
} else {
label = this.getTabTooltip(tab);
}

if (!gProtonPlacesTooltip) {
event.target.setAttribute("label", label);
return;
}

if (alignToTab) {
event.target.setAttribute("position", "after_start");
event.target.moveToAnchor(tab, "after_start");
}

let title = event.target.querySelector(".places-tooltip-title");
title.textContent = label;
let url = event.target.querySelector(".places-tooltip-uri");
url.value = tab.linkedBrowser?.currentURI?.spec.replace(
/^https:\/\//,
""
);
let icon = event.target.querySelector("#places-tooltip-insecure-icon");
icon.hidden = !url.value.startsWith("http://");
event.target.setAttribute("label", label);
},

handleEvent(aEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const ROLLOUT_PREF_PHASE1 =
const ROLLOUT_PREF_PHASE1_PREFERENCES =
"privacy.restrict3rdpartystorage.rollout.preferences.TCPToggleInStandard";
const COOKIE_BEHAVIOR_PREF = "network.cookie.cookieBehavior";
const CB_CATEGORY_PREF = "browser.contentblocking.category";

const defaultPrefs = Services.prefs.getDefaultBranch("");
const previousDefaultCB = defaultPrefs.getIntPref(COOKIE_BEHAVIOR_PREF);
Expand All @@ -37,6 +38,7 @@ function cleanup() {

Services.prefs.clearUserPref(ROLLOUT_PREF_PHASE1);
Services.prefs.clearUserPref(ROLLOUT_PREF_PHASE1_PREFERENCES);
Services.prefs.clearUserPref(CB_CATEGORY_PREF);

// Reset the rollout scalar back to 2 = unset. We have to simulate this on
// test cleanup, because BrowserGlue only sets this once initially.
Expand Down Expand Up @@ -499,6 +501,7 @@ add_task(async function test_phase2_enterprise_policy_with_cookie_behavior() {
);

await doEnrollmentCleanup();
await EnterprisePolicyTesting.setupPolicyEngineWithJson("");
cleanup();
});

Expand Down Expand Up @@ -563,6 +566,7 @@ add_task(
);

await doEnrollmentCleanup();
await EnterprisePolicyTesting.setupPolicyEngineWithJson("");
cleanup();
}
);
127 changes: 52 additions & 75 deletions browser/base/content/test/tabs/browser_tab_tooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,81 +34,58 @@ function closeTooltip(node, tooltip) {
// This test verifies that the tab tooltip appears at the correct location, aligned
// with the bottom of the tab, and that the tooltip appears near the close button.
add_task(async function() {
for (let useProtonTooltips of [false, true]) {
await SpecialPowers.pushPrefEnv({
set: [["browser.proton.places-tooltip.enabled", useProtonTooltips]],
});

const tabUrl =
"data:text/html,<html><head><title>A Tab</title></head><body>Hello</body></html>";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl);

let tooltip = document.getElementById("tabbrowser-tab-tooltip");
await openTooltip(tab, tooltip);

let tabRect = tab.getBoundingClientRect();
let tooltipRect = tooltip.getBoundingClientRect();

if (useProtonTooltips) {
// Add the margin when using photon tooltips, but not when that is disabled.
isfuzzy(
tooltipRect.left,
tabRect.left + parseInt(getComputedStyle(tooltip).marginLeft),
1,
"tooltip left position for tab"
);
isfuzzy(
tooltipRect.top,
tabRect.bottom + parseInt(getComputedStyle(tooltip).marginTop),
1,
"tooltip top position for tab"
);
} else {
isfuzzy(
tooltipRect.left,
tabRect.left + MOUSE_OFFSET,
1,
"tooltip left position for tab"
);
ok(
tooltipRect.top >=
tabRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for tab"
);
}
is(
tooltip.getAttribute("position"),
useProtonTooltips ? "after_start" : "",
"tooltip position attribute for tab"
);

await closeTooltip(tab, tooltip);

await openTooltip(tab.closeButton, tooltip);

let closeButtonRect = tab.closeButton.getBoundingClientRect();
tooltipRect = tooltip.getBoundingClientRect();

isfuzzy(
tooltipRect.left,
closeButtonRect.left + MOUSE_OFFSET,
1,
"tooltip left position for close button"
);
ok(
tooltipRect.top >
closeButtonRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for close button"
);
ok(
!tooltip.hasAttribute("position"),
"tooltip position attribute for close button"
);

await closeTooltip(tab, tooltip);

BrowserTestUtils.removeTab(tab);
}
const tabUrl =
"data:text/html,<html><head><title>A Tab</title></head><body>Hello</body></html>";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl);

let tooltip = document.getElementById("tabbrowser-tab-tooltip");
await openTooltip(tab, tooltip);

let tabRect = tab.getBoundingClientRect();
let tooltipRect = tooltip.getBoundingClientRect();

isfuzzy(
tooltipRect.left,
tabRect.left + MOUSE_OFFSET,
1,
"tooltip left position for tab"
);
ok(
tooltipRect.top >= tabRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for tab"
);
is(
tooltip.getAttribute("position"),
"",
"tooltip position attribute for tab"
);

await closeTooltip(tab, tooltip);

await openTooltip(tab.closeButton, tooltip);

let closeButtonRect = tab.closeButton.getBoundingClientRect();
tooltipRect = tooltip.getBoundingClientRect();

isfuzzy(
tooltipRect.left,
closeButtonRect.left + MOUSE_OFFSET,
1,
"tooltip left position for close button"
);
ok(
tooltipRect.top >
closeButtonRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for close button"
);
ok(
!tooltip.hasAttribute("position"),
"tooltip position attribute for close button"
);

await closeTooltip(tab, tooltip);

BrowserTestUtils.removeTab(tab);
});

// This test verifies that a mouse wheel closes the tooltip.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,22 @@ function Article(props) {
utmParams,
openInPocketReader,
} = props;

const url = new URL(article.url || article.resolved_url || "");
const urlSearchParams = new URLSearchParams(utmParams);

if (
openInPocketReader &&
article.item_id &&
!url.href.match(/getpocket\.com\/read/)
) {
url.href = `https://getpocket.com/read/${article.item_id}`;
}

for (let [key, val] of urlSearchParams.entries()) {
url.searchParams.set(key, val);
}

// Using array notation because there is a key titled `1` (`images` is an object)
const thumbnail =
article.thumbnail ||
Expand All @@ -60,20 +71,10 @@ function Article(props) {
article.domain_metadata?.name ||
article.resolved_domain;

let constructedURL = url.href;

if (
openInPocketReader &&
article.item_id &&
!url.href.match(/getpocket\.com\/read/)
) {
constructedURL = `https://getpocket.com/read/${article.item_id}`;
}

return (
<li className="stp_article_list_item">
<ArticleUrl
url={constructedURL}
url={url.href}
savedArticle={savedArticle}
position={position}
source={source}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ function Saved(props) {
</Button>
</h3>
{savedStory && (
<ArticleList articles={[savedStory]} openInPocketReader={true} />
<ArticleList
articles={[savedStory]}
openInPocketReader={true}
utmParams={utmParams}
/>
)}
<TagPicker tags={[]} itemUrl={itemUrl} />
{similarRecs?.length && locale?.startsWith("en") && (
Expand Down
15 changes: 7 additions & 8 deletions browser/components/pocket/content/panels/js/main.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ function Article(props) {
const url = new URL(article.url || article.resolved_url || "");
const urlSearchParams = new URLSearchParams(utmParams);

if (openInPocketReader && article.item_id && !url.href.match(/getpocket\.com\/read/)) {
url.href = `https://getpocket.com/read/${article.item_id}`;
}

for (let [key, val] of urlSearchParams.entries()) {
url.searchParams.set(key, val);
} // Using array notation because there is a key titled `1` (`images` is an object)
Expand All @@ -184,16 +188,10 @@ function Article(props) {
const title = article.title || article.resolved_title; // Sometimes domain_metadata is not there, depending on the source.

const publisher = article.publisher || article.domain_metadata?.name || article.resolved_domain;
let constructedURL = url.href;

if (openInPocketReader && article.item_id && !url.href.match(/getpocket\.com\/read/)) {
constructedURL = `https://getpocket.com/read/${article.item_id}`;
}

return /*#__PURE__*/react.createElement("li", {
className: "stp_article_list_item"
}, /*#__PURE__*/react.createElement(ArticleUrl, {
url: constructedURL,
url: url.href,
savedArticle: savedArticle,
position: position,
source: source,
Expand Down Expand Up @@ -1008,7 +1006,8 @@ function Saved(props) {
"data-l10n-id": "pocket-panel-button-remove"
}))), savedStory && /*#__PURE__*/react.createElement(ArticleList_ArticleList, {
articles: [savedStory],
openInPocketReader: true
openInPocketReader: true,
utmParams: utmParams
}), /*#__PURE__*/react.createElement(TagPicker_TagPicker, {
tags: [],
itemUrl: itemUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h1 id="info-title"></h1>
<h1 id="promo-header"></h1>
<p id="private-browsing-vpn-text" class="vpn-promo"></p>
<div class="promo-cta">
<button id="private-browsing-vpn-link" class="vpn-promo button"></button>
<button id="private-browsing-vpn-link" class="vpn-promo primary button"></button>
<div class="promo-image-small">
<img src="" alt="" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ add_task(async function test_remove_promo_from_prerendered_tab_if_blocked() {
const promoContainer = content.document.querySelector(".promo"); // container which is present if promo message is not blocked
ok(promoContainer, "Focus promo is shown in a new tab");
content.document.getElementById("dismiss-btn").click();
await ContentTaskUtils.waitForCondition(() => {
return !content.document.querySelector(".promo");
}, "The promo container is removed.");
});

win.BrowserOpenTab();
await BrowserTestUtils.switchTab(win.gBrowser, win.gBrowser.tabs[1]);
await SimpleTest.promiseFocus(gBrowser.selectedBrowser);
await SimpleTest.promiseFocus(win.gBrowser.selectedBrowser);
const tab2 = win.gBrowser.selectedBrowser;

await SpecialPowers.spawn(tab2, [], async function() {
Expand Down
Loading

0 comments on commit 4f14eca

Please sign in to comment.