Added preference to enable/disable async html tokenizer

This commit is contained in:
Nikhil Shagrithaya 2017-06-17 13:35:55 +05:30
parent 161ff15d54
commit ad649bb7e3
2 changed files with 13 additions and 4 deletions

View file

@ -43,6 +43,7 @@ use profile_traits::time::{TimerMetadata, TimerMetadataFrameType};
use profile_traits::time::{TimerMetadataReflowType, ProfilerCategory, profile}; use profile_traits::time::{TimerMetadataReflowType, ProfilerCategory, profile};
use script_thread::ScriptThread; use script_thread::ScriptThread;
use script_traits::DocumentActivity; use script_traits::DocumentActivity;
use servo_config::prefs::PREFS;
use servo_config::resource_files::read_resource_file; use servo_config::resource_files::read_resource_file;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
@ -103,10 +104,17 @@ enum LastChunkState {
impl ServoParser { impl ServoParser {
pub fn parse_html_document(document: &Document, input: DOMString, url: ServoUrl) { pub fn parse_html_document(document: &Document, input: DOMString, url: ServoUrl) {
let parser = ServoParser::new(document, let parser = if PREFS.get("dom.servoparser.async_html_tokenizer.enabled").as_boolean().unwrap() {
Tokenizer::Html(self::html::Tokenizer::new(document, url, None)), ServoParser::new(document,
LastChunkState::NotReceived, Tokenizer::AsyncHtml(self::async_html::Tokenizer::new(document, url, None)),
ParserKind::Normal); LastChunkState::NotReceived,
ParserKind::Normal)
} else {
ServoParser::new(document,
Tokenizer::Html(self::html::Tokenizer::new(document, url, None)),
LastChunkState::NotReceived,
ParserKind::Normal)
};
parser.parse_string_chunk(String::from(input)); parser.parse_string_chunk(String::from(input));
} }

View file

@ -10,6 +10,7 @@
"dom.permissions.enabled": false, "dom.permissions.enabled": false,
"dom.permissions.testing.allowed_in_nonsecure_contexts": false, "dom.permissions.testing.allowed_in_nonsecure_contexts": false,
"dom.serviceworker.timeout_seconds": 60, "dom.serviceworker.timeout_seconds": 60,
"dom.servoparser.async_html_tokenizer.enabled": false,
"dom.testable_crash.enabled": false, "dom.testable_crash.enabled": false,
"dom.testbinding.enabled": false, "dom.testbinding.enabled": false,
"dom.webvr.enabled": false, "dom.webvr.enabled": false,