Skip to content

Commit 86e21bf

Browse files
Release build 4.31.0 [ci release]
1 parent a4f35ad commit 86e21bf

File tree

10 files changed

+988
-521
lines changed

10 files changed

+988
-521
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 75 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,67 +2991,6 @@
29912991
window.outerWidth = window.innerWidth;
29922992
}
29932993

2994-
/**
2995-
* Notification fix for adding missing API for Android WebView.
2996-
*/
2997-
function notificationFix () {
2998-
if (window.Notification) {
2999-
return
3000-
}
3001-
const Notification = () => {
3002-
// noop
3003-
};
3004-
Notification.requestPermission = () => {
3005-
return Promise.resolve({ permission: 'denied' })
3006-
};
3007-
Notification.permission = 'denied';
3008-
Notification.maxActions = 2;
3009-
3010-
// Expose the API
3011-
// @ts-expect-error window.Notification isn't assignable
3012-
window.Notification = Notification;
3013-
}
3014-
3015-
/**
3016-
* Adds missing permissions API for Android WebView.
3017-
*/
3018-
function permissionsFix (settings) {
3019-
if (window.navigator.permissions) {
3020-
return
3021-
}
3022-
// @ts-expect-error window.navigator isn't assignable
3023-
window.navigator.permissions = {};
3024-
class PermissionStatus extends EventTarget {
3025-
constructor (name, state) {
3026-
super();
3027-
this.name = name;
3028-
this.state = state;
3029-
this.onchange = null; // noop
3030-
}
3031-
}
3032-
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
3033-
const defaultValidPermissionNames = [
3034-
'geolocation',
3035-
'notifications',
3036-
'push',
3037-
'persistent-storage',
3038-
'midi'
3039-
];
3040-
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
3041-
window.navigator.permissions.query = (query) => {
3042-
if (!query) {
3043-
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
3044-
}
3045-
if (!query.name) {
3046-
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
3047-
}
3048-
if (!validPermissionNames.includes(query.name)) {
3049-
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value 's' is not a valid enum value of type PermissionName.")
3050-
}
3051-
return Promise.resolve(new PermissionStatus(query.name, 'denied'))
3052-
};
3053-
}
3054-
30552994
class WebCompat extends ContentFeature {
30562995
init () {
30572996
if (this.getFeatureSettingEnabled('windowSizing')) {
@@ -3066,6 +3005,81 @@
30663005
if (this.getFeatureSettingEnabled('messageHandlers')) {
30673006
this.messageHandlersFix();
30683007
}
3008+
if (this.getFeatureSettingEnabled('notification')) {
3009+
this.notificationFix();
3010+
}
3011+
if (this.getFeatureSettingEnabled('permissions')) {
3012+
const settings = this.getFeatureSettingEnabled('permissions');
3013+
this.permissionsFix(settings);
3014+
}
3015+
}
3016+
3017+
/**
3018+
* Notification fix for adding missing API for Android WebView.
3019+
*/
3020+
notificationFix () {
3021+
if (window.Notification) {
3022+
return
3023+
}
3024+
const Notification = () => {
3025+
// noop
3026+
};
3027+
Notification.requestPermission = () => {
3028+
return Promise.resolve({ permission: 'denied' })
3029+
};
3030+
Notification.permission = 'denied';
3031+
Notification.maxActions = 2;
3032+
3033+
// Expose the API
3034+
this.defineProperty(window, 'Notification', {
3035+
value: Notification,
3036+
writable: true,
3037+
configurable: true,
3038+
enumerable: false
3039+
});
3040+
}
3041+
3042+
/**
3043+
* Adds missing permissions API for Android WebView.
3044+
*/
3045+
permissionsFix (settings) {
3046+
if (window.navigator.permissions) {
3047+
return
3048+
}
3049+
const permissions = {};
3050+
class PermissionStatus extends EventTarget {
3051+
constructor (name, state) {
3052+
super();
3053+
this.name = name;
3054+
this.state = state;
3055+
this.onchange = null; // noop
3056+
}
3057+
}
3058+
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
3059+
const defaultValidPermissionNames = [
3060+
'geolocation',
3061+
'notifications',
3062+
'push',
3063+
'persistent-storage',
3064+
'midi'
3065+
];
3066+
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
3067+
permissions.query = (query) => {
3068+
this.addDebugFlag();
3069+
if (!query) {
3070+
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
3071+
}
3072+
if (!query.name) {
3073+
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
3074+
}
3075+
if (!validPermissionNames.includes(query.name)) {
3076+
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value 's' is not a valid enum value of type PermissionName.")
3077+
}
3078+
return Promise.resolve(new PermissionStatus(query.name, 'denied'))
3079+
};
3080+
// Expose the API
3081+
// @ts-expect-error window.navigator isn't assignable
3082+
window.navigator.permissions = permissions;
30693083
}
30703084

30713085
/**
@@ -3147,13 +3161,6 @@
31473161
} catch {
31483162
// Ignore exceptions that could be caused by conflicting with other extensions
31493163
}
3150-
if (this.getFeatureSettingEnabled('notification')) {
3151-
notificationFix();
3152-
}
3153-
if (this.getFeatureSettingEnabled('permissions')) {
3154-
const settings = this.getFeatureSettingEnabled('permissions');
3155-
permissionsFix(settings);
3156-
}
31573164
}
31583165

31593166
/**

build/android/contentScope.js

Lines changed: 75 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7027,67 +7027,6 @@
70277027
window.outerWidth = window.innerWidth;
70287028
}
70297029

7030-
/**
7031-
* Notification fix for adding missing API for Android WebView.
7032-
*/
7033-
function notificationFix () {
7034-
if (window.Notification) {
7035-
return
7036-
}
7037-
const Notification = () => {
7038-
// noop
7039-
};
7040-
Notification.requestPermission = () => {
7041-
return Promise.resolve({ permission: 'denied' })
7042-
};
7043-
Notification.permission = 'denied';
7044-
Notification.maxActions = 2;
7045-
7046-
// Expose the API
7047-
// @ts-expect-error window.Notification isn't assignable
7048-
window.Notification = Notification;
7049-
}
7050-
7051-
/**
7052-
* Adds missing permissions API for Android WebView.
7053-
*/
7054-
function permissionsFix (settings) {
7055-
if (window.navigator.permissions) {
7056-
return
7057-
}
7058-
// @ts-expect-error window.navigator isn't assignable
7059-
window.navigator.permissions = {};
7060-
class PermissionStatus extends EventTarget {
7061-
constructor (name, state) {
7062-
super();
7063-
this.name = name;
7064-
this.state = state;
7065-
this.onchange = null; // noop
7066-
}
7067-
}
7068-
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
7069-
const defaultValidPermissionNames = [
7070-
'geolocation',
7071-
'notifications',
7072-
'push',
7073-
'persistent-storage',
7074-
'midi'
7075-
];
7076-
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
7077-
window.navigator.permissions.query = (query) => {
7078-
if (!query) {
7079-
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
7080-
}
7081-
if (!query.name) {
7082-
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
7083-
}
7084-
if (!validPermissionNames.includes(query.name)) {
7085-
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value 's' is not a valid enum value of type PermissionName.")
7086-
}
7087-
return Promise.resolve(new PermissionStatus(query.name, 'denied'))
7088-
};
7089-
}
7090-
70917030
class WebCompat extends ContentFeature {
70927031
init () {
70937032
if (this.getFeatureSettingEnabled('windowSizing')) {
@@ -7102,6 +7041,81 @@
71027041
if (this.getFeatureSettingEnabled('messageHandlers')) {
71037042
this.messageHandlersFix();
71047043
}
7044+
if (this.getFeatureSettingEnabled('notification')) {
7045+
this.notificationFix();
7046+
}
7047+
if (this.getFeatureSettingEnabled('permissions')) {
7048+
const settings = this.getFeatureSettingEnabled('permissions');
7049+
this.permissionsFix(settings);
7050+
}
7051+
}
7052+
7053+
/**
7054+
* Notification fix for adding missing API for Android WebView.
7055+
*/
7056+
notificationFix () {
7057+
if (window.Notification) {
7058+
return
7059+
}
7060+
const Notification = () => {
7061+
// noop
7062+
};
7063+
Notification.requestPermission = () => {
7064+
return Promise.resolve({ permission: 'denied' })
7065+
};
7066+
Notification.permission = 'denied';
7067+
Notification.maxActions = 2;
7068+
7069+
// Expose the API
7070+
this.defineProperty(window, 'Notification', {
7071+
value: Notification,
7072+
writable: true,
7073+
configurable: true,
7074+
enumerable: false
7075+
});
7076+
}
7077+
7078+
/**
7079+
* Adds missing permissions API for Android WebView.
7080+
*/
7081+
permissionsFix (settings) {
7082+
if (window.navigator.permissions) {
7083+
return
7084+
}
7085+
const permissions = {};
7086+
class PermissionStatus extends EventTarget {
7087+
constructor (name, state) {
7088+
super();
7089+
this.name = name;
7090+
this.state = state;
7091+
this.onchange = null; // noop
7092+
}
7093+
}
7094+
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
7095+
const defaultValidPermissionNames = [
7096+
'geolocation',
7097+
'notifications',
7098+
'push',
7099+
'persistent-storage',
7100+
'midi'
7101+
];
7102+
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
7103+
permissions.query = (query) => {
7104+
this.addDebugFlag();
7105+
if (!query) {
7106+
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
7107+
}
7108+
if (!query.name) {
7109+
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
7110+
}
7111+
if (!validPermissionNames.includes(query.name)) {
7112+
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value 's' is not a valid enum value of type PermissionName.")
7113+
}
7114+
return Promise.resolve(new PermissionStatus(query.name, 'denied'))
7115+
};
7116+
// Expose the API
7117+
// @ts-expect-error window.navigator isn't assignable
7118+
window.navigator.permissions = permissions;
71057119
}
71067120

71077121
/**
@@ -7183,13 +7197,6 @@
71837197
} catch {
71847198
// Ignore exceptions that could be caused by conflicting with other extensions
71857199
}
7186-
if (this.getFeatureSettingEnabled('notification')) {
7187-
notificationFix();
7188-
}
7189-
if (this.getFeatureSettingEnabled('permissions')) {
7190-
const settings = this.getFeatureSettingEnabled('permissions');
7191-
permissionsFix(settings);
7192-
}
71937200
}
71947201

71957202
/**

0 commit comments

Comments
 (0)