mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Add pref to ignore popup in testing
This commit is contained in:
parent
3ec9f0bab9
commit
4a62562b0f
4 changed files with 12 additions and 8 deletions
|
@ -17,7 +17,7 @@ use dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::Bluetoot
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerBinding::
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerBinding::
|
||||||
BluetoothRemoteGATTServerMethods;
|
BluetoothRemoteGATTServerMethods;
|
||||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||||
use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState;
|
use dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, PermissionState};
|
||||||
use dom::bindings::codegen::UnionTypes::{StringOrStringSequence, StringOrUnsignedLong};
|
use dom::bindings::codegen::UnionTypes::{StringOrStringSequence, StringOrUnsignedLong};
|
||||||
use dom::bindings::error::Error::{self, Network, Security, Type};
|
use dom::bindings::error::Error::{self, Network, Security, Type};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
|
@ -216,11 +216,9 @@ impl Bluetooth {
|
||||||
ServiceUUIDSequence::new(optional_services_uuids));
|
ServiceUUIDSequence::new(optional_services_uuids));
|
||||||
|
|
||||||
// Step 3 - 5
|
// Step 3 - 5
|
||||||
// FIXME The following call will create a popup, which will mess up the testing...
|
if let PermissionState::Denied = get_descriptor_permission_state(PermissionName::Bluetooth, None) {
|
||||||
// Maybe create a call to the lower level to check if we are testing or not
|
return p.reject_error(p.global().get_cx(), Error::NotFound);
|
||||||
// if let PermissionState::Denied = get_descriptor_permission_state(PermissionName::Bluetooth, None) {
|
}
|
||||||
// return p.reject_error(p.global().get_cx(), Error::NotFound);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Note: Steps 6 - 8 are implemented in
|
// Note: Steps 6 - 8 are implemented in
|
||||||
// components/net/bluetooth_thread.rs in request_device function.
|
// components/net/bluetooth_thread.rs in request_device function.
|
||||||
|
|
|
@ -15,6 +15,7 @@ use dom::promise::Promise;
|
||||||
use js::conversions::ConversionResult;
|
use js::conversions::ConversionResult;
|
||||||
use js::jsapi::{JSContext, JSObject};
|
use js::jsapi::{JSContext, JSObject};
|
||||||
use js::jsval::{ObjectValue, UndefinedValue};
|
use js::jsval::{ObjectValue, UndefinedValue};
|
||||||
|
use servo_config::prefs::PREFS;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use tinyfiledialogs::{self, MessageBoxIcon, YesNo};
|
use tinyfiledialogs::{self, MessageBoxIcon, YesNo};
|
||||||
|
@ -231,7 +232,11 @@ pub fn get_descriptor_permission_state(permission_name: PermissionName ,
|
||||||
// if the feature is not allowed in non-secure contexcts,
|
// if the feature is not allowed in non-secure contexcts,
|
||||||
// and let the user decide to grant the permission or not.
|
// and let the user decide to grant the permission or not.
|
||||||
if !allowed_in_nonsecure_contexts(&permission_name) {
|
if !allowed_in_nonsecure_contexts(&permission_name) {
|
||||||
return prompt_user(permission_name);
|
if PREFS.get("dom.permissions.testing.allowed_in_nonsecure_contexts").as_boolean().unwrap_or(false) {
|
||||||
|
return PermissionState::Granted;
|
||||||
|
} else {
|
||||||
|
return prompt_user(permission_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Step 3: Store the invocation results
|
// TODO: Step 3: Store the invocation results
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"dom.mouseevent.which.enabled": false,
|
"dom.mouseevent.which.enabled": false,
|
||||||
"dom.mozbrowser.enabled": false,
|
"dom.mozbrowser.enabled": false,
|
||||||
"dom.permissions.enabled": false,
|
"dom.permissions.enabled": false,
|
||||||
|
"dom.permissions.testing.allowed_in_nonsecure_contexts": false,
|
||||||
"dom.serviceworker.timeout_seconds": 60,
|
"dom.serviceworker.timeout_seconds": 60,
|
||||||
"dom.testable_crash.enabled": false,
|
"dom.testable_crash.enabled": false,
|
||||||
"dom.testbinding.enabled": false,
|
"dom.testbinding.enabled": false,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
prefs: [dom.bluetooth.enabled:true, dom.bluetooth.testing.enabled:true]
|
prefs: [dom.bluetooth.enabled:true, dom.bluetooth.testing.enabled:true, dom.permissions.testing.allowed_in_nonsecure_contexts:true]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue