mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Enable MIME sniffing via a pref instead of a global option.
This commit is contained in:
parent
9601d555cd
commit
cca25e2b3a
3 changed files with 3 additions and 8 deletions
|
@ -29,7 +29,7 @@ use std::collections::HashMap;
|
|||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use url::Url;
|
||||
use util::opts;
|
||||
use util::prefs;
|
||||
use util::task::spawn_named;
|
||||
use websocket_loader;
|
||||
|
||||
|
@ -77,7 +77,7 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
|||
classifier: Arc<MIMEClassifier>, partial_body: &[u8],
|
||||
context: LoadContext)
|
||||
-> Result<ProgressSender, ()> {
|
||||
if opts::get().sniff_mime_types {
|
||||
if prefs::get_pref("net.mime.sniff").as_boolean().unwrap_or(false) {
|
||||
// TODO: should be calculated in the resource loader, from pull requeset #4094
|
||||
let mut no_sniff = NoSniffFlag::OFF;
|
||||
let mut check_for_apache_bug = ApacheBugFlag::OFF;
|
||||
|
|
|
@ -171,9 +171,6 @@ pub struct Opts {
|
|||
/// Whether to show an error when display list geometry escapes flow overflow regions.
|
||||
pub validate_display_list_geometry: bool,
|
||||
|
||||
/// Whether MIME sniffing should be used
|
||||
pub sniff_mime_types: bool,
|
||||
|
||||
/// Whether Style Sharing Cache is used
|
||||
pub disable_share_style_cache: bool,
|
||||
|
||||
|
@ -491,7 +488,6 @@ pub fn default_opts() -> Opts {
|
|||
profile_tasks: false,
|
||||
profile_script_events: false,
|
||||
profile_heartbeats: false,
|
||||
sniff_mime_types: false,
|
||||
disable_share_style_cache: false,
|
||||
parallel_display_list_building: false,
|
||||
convert_mouse_to_touch: false,
|
||||
|
@ -536,7 +532,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
"A comma-separated string of debug options. Pass help to show available options.", "");
|
||||
opts.optflag("h", "help", "Print this message");
|
||||
opts.optopt("", "resources-path", "Path to find static resources", "/home/servo/resources");
|
||||
opts.optflag("", "sniff-mime-types" , "Enable MIME sniffing");
|
||||
opts.optopt("", "content-process" , "Run as a content process and connect to the given pipe",
|
||||
"servo-ipc-channel.abcdefg");
|
||||
opts.optmulti("", "pref",
|
||||
|
@ -726,7 +721,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
dump_layer_tree: debug_options.dump_layer_tree,
|
||||
relayout_event: debug_options.relayout_event,
|
||||
validate_display_list_geometry: debug_options.validate_display_list_geometry,
|
||||
sniff_mime_types: opt_match.opt_present("sniff-mime-types"),
|
||||
disable_share_style_cache: debug_options.disable_share_style_cache,
|
||||
parallel_display_list_building: debug_options.parallel_display_list_building,
|
||||
convert_mouse_to_touch: debug_options.convert_mouse_to_touch,
|
||||
|
|
|
@ -10,5 +10,6 @@
|
|||
"layout.text-orientation.enabled": false,
|
||||
"layout.viewport.enabled": false,
|
||||
"layout.writing-mode.enabled": false,
|
||||
"net.mime.sniff": false,
|
||||
"shell.homepage": "http://servo.org"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue