Closed Bug 1781929 Opened 2 years ago Closed 2 years ago

Invoke Firefox from notification COM server with enough notification details to allow processing

Categories

(Toolkit Graveyard :: Notifications and Alerts, enhancement)

enhancement

Tracking

(firefox106 fixed)

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidedi-notifications])

Attachments

(4 files, 1 obsolete file)

In Bug 1774083, we're adding the scaffolding for launching Firefox from Windows native notifications. We need to ferry a bit more information from the notification through to the launched Firefox to handle more use cases; this ticket tracks doing so.

Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Attachment #9288375 - Attachment description: Bug 1781929 - Pre: Include executable as first argument; log to Windows Event Log. r?nrishel → WIP: Bug 1781929 - Pre: Include executable as first argument; log to Windows Event Log. r?nrishel

When the notification server callback is executed by the Windows
notification system, it invokes Firefox with additional command line
parameters, most importantly the Windows-specific notification
"Windows tag".

If no appropriate Firefox is running, the command line will be
processed and the provided --notification-fallback-url opened.

If an appropriate Firefox is running, the remoting protocol will
forward this command line to the running instance. If the instance
recognizes the provided --notification-windowsTag, the command line
will be ignored. When the notification server exits, Windows will
fallback to the Windows 8.1 style notification callbacks registered
for this Windows tag and the existing (non notification server)
behaviour will occur.

In fact, the server therefore waits for a Windows tag-specific system
event to be signalled by the invoked Firefox (or a sibling process).
If we were to return S_OK from the notification server immediately,
and a running Firefox process would handle the notification via
Windows 8.1-style notification callbacks, then Windows would fall back
to those callbacks. The invoked callbacks unregister themselves upon
completion, often before the launched Firefox has an opportunity to
process the command line. By waiting for this system event, we allow
the invoked Firefox to process the command line while its own
notification callbacks are registered and therefore recognize that its
callbacks will handle the notification.

Depends on D153659

nrishel: over in https://phabricator.services.mozilla.com/D154468, you can see some of the ideas coming together here. Fundamentally, your idea of waiting for a Windows system event seems sound. I tried to explain what was up in the commit comment.

I would very much appreciate it if you span the Event Log stuff out into a separate ticket and worked with Ray to address their review comments and get it landed. That's all preparatory to this ticket.

There are a few things left to work through here that I don't expect you to push on while I'm PTO.

  1. The SetEvent is happening in a check function for convenience. That should be separate or have a better name.
  2. We need some concept of a fallbackUrl to launch when Firefox isn't running and/or doesn't have notification handlers registered. You can see that here, but what's not correct is how the background task ToastNotification.jsm mechanism will specify that URL. Perhaps it's part of the action?
  3. Background task toasts want to use systemAction for snooze and dismiss. Again, ToastNotification.jsm has to grow to support that. (And the Windows-only alert service has to accommodate these details. Tricky.)

Maybe take this as a base while you work on the WDBA notifications next week and we'll regroup when I'm back?

Flags: needinfo?(nrishel)
Flags: needinfo?(nrishel)
Attachment #9290714 - Attachment description: WIP: Bug 1781929 - Recover prior Windows toast notifications launched by app with current profile when initializing Windows native toast notification service. → WIP: Bug 1781929 - Recover prior Windows toast notifications launched by app with current profile when initializing Windows native toast notification service. r=nalexander

Comment on attachment 9290714 [details]
WIP: Bug 1781929 - Recover prior Windows toast notifications launched by app with current profile when initializing Windows native toast notification service. r=nalexander

Revision D155125 was moved to bug 1783081. Setting attachment 9290714 [details] to obsolete.

Attachment #9290714 - Attachment is obsolete: true
Depends on: 1787573
Depends on: 1787956

In background task mode:

  1. Re-launch Firefox into the default browsing profile, not the
    (possibly ephemeral) background task profile.
  2. Don't show the in-product notification settings, which won't apply
    to the relevant Firefox profile.

Depends on D155907

Attachment #9288375 - Attachment description: WIP: Bug 1781929 - Pre: Include executable as first argument; log to Windows Event Log. r?nrishel → Bug 1781929 - Part 2: Include executable as first argument; log to Windows Event Log. r?nrishel
Attachment #9289579 - Attachment description: WIP: Bug 1781929 - WIP - Pass through or launch Firefox from notification server. r?nrishel → Bug 1781929 - Part 4: Pass through or launch Firefox from notification server. r?nrishel
Depends on: 1788805
Blocks: 1788960
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/abf6eff708d8
Part 1: Handle toast notifications from background tasks specially. r=nrishel
https://hg.mozilla.org/integration/autoland/rev/e50432e37751
Part 2: Include executable as first argument; log to Windows Event Log. r=nrishel
https://hg.mozilla.org/integration/autoland/rev/8e6fe1c18e8d
Part 3: Include `launchUrl` in Windows toast notification. r=nrishel
https://hg.mozilla.org/integration/autoland/rev/34003f6f7b27
Part 4: Pass through or launch Firefox from notification server. r=nrishel
Regressions: 1789024

Backed out 5 changesets (Bug 1781929, Bug 1784367) for causing bc test failures.
Backout link
Push with failures <--> bc3 <--> x
Failure Log
Also x failure log

Flags: needinfo?(nalexander)
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cd529052e4c3
Part 1: Handle toast notifications from background tasks specially. r=nrishel
https://hg.mozilla.org/integration/autoland/rev/0269445d430b
Part 2: Include executable as first argument; log to Windows Event Log. r=nrishel
https://hg.mozilla.org/integration/autoland/rev/1a985841bfce
Part 3: Include `launchUrl` in Windows toast notification. r=nrishel
https://hg.mozilla.org/integration/autoland/rev/7507acebeaa1
Part 4: Pass through or launch Firefox from notification server. r=nrishel

Clearing NI since I relanded this yesterday.

Flags: needinfo?(nalexander)
Regressions: 1789390
Blocks: 1805514
Blocks: 1811626
Regressions: 1822842
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: