Skip to content

Commit 8f8c168

Browse files
authored
Bring pushManager back to ServiceWorkerRegistration (#2407)
1 parent 0dab062 commit 8f8c168

File tree

10 files changed

+68
-15
lines changed

10 files changed

+68
-15
lines changed

baselines/dom.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28320,6 +28320,12 @@ declare var PushManager: {
2832028320
readonly supportedContentEncodings: ReadonlyArray<string>;
2832128321
};
2832228322

28323+
/** Available only in secure contexts. */
28324+
interface PushManagerAttribute {
28325+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
28326+
readonly pushManager: PushManager;
28327+
}
28328+
2832328329
/**
2832428330
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
2832528331
* Available only in secure contexts.
@@ -34738,7 +34744,7 @@ interface ServiceWorkerRegistrationEventMap {
3473834744
*
3473934745
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
3474034746
*/
34741-
interface ServiceWorkerRegistration extends EventTarget {
34747+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
3474234748
/**
3474334749
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
3474434750
*

baselines/sharedworker.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7070,6 +7070,12 @@ declare var PushManager: {
70707070
readonly supportedContentEncodings: ReadonlyArray<string>;
70717071
};
70727072

7073+
/** Available only in secure contexts. */
7074+
interface PushManagerAttribute {
7075+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
7076+
readonly pushManager: PushManager;
7077+
}
7078+
70737079
/**
70747080
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
70757081
* Available only in secure contexts.
@@ -7803,7 +7809,7 @@ interface ServiceWorkerRegistrationEventMap {
78037809
*
78047810
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
78057811
*/
7806-
interface ServiceWorkerRegistration extends EventTarget {
7812+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
78077813
/**
78087814
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
78097815
*

baselines/ts5.5/dom.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28296,6 +28296,12 @@ declare var PushManager: {
2829628296
readonly supportedContentEncodings: ReadonlyArray<string>;
2829728297
};
2829828298

28299+
/** Available only in secure contexts. */
28300+
interface PushManagerAttribute {
28301+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
28302+
readonly pushManager: PushManager;
28303+
}
28304+
2829928305
/**
2830028306
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
2830128307
* Available only in secure contexts.
@@ -34713,7 +34719,7 @@ interface ServiceWorkerRegistrationEventMap {
3471334719
*
3471434720
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
3471534721
*/
34716-
interface ServiceWorkerRegistration extends EventTarget {
34722+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
3471734723
/**
3471834724
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
3471934725
*

baselines/ts5.5/sharedworker.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7067,6 +7067,12 @@ declare var PushManager: {
70677067
readonly supportedContentEncodings: ReadonlyArray<string>;
70687068
};
70697069

7070+
/** Available only in secure contexts. */
7071+
interface PushManagerAttribute {
7072+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
7073+
readonly pushManager: PushManager;
7074+
}
7075+
70707076
/**
70717077
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
70727078
* Available only in secure contexts.
@@ -7800,7 +7806,7 @@ interface ServiceWorkerRegistrationEventMap {
78007806
*
78017807
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
78027808
*/
7803-
interface ServiceWorkerRegistration extends EventTarget {
7809+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
78047810
/**
78057811
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
78067812
*

baselines/ts5.6/dom.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28317,6 +28317,12 @@ declare var PushManager: {
2831728317
readonly supportedContentEncodings: ReadonlyArray<string>;
2831828318
};
2831928319

28320+
/** Available only in secure contexts. */
28321+
interface PushManagerAttribute {
28322+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
28323+
readonly pushManager: PushManager;
28324+
}
28325+
2832028326
/**
2832128327
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
2832228328
* Available only in secure contexts.
@@ -34735,7 +34741,7 @@ interface ServiceWorkerRegistrationEventMap {
3473534741
*
3473634742
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
3473734743
*/
34738-
interface ServiceWorkerRegistration extends EventTarget {
34744+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
3473934745
/**
3474034746
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
3474134747
*

baselines/ts5.6/sharedworker.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7067,6 +7067,12 @@ declare var PushManager: {
70677067
readonly supportedContentEncodings: ReadonlyArray<string>;
70687068
};
70697069

7070+
/** Available only in secure contexts. */
7071+
interface PushManagerAttribute {
7072+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
7073+
readonly pushManager: PushManager;
7074+
}
7075+
70707076
/**
70717077
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
70727078
* Available only in secure contexts.
@@ -7800,7 +7806,7 @@ interface ServiceWorkerRegistrationEventMap {
78007806
*
78017807
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
78027808
*/
7803-
interface ServiceWorkerRegistration extends EventTarget {
7809+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
78047810
/**
78057811
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
78067812
*

baselines/ts5.9/dom.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28317,6 +28317,12 @@ declare var PushManager: {
2831728317
readonly supportedContentEncodings: ReadonlyArray<string>;
2831828318
};
2831928319

28320+
/** Available only in secure contexts. */
28321+
interface PushManagerAttribute {
28322+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
28323+
readonly pushManager: PushManager;
28324+
}
28325+
2832028326
/**
2832128327
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
2832228328
* Available only in secure contexts.
@@ -34735,7 +34741,7 @@ interface ServiceWorkerRegistrationEventMap {
3473534741
*
3473634742
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
3473734743
*/
34738-
interface ServiceWorkerRegistration extends EventTarget {
34744+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
3473934745
/**
3474034746
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
3474134747
*

baselines/ts5.9/sharedworker.generated.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7067,6 +7067,12 @@ declare var PushManager: {
70677067
readonly supportedContentEncodings: ReadonlyArray<string>;
70687068
};
70697069

7070+
/** Available only in secure contexts. */
7071+
interface PushManagerAttribute {
7072+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager) */
7073+
readonly pushManager: PushManager;
7074+
}
7075+
70707076
/**
70717077
* The **`PushSubscription`** interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. This information must be passed to the application server, using any desired application-specific method.
70727078
* Available only in secure contexts.
@@ -7800,7 +7806,7 @@ interface ServiceWorkerRegistrationEventMap {
78007806
*
78017807
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
78027808
*/
7803-
interface ServiceWorkerRegistration extends EventTarget {
7809+
interface ServiceWorkerRegistration extends EventTarget, PushManagerAttribute {
78047810
/**
78057811
* The **`active`** read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state is activating or activated. This property is initially set to null.
78067812
*

inputfiles/patches/push-api.kdl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
interface-mixin PushManagerAttribute {
2-
// Windows support only on WebKit as of 2025-10
3-
property pushManager exposed=ServiceWorker
4-
}
5-
61
removals {
2+
interface Window {
3+
// Not supported on Windows as of 2025-10
4+
includes PushManagerAttribute
5+
}
76
dictionary PushEventInit {
87
member notification // WebKit only as of 2025-12
98
}

src/build/patches.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ function handleMixinAndInterfaces(
208208
let method: Record<string, DeepPartial<OverridableMethod>> = {};
209209
let constructor: DeepPartial<OverridableMethod> | undefined;
210210
let typeParameters = {};
211+
const includes: string[] = [];
211212

212213
for (const child of node.children) {
213214
switch (child.name) {
@@ -236,6 +237,10 @@ function handleMixinAndInterfaces(
236237
typeParameters = handleTypeParameters(child);
237238
break;
238239
}
240+
case "includes": {
241+
includes.push(string(child.values[0]));
242+
break;
243+
}
239244
default:
240245
throw new Error(`Unknown node name: ${child.name}`);
241246
}
@@ -255,8 +260,9 @@ function handleMixinAndInterfaces(
255260
return {
256261
name,
257262
...optionalNestedMember("events", event, { event }),
258-
properties: { property },
259-
methods: { method },
263+
...optionalNestedMember("properties", property, { property }),
264+
...optionalNestedMember("methods", method, { method }),
265+
...optionalNestedMember("implements", includes, includes),
260266
...optionalMember("extends", "string", node.properties?.extends),
261267
...optionalMember("overrideThis", "string", node.properties?.overrideThis),
262268
...optionalMember("forward", "string", node.properties?.forward),

0 commit comments

Comments
 (0)