Closed Bug 1845150 Opened 1 year ago Closed 11 months ago

Use moz-message-bar instead of message-bar in notificationbox.js

Categories

(Toolkit :: UI Widgets, task)

task

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: hjones, Assigned: hjones)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

(Whiteboard: [recomp])

Attachments

(8 files, 1 obsolete file)

24.77 KB, image/png
Details
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

The code in notificationbox.js handles creating info bars that are displayed at the top of web pages in the chrome when certain events occur. Currently the NotificationMessage element extends the message-bar element: https://searchfox.org/mozilla-central/source/toolkit/content/widgets/notificationbox.js#611-614

Now that moz-mesage-bar is available we should us it as the base class for NotificationMessage instead of message-bar. This will solve the issue of in-content/common-shared.css getting pulled into the chrome, which has been a side effect of the current NotificationMessage setup.

There will likely be changes that need to be made to reflect the fact that moz-message-bar has a different API from message-bar - it's more controlled and no longer based around having a single <slot>. Also notificationbox.js adds a number of classes to the message bar element. These styles currently live in message-bar.css, but we removed them from moz-message-bar.css so we may have to add a new stylesheet that gets pulled in to Notificationmessages only.

Blocks: 1845151
Whiteboard: [fidefe-reusable-components]
Blocks: 1702040
Blocks: 1702771
Assignee: nobody → hjones
Attachment #9356263 - Attachment description: WIP: Bug 1845150 - update notification-message to use moz-message-bar → WIP: - update notification-message to use moz-message-bar
Blocks: 1865902
Attachment #9356263 - Attachment description: WIP: - update notification-message to use moz-message-bar → WIP: Bug 1845150 - Use moz-message-bar instead of message-bar in notificationbox.js r=#recomp-reviewers

Notification can be triggered locally via this snippet:

BrowserSearch.removalOfSearchEngineNotificationBox("Google", "Foogle")

Depends on D189872

There are some tests you can run to see how this looks, but I've also been verifying things locally by running this snippet in the browser toolbox:

const { InfoBar } = ChromeUtils.import(
  "resource://activity-stream/lib/InfoBar.jsm"
);
const { CFRMessageProvider } = ChromeUtils.importESModule(
  "resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
);
let message = (await CFRMessageProvider.getMessages()).find(
	m => m.id === "INFOBAR_ACTION_86"
);
InfoBar.showInfoBarMessage(
    BrowserWindowTracker.getTopWindow().gBrowser.selectedBrowser,
    {
      ...message,
      content: {
        priority: window.gNotificationBox.PRIORITY_WARNING_HIGH,
        ...message.content,
      },
    },
    {}
);

Depends on D194312

Can be tested locally by running this code in the browser toolbox:

gBrowser.selectedBrowser.ownerGlobal.CaptivePortalWatcher._showNotification();

Depends on D194313

I've been testing locally with these snippets in the browser toolbox:

const { TabCrashHandler } = ChromeUtils.importESModule("resource:///modules/ContentCrashHandlers.sys.mjs");
TabCrashHandler.showSubFrameNotification(gBrowser.selectedBrowser, "foo", "bar");
const { UnsubmittedCrashHandler } = ChromeUtils.importESModule("resource:///modules/ContentCrashHandlers.sys.mjs");
UnsubmittedCrashHandler.show({ notificationId: "foo", reportIDs: [], onAction: () => {}});

Depends on D194314

Can be tested locally using this snippet (which I think I took from a test...):

let addonId = "test";
let policy = new WebExtensionPolicy({
    name: "Scapegoat",
    id: addonId,
    mozExtensionHostname: Services.uuid.generateUUID().number.slice(1, -1),
    baseURL: "file:///",
    allowedOrigins: new MatchPatternSet([]),
    localizeCallback() {},
});
policy.active = true;
ProcessHangMonitor.showNotification(window, { addonId, scriptBrowser: { browsingContext: { watchedByDevTools: false }} });

Depends on D194315

Can be tested locally with this snippet:

const { Heartbeat } = ChromeUtils.importESModule(
  "resource://normandy/lib/Heartbeat.sys.mjs"
);
new Heartbeat(window, {
    testing: true,
    flowId: "test",
    message: "This is a test message!",
    engagementButtonLabel: undefined,
    learnMoreMessage: "Learn More",
    learnMoreUrl: "https://example.org/learnmore",
});

Depends on D194316

This is only sort of related to the rest of the patches in the stack, but when using the .footer-button class in the info-bar I realized the styles don't change in HCM, which seemed worth fixing. These styles can be seen in action in the ETP panel or in the customize mode screen.

Attachment #9365730 - Attachment description: WIP: Bug 1845150 - fix .footer-button colors in high contrast mode r=#recomp-reviewers,#desktop-theme-reviewers → Bug 1845150 - fix .footer-button colors in high contrast mode r=#recomp-reviewers,#desktop-theme-reviewers
Attachment #9356263 - Attachment description: WIP: Bug 1845150 - Use moz-message-bar instead of message-bar in notificationbox.js r=#recomp-reviewers → Bug 1845150 - Use moz-message-bar instead of message-bar in notificationbox.js r=#recomp-reviewers
Attachment #9364864 - Attachment description: WIP: Bug 1845150 - Update notificationbox usage for search engine removal notification r=#search-reviewers → Bug 1845150 - Update notificationbox usage for search engine removal notification r=#search-reviewers
Attachment #9364865 - Attachment description: WIP: Bug 1845150 - Update usage of notificationbox in InfoBar r=#recomp-reviewers → Bug 1845150 - Update usage of notificationbox in InfoBar r=#recomp-reviewers
Attachment #9364866 - Attachment description: WIP: Bug 1845150 - Update notificationbox usage for captive portal notification r=#recomp-reviewers → Bug 1845150 - Update notificationbox usage for captive portal notification r=#recomp-reviewers
Attachment #9364867 - Attachment description: WIP: Bug 1845150 - Update notificationbox usage for crash notifications r=#recomp-reviewers → Bug 1845150 - Update notificationbox usage for crash notifications r=#recomp-reviewers
Attachment #9364868 - Attachment description: WIP: Bug 1845150 - Update notificationbox usage for process hang notification r=#recomp-reviewers → Bug 1845150 - Update notificationbox usage for process hang notification r=#recomp-reviewers
Attachment #9364869 - Attachment description: WIP: Bug 1845150 - Update notificationbox usage for heartbeat notifications r=#recomp-reviewers → Bug 1845150 - Update notificationbox usage for heartbeat notifications r=#recomp-reviewers
Attachment #9365730 - Attachment is obsolete: true

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:hjones, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(hskupin)
Flags: needinfo?(hjones)

Not sure why I was selected for needinfo. Maybe because I reviewed a tiny bit of a patch as last person? Clearing...

Flags: needinfo?(hskupin)
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7477fd1c48fa Use moz-message-bar instead of message-bar in notificationbox.js r=webdriver-reviewers,desktop-theme-reviewers,media-playback-reviewers,reusable-components-reviewers,karlt,whimboo,tgiles,dao https://hg.mozilla.org/integration/autoland/rev/91365291f80f Update notificationbox usage for search engine removal notification r=search-reviewers,fluent-reviewers,Standard8,bolsson https://hg.mozilla.org/integration/autoland/rev/a75fe63bd39f Update usage of notificationbox in InfoBar r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/f66e8bb15e18 Update notificationbox usage for captive portal notification r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/6c405863be54 Update notificationbox usage for crash notifications r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/ba7789c89bdd Update notificationbox usage for process hang notification r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/fdc3f1b5e5ae Update notificationbox usage for heartbeat notifications r=reusable-components-reviewers,tgiles
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/683745289588 Use moz-message-bar instead of message-bar in notificationbox.js r=webdriver-reviewers,desktop-theme-reviewers,media-playback-reviewers,karlt,whimboo,tgiles,dao,devtools-reviewers https://hg.mozilla.org/integration/autoland/rev/7aa4340bfd96 Update notificationbox usage for search engine removal notification r=search-reviewers,fluent-reviewers,Standard8,bolsson https://hg.mozilla.org/integration/autoland/rev/ada948351267 Update usage of notificationbox in InfoBar r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/83190b8a08d0 Update notificationbox usage for captive portal notification r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/46cfe5fe6e6a Update notificationbox usage for crash notifications r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/0016d7f4e556 Update notificationbox usage for process hang notification r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/a07c835a4bf7 Update notificationbox usage for heartbeat notifications r=reusable-components-reviewers,tgiles

Backed out for causing failures on browser_datachoices_notification.js

Backout link

Push with failures

Failure log

Blocks: 1873377
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/598874fd4b8e Use moz-message-bar instead of message-bar in notificationbox.js r=webdriver-reviewers,desktop-theme-reviewers,media-playback-reviewers,karlt,whimboo,tgiles,dao,devtools-reviewers https://hg.mozilla.org/integration/autoland/rev/1a3e1eda40b0 Update notificationbox usage for search engine removal notification r=search-reviewers,fluent-reviewers,Standard8,bolsson https://hg.mozilla.org/integration/autoland/rev/9ae523de438c Update usage of notificationbox in InfoBar r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/18b04346d36c Update notificationbox usage for captive portal notification r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/e5876a299cdd Update notificationbox usage for crash notifications r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/e0beffc85b9b Update notificationbox usage for process hang notification r=reusable-components-reviewers,tgiles https://hg.mozilla.org/integration/autoland/rev/fe54bf7adef0 Update notificationbox usage for heartbeat notifications r=reusable-components-reviewers,tgiles
Regressions: 1874019
Flags: needinfo?(hjones)
Regressions: 1874505
Whiteboard: [fidefe-reusable-components] → [recomp]
Depends on: 1887170
Blocks: 1915646
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: