Skip to content

Commit

Permalink
Backed out 7 changesets (bug 1845150) for causing failures on browser…
Browse files Browse the repository at this point in the history
…_datachoices_notification.js CLOSED TREE

Backed out changeset a07c835a4bf7 (bug 1845150)
Backed out changeset 0016d7f4e556 (bug 1845150)
Backed out changeset 46cfe5fe6e6a (bug 1845150)
Backed out changeset 83190b8a08d0 (bug 1845150)
Backed out changeset ada948351267 (bug 1845150)
Backed out changeset 7aa4340bfd96 (bug 1845150)
Backed out changeset 683745289588 (bug 1845150)
  • Loading branch information
Norisz Fay committed Jan 5, 2024
1 parent fbb63e9 commit 0d4fc02
Show file tree
Hide file tree
Showing 42 changed files with 462 additions and 577 deletions.
27 changes: 17 additions & 10 deletions browser/actors/PluginParent.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,11 @@ export class PluginParent extends JSWindowActorParent {
buttons.push(submitButton);
}

// Add the "learn more" link.
let learnMoreLink = {
supportPage: "plugin-crashed-notificationbar",
label: lazy.gNavigatorBundle.GetStringFromName(
"crashedpluginsMessage.learnMore"
),
};
buttons.push(learnMoreLink);

let messageString = lazy.gNavigatorBundle.formatStringFromName(
"crashedpluginsMessage.title",
[report.pluginName]
);
notificationBox.appendNotification(
notification = notificationBox.appendNotification(
"plugin-crashed",
{
label: messageString,
Expand All @@ -200,5 +191,21 @@ export class PluginParent extends JSWindowActorParent {
},
buttons
);

// Add the "learn more" link.
let link = notification.ownerDocument.createXULElement("label", {
is: "text-link",
});
link.setAttribute(
"value",
lazy.gNavigatorBundle.GetStringFromName("crashedpluginsMessage.learnMore")
);
let crashurl = Services.urlFormatter.formatURLPref("app.support.baseURL");
crashurl += "plugin-crashed-notificationbar";
link.href = crashurl;
// Append a blank text node to make sure we don't put
// the link right next to the end of the message text.
notification.messageText.appendChild(new Text(" "));
notification.messageText.appendChild(link);
}
}
3 changes: 3 additions & 0 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,9 @@ pref("browser.download.clearHistoryOnDelete", 0);
pref("browser.helperApps.showOpenOptionForPdfJS", true);
pref("browser.helperApps.showOpenOptionForViewableInternally", true);

// search engine removal URL
pref("browser.search.searchEngineRemoval", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/search-engine-removal");

// search engines URL
pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/");

Expand Down
7 changes: 2 additions & 5 deletions browser/base/content/browser-captivePortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,12 @@ var CaptivePortalWatcher = {
}
},

async handleEvent(aEvent) {
handleEvent(aEvent) {
switch (aEvent.type) {
case "activate":
this._delayedCaptivePortalDetected();
break;
case "TabSelect":
if (this._notificationPromise) {
await this._notificationPromise;
}
if (!this._captivePortalTab || !this._captivePortalNotification) {
break;
}
Expand Down Expand Up @@ -326,7 +323,7 @@ var CaptivePortalWatcher = {
gBrowser.tabContainer.removeEventListener("TabSelect", this);
};

this._notificationPromise = gNotificationBox.appendNotification(
gNotificationBox.appendNotification(
this.PORTAL_NOTIFICATION_VALUE,
{
label: message,
Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/browser-data-submission-info-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var gDataNotificationInfoBar = {
return gNotificationBox.getNotificationWithValue(name);
},

async _displayDataPolicyInfoBar(request) {
_displayDataPolicyInfoBar(request) {
if (this._getDataReportingNotification()) {
return;
}
Expand All @@ -59,7 +59,7 @@ var gDataNotificationInfoBar = {
];

this._log.info("Creating data reporting policy notification.");
await gNotificationBox.appendNotification(
gNotificationBox.appendNotification(
this._DATA_REPORTING_NOTIFICATION,
{
label: {
Expand Down
112 changes: 58 additions & 54 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ const gStoragePressureObserver = {
}
messageFragment.appendChild(message);

await gNotificationBox.appendNotification(
gNotificationBox.appendNotification(
NOTIFICATION_VALUE,
{
label: messageFragment,
Expand All @@ -1122,7 +1122,7 @@ const gStoragePressureObserver = {
};

var gPopupBlockerObserver = {
async handleEvent(aEvent) {
handleEvent(aEvent) {
if (aEvent.originalTarget != gBrowser.selectedBrowser) {
return;
}
Expand Down Expand Up @@ -1158,31 +1158,23 @@ var gPopupBlockerObserver = {

let notificationBox = gBrowser.getNotificationBox();
let notification =
notificationBox.getNotificationWithValue("popup-blocked") ||
(await this.notificationPromise);
notificationBox.getNotificationWithValue("popup-blocked");
if (notification) {
notification.label = label;
} else {
const image = "chrome://browser/skin/notification-icons/popup.svg";
const priority = notificationBox.PRIORITY_INFO_MEDIUM;
try {
this.notificationPromise = notificationBox.appendNotification(
"popup-blocked",
{ label, image, priority },
[
{
"l10n-id": "popup-warning-button",
popup: "blockedPopupOptions",
callback: null,
},
]
);
await this.notificationPromise;
} catch (err) {
console.warn(err);
} finally {
this.notificationPromise = null;
}
notificationBox.appendNotification(
"popup-blocked",
{ label, image, priority },
[
{
"l10n-id": "popup-warning-button",
popup: "blockedPopupOptions",
callback: null,
},
]
);
}
}

Expand Down Expand Up @@ -1410,7 +1402,7 @@ var gKeywordURIFixup = {
let asciiHost = fixedURI.asciiHost;

let onLookupCompleteListener = {
async onLookupComplete(request, record, status) {
onLookupComplete(request, record, status) {
let browserRef = weakBrowser.get();
if (!Components.isSuccessCode(status) || !browserRef) {
return;
Expand Down Expand Up @@ -1465,7 +1457,7 @@ var gKeywordURIFixup = {
},
},
];
let notification = await notificationBox.appendNotification(
let notification = notificationBox.appendNotification(
"keyword-uri-fixup",
{
label: message,
Expand Down Expand Up @@ -3342,9 +3334,22 @@ function PageProxyClickHandler(aEvent) {
* us via async messaging.
*/
var BrowserOnClick = {
async ignoreWarningLink(reason, blockedInfo, browsingContext) {
// Add a notify bar before allowing the user to continue through to the
// site, so that they don't lose track after, e.g., tab switching.
ignoreWarningLink(reason, blockedInfo, browsingContext) {
let triggeringPrincipal =
blockedInfo.triggeringPrincipal ||
_createNullPrincipalFromTabUserContextId();

// Allow users to override and continue through to the site,
// but add a notify bar as a reminder, so that they don't lose
// track after, e.g., tab switching.
// Note that we have to use the passed URI info and can't just
// rely on the document URI, because the latter contains
// additional query parameters that should be stripped.
browsingContext.fixupAndLoadURIString(blockedInfo.uri, {
triggeringPrincipal,
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
});

// We can't use browser.contentPrincipal which is principal of about:blocked
// Create one from uri with current principal origin attributes
let principal = Services.scriptSecurityManager.createContentPrincipal(
Expand Down Expand Up @@ -3419,20 +3424,7 @@ var BrowserOnClick = {
// provide a URL endpoint for these reports.
}

await SafeBrowsingNotificationBox.show(title, buttons);

// Allow users to override and continue through to the site.
// Note that we have to use the passed URI info and can't just
// rely on the document URI, because the latter contains
// additional query parameters that should be stripped.
let triggeringPrincipal =
blockedInfo.triggeringPrincipal ||
_createNullPrincipalFromTabUserContextId();

browsingContext.fixupAndLoadURIString(blockedInfo.uri, {
triggeringPrincipal,
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
});
SafeBrowsingNotificationBox.show(title, buttons);
},
};

Expand Down Expand Up @@ -4288,8 +4280,26 @@ const BrowserSearch = {
* @param {string} newEngine
* name of the application default engine to replaced the removed engine.
*/
async removalOfSearchEngineNotificationBox(oldEngine, newEngine) {
let buttons = [
removalOfSearchEngineNotificationBox(oldEngine, newEngine) {
let messageFragment = document.createDocumentFragment();
let message = document.createElement("span");
let link = document.createXULElement("label", {
is: "text-link",
});

link.href = Services.urlFormatter.formatURLPref(
"browser.search.searchEngineRemoval"
);
link.setAttribute("data-l10n-name", "remove-search-engine-article");
document.l10n.setAttributes(message, "removed-search-engine-message", {
oldEngine,
newEngine,
});

message.appendChild(link);
messageFragment.appendChild(message);

let button = [
{
"l10n-id": "remove-search-engine-button",
primary: true,
Expand All @@ -4300,21 +4310,15 @@ const BrowserSearch = {
gNotificationBox.removeNotification(notificationBox);
},
},
{
supportPage: "search-engine-removal",
},
];

await gNotificationBox.appendNotification(
gNotificationBox.appendNotification(
"search-engine-removal",
{
label: {
"l10n-id": "removed-search-engine-message2",
"l10n-args": { oldEngine, newEngine },
},
label: messageFragment,
priority: gNotificationBox.PRIORITY_SYSTEM,
},
buttons
button
);

// Update engine name in the placeholder to the new default engine name.
Expand Down Expand Up @@ -9055,7 +9059,7 @@ var PanicButtonNotifier = {

const SafeBrowsingNotificationBox = {
_currentURIBaseDomain: null,
async show(title, buttons) {
show(title, buttons) {
let uri = gBrowser.currentURI;

// start tracking host so that we know when we leave the domain
Expand All @@ -9076,7 +9080,7 @@ const SafeBrowsingNotificationBox = {
notificationBox.removeNotification(previousNotification);
}

let notification = await notificationBox.appendNotification(
let notification = notificationBox.appendNotification(
value,
{
label: title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ let testCasesForBothSuccessAndAbort = [
await portalDetected();

// Notification should be shown in both windows.
await ensurePortalNotification(win1);
ensurePortalNotification(win1);
ensureNoPortalTab(win1);
await ensurePortalNotification(win2);
ensurePortalNotification(win2);
ensureNoPortalTab(win2);

await focusWindowAndWaitForPortalUI(false, win2);
Expand Down Expand Up @@ -108,8 +108,8 @@ let testCasesForBothSuccessAndAbort = [
await portalDetected();
ensureNoPortalTab(win1);
ensureNoPortalTab(win2);
await ensurePortalNotification(win1);
await ensurePortalNotification(win2);
ensurePortalNotification(win1);
ensurePortalNotification(win2);
await freePortal(aSuccess);
ensureNoPortalNotification(win1);
ensureNoPortalNotification(win2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ let testcases = [
async function test_showLoginPageButton() {
let win = await openWindowAndWaitForFocus();
await portalDetected();
let notification = await ensurePortalNotification(win);
await testShowLoginPageButtonVisibility(notification, "visible");
let notification = ensurePortalNotification(win);
testShowLoginPageButtonVisibility(notification, "visible");

async function testPortalTabSelectedAndButtonNotVisible() {
function testPortalTabSelectedAndButtonNotVisible() {
is(
win.gBrowser.selectedTab,
tab,
"The captive portal tab should be selected."
);
await testShowLoginPageButtonVisibility(notification, "hidden");
testShowLoginPageButtonVisibility(notification, "hidden");
}

let button = notification.buttonContainer.querySelector(
Expand All @@ -66,12 +66,12 @@ let testcases = [
// Simulate clicking the button. The portal tab should be opened and
// selected and the button should hide.
let tab = await clickButtonAndExpectNewPortalTab();
await testPortalTabSelectedAndButtonNotVisible();
testPortalTabSelectedAndButtonNotVisible();

// Close the tab. The button should become visible.
BrowserTestUtils.removeTab(tab);
ensureNoPortalTab(win);
await testShowLoginPageButtonVisibility(notification, "visible");
testShowLoginPageButtonVisibility(notification, "visible");

// When the button is clicked, a new portal tab should be opened and
// selected.
Expand All @@ -80,7 +80,7 @@ let testcases = [
// Open another arbitrary tab. The button should become visible. When it's clicked,
// the portal tab should be selected.
let anotherTab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser);
await testShowLoginPageButtonVisibility(notification, "visible");
testShowLoginPageButtonVisibility(notification, "visible");
button.click();
is(
win.gBrowser.selectedTab,
Expand All @@ -92,7 +92,7 @@ let testcases = [
// visible and when it's clicked, a new portal tab should be opened.
BrowserTestUtils.removeTab(tab);
win.gBrowser.selectedTab = anotherTab;
await testShowLoginPageButtonVisibility(notification, "visible");
testShowLoginPageButtonVisibility(notification, "visible");
tab = await clickButtonAndExpectNewPortalTab();

BrowserTestUtils.removeTab(anotherTab);
Expand Down
Loading

0 comments on commit 0d4fc02

Please sign in to comment.