Skip to content

Commit e47807a

Browse files
Release build 4.44.0 [ci release]
1 parent 0e630cc commit e47807a

File tree

6 files changed

+142
-48
lines changed

6 files changed

+142
-48
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,15 +2367,29 @@
23672367
if (window.Notification) {
23682368
return;
23692369
}
2370-
const Notification = () => {
2371-
};
2372-
Notification.requestPermission = () => {
2373-
return Promise.resolve({ permission: "denied" });
2374-
};
2375-
Notification.permission = "denied";
2376-
Notification.maxActions = 2;
23772370
this.defineProperty(window, "Notification", {
2378-
value: Notification,
2371+
value: () => {
2372+
},
2373+
writable: true,
2374+
configurable: true,
2375+
enumerable: false
2376+
});
2377+
this.defineProperty(window.Notification, "requestPermission", {
2378+
value: () => {
2379+
return Promise.resolve("denied");
2380+
},
2381+
writable: true,
2382+
configurable: true,
2383+
enumerable: false
2384+
});
2385+
this.defineProperty(window.Notification, "permission", {
2386+
value: "denied",
2387+
writable: true,
2388+
configurable: true,
2389+
enumerable: false
2390+
});
2391+
this.defineProperty(window.Notification, "maxActions", {
2392+
value: 2,
23792393
writable: true,
23802394
configurable: true,
23812395
enumerable: false

build/android/contentScope.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7487,18 +7487,34 @@
74877487
if (window.Notification) {
74887488
return
74897489
}
7490-
const Notification = () => {
7491-
// noop
7492-
};
7493-
Notification.requestPermission = () => {
7494-
return Promise.resolve({ permission: 'denied' })
7495-
};
7496-
Notification.permission = 'denied';
7497-
Notification.maxActions = 2;
7498-
74997490
// Expose the API
75007491
this.defineProperty(window, 'Notification', {
7501-
value: Notification,
7492+
value: () => {
7493+
// noop
7494+
},
7495+
writable: true,
7496+
configurable: true,
7497+
enumerable: false
7498+
});
7499+
7500+
this.defineProperty(window.Notification, 'requestPermission', {
7501+
value: () => {
7502+
return Promise.resolve('denied')
7503+
},
7504+
writable: true,
7505+
configurable: true,
7506+
enumerable: false
7507+
});
7508+
7509+
this.defineProperty(window.Notification, 'permission', {
7510+
value: 'denied',
7511+
writable: true,
7512+
configurable: true,
7513+
enumerable: false
7514+
});
7515+
7516+
this.defineProperty(window.Notification, 'maxActions', {
7517+
value: 2,
75027518
writable: true,
75037519
configurable: true,
75047520
enumerable: false

build/contentScope.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11842,18 +11842,34 @@
1184211842
if (window.Notification) {
1184311843
return
1184411844
}
11845-
const Notification = () => {
11846-
// noop
11847-
};
11848-
Notification.requestPermission = () => {
11849-
return Promise.resolve({ permission: 'denied' })
11850-
};
11851-
Notification.permission = 'denied';
11852-
Notification.maxActions = 2;
11853-
1185411845
// Expose the API
1185511846
this.defineProperty(window, 'Notification', {
11856-
value: Notification,
11847+
value: () => {
11848+
// noop
11849+
},
11850+
writable: true,
11851+
configurable: true,
11852+
enumerable: false
11853+
});
11854+
11855+
this.defineProperty(window.Notification, 'requestPermission', {
11856+
value: () => {
11857+
return Promise.resolve('denied')
11858+
},
11859+
writable: true,
11860+
configurable: true,
11861+
enumerable: false
11862+
});
11863+
11864+
this.defineProperty(window.Notification, 'permission', {
11865+
value: 'denied',
11866+
writable: true,
11867+
configurable: true,
11868+
enumerable: false
11869+
});
11870+
11871+
this.defineProperty(window.Notification, 'maxActions', {
11872+
value: 2,
1185711873
writable: true,
1185811874
configurable: true,
1185911875
enumerable: false

build/integration/contentScope.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11842,18 +11842,34 @@
1184211842
if (window.Notification) {
1184311843
return
1184411844
}
11845-
const Notification = () => {
11846-
// noop
11847-
};
11848-
Notification.requestPermission = () => {
11849-
return Promise.resolve({ permission: 'denied' })
11850-
};
11851-
Notification.permission = 'denied';
11852-
Notification.maxActions = 2;
11853-
1185411845
// Expose the API
1185511846
this.defineProperty(window, 'Notification', {
11856-
value: Notification,
11847+
value: () => {
11848+
// noop
11849+
},
11850+
writable: true,
11851+
configurable: true,
11852+
enumerable: false
11853+
});
11854+
11855+
this.defineProperty(window.Notification, 'requestPermission', {
11856+
value: () => {
11857+
return Promise.resolve('denied')
11858+
},
11859+
writable: true,
11860+
configurable: true,
11861+
enumerable: false
11862+
});
11863+
11864+
this.defineProperty(window.Notification, 'permission', {
11865+
value: 'denied',
11866+
writable: true,
11867+
configurable: true,
11868+
enumerable: false
11869+
});
11870+
11871+
this.defineProperty(window.Notification, 'maxActions', {
11872+
value: 2,
1185711873
writable: true,
1185811874
configurable: true,
1185911875
enumerable: false

integration-test/test-web-compat.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,22 @@ describe('Ensure Notification and Permissions interface is injected', () => {
140140

141141
const modifiedDescriptorSerialization = await page.evaluate(checkObjectDescriptorSerializedValue)
142142
expect(modifiedDescriptorSerialization).toEqual(initialDescriptorSerialization)
143+
144+
const permissionDenied = await page.evaluate(() => {
145+
return window.Notification.requestPermission()
146+
})
147+
expect(permissionDenied).toEqual('denied')
148+
149+
const permissionPropDenied = await page.evaluate(() => {
150+
return window.Notification.permission
151+
})
152+
expect(permissionPropDenied).toEqual('denied')
153+
154+
const maxActionsPropDenied = await page.evaluate(() => {
155+
// @ts-expect-error - This is a property that should exist but experimental.
156+
return window.Notification.maxActions
157+
})
158+
expect(maxActionsPropDenied).toEqual(2)
143159
})
144160

145161
it('should expose window.navigator.permissions when enabled', async () => {

src/features/web-compat.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,34 @@ export default class WebCompat extends ContentFeature {
5252
if (window.Notification) {
5353
return
5454
}
55-
const Notification = () => {
56-
// noop
57-
}
58-
Notification.requestPermission = () => {
59-
return Promise.resolve({ permission: 'denied' })
60-
}
61-
Notification.permission = 'denied'
62-
Notification.maxActions = 2
63-
6455
// Expose the API
6556
this.defineProperty(window, 'Notification', {
66-
value: Notification,
57+
value: () => {
58+
// noop
59+
},
60+
writable: true,
61+
configurable: true,
62+
enumerable: false
63+
})
64+
65+
this.defineProperty(window.Notification, 'requestPermission', {
66+
value: () => {
67+
return Promise.resolve('denied')
68+
},
69+
writable: true,
70+
configurable: true,
71+
enumerable: false
72+
})
73+
74+
this.defineProperty(window.Notification, 'permission', {
75+
value: 'denied',
76+
writable: true,
77+
configurable: true,
78+
enumerable: false
79+
})
80+
81+
this.defineProperty(window.Notification, 'maxActions', {
82+
value: 2,
6783
writable: true,
6884
configurable: true,
6985
enumerable: false

0 commit comments

Comments
 (0)