mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-23 00:47:31 +09:00
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
This commit is contained in:
parent
e1e5fbf698
commit
99e4dc450c
2 changed files with 31 additions and 0 deletions
|
|
@ -368,6 +368,8 @@ geolocation.shareWithSite2=Would you like to share your location with this site?
|
||||||
geolocation.shareWithFile2=Would you like to share your location with this file?
|
geolocation.shareWithFile2=Would you like to share your location with this file?
|
||||||
|
|
||||||
webUSB.connectToSite=Would you like to let this site access USB devices?
|
webUSB.connectToSite=Would you like to let this site access USB devices?
|
||||||
|
webUSB.selectDeviceTitle=Select USB device
|
||||||
|
webUSB.selectDevice=Choose a USB device to access:
|
||||||
webUSB.allow=Allow USB Devices
|
webUSB.allow=Allow USB Devices
|
||||||
webUSB.allow.accesskey=A
|
webUSB.allow.accesskey=A
|
||||||
webUSB.block=Block USB Devices
|
webUSB.block=Block USB Devices
|
||||||
|
|
|
||||||
|
|
@ -550,6 +550,35 @@ USBPermissionPrompt.prototype = {
|
||||||
return "web-usb";
|
return "web-usb";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// PopupNotifications in older UXP builds cannot reliably render a
|
||||||
|
// permission request that contains a variable list of USB devices. Use
|
||||||
|
// the native prompt service so the chooser is always visible and the
|
||||||
|
// selected device can be returned to the content request.
|
||||||
|
prompt() {
|
||||||
|
let choices = getUSBDeviceChoices(this.request);
|
||||||
|
if (!choices.length) {
|
||||||
|
this.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let browser = this.browser;
|
||||||
|
let parent = browser && browser.ownerGlobal ? browser.ownerGlobal : null;
|
||||||
|
let selected = { value: 0 };
|
||||||
|
let accepted = Services.prompt.select(
|
||||||
|
parent,
|
||||||
|
getUSBString("webUSB.selectDeviceTitle", "Select USB device"),
|
||||||
|
getUSBString("webUSB.selectDevice", "Choose a USB device to access:"),
|
||||||
|
choices.length,
|
||||||
|
choices,
|
||||||
|
selected);
|
||||||
|
|
||||||
|
if (accepted && selected.value >= 0 && selected.value < choices.length) {
|
||||||
|
this.request.allow({usb: choices[selected.value]});
|
||||||
|
} else {
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
get anchorID() {
|
get anchorID() {
|
||||||
return "default-notification-icon";
|
return "default-notification-icon";
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue