Why Declarative Web Push Still Needs a Non-Declarative Fallback in Firefox 162

Why Declarative Web Push Still Needs a Non-Declarative Fallback in Firefox 162

pr0h0••20 min read•tech
AI Usage (82%)

Declarative Web Push sounds like the kind of change that lets you delete code. A headline saying Firefox 162 handles notifications without a push handler reads like permission to drop sw.js from the critical path. That reading is wrong — not because the feature is bad, but because the public report we have right now doesn't carry enough detail to build against, and this post shows what to do instead.

What follows is the delivery contract you already depend on, a reproducible conventional baseline, and an evidence-gated way to add a declarative path later. The position up front: treat declarative delivery as an optional fast path per subscription, never as a replacement for the non-declarative, worker-driven path, until you've read the payload contract in a primary source and reproduced the behaviour in a real browser build.

On this page

Why the Delivery Contract Matters More Than Removing a Push Handler

Treat declarative delivery as an optional path until its contract is verified

The case for caution here isn't nostalgia for service workers. It's that "the browser displays the notification" is one line item in a chain that also includes authorization, subscription lifecycle, targeting, preference handling, and click routing. Removing showNotification removes one function call. None of the state your application owns around it goes with it.

So the engineering position: declarative delivery is a per-subscription strategy, picked by your server from application-owned metadata, gated on verified compatibility, with a server-side switch back. The non-declarative worker path stays — tested — for every subscription that doesn't clear that gate.

What the Firefox 162 Declarative Web Push Report Actually Says

The supplied material is a NeoTeo item dated 5 December 2026, titled around "Firefox Declarative Web Push: What Changes in Version 162." What I have is a headline and a snippet naming the browser version and the feature. No payload schema, no statement about default-on behaviour, no compatibility matrix, no service-worker interaction model.

That's enough to justify planning and testing. It isn't enough to justify an implementation. Everything below is arranged so the second half can be filled in once primary documentation exists, without rewriting the first half.

What This Walkthrough Leaves You With

By the end you should have three things: a non-declarative Web Push baseline you can reproduce and reason about, an integration seam where a declarative adapter can sit behind a flag, and a test matrix that produces an evidence table instead of a vague claim that "notifications work." The matrix also covers the two failure modes a dual-format rollout creates: missing notifications and duplicate notifications.

What the Firefox 162 Report Establishes—and What It Does Not

The report establishes that a secondary publication wrote about declarative Web Push in connection with Firefox 162 on 5 December 2026. That is the entire confirmed set from the supplied material.

Here's the split I'm working from:

ClaimStatus
NeoTeo published an item about Firefox 162 and declarative Web Push on 2026-12-05Confirmed by supplied source metadata
Firefox 162 ships declarative Web PushReported, unverified — no Mozilla source seen
The feature is enabled by defaultUnknown
There is a specific declarative payload schemaUnknown from this material
The service worker is bypassed, invoked, or coordinatedUnknown
Supported notification options match showNotificationUnknown, and unlikely to be full parity
Behaviour in other browsersUnknown

Declarative push isn't a novel concept. Apple's WebKit team published a declarative notification format for Safari during 2025, which is why the idea feels familiar. I mention it purely as orientation: that document describes Apple's format, not anything Mozilla would necessarily implement, and it should be read from source rather than from a summary. Don't port a Safari payload shape into a Firefox path on the assumption that "declarative" means the same bytes.

The primary evidence to collect first

Before writing a declarative sender, find and read:

  • the Mozilla release notes for the specific Firefox version, plus any MDN documentation page for the API surface;
  • the implementation tracking bug or standards-position entry that states what was implemented and what was deferred;
  • the applicable specification or explainer that defines the payload, version marker, and error behaviour;
  • browser tests — your own — against an actual build.

What Changes if the Primary Evidence Lands

If a primary source confirms that a signed, application-owned JSON payload can display a notification with no active worker, that's a real win for one class of message: short, static, server-authored notifications whose display text is fully decided at send time. That path gets simpler.

It does not establish universal browser support, and it doesn't remove the need for the conventional path in the same codebase. A capability that exists in one engine and not three others is a fast path, not an architecture.

Map the Existing Web Push Delivery Path Before Changing It

The conventional flow, in the order it actually executes:

  1. The page requests notification permission through a user gesture.
  2. The page registers a service worker and waits for navigator.serviceWorker.ready.
  3. pushManager.subscribe() produces a PushSubscription containing an endpoint and two keys.
  4. Your server stores that subscription against an authenticated principal.
  5. Your server encrypts a payload and POSTs it to the endpoint, authenticated with VAPID.
  6. The push service accepts, queues, and later delivers to the browser.
  7. The browser wakes the worker and dispatches a push event.
  8. Your handler calls registration.showNotification().

Steps 6 through 8 are where most debugging time is wasted, because they're invisible from the page.

Four distinct outcomes that get collapsed into "it worked"

  • Transport acceptance — the push service returned 201. Your payload was accepted. Nothing more.
  • Browser receipt — the push service delivered to the browser. You have no direct signal.
  • Display — showNotification resolved. Visible notification. Still not observable from your server.
  • Interaction — the user clicked, notificationclick fired, your handler ran.

web-push returning statusCode: 201 is step 6. Treating it as step 8 produces the classic bug report: "the dashboard says delivered, the user says nothing appeared." The dashboard is right about what it measured and wrong about what you think it measured.

What a Declarative Display Call Does Not Replace

Authorization, subscription lifecycle (including deletion on 404/410), audience targeting, per-user notification preferences, and click routing are all application responsibilities. A declarative payload moves the display call. None of that state moves with it.

ResponsibilityWorker-driven (established)Reported declarative model
Permission requestPage, on user gestureUnverified
Subscription storage and deletionApplication serverApplication server — unchanged
Payload schemaApplication-owned JSONUnverified; likely constrained
Encryption and VAPID authRFC 8291 / RFC 8292 via libraryUnverified where it happens
Display callshowNotification in workerReported without worker — unverified
DeduplicationApplication plus notification tagUnverified
Click routingnotificationclick handlerUnverified
Audience authorizationApplication serverApplication server — unchanged

The two rows that don't move — subscription lifecycle and audience authorization — are the two that matter most for correctness and security. That's a useful sanity check on any "we can drop the worker" proposal.

Build a Reproducible Non-Declarative Web Push Baseline

Test setup: a controlled origin served over HTTPS (or http://localhost, which browsers treat as a secure context), a test-only account, permission requested from a real click handler, and subscriptions that never mix with production data.

Page-side subscription with PushManager

subscribe.js
const PUBLIC_KEY = document.querySelector('meta[name="vapid-public-key"]').content;

function urlBase64ToUint8Array(base64String) {
const padding = "=".repeat((4 - (base64String.length % 4)) % 4);
const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
const raw = atob(base64);
const out = new Uint8Array(raw.length);
for (let i = 0; i < raw.length; i += 1) out[i] = raw.charCodeAt(i);
return out;
}

export async function subscribe() {
if (!("serviceWorker" in navigator) || !("PushManager" in window)) {
  return { ok: false, reason: "unsupported" };
}

const registration = await navigator.serviceWorker.register("/sw.js");
await navigator.serviceWorker.ready;

const existing = await registration.pushManager.getSubscription();
const subscription =
  existing ||
  (await registration.pushManager.subscribe({
    userVisibleOnly: true,
    applicationServerKey: urlBase64ToUint8Array(PUBLIC_KEY),
  }));

const res = await fetch("/api/push/subscriptions", {
  method: "POST",
  headers: { "content-type": "application/json" },
  credentials: "same-origin",
  body: JSON.stringify(subscription.toJSON()),
});

if (!res.ok) return { ok: false, reason: "store-failed", status: res.status };
return { ok: true, endpointLength: subscription.endpoint.length };
}

Note what's deliberately absent from any log line: the endpoint value. Subscription endpoints are capability URLs — anyone holding one can attempt delivery. Log endpointLength or a truncated hash, never the endpoint, and never the keys.

Server-side sender with VAPID and web-push

send-push.mjs
import webpush from "web-push";

const { VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY, VAPID_SUBJECT } = process.env;
if (!VAPID_PUBLIC_KEY || !VAPID_PRIVATE_KEY || !VAPID_SUBJECT) {
throw new Error("missing VAPID configuration");
}
webpush.setVapidDetails(VAPID_SUBJECT, VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY);

export async function sendTestPush(subscription, eventId) {
const payload = JSON.stringify({
  v: 1,
  eventId,
  title: "Test delivery",
  body: "Sent from the HackyJS baseline",
  url: "/inbox",
});

try {
  const res = await webpush.sendNotification(subscription, payload, {
    TTL: 300,
    urgency: "normal",
  });
  return { ok: true, status: res.statusCode, eventId };
} catch (err) {
  return {
    ok: false,
    status: err.statusCode,
    code: err.code,
    gone: err.statusCode === 404 || err.statusCode === 410,
    eventId,
  };
}
}

Expected output shapes, taken from the documented Push API and Web Push Protocol behaviour rather than from a run in this article:

{ ok: true,  status: 201, eventId: "evt_01J8Z4K2" }      # push service accepted
{ ok: false, status: 410, gone: true, eventId: "..." }   # subscription no longer valid
{ ok: false, status: 429 }                               # throttled; honour Retry-After

201 means accepted. 404/410 means delete the subscription record. 429 means back off on the schedule the push service gave you, not on your own retry timer.

Push handler with defensive parsing

sw.js
const MAX_TITLE = 120;
const MAX_BODY = 240;
const DEFAULT_TARGET = "/inbox";

function safeTarget(value) {
try {
  const url = new URL(String(value || DEFAULT_TARGET), self.location.origin);
  if (url.origin !== self.location.origin) return DEFAULT_TARGET;
  return url.pathname + url.search + url.hash;
} catch {
  return DEFAULT_TARGET;
}
}

self.addEventListener("push", (event) => {
let payload = {};
try {
  payload = event.data ? event.data.json() : {};
} catch {
  payload = {};
}

const title = String(payload.title || "Update").slice(0, MAX_TITLE);
const body = String(payload.body || "").slice(0, MAX_BODY);
const eventId =
  typeof payload.eventId === "string" ? payload.eventId.slice(0, 64) : undefined;

event.waitUntil(
  self.registration.showNotification(title, {
    body,
    tag: eventId,
    data: { target: safeTarget(payload.url), eventId },
  })
);
});

Two things here matter. The handler never trusts the payload shape — event.data.json() throws on malformed input, and a throw in a push handler without waitUntil can cost you the notification entirely. And the v: 1 field in the sender is an application-owned marker. It is not a standards version marker, and it must not be conflated with whatever version field a declarative format uses.

Click handling with a same-origin policy

notificationclick.js
self.addEventListener("notificationclick", (event) => {
event.notification.close();
const data = event.notification.data || {};
const target = safeTarget(data.target);

event.waitUntil(
  (async () => {
    const windows = await self.clients.matchAll({
      type: "window",
      includeUncontrolled: true,
    });
    const sameOrigin = windows.find(
      (client) => new URL(client.url).origin === self.location.origin
    );

    if (sameOrigin) {
      await sameOrigin.focus();
      if ("navigate" in sameOrigin) {
        try {
          await sameOrigin.navigate(target);
        } catch {
          /* navigation refused; the focused window is still a safe outcome */
        }
      }
      return;
    }
    await self.clients.openWindow(target);
  })()
);
});

safeTarget is a security boundary, not a formatting helper. A push payload can arrive from a compromised server or a bug in your own sender, and clients.openWindow() on an attacker-chosen URL turns a notification into a redirect primitive. Restrict to same-origin paths and fall back to a known destination.

📝

Outputs in this post are labelled as expected shapes derived from the Push API, the Web Push Protocol, and documented library behaviour — not as results from a browser run in this article. Every claim that needs a real run gets pushed into the test matrix below, where you produce the evidence yourself.

Add Declarative Delivery Only After Verifying Its Contract

The gate is a document, not a hunch. From a primary source you need, in writing:

  • the exact schema, including any version or magic marker at the top level;
  • which fields are required and which are optional, and their size limits;
  • whether the payload is signed, encrypted, or both, and by which party;
  • the error behaviour for a malformed or unsupported payload — dropped silently, surfaced to the worker, or rejected at the push service;
  • whether an installed worker is bypassed, invoked before display, or invoked after;
  • which notification options are honoured.

Worker bypass is the claim that needs the most scrutiny

"Displays without a service worker" is not the same as "ignores an installed service worker." A payload might display with no worker registered and still dispatch a push event when one is active — which means your existing handler runs and you get two notifications. Whether that happens is a documented detail, not something to discover in production. Don't infer event ordering or fallback semantics from the absence of a push handler in your demo.

Option Parity With showNotification Is Not Implied

showNotification supports a wide set of options, and your handlers probably lean on tag, data, renotify, requireInteraction, actions, and an icon set. A declarative format may support a subset. Before adopting it for anything beyond a plain title-and-body message, check each option you use against the declarative contract, in the documentation, then in a browser.

When documentation is missing, ship the placeholder

If primary documentation is unavailable — the state of the world for the Firefox 162 report as supplied — the adapter stays disabled and the code says so explicitly.

delivery-policy.js
export const STRATEGY = {
CONVENTIONAL: "conventional",
DECLARATIVE: "declarative-verified",
};

// Replace only after the payload contract is read from a primary source
// and the version constant below is pinned to a documented value.
export const EXPECTED_DECLARATIVE_CONTRACT = null;

export function chooseDelivery(record) {
if (!record || !record.authorized) {
  return { strategy: null, reason: "not-authorized" };
}
if (record.declarativeCapability !== "verified") {
  return { strategy: STRATEGY.CONVENTIONAL, reason: "unverified-capability" };
}
if (EXPECTED_DECLARATIVE_CONTRACT === null) {
  return { strategy: STRATEGY.CONVENTIONAL, reason: "contract-not-pinned" };
}
if (record.declarativeContract !== EXPECTED_DECLARATIVE_CONTRACT) {
  return { strategy: STRATEGY.CONVENTIONAL, reason: "contract-mismatch" };
}
return { strategy: STRATEGY.DECLARATIVE, reason: "verified" };
}

export function buildDeclarativePayload() {
throw new Error("declarative payload contract not verified; use conventional delivery");
}

That throw is the point. A placeholder that quietly returns a plausible-looking object is worse than no adapter, because the first person to flip the flag ships invented field names to production.

Feature Detection Is Not the Same as Finding PushManager

const caps = {
  serviceWorker: "serviceWorker" in navigator,
  pushManager: "PushManager" in window,
  notifications: "Notification" in window,
  permission: typeof Notification !== "undefined" ? Notification.permission : "unavailable",
};
console.table(caps);

These checks tell you the platform surface exists and what the current permission state is. They tell you nothing about whether a declarative payload will be displayed. Every browser in the matrix will print true for most of those keys, which is exactly why the check doesn't answer the question.

Version strings are not a capability signal

User-agent parsing or a version-number comparison is the wrong instrument. Engines ship features behind flags, backport them, delay them, or disable them for particular platforms. Current browser releases also freeze or reduce UA detail, so the string is both unreliable and unstable. If a documented declarative capability signal exists — a property, a method, a feature query — use that and only that, and check it against the specification rather than a tutorial.

Model Capability in Application-Owned Metadata

Three states, stored per subscription:

  • unknown — no evidence either way; deliver conventionally.
  • conventional-only — tested, declarative unsupported; deliver conventionally.
  • verified — tested in a named build, with a pinned contract version; eligible for declarative delivery.

Keep authorized as a separate field from declarativeCapability. Mixing a UI preference, an authorization decision, and a delivery strategy into one enum is how a permission bug turns into a delivery bug.

Stale metadata is the default case, not the edge case

Subscriptions outlive deployments. A record marked verified six months ago may point at a worker that has since been replaced, or a browser that has since changed. Re-verify on subscription change, on worker update, and on any observed mismatch. The conservative default — conventional — is what makes a stale record safe instead of dangerous.

Design the Fallback Without Sending Two Notifications

Two mechanisms, kept clearly apart:

  • Application-level selection: your server picks one strategy per subscription per logical event. You control it.
  • Browser-provided fallback: the browser somehow handles a payload your worker also handles. You don't control it, and you have to verify whether it exists before relying on it.

One strategy per subscription per logical event

Don't send both formats to the same subscription "for compatibility." That is the shortest path to duplicate notifications, and duplicates are worse than misses: users tolerate one missing notification, but they turn notifications off for an app that pings twice.

Keep the Worker Path Where It Still Does Work

Some workflows need worker-side processing: computing a target URL from local state, updating a badge count, writing to IndexedDB, or suppressing a notification the user has muted in-app. Any of those is a reason to stay conventional for that subscription regardless of declarative support.

tag Replacement Is Not Exactly-Once Delivery

tag is documented notification replacement: a new notification with the same tag and origin replaces the existing one. That's a display-level dedupe, and it's handy for repeated status updates. It doesn't give you exactly-once semantics. It doesn't dedupe across different tags, across different delivery strategies, or across a device that was offline when the first message was discarded on TTL expiry.

Use an application eventId for idempotency at the point where a message actually causes a side effect — a write, a navigation, an analytics event — and store that ID server-side with a bounded retention window.

Do Not Resend on Silence

Send a push and see no interaction and you've learned nothing conclusive. The device may be offline. The push service may have queued until TTL expiry. The notification may have displayed and been ignored. Telemetry may be blocked. Immediate resend-on-silence turns all four into duplicate traffic and, eventually, into a rate limit from the push service.

Test the Firefox Claim Against Real Browser Behaviour

Minimum matrix: the reported Firefox 162 build, the previous supported Firefox release, one current Chromium-based browser, and Safari if you support it. Record for each run:

  • exact build string;
  • operating system and configuration (including whether any relevant flag was toggled manually);
  • permission state at start;
  • active service worker version;
  • the evidence that supports the capability classification.

Scenario Checklist for the Test Matrix

ScenarioWhat it testsSignal to record
Page open, worker activeBaseline pathpush event fired, notification shown
All tabs closedBackground wakeWhether the worker started at all
No worker registeredDeclarative claimWhether a notification appears without any handler
Offline, then reconnectQueue and TTL behaviourWhether delivery arrives after TTL
Worker updated between sendsStale metadataWhether the old or new handler ran
Malformed JSON payloadDefensive parsingFallback notification, no unhandled rejection
Expired subscriptionLifecycle404/410 from the push service, record deleted
Permission deniedGate correctnessNo subscribe call, no error spam
Cross-origin url in payloadClick policyFallback target, never the hostile origin
Unsupported option (e.g. actions)Option parityWhether the option is ignored or the notification fails

Publish an Evidence Table, Not a Summary

CaseSender responseWorker eventVisible notificationClick outcomeStatus
Conventional, page open201pushyesfocused, navigatedobserved
Conventional, no tabs201pushyesopened /inboxobserved
Declarative, worker absent?—??untested
Declarative, worker present????untested
Malformed payload201pushfallback text/inboxobserved

The untested rows are the honest state for the reported declarative behaviour until a primary source and a local build exist. A table with ? in it beats a table with guesses in it, because the ? is an instruction.

Roll Out With a Kill Switch and a Working Conventional Path

Gate on Verified Compatibility and a Limited Cohort

Enable declarative delivery for a small cohort — internal first, then a percentage — behind a server-side flag that flips back to the conventional format without a client deploy. The flag has to be readable at send time, per subscription, not cached globally at boot.

Protect the Push Pipeline

  • Subscription changes require authentication, and the server verifies the endpoint belongs to the authenticated principal before storing it.
  • Audience authorization happens server-side at send time. A declarative display path must not become an excuse for trusting a client-supplied recipient.
  • Payloads stay minimal: no tokens, no PII beyond what the notification text requires, no internal URLs.
  • All payload fields are bounded before they reach the notification, in the sender and again in the handler.
  • Diagnostics are credential-safe: hashed endpoints, no VAPID private key in logs, no full subscription JSON in error reports.

Instrument Only What You Can Actually Observe

Track sender response codes, expired-subscription deletions, and application-visible interactions such as notificationclick and the navigation that follows. Don't claim display telemetry you don't have. If your analytics show an interaction, that's evidence of display plus click; if they show nothing, that's evidence of nothing.

Release Gates

Ship the declarative path only when all of these hold:

  1. A primary source documents the payload contract, version marker, and error behaviour.
  2. Browser results are reproducible across the matrix, including worker-present and worker-absent cases.
  3. No duplicate-display regression in any scenario.
  4. Interaction routing is same-origin and has a tested default.
  5. Rollback is demonstrated — the flag flipped in staging produces the conventional format, verified by an observed notification.

Keep the Fallback Until the Evidence Supports Removing It

Decision rule: adopt declarative delivery where a primary document and a reproduced browser run both support it, for the narrow class of messages where it helps. Retain the non-declarative, worker-driven fallback wherever support is unverified or the application needs worker-side processing. If a subscription's state is anything other than verified, send conventionally. The only cost is a few kilobytes of code you already wrote and already test.

What to watch next: Mozilla's release documentation and implementation tracking for the specific version, a stable and specified payload contract with a version marker, a documented capability detection mechanism that isn't user-agent parsing, and evidence of interoperable behaviour across your supported browsers. Until those exist, the fallback is the product.

Further Reading and Verification Sources

Reporting seed (secondary coverage, limited detail)

Standards and platform documentation for the conventional baseline

Firefox and declarative sources to verify before use

These are the documents that must exist and be read before a declarative adapter is enabled. Construct and check the current URLs yourself; don't rely on a remembered path.

  • Mozilla release notes for the specific Firefox version (the mozilla.org releases page for that version), to establish what shipped and whether it is default-on.
  • The Bugzilla or implementation-tracking entry for declarative Web Push, to establish what was implemented and what was deferred.
  • MDN documentation for any declarative notification surface, to establish the payload schema and version marker.
  • The specification or explainer that defines the declarative format, to establish required fields, error behaviour, and worker interaction.
  • WebKit's published declarative notification documentation, if you support Safari — read as a separate contract from anything Mozilla ships.

Share this post

More posts

Loading comments…