mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
#8539 Config preferences backend restructure
This commit is contained in:
parent
34fda66dfa
commit
8bfd4dc1e2
53 changed files with 1748 additions and 680 deletions
|
@ -18,7 +18,6 @@ use net_traits::filemanager_thread::{
|
|||
use net_traits::http_percent_encode;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom};
|
||||
|
@ -311,7 +310,7 @@ impl FileManagerStore {
|
|||
// Check if the select_files preference is enabled
|
||||
// to ensure process-level security against compromised script;
|
||||
// Then try applying opt_test_path directly for testing convenience
|
||||
let opt_s = if select_files_pref_enabled() {
|
||||
let opt_s = if pref!(dom.testing.html_input_element.select_files.enabled) {
|
||||
opt_test_path
|
||||
} else {
|
||||
self.query_files_from_embedder(patterns, false, embedder_proxy)
|
||||
|
@ -342,7 +341,7 @@ impl FileManagerStore {
|
|||
// Check if the select_files preference is enabled
|
||||
// to ensure process-level security against compromised script;
|
||||
// Then try applying opt_test_paths directly for testing convenience
|
||||
let opt_v = if select_files_pref_enabled() {
|
||||
let opt_v = if pref!(dom.testing.html_input_element.select_files.enabled) {
|
||||
opt_test_paths
|
||||
} else {
|
||||
self.query_files_from_embedder(patterns, true, embedder_proxy)
|
||||
|
@ -740,13 +739,6 @@ impl FileManagerStore {
|
|||
}
|
||||
}
|
||||
|
||||
fn select_files_pref_enabled() -> bool {
|
||||
PREFS
|
||||
.get("dom.testing.htmlinputelement.select_files.enabled")
|
||||
.as_boolean()
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
fn read_file_in_chunks(
|
||||
sender: &IpcSender<FileManagerResult<ReadFileProgress>>,
|
||||
file: &mut File,
|
||||
|
|
|
@ -22,7 +22,6 @@ use net_traits::request::Request;
|
|||
use net_traits::response::{HttpsState, Response, ResponseBody};
|
||||
use net_traits::{FetchMetadata, Metadata, ResourceFetchTiming};
|
||||
use servo_arc::Arc;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Bound;
|
||||
|
@ -766,11 +765,7 @@ impl HttpCache {
|
|||
/// Storing Responses in Caches.
|
||||
/// <https://tools.ietf.org/html/rfc7234#section-3>
|
||||
pub fn store(&mut self, request: &Request, response: &Response) {
|
||||
if PREFS
|
||||
.get("network.http-cache.disabled")
|
||||
.as_boolean()
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if pref!(network.http_cache.disabled) {
|
||||
return;
|
||||
}
|
||||
if request.method != Method::GET {
|
||||
|
|
|
@ -16,6 +16,8 @@ extern crate matches;
|
|||
extern crate profile_traits;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate servo_config;
|
||||
|
||||
pub mod connector;
|
||||
pub mod cookie;
|
||||
|
|
|
@ -10,7 +10,7 @@ use net_traits::blob_url_store::BlobURLStoreError;
|
|||
use net_traits::filemanager_thread::{
|
||||
FileManagerThreadError, FileManagerThreadMsg, ReadFileProgress,
|
||||
};
|
||||
use servo_config::prefs::{PrefValue, PREFS};
|
||||
use servo_config::set_pref;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
|
@ -18,10 +18,7 @@ use std::path::PathBuf;
|
|||
#[test]
|
||||
fn test_filemanager() {
|
||||
let filemanager = FileManager::new(create_embedder_proxy());
|
||||
PREFS.set(
|
||||
"dom.testing.htmlinputelement.select_files.enabled",
|
||||
PrefValue::Boolean(true),
|
||||
);
|
||||
set_pref!(dom.testing.html_input_element.select_files.enabled, true);
|
||||
|
||||
// Try to open a dummy file "components/net/tests/test.jpeg" in tree
|
||||
let mut handler = File::open("tests/test.jpeg").expect("test.jpeg is stolen");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue