Skip to content

Commit b121b27

Browse files
Release build 4.55.0 [ci release]
1 parent ddc9aef commit b121b27

File tree

6 files changed

+207
-179
lines changed

6 files changed

+207
-179
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,7 @@
22902290
window.outerWidth = window.innerWidth;
22912291
}
22922292
const MSG_WEB_SHARE = "webShare";
2293+
const MSG_PERMISSIONS_QUERY = "permissionsQuery";
22932294
function canShare(data) {
22942295
if (typeof data !== "object")
22952296
return false;
@@ -2509,38 +2510,28 @@
25092510
this.onchange = null;
25102511
}
25112512
}
2512-
const defaultValidPermissionNames = [
2513-
"geolocation",
2514-
"notifications",
2515-
"push",
2516-
"persistent-storage",
2517-
"midi",
2518-
"accelerometer",
2519-
"ambient-light-sensor",
2520-
"background-sync",
2521-
"bluetooth",
2522-
"camera",
2523-
"clipboard",
2524-
"device-info",
2525-
"gyroscope",
2526-
"magnetometer",
2527-
"microphone",
2528-
"speaker"
2529-
];
2530-
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
2531-
const returnStatus = settings.permissionResponse || "prompt";
2532-
permissions.query = new Proxy((query) => {
2513+
permissions.query = new Proxy(async (query) => {
25332514
this.addDebugFlag();
25342515
if (!query) {
25352516
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.");
25362517
}
25372518
if (!query.name) {
25382519
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.");
25392520
}
2540-
if (!validPermissionNames.includes(query.name)) {
2521+
if (!settings.supportedPermissions || !(query.name in settings.supportedPermissions)) {
25412522
throw new TypeError(`Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value '${query.name}' is not a valid enum value of type PermissionName.`);
25422523
}
2543-
return Promise.resolve(new PermissionStatus(query.name, returnStatus));
2524+
const permSetting = settings.supportedPermissions[query.name];
2525+
const returnName = permSetting.name || query.name;
2526+
let returnStatus = settings.permissionResponse || "prompt";
2527+
if (permSetting.native) {
2528+
try {
2529+
const response = await this.messaging.request(MSG_PERMISSIONS_QUERY, query);
2530+
returnStatus = response.state || "prompt";
2531+
} catch (err) {
2532+
}
2533+
}
2534+
return Promise.resolve(new PermissionStatus(returnName, returnStatus));
25442535
}, {
25452536
get(target, name) {
25462537
return Reflect.get(target, name);

build/android/contentScope.js

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7404,6 +7404,7 @@
74047404
}
74057405

74067406
const MSG_WEB_SHARE = 'webShare';
7407+
const MSG_PERMISSIONS_QUERY = 'permissionsQuery';
74077408

74087409
function canShare (data) {
74097410
if (typeof data !== 'object') return false
@@ -7640,39 +7641,29 @@
76407641
this.onchange = null; // noop
76417642
}
76427643
}
7643-
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
7644-
const defaultValidPermissionNames = [
7645-
'geolocation',
7646-
'notifications',
7647-
'push',
7648-
'persistent-storage',
7649-
'midi',
7650-
'accelerometer',
7651-
'ambient-light-sensor',
7652-
'background-sync',
7653-
'bluetooth',
7654-
'camera',
7655-
'clipboard',
7656-
'device-info',
7657-
'gyroscope',
7658-
'magnetometer',
7659-
'microphone',
7660-
'speaker'
7661-
];
7662-
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
7663-
const returnStatus = settings.permissionResponse || 'prompt';
7664-
permissions.query = new Proxy((query) => {
7644+
permissions.query = new Proxy(async (query) => {
76657645
this.addDebugFlag();
76667646
if (!query) {
76677647
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
76687648
}
76697649
if (!query.name) {
76707650
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
76717651
}
7672-
if (!validPermissionNames.includes(query.name)) {
7652+
if (!settings.supportedPermissions || !(query.name in settings.supportedPermissions)) {
76737653
throw new TypeError(`Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value '${query.name}' is not a valid enum value of type PermissionName.`)
76747654
}
7675-
return Promise.resolve(new PermissionStatus(query.name, returnStatus))
7655+
const permSetting = settings.supportedPermissions[query.name];
7656+
const returnName = permSetting.name || query.name;
7657+
let returnStatus = settings.permissionResponse || 'prompt';
7658+
if (permSetting.native) {
7659+
try {
7660+
const response = await this.messaging.request(MSG_PERMISSIONS_QUERY, query);
7661+
returnStatus = response.state || 'prompt';
7662+
} catch (err) {
7663+
// do nothing - keep returnStatus as-is
7664+
}
7665+
}
7666+
return Promise.resolve(new PermissionStatus(returnName, returnStatus))
76767667
}, {
76777668
get (target, name) {
76787669
return Reflect.get(target, name)

build/contentScope.js

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13573,6 +13573,7 @@
1357313573
}
1357413574

1357513575
const MSG_WEB_SHARE = 'webShare';
13576+
const MSG_PERMISSIONS_QUERY = 'permissionsQuery';
1357613577

1357713578
function canShare (data) {
1357813579
if (typeof data !== 'object') return false
@@ -13809,39 +13810,29 @@
1380913810
this.onchange = null; // noop
1381013811
}
1381113812
}
13812-
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
13813-
const defaultValidPermissionNames = [
13814-
'geolocation',
13815-
'notifications',
13816-
'push',
13817-
'persistent-storage',
13818-
'midi',
13819-
'accelerometer',
13820-
'ambient-light-sensor',
13821-
'background-sync',
13822-
'bluetooth',
13823-
'camera',
13824-
'clipboard',
13825-
'device-info',
13826-
'gyroscope',
13827-
'magnetometer',
13828-
'microphone',
13829-
'speaker'
13830-
];
13831-
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
13832-
const returnStatus = settings.permissionResponse || 'prompt';
13833-
permissions.query = new Proxy((query) => {
13813+
permissions.query = new Proxy(async (query) => {
1383413814
this.addDebugFlag();
1383513815
if (!query) {
1383613816
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
1383713817
}
1383813818
if (!query.name) {
1383913819
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
1384013820
}
13841-
if (!validPermissionNames.includes(query.name)) {
13821+
if (!settings.supportedPermissions || !(query.name in settings.supportedPermissions)) {
1384213822
throw new TypeError(`Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value '${query.name}' is not a valid enum value of type PermissionName.`)
1384313823
}
13844-
return Promise.resolve(new PermissionStatus(query.name, returnStatus))
13824+
const permSetting = settings.supportedPermissions[query.name];
13825+
const returnName = permSetting.name || query.name;
13826+
let returnStatus = settings.permissionResponse || 'prompt';
13827+
if (permSetting.native) {
13828+
try {
13829+
const response = await this.messaging.request(MSG_PERMISSIONS_QUERY, query);
13830+
returnStatus = response.state || 'prompt';
13831+
} catch (err) {
13832+
// do nothing - keep returnStatus as-is
13833+
}
13834+
}
13835+
return Promise.resolve(new PermissionStatus(returnName, returnStatus))
1384513836
}, {
1384613837
get (target, name) {
1384713838
return Reflect.get(target, name)

build/integration/contentScope.js

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13573,6 +13573,7 @@
1357313573
}
1357413574

1357513575
const MSG_WEB_SHARE = 'webShare';
13576+
const MSG_PERMISSIONS_QUERY = 'permissionsQuery';
1357613577

1357713578
function canShare (data) {
1357813579
if (typeof data !== 'object') return false
@@ -13809,39 +13810,29 @@
1380913810
this.onchange = null; // noop
1381013811
}
1381113812
}
13812-
// Default subset based upon Firefox (the full list is pretty large right now and these are the common ones)
13813-
const defaultValidPermissionNames = [
13814-
'geolocation',
13815-
'notifications',
13816-
'push',
13817-
'persistent-storage',
13818-
'midi',
13819-
'accelerometer',
13820-
'ambient-light-sensor',
13821-
'background-sync',
13822-
'bluetooth',
13823-
'camera',
13824-
'clipboard',
13825-
'device-info',
13826-
'gyroscope',
13827-
'magnetometer',
13828-
'microphone',
13829-
'speaker'
13830-
];
13831-
const validPermissionNames = settings.validPermissionNames || defaultValidPermissionNames;
13832-
const returnStatus = settings.permissionResponse || 'prompt';
13833-
permissions.query = new Proxy((query) => {
13813+
permissions.query = new Proxy(async (query) => {
1383413814
this.addDebugFlag();
1383513815
if (!query) {
1383613816
throw new TypeError("Failed to execute 'query' on 'Permissions': 1 argument required, but only 0 present.")
1383713817
}
1383813818
if (!query.name) {
1383913819
throw new TypeError("Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': Required member is undefined.")
1384013820
}
13841-
if (!validPermissionNames.includes(query.name)) {
13821+
if (!settings.supportedPermissions || !(query.name in settings.supportedPermissions)) {
1384213822
throw new TypeError(`Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value '${query.name}' is not a valid enum value of type PermissionName.`)
1384313823
}
13844-
return Promise.resolve(new PermissionStatus(query.name, returnStatus))
13824+
const permSetting = settings.supportedPermissions[query.name];
13825+
const returnName = permSetting.name || query.name;
13826+
let returnStatus = settings.permissionResponse || 'prompt';
13827+
if (permSetting.native) {
13828+
try {
13829+
const response = await this.messaging.request(MSG_PERMISSIONS_QUERY, query);
13830+
returnStatus = response.state || 'prompt';
13831+
} catch (err) {
13832+
// do nothing - keep returnStatus as-is
13833+
}
13834+
}
13835+
return Promise.resolve(new PermissionStatus(returnName, returnStatus))
1384513836
}, {
1384613837
get (target, name) {
1384713838
return Reflect.get(target, name)

0 commit comments

Comments
 (0)