Skip to content

Commit edf4364

Browse files
committed
support static attributes
1 parent bf18e81 commit edf4364

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

baselines/dom.generated.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9838,12 +9838,10 @@ interface Notification extends EventTarget {
98389838
readonly icon: string;
98399839
readonly image: string;
98409840
readonly lang: string;
9841-
readonly maxActions: number;
98429841
onclick: ((this: Notification, ev: Event) => any) | null;
98439842
onclose: ((this: Notification, ev: Event) => any) | null;
98449843
onerror: ((this: Notification, ev: Event) => any) | null;
98459844
onshow: ((this: Notification, ev: Event) => any) | null;
9846-
readonly permission: NotificationPermission;
98479845
readonly renotify: boolean;
98489846
readonly requireInteraction: boolean;
98499847
readonly silent: boolean;
@@ -9861,6 +9859,8 @@ interface Notification extends EventTarget {
98619859
declare var Notification: {
98629860
prototype: Notification;
98639861
new(title: string, options?: NotificationOptions): Notification;
9862+
readonly maxActions: number;
9863+
readonly permission: NotificationPermission;
98649864
requestPermission(deprecatedCallback?: NotificationPermissionCallback): Promise<NotificationPermission>;
98659865
};
98669866

@@ -10471,7 +10471,6 @@ interface PromiseRejectionEventInit extends EventInit {
1047110471
}
1047210472

1047310473
interface PushManager {
10474-
readonly supportedContentEncodings: ReadonlyArray<string>;
1047510474
getSubscription(): Promise<PushSubscription | null>;
1047610475
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
1047710476
subscribe(options?: PushSubscriptionOptionsInit): Promise<PushSubscription>;
@@ -10480,6 +10479,7 @@ interface PushManager {
1048010479
declare var PushManager: {
1048110480
prototype: PushManager;
1048210481
new(): PushManager;
10482+
readonly supportedContentEncodings: ReadonlyArray<string>;
1048310483
};
1048410484

1048510485
interface PushSubscription {

baselines/webworker.generated.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,12 +1017,10 @@ interface Notification extends EventTarget {
10171017
readonly icon: string;
10181018
readonly image: string;
10191019
readonly lang: string;
1020-
readonly maxActions: number;
10211020
onclick: ((this: Notification, ev: Event) => any) | null;
10221021
onclose: ((this: Notification, ev: Event) => any) | null;
10231022
onerror: ((this: Notification, ev: Event) => any) | null;
10241023
onshow: ((this: Notification, ev: Event) => any) | null;
1025-
readonly permission: NotificationPermission;
10261024
readonly renotify: boolean;
10271025
readonly requireInteraction: boolean;
10281026
readonly silent: boolean;
@@ -1040,6 +1038,8 @@ interface Notification extends EventTarget {
10401038
declare var Notification: {
10411039
prototype: Notification;
10421040
new(title: string, options?: NotificationOptions): Notification;
1041+
readonly maxActions: number;
1042+
readonly permission: NotificationPermission;
10431043
requestPermission(deprecatedCallback?: NotificationPermissionCallback): Promise<NotificationPermission>;
10441044
};
10451045

@@ -1218,7 +1218,6 @@ declare var PushEvent: {
12181218
};
12191219

12201220
interface PushManager {
1221-
readonly supportedContentEncodings: ReadonlyArray<string>;
12221221
getSubscription(): Promise<PushSubscription | null>;
12231222
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
12241223
subscribe(options?: PushSubscriptionOptionsInit): Promise<PushSubscription>;
@@ -1227,6 +1226,7 @@ interface PushManager {
12271226
declare var PushManager: {
12281227
prototype: PushManager;
12291228
new(): PushManager;
1229+
readonly supportedContentEncodings: ReadonlyArray<string>;
12301230
};
12311231

12321232
interface PushMessageData {

src/emitter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const eventTypeMap: Record<string, string> = {
4343

4444
// Used to decide if a member should be emitted given its static property and
4545
// the intended scope level.
46-
function matchScope(scope: EmitScope, x: Browser.Method) {
46+
function matchScope(scope: EmitScope, x: { static?: 1 | undefined }) {
4747
return scope === EmitScope.All || (scope === EmitScope.StaticOnly) === !!x.static;
4848
}
4949

@@ -618,10 +618,9 @@ export function emitWebIDl(webidl: Browser.WebIdl, flavor: Flavor) {
618618
}
619619

620620
function emitProperties(prefix: string, emitScope: EmitScope, i: Browser.Interface, conflictedMembers: Set<string>) {
621-
// Note: the schema file shows the property doesn't have "static" attribute,
622-
// therefore all properties are emited for the instance type.
623-
if (emitScope !== EmitScope.StaticOnly && i.properties) {
621+
if (i.properties) {
624622
mapToArray(i.properties.property)
623+
.filter(m => matchScope(emitScope, m))
625624
.filter(p => !isCovariantEventHandler(i, p))
626625
.sort(compareName)
627626
.forEach(p => emitProperty(prefix, i, emitScope, p, conflictedMembers));

src/widlprocess.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ function convertAttribute(attribute: webidl2.AttributeMemberType): Browser.Prope
172172
return {
173173
name: attribute.name,
174174
...convertIdlType(attribute.idlType),
175+
static: attribute.static ? 1 : undefined,
175176
"read-only": attribute.readonly ? 1 : undefined,
176177
"event-handler": attribute.idlType.idlType === "EventHandler" ? attribute.name.slice(2) : undefined
177178
}

0 commit comments

Comments
 (0)