diff options
62 files changed, 370 insertions, 434 deletions
diff --git a/README.md b/README.md index 98687f13fe8..164d7ca555f 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,15 @@ settings for the installer are fine). 7. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). You MUST add "Visual C++" to the list of installed components as well as the "Windows Universal C runtime." They are not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it. +Note that version is hard to download online and is easier to install via [Chocolatey](https://chocolatey.org/install#installing-chocolatey) with: +``` +choco install -y visualstudio2017community --package-parameters="'--add Microsoft.VisualStudio.Component.Git'" +Update-SessionEnvironment #refreshing env due to Git install + +#--- UWP Workload and installing Windows Template Studio --- +choco install -y visualstudio2017-workload-nativedesktop +``` + ##### [Optional] Install LLVM for faster link times You may experience much faster builds on Windows by following these steps. (Related Rust issue: https://github.com/rust-lang/rust/issues/37543) diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 19d6db743e4..5c54860d9e3 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -288,7 +288,7 @@ impl BluetoothManager { self.adapter = BluetoothAdapter::init_mock().ok(); match test::test(self, data_set_name) { Ok(_) => return Ok(()), - Err(error) => Err(BluetoothError::Type(error.description().to_owned())), + Err(error) => Err(BluetoothError::Type(error.to_string())), } } diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs index bfc547f6b75..29fbaa2beeb 100644 --- a/components/devtools/protocol.rs +++ b/components/devtools/protocol.rs @@ -8,7 +8,6 @@ use serde::Serialize; use serde_json::{self, Value}; -use std::error::Error; use std::io::{Read, Write}; use std::net::TcpStream; @@ -62,7 +61,7 @@ impl JsonPacketStream for TcpStream { Ok(0) => return Ok(None), // EOF Ok(1) => buf[0], Ok(_) => unreachable!(), - Err(e) => return Err(e.description().to_owned()), + Err(e) => return Err(e.to_string()), }; match byte { b':' => { @@ -79,7 +78,7 @@ impl JsonPacketStream for TcpStream { debug!("{}", packet); return match serde_json::from_str(&packet) { Ok(json) => Ok(Some(json)), - Err(err) => Err(err.description().to_owned()), + Err(err) => Err(err.to_string()), }; }, c => buffer.push(c), diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 18e4e696f80..7868556adfe 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -44,7 +44,6 @@ use net_traits::{ use servo_arc::Arc; use servo_url::{ImmutableOrigin, ServoUrl}; use std::collections::{HashMap, HashSet}; -use std::error::Error; use std::iter::FromIterator; use std::mem; use std::ops::Deref; @@ -622,7 +621,7 @@ pub fn http_fetch( HeaderValue::to_str(v) .map(|l| { ServoUrl::parse_with_base(response.actual_response().url(), &l) - .map_err(|err| err.description().into()) + .map_err(|err| err.to_string()) }) .ok() }); diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index c948055bc55..f85d623fe4f 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -40,7 +40,6 @@ use servo_arc::Arc as ServoArc; use servo_url::ServoUrl; use std::borrow::{Cow, ToOwned}; use std::collections::HashMap; -use std::error::Error; use std::fs::{self, File}; use std::io::prelude::*; use std::ops::Deref; @@ -361,7 +360,7 @@ where let mut file = match File::open(&path) { Err(why) => { - warn!("couldn't open {}: {}", display, Error::description(&why)); + warn!("couldn't open {}: {}", display, why); return; }, Ok(file) => file, @@ -369,11 +368,7 @@ where let mut string_buffer: String = String::new(); match file.read_to_string(&mut string_buffer) { - Err(why) => panic!( - "couldn't read from {}: {}", - display, - Error::description(&why) - ), + Err(why) => panic!("couldn't read from {}: {}", display, why), Ok(_) => println!("successfully read from {}", display), } @@ -396,16 +391,12 @@ where let display = path.display(); let mut file = match File::create(&path) { - Err(why) => panic!("couldn't create {}: {}", display, Error::description(&why)), + Err(why) => panic!("couldn't create {}: {}", display, why), Ok(file) => file, }; match file.write_all(json_encoded.as_bytes()) { - Err(why) => panic!( - "couldn't write to {}: {}", - display, - Error::description(&why) - ), + Err(why) => panic!("couldn't write to {}: {}", display, why), Ok(_) => println!("successfully wrote to {}", display), } } diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index a25a804ce01..f7b291e420f 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -31,7 +31,6 @@ use ipc_channel::Error as IpcError; use mime::Mime; use msg::constellation_msg::HistoryStateId; use servo_url::ServoUrl; -use std::error::Error; use time::precise_time_ns; use webrender_api::ImageKey; @@ -699,11 +698,11 @@ pub enum NetworkError { impl NetworkError { pub fn from_hyper_error(error: &HyperError) -> Self { - NetworkError::Internal(error.description().to_owned()) + NetworkError::Internal(error.to_string()) } pub fn from_http_error(error: &HttpError) -> Self { - NetworkError::Internal(error.description().to_owned()) + NetworkError::Internal(error.to_string()) } } diff --git a/components/profile/heartbeats.rs b/components/profile/heartbeats.rs index ac29d12bbb3..5a09ea4f9e6 100644 --- a/components/profile/heartbeats.rs +++ b/components/profile/heartbeats.rs @@ -7,7 +7,6 @@ use heartbeats_simple::HeartbeatPow as Heartbeat; use profile_traits::time::ProfilerCategory; use std::collections::HashMap; use std::env::var_os; -use std::error::Error; use std::fs::File; use std::path::Path; @@ -85,7 +84,7 @@ fn open_heartbeat_log<P: AsRef<Path>>(name: P) -> Option<File> { match File::create(name) { Ok(f) => Some(f), Err(e) => { - warn!("Failed to open heartbeat log: {}", Error::description(&e)); + warn!("Failed to open heartbeat log: {}", e); None }, } @@ -138,7 +137,7 @@ fn maybe_create_heartbeat( fn log_heartbeat_records(hb: &mut Heartbeat) { match hb.log_to_buffer_index() { Ok(_) => (), - Err(e) => warn!("Failed to write heartbeat log: {}", Error::description(&e)), + Err(e) => warn!("Failed to write heartbeat log: {}", e), } } diff --git a/components/profile/time.rs b/components/profile/time.rs index 3dac5663799..cea75b54b44 100644 --- a/components/profile/time.rs +++ b/components/profile/time.rs @@ -19,7 +19,6 @@ use servo_config::opts::OutputOptions; use std::borrow::ToOwned; use std::cmp::Ordering; use std::collections::{BTreeMap, HashMap}; -use std::error::Error; use std::fs::File; use std::io::{self, Write}; use std::path::Path; @@ -397,11 +396,7 @@ impl Profiler { Some(OutputOptions::FileName(ref filename)) => { let path = Path::new(&filename); let mut file = match File::create(&path) { - Err(e) => panic!( - "Couldn't create {}: {}", - path.display(), - Error::description(&e) - ), + Err(e) => panic!("Couldn't create {}: {}", path.display(), e), Ok(file) => file, }; write!( diff --git a/components/script/dom/audiotrack.rs b/components/script/dom/audiotrack.rs index b66ea5bf4cc..af237bc8b1a 100644 --- a/components/script/dom/audiotrack.rs +++ b/components/script/dom/audiotrack.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::audiotracklist::AudioTrackList; +use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AudioTrackBinding::{self, AudioTrackMethods}; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; @@ -19,7 +20,7 @@ pub struct AudioTrack { label: DOMString, language: DOMString, enabled: Cell<bool>, - track_list: Option<Dom<AudioTrackList>>, + track_list: DomRefCell<Option<Dom<AudioTrackList>>>, } impl AudioTrack { @@ -37,7 +38,7 @@ impl AudioTrack { label: label.into(), language: language.into(), enabled: Cell::new(false), - track_list: track_list.map(|t| Dom::from_ref(t)), + track_list: DomRefCell::new(track_list.map(|t| Dom::from_ref(t))), } } @@ -73,6 +74,14 @@ impl AudioTrack { pub fn set_enabled(&self, value: bool) { self.enabled.set(value); } + + pub fn add_track_list(&self, track_list: &AudioTrackList) { + *self.track_list.borrow_mut() = Some(Dom::from_ref(track_list)); + } + + pub fn remove_track_list(&self) { + *self.track_list.borrow_mut() = None; + } } impl AudioTrackMethods for AudioTrack { @@ -103,7 +112,7 @@ impl AudioTrackMethods for AudioTrack { // https://html.spec.whatwg.org/multipage/#dom-audiotrack-enabled fn SetEnabled(&self, value: bool) { - if let Some(list) = self.track_list.as_ref() { + if let Some(list) = self.track_list.borrow().as_ref() { if let Some(idx) = list.find(self) { list.set_enabled(idx, value); } diff --git a/components/script/dom/audiotracklist.rs b/components/script/dom/audiotracklist.rs index e26f23cb2a8..5191221b7d9 100644 --- a/components/script/dom/audiotracklist.rs +++ b/components/script/dom/audiotracklist.rs @@ -104,9 +104,14 @@ impl AudioTrackList { pub fn add(&self, track: &AudioTrack) { self.tracks.borrow_mut().push(Dom::from_ref(track)); + track.add_track_list(self); } pub fn clear(&self) { + self.tracks + .borrow() + .iter() + .for_each(|t| t.remove_track_list()); self.tracks.borrow_mut().clear(); } } diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index dbeacdc7ebb..392cf49cce5 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -448,6 +448,17 @@ impl CustomElementRegistryMethods for CustomElementRegistry { // Step 6 promise } + /// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-upgrade + fn Upgrade(&self, node: &Node) { + // Spec says to make a list first and then iterate the list, but + // try-to-upgrade only queues upgrade reactions and doesn't itself + // modify the tree, so that's not an observable distinction. + node.traverse_preorder(ShadowIncluding::Yes).for_each(|n| { + if let Some(element) = n.downcast::<Element>() { + try_upgrade_element(element); + } + }); + } } #[derive(Clone, JSTraceable, MallocSizeOf)] diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 6f0e2620db4..572c18dc129 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -370,6 +370,8 @@ pub struct Document { page_showing: Cell<bool>, /// Whether the document is salvageable. salvageable: Cell<bool>, + /// Whether the document was aborted with an active parser + active_parser_was_aborted: Cell<bool>, /// Whether the unload event has already been fired. fired_unload: Cell<bool>, /// List of responsive images @@ -2264,6 +2266,7 @@ impl Document { // Step 3. if let Some(parser) = self.get_current_parser() { + self.active_parser_was_aborted.set(true); parser.abort(); self.salvageable.set(false); } @@ -2812,6 +2815,7 @@ impl Document { throw_on_dynamic_markup_insertion_counter: Cell::new(0), page_showing: Cell::new(false), salvageable: Cell::new(true), + active_parser_was_aborted: Cell::new(false), fired_unload: Cell::new(false), responsive_images: Default::default(), redirect_count: Cell::new(0), @@ -4458,18 +4462,25 @@ impl DocumentMethods for Document { return Ok(DomRoot::from_ref(self)); } + // Step 7 + if self.active_parser_was_aborted.get() { + return Ok(DomRoot::from_ref(self)); + } + // TODO: prompt to unload. // TODO: set unload_event_start and unload_event_end window_from_node(self).set_navigation_start(); - // Step 7 + // Step 8 // TODO: https://github.com/servo/servo/issues/21937 if self.has_browsing_context() { + // spec says "stop document loading", + // which is a process that does more than just abort self.abort(); } - // Step 8 + // Step 9 for node in self .upcast::<Node>() .traverse_preorder(ShadowIncluding::Yes) @@ -4477,16 +4488,16 @@ impl DocumentMethods for Document { node.upcast::<EventTarget>().remove_all_listeners(); } - // Step 9 + // Step 10 if self.window.Document() == DomRoot::from_ref(self) { self.window.upcast::<EventTarget>().remove_all_listeners(); } - // Step 10 + // Step 11 // TODO: https://github.com/servo/servo/issues/21936 Node::replace_all(None, self.upcast::<Node>()); - // Step 11 + // Step 12 if self.is_fully_active() { let mut new_url = entry_responsible_document.url(); if entry_responsible_document != DomRoot::from_ref(self) { @@ -4496,13 +4507,13 @@ impl DocumentMethods for Document { self.set_url(new_url); } - // Step 12 + // Step 13 // TODO: https://github.com/servo/servo/issues/21938 - // Step 13 + // Step 14 self.set_quirks_mode(QuirksMode::NoQuirks); - // Step 14 + // Step 15 let resource_threads = self .window .upcast::<GlobalScope>() @@ -4512,13 +4523,13 @@ impl DocumentMethods for Document { DocumentLoader::new_with_threads(resource_threads, Some(self.url())); ServoParser::parse_html_script_input(self, self.url()); - // Step 15 - self.ready_state.set(DocumentReadyState::Loading); - // Step 16 - // Handled when creating the parser in step 14 + self.ready_state.set(DocumentReadyState::Loading); // Step 17 + // Handled when creating the parser in step 15 + + // Step 18 Ok(DomRoot::from_ref(self)) } @@ -4550,8 +4561,8 @@ impl DocumentMethods for Document { return Err(Error::InvalidState); } - if !self.is_active() { - // Step 3. + // Step 3 - what specifies the is_active() part here? + if !self.is_active() || self.active_parser_was_aborted.get() { return Ok(()); } diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index 61c6fc1f98e..a75b0292d6f 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -100,10 +100,20 @@ impl HeadersMethods for Headers { combined_value.push(b','); } combined_value.extend(valid_value.iter().cloned()); - self.header_list.borrow_mut().insert( - HeaderName::from_str(&valid_name).unwrap(), - HeaderValue::from_bytes(&combined_value).unwrap(), - ); + match HeaderValue::from_bytes(&combined_value) { + Ok(value) => { + self.header_list + .borrow_mut() + .insert(HeaderName::from_str(&valid_name).unwrap(), value); + }, + Err(_) => { + // can't add the header, but we don't need to panic the browser over it + warn!( + "Servo thinks \"{:?}\" is a valid HTTP header value but HeaderValue doesn't.", + combined_value + ); + }, + }; Ok(()) } @@ -197,7 +207,7 @@ impl Headers { for (name, value) in h.header_list.borrow().iter() { self.Append( ByteString::new(Vec::from(name.as_str())), - ByteString::new(Vec::from(value.to_str().unwrap().as_bytes())), + ByteString::new(Vec::from(value.as_bytes())), )?; } Ok(()) @@ -267,13 +277,13 @@ impl Headers { .map_or(vec![], |v| v.as_bytes().to_owned()) } - pub fn sort_header_list(&self) -> Vec<(String, String)> { + pub fn sort_header_list(&self) -> Vec<(String, Vec<u8>)> { let borrowed_header_list = self.header_list.borrow(); let headers_iter = borrowed_header_list.iter(); let mut header_vec = vec![]; for (name, value) in headers_iter { let name = name.as_str().to_owned(); - let value = value.to_str().unwrap().to_owned(); + let value = value.as_bytes().to_vec(); let name_value = (name, value); header_vec.push(name_value); } @@ -293,7 +303,7 @@ impl Iterable for Headers { fn get_value_at_index(&self, n: u32) -> ByteString { let sorted_header_vec = self.sort_header_list(); let value = sorted_header_vec[n as usize].1.clone(); - ByteString::new(value.into_bytes().to_vec()) + ByteString::new(value) } fn get_key_at_index(&self, n: u32) -> ByteString { @@ -345,40 +355,19 @@ pub fn is_forbidden_header_name(name: &str) -> bool { } // There is some unresolved confusion over the definition of a name and a value. -// The fetch spec [1] defines a name as "a case-insensitive byte -// sequence that matches the field-name token production. The token -// productions are viewable in [2]." A field-name is defined as a -// token, which is defined in [3]. -// ISSUE 1: -// It defines a value as "a byte sequence that matches the field-content token production." -// To note, there is a difference between field-content and -// field-value (which is made up of field-content and obs-fold). The -// current definition does not allow for obs-fold (which are white -// space and newlines) in values. So perhaps a value should be defined -// as "a byte sequence that matches the field-value token production." -// However, this would then allow values made up entirely of white space and newlines. -// RELATED ISSUE 2: -// According to a previously filed Errata ID: 4189 in [4], "the -// specified field-value rule does not allow single field-vchar -// surrounded by whitespace anywhere". They provided a fix for the -// field-content production, but ISSUE 1 has still not been resolved. -// The production definitions likely need to be re-written. -// [1] https://fetch.spec.whatwg.org/#concept-header-value -// [2] https://tools.ietf.org/html/rfc7230#section-3.2 -// [3] https://tools.ietf.org/html/rfc7230#section-3.2.6 -// [4] https://www.rfc-editor.org/errata_search.php?rfc=7230 // -// As of December 2019 WHATWG, isn't even using grammar productions for value; +// As of December 2019, WHATWG has no formal grammar production for value; // https://fetch.spec.whatg.org/#concept-header-value just says not to have -// newlines, nulls, or leading/trailing whitespace. +// newlines, nulls, or leading/trailing whitespace. It even allows +// octets that aren't a valid UTF-8 encoding, and WPT tests reflect this. +// The HeaderValue class does not fully reflect this, so headers +// containing bytes with values 1..31 or 127 can't be created, failing +// WPT tests but probably not affecting anything important on the real Internet. fn validate_name_and_value(name: ByteString, value: ByteString) -> Fallible<(String, Vec<u8>)> { let valid_name = validate_name(name)?; - - // this is probably out of date - if !is_field_content(&value) { - return Err(Error::Type("Value is not valid".to_string())); + if !is_legal_header_value(&value) { + return Err(Error::Type("Header value is not valid".to_string())); } - Ok((valid_name, value.into())) } @@ -431,47 +420,40 @@ fn is_field_name(name: &ByteString) -> bool { is_token(&*name) } -// https://tools.ietf.org/html/rfc7230#section-3.2 -// http://www.rfc-editor.org/errata_search.php?rfc=7230 -// Errata ID: 4189 -// field-content = field-vchar [ 1*( SP / HTAB / field-vchar ) -// field-vchar ] -fn is_field_content(value: &ByteString) -> bool { +// https://fetch.spec.whatg.org/#concept-header-value +fn is_legal_header_value(value: &ByteString) -> bool { let value_len = value.len(); - if value_len == 0 { - return false; - } - if !is_field_vchar(value[0]) { - return false; - } - - if value_len > 2 { - for &ch in &value[1..value_len - 1] { - if !is_field_vchar(ch) && !is_space(ch) && !is_htab(ch) { - return false; - } + return true; + } + match value[0] { + b' ' | b'\t' => return false, + _ => {}, + }; + match value[value_len - 1] { + b' ' | b'\t' => return false, + _ => {}, + }; + for &ch in &value[..] { + match ch { + b'\0' | b'\n' | b'\r' => return false, + _ => {}, } } - - if !is_field_vchar(value[value_len - 1]) { - return false; - } - - return true; -} - -fn is_space(x: u8) -> bool { - x == b' ' -} - -fn is_htab(x: u8) -> bool { - x == b'\t' -} - -// https://tools.ietf.org/html/rfc7230#section-3.2 -fn is_field_vchar(x: u8) -> bool { - is_vchar(x) || is_obs_text(x) + true + // If accepting non-UTF8 header values causes breakage, + // removing the above "true" and uncommenting the below code + // would ameliorate it while still accepting most reasonable headers: + //match str::from_utf8(value) { + // Ok(_) => true, + // Err(_) => { + // warn!( + // "Rejecting spec-legal but non-UTF8 header value: {:?}", + // value + // ); + // false + // }, + // } } // https://tools.ietf.org/html/rfc5234#appendix-B.1 diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 1406ceb870b..6a60a88b25c 100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -34,7 +34,6 @@ enum ButtonType { Submit, Reset, Button, - Menu, } #[dom_struct] @@ -97,7 +96,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement { } // https://html.spec.whatwg.org/multipage/#dom-button-type - make_enumerated_getter!(Type, "type", "submit", "reset" | "button" | "menu"); + make_enumerated_getter!(Type, "type", "submit", "reset" | "button"); // https://html.spec.whatwg.org/multipage/#dom-button-type make_setter!(SetType, "type"); @@ -216,7 +215,6 @@ impl VirtualMethods for HTMLButtonElement { let value = match &**attr.value() { "reset" => ButtonType::Reset, "button" => ButtonType::Button, - "menu" => ButtonType::Menu, _ => ButtonType::Submit, }; self.button_type.set(value); diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 9018f05813a..962ccc8161f 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -35,7 +35,7 @@ use crate::dom::htmlformelement::{ResetFrom, SubmittedFrom}; use crate::dom::keyboardevent::KeyboardEvent; use crate::dom::mouseevent::MouseEvent; use crate::dom::node::{document_from_node, window_from_node}; -use crate::dom::node::{BindContext, Node, NodeDamage, UnbindContext}; +use crate::dom::node::{BindContext, CloneChildrenFlag, Node, NodeDamage, UnbindContext}; use crate::dom::nodelist::NodeList; use crate::dom::textcontrol::{TextControlElement, TextControlSelection}; use crate::dom::validation::Validatable; @@ -46,7 +46,6 @@ use crate::textinput::KeyReaction::{ }; use crate::textinput::Lines::Single; use crate::textinput::{Direction, SelectionDirection, TextInput, UTF16CodeUnits, UTF8Bytes}; -use caseless::compatibility_caseless_match_str; use dom_struct::dom_struct; use embedder_traits::FilterPattern; use encoding_rs::Encoding; @@ -917,7 +916,7 @@ fn in_same_group( // TODO Both a and b are in the same home subtree. other.form_owner().as_deref() == owner && match (other.radio_group_name(), group) { - (Some(ref s1), Some(s2)) => compatibility_caseless_match_str(s1, s2) && s2 != &atom!(""), + (Some(ref s1), Some(s2)) => s1 == s2 && s2 != &atom!(""), _ => false } } @@ -1659,6 +1658,26 @@ impl VirtualMethods for HTMLInputElement { } } } + + // https://html.spec.whatwg.org/multipage/#the-input-element%3Aconcept-node-clone-ext + fn cloning_steps( + &self, + copy: &Node, + maybe_doc: Option<&Document>, + clone_children: CloneChildrenFlag, + ) { + if let Some(ref s) = self.super_type() { + s.cloning_steps(copy, maybe_doc, clone_children); + } + let elem = copy.downcast::<HTMLInputElement>().unwrap(); + elem.value_dirty.set(self.value_dirty.get()); + elem.checked_changed.set(self.checked_changed.get()); + elem.upcast::<Element>() + .set_state(ElementState::IN_CHECKED_STATE, self.Checked()); + elem.textinput + .borrow_mut() + .set_content(self.textinput.borrow().get_content()); + } } impl FormControl for HTMLInputElement { diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 91acd4b97e7..cb93a77a90d 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -2362,6 +2362,7 @@ impl HTMLMediaElementMethods for HTMLMediaElement { label, language, TextTrackMode::Hidden, + None, ); // Step 3 & 4 self.TextTracks().add(&track); diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index 3893aea95ab..4ebb2860a79 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -8,12 +8,14 @@ use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods; use crate::dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementBinding::HTMLSelectElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; +use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; +use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::characterdata::CharacterData; use crate::dom::document::Document; -use crate::dom::element::{AttributeMutation, Element}; +use crate::dom::element::{AttributeMutation, CustomElementCreationMode, Element, ElementCreator}; use crate::dom::htmlelement::HTMLElement; use crate::dom::htmlformelement::HTMLFormElement; use crate::dom::htmloptgroupelement::HTMLOptGroupElement; @@ -22,8 +24,9 @@ use crate::dom::htmlselectelement::HTMLSelectElement; use crate::dom::node::{BindContext, Node, ShadowIncluding, UnbindContext}; use crate::dom::text::Text; use crate::dom::virtualmethods::VirtualMethods; +use crate::dom::window::Window; use dom_struct::dom_struct; -use html5ever::{LocalName, Prefix}; +use html5ever::{LocalName, Prefix, QualName}; use std::cell::Cell; use style::element_state::ElementState; use style::str::{split_html_space_chars, str_join}; @@ -72,6 +75,37 @@ impl HTMLOptionElement { ) } + // https://html.spec.whatwg.org/multipage/#dom-option + pub fn Option( + window: &Window, + text: DOMString, + value: Option<DOMString>, + default_selected: bool, + selected: bool, + ) -> Fallible<DomRoot<HTMLOptionElement>> { + let element = Element::create( + QualName::new(None, ns!(html), local_name!("option")), + None, + &window.Document(), + ElementCreator::ScriptCreated, + CustomElementCreationMode::Synchronous, + ); + + let option = DomRoot::downcast::<HTMLOptionElement>(element).unwrap(); + + if !text.is_empty() { + option.upcast::<Node>().SetTextContent(Some(text)) + } + + if let Some(val) = value { + option.SetValue(val) + } + + option.SetDefaultSelected(default_selected); + option.set_selectedness(selected); + Ok(option) + } + pub fn set_selectedness(&self, selected: bool) { self.selectedness.set(selected); } diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs index caa8932b415..c67701b3894 100644 --- a/components/script/dom/htmltrackelement.rs +++ b/components/script/dom/htmltrackelement.rs @@ -59,6 +59,7 @@ impl HTMLTrackElement { Default::default(), Default::default(), Default::default(), + None, ); Node::reflect_node( Box::new(HTMLTrackElement::new_inherited( diff --git a/components/script/dom/texttrack.rs b/components/script/dom/texttrack.rs index 88c4859e05e..7c2b54adcd9 100644 --- a/components/script/dom/texttrack.rs +++ b/components/script/dom/texttrack.rs @@ -2,16 +2,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::TextTrackBinding::{ self, TextTrackKind, TextTrackMethods, TextTrackMode, }; use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; -use crate::dom::bindings::root::{DomRoot, MutNullableDom}; +use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::eventtarget::EventTarget; use crate::dom::texttrackcue::TextTrackCue; use crate::dom::texttrackcuelist::TextTrackCueList; +use crate::dom::texttracklist::TextTrackList; use crate::dom::window::Window; use dom_struct::dom_struct; use std::cell::Cell; @@ -25,6 +27,7 @@ pub struct TextTrack { id: String, mode: Cell<TextTrackMode>, cue_list: MutNullableDom<TextTrackCueList>, + track_list: DomRefCell<Option<Dom<TextTrackList>>>, } impl TextTrack { @@ -34,6 +37,7 @@ impl TextTrack { label: DOMString, language: DOMString, mode: TextTrackMode, + track_list: Option<&TextTrackList>, ) -> TextTrack { TextTrack { eventtarget: EventTarget::new_inherited(), @@ -43,6 +47,7 @@ impl TextTrack { id: id.into(), mode: Cell::new(mode), cue_list: Default::default(), + track_list: DomRefCell::new(track_list.map(|t| Dom::from_ref(t))), } } @@ -53,9 +58,12 @@ impl TextTrack { label: DOMString, language: DOMString, mode: TextTrackMode, + track_list: Option<&TextTrackList>, ) -> DomRoot<TextTrack> { reflect_dom_object( - Box::new(TextTrack::new_inherited(id, kind, label, language, mode)), + Box::new(TextTrack::new_inherited( + id, kind, label, language, mode, track_list, + )), window, TextTrackBinding::Wrap, ) @@ -69,6 +77,14 @@ impl TextTrack { pub fn id(&self) -> &str { &self.id } + + pub fn add_track_list(&self, track_list: &TextTrackList) { + *self.track_list.borrow_mut() = Some(Dom::from_ref(track_list)); + } + + pub fn remove_track_list(&self) { + *self.track_list.borrow_mut() = None; + } } impl TextTrackMethods for TextTrack { diff --git a/components/script/dom/texttracklist.rs b/components/script/dom/texttracklist.rs index f6f9037902e..0e978972d69 100644 --- a/components/script/dom/texttracklist.rs +++ b/components/script/dom/texttracklist.rs @@ -94,6 +94,7 @@ impl TextTrackList { }), &canceller, ); + track.add_track_list(self); } } @@ -101,6 +102,9 @@ impl TextTrackList { // removed from the TextTrackList. #[allow(dead_code)] pub fn remove(&self, idx: usize) { + if let Some(track) = self.dom_tracks.borrow().get(idx) { + track.remove_track_list(); + } self.dom_tracks.borrow_mut().remove(idx); self.upcast::<EventTarget>() .fire_event(atom!("removetrack")); diff --git a/components/script/dom/videotrack.rs b/components/script/dom/videotrack.rs index b1453da0df4..18a383ab816 100644 --- a/components/script/dom/videotrack.rs +++ b/components/script/dom/videotrack.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::VideoTrackBinding::{self, VideoTrackMethods}; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; @@ -19,7 +20,7 @@ pub struct VideoTrack { label: DOMString, language: DOMString, selected: Cell<bool>, - track_list: Option<Dom<VideoTrackList>>, + track_list: DomRefCell<Option<Dom<VideoTrackList>>>, } impl VideoTrack { @@ -37,7 +38,7 @@ impl VideoTrack { label: label.into(), language: language.into(), selected: Cell::new(false), - track_list: track_list.map(|t| Dom::from_ref(t)), + track_list: DomRefCell::new(track_list.map(|t| Dom::from_ref(t))), } } @@ -73,6 +74,14 @@ impl VideoTrack { pub fn set_selected(&self, value: bool) { self.selected.set(value); } + + pub fn add_track_list(&self, track_list: &VideoTrackList) { + *self.track_list.borrow_mut() = Some(Dom::from_ref(track_list)); + } + + pub fn remove_track_list(&self) { + *self.track_list.borrow_mut() = None; + } } impl VideoTrackMethods for VideoTrack { @@ -103,7 +112,7 @@ impl VideoTrackMethods for VideoTrack { // https://html.spec.whatwg.org/multipage/#dom-videotrack-selected fn SetSelected(&self, value: bool) { - if let Some(list) = self.track_list.as_ref() { + if let Some(list) = self.track_list.borrow().as_ref() { if let Some(idx) = list.find(self) { list.set_selected(idx, value); } diff --git a/components/script/dom/videotracklist.rs b/components/script/dom/videotracklist.rs index 9654123d3f3..98fa495bfdd 100644 --- a/components/script/dom/videotracklist.rs +++ b/components/script/dom/videotracklist.rs @@ -113,9 +113,14 @@ impl VideoTrackList { self.set_selected(idx, false); } } + track.add_track_list(self); } pub fn clear(&self) { + self.tracks + .borrow() + .iter() + .for_each(|t| t.remove_track_list()); self.tracks.borrow_mut().clear(); } } diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index fc5919132cf..54643e7a2da 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -47,10 +47,12 @@ pub enum TexImageValidationError { InvalidOffsets, } -impl std::error::Error for TexImageValidationError { - fn description(&self) -> &str { +impl std::error::Error for TexImageValidationError {} + +impl fmt::Display for TexImageValidationError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use self::TexImageValidationError::*; - match *self { + let description = match *self { InvalidTextureTarget(_) => "Invalid texture target", TextureTargetNotBound(_) => "Texture was not bound", InvalidCubicTextureDimensions => { @@ -68,17 +70,8 @@ impl std::error::Error for TexImageValidationError { NonPotTexture => "Expected a power of two texture", InvalidCompressionFormat => "Unrecognized texture compression format", InvalidOffsets => "Invalid X/Y texture offset parameters", - } - } -} - -impl fmt::Display for TexImageValidationError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "TexImageValidationError({})", - std::error::Error::description(self) - ) + }; + write!(f, "TexImageValidationError({})", description) } } diff --git a/components/script/dom/webidls/CustomElementRegistry.webidl b/components/script/dom/webidls/CustomElementRegistry.webidl index 6d3a7b436de..3ba49a2082c 100644 --- a/components/script/dom/webidls/CustomElementRegistry.webidl +++ b/components/script/dom/webidls/CustomElementRegistry.webidl @@ -11,6 +11,8 @@ interface CustomElementRegistry { any get(DOMString name); Promise<void> whenDefined(DOMString name); + + [CEReactions] void upgrade(Node root); }; callback CustomElementConstructor = HTMLElement(); diff --git a/components/script/dom/webidls/HTMLOptionElement.webidl b/components/script/dom/webidls/HTMLOptionElement.webidl index 56a379fc8db..65f37458295 100644 --- a/components/script/dom/webidls/HTMLOptionElement.webidl +++ b/components/script/dom/webidls/HTMLOptionElement.webidl @@ -3,9 +3,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://html.spec.whatwg.org/multipage/#htmloptionelement -[Exposed=Window/*, NamedConstructor=Option(optional DOMString text = "", optional DOMString value, +[Exposed=Window, NamedConstructor=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, - optional boolean selected = false)*/] + optional boolean selected = false)] interface HTMLOptionElement : HTMLElement { [HTMLConstructor] constructor(); diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index aa4ea4026b0..6935c84d7bb 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -659655,7 +659655,7 @@ "testharness" ], "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html": [ - "5b155c1047da85d2bd8301effaa3ef9d9096b0ad", + "3000032978082356086930b2b5bee96b73947dc8", "testharness" ], "html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-dim-ref.html": [ diff --git a/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-handleEvent.html.ini b/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-handleEvent.html.ini index 9997350495a..7bc6ba992af 100644 --- a/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-handleEvent.html.ini +++ b/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-handleEvent.html.ini @@ -9,3 +9,6 @@ [throws if handleEvent is thruthy and not callable] expected: NOTRUN + [looks up handleEvent method on every event dispatch] + expected: FAIL + diff --git a/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini b/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini index c884dc82eab..628b1fab770 100644 --- a/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini +++ b/tests/wpt/metadata/css/cssom-view/MediaQueryList-addListener-removeListener.html.ini @@ -2,6 +2,3 @@ [listeners are called when <iframe> is resized] expected: FAIL - [listeners are called correct number of times] - expected: FAIL - diff --git a/tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini b/tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini new file mode 100644 index 00000000000..e38782d8c85 --- /dev/null +++ b/tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini @@ -0,0 +1,4 @@ +[elementFromPoint-001.html] + [CSSOM View - 5 - extensions to the Document interface] + expected: FAIL + diff --git a/tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini b/tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini new file mode 100644 index 00000000000..e181af5397f --- /dev/null +++ b/tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini @@ -0,0 +1,4 @@ +[elementsFromPoint-invalid-cases.html] + [The root element is the last element returned for otherwise empty queries within the viewport] + expected: FAIL + diff --git a/tests/wpt/metadata/custom-elements/custom-element-registry/upgrade.html.ini b/tests/wpt/metadata/custom-elements/custom-element-registry/upgrade.html.ini index 3c538145973..f38f6bafb44 100644 --- a/tests/wpt/metadata/custom-elements/custom-element-registry/upgrade.html.ini +++ b/tests/wpt/metadata/custom-elements/custom-element-registry/upgrade.html.ini @@ -1,16 +1,4 @@ [upgrade.html] - [Upgrading an element directly (example from the spec)] - expected: FAIL - - [Two elements as children of the upgraded node] - expected: FAIL - - [Two elements as descendants of the upgraded node] - expected: FAIL - [Two elements as shadow-including descendants (and not descendants) of the upgraded node] expected: FAIL - [Elements inside a template contents DocumentFragment node] - expected: FAIL - diff --git a/tests/wpt/metadata/fetch/api/basic/request-forbidden-headers.any.js.ini b/tests/wpt/metadata/fetch/api/basic/request-forbidden-headers.any.js.ini deleted file mode 100644 index 05bb2f4b081..00000000000 --- a/tests/wpt/metadata/fetch/api/basic/request-forbidden-headers.any.js.ini +++ /dev/null @@ -1,23 +0,0 @@ -[request-forbidden-headers.any.html] - type: testharness - [Accept-Encoding is a forbidden request header] - expected: FAIL - - [Access-Control-Request-Headers is a forbidden request header] - expected: FAIL - - [Access-Control-Request-Method is a forbidden request header] - expected: FAIL - - -[request-forbidden-headers.any.worker.html] - type: testharness - [Accept-Encoding is a forbidden request header] - expected: FAIL - - [Access-Control-Request-Headers is a forbidden request header] - expected: FAIL - - [Access-Control-Request-Method is a forbidden request header] - expected: FAIL - diff --git a/tests/wpt/metadata/fetch/api/headers/header-values-normalize.html.ini b/tests/wpt/metadata/fetch/api/headers/header-values-normalize.html.ini index d366c5a617b..c196a28ec0f 100644 --- a/tests/wpt/metadata/fetch/api/headers/header-values-normalize.html.ini +++ b/tests/wpt/metadata/fetch/api/headers/header-values-normalize.html.ini @@ -48,15 +48,6 @@ [fetch() with value %08] expected: FAIL - [fetch() with value %09] - expected: FAIL - - [fetch() with value %0A] - expected: FAIL - - [fetch() with value %0D] - expected: FAIL - [XMLHttpRequest with value %0E] expected: FAIL @@ -164,7 +155,3 @@ [fetch() with value %1F] expected: FAIL - - [fetch() with value %20] - expected: FAIL - diff --git a/tests/wpt/metadata/fetch/api/headers/headers-no-cors.window.js.ini b/tests/wpt/metadata/fetch/api/headers/headers-no-cors.window.js.ini index 64af50663e8..cd59efee25a 100644 --- a/tests/wpt/metadata/fetch/api/headers/headers-no-cors.window.js.ini +++ b/tests/wpt/metadata/fetch/api/headers/headers-no-cors.window.js.ini @@ -1,10 +1,4 @@ [headers-no-cors.window.html] - ["no-cors" Headers object cannot have accept-language/\x01 as header] - expected: FAIL - - ["no-cors" Headers object cannot have content-language/\x01 as header] - expected: FAIL - ["no-cors" Headers object cannot have content-type set to text/plain;ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, text/plain] expected: FAIL diff --git a/tests/wpt/metadata/fetch/api/request/request-headers.html.ini b/tests/wpt/metadata/fetch/api/request/request-headers.html.ini deleted file mode 100644 index 58f805ae0c8..00000000000 --- a/tests/wpt/metadata/fetch/api/request/request-headers.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[request-headers.html] - type: testharness - [Testing empty Request Content-Type header] - expected: FAIL - diff --git a/tests/wpt/metadata/fetch/api/response/response-init-002.html.ini b/tests/wpt/metadata/fetch/api/response/response-init-002.html.ini index d5d77c14514..3340acba7e7 100644 --- a/tests/wpt/metadata/fetch/api/response/response-init-002.html.ini +++ b/tests/wpt/metadata/fetch/api/response/response-init-002.html.ini @@ -3,9 +3,6 @@ [Read Response's body as readableStream] expected: FAIL - [Testing empty Response Content-Type header] - expected: FAIL - [Testing null Response body] expected: FAIL diff --git a/tests/wpt/metadata/fetch/content-type/response.window.js.ini b/tests/wpt/metadata/fetch/content-type/response.window.js.ini index b497c77e771..1fb9808a893 100644 --- a/tests/wpt/metadata/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata/fetch/content-type/response.window.js.ini @@ -321,9 +321,6 @@ [<iframe>: separate response Content-Type: text/html */*] expected: FAIL - [<iframe>: separate response Content-Type: text/html;x=" text/plain] - expected: FAIL - [<iframe>: combined response Content-Type: text/html;x=" text/plain] expected: FAIL diff --git a/tests/wpt/metadata/fetch/content-type/script.window.js.ini b/tests/wpt/metadata/fetch/content-type/script.window.js.ini index e67f0406fc3..d2df9b78483 100644 --- a/tests/wpt/metadata/fetch/content-type/script.window.js.ini +++ b/tests/wpt/metadata/fetch/content-type/script.window.js.ini @@ -53,3 +53,6 @@ [combined text/javascript ] expected: FAIL + [separate text/javascript x/x] + expected: FAIL + diff --git a/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini b/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini index b7052af5b5c..d4ba399b762 100644 --- a/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini +++ b/tests/wpt/metadata/fetch/nosniff/parsing-nosniff.window.js.ini @@ -11,6 +11,6 @@ [X-Content-Type-Options%3A%20nosniff%0C] expected: FAIL - [X-Content-Type-Options%3A%0D%0AX-Content-Type-Options%3A%20nosniff] + [X-Content-Type-Options%3A%20'NosniFF'] expected: FAIL diff --git a/tests/wpt/metadata/fetch/security/embedded-credentials.tentative.sub.html.ini b/tests/wpt/metadata/fetch/security/embedded-credentials.tentative.sub.html.ini index 80ebd73cb00..c6486926191 100644 --- a/tests/wpt/metadata/fetch/security/embedded-credentials.tentative.sub.html.ini +++ b/tests/wpt/metadata/fetch/security/embedded-credentials.tentative.sub.html.ini @@ -5,7 +5,7 @@ expected: FAIL [Embedded credentials are treated as network errors in frames.] - expected: FAIL + expected: TIMEOUT [Embedded credentials are treated as network errors in new windows.] expected: TIMEOUT @@ -13,9 +13,6 @@ [Embedded credentials matching the top-level are treated as network errors for cross-origin URLs.] expected: TIMEOUT - [Embedded credentials matching the top-level are not treated as network errors for same-origin URLs.] - expected: TIMEOUT - [Embedded credentials matching the top-level are not treated as network errors for relative URLs.] expected: TIMEOUT diff --git a/tests/wpt/metadata/html/dom/idlharness.https.html.ini b/tests/wpt/metadata/html/dom/idlharness.https.html.ini index c026f0614c0..dfd89a10358 100644 --- a/tests/wpt/metadata/html/dom/idlharness.https.html.ini +++ b/tests/wpt/metadata/html/dom/idlharness.https.html.ini @@ -62,9 +62,6 @@ [CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getTransform()" with the proper type] expected: FAIL - [CustomElementRegistry interface: operation upgrade(Node)] - expected: FAIL - [OffscreenCanvasRenderingContext2D interface: attribute imageSmoothingEnabled] expected: FAIL @@ -2106,9 +2103,6 @@ [HTMLSelectElement interface: attribute willValidate] expected: FAIL - [HTMLOptionElement interface: named constructor] - expected: FAIL - [HTMLMarqueeElement interface: attribute hspace] expected: FAIL @@ -2253,9 +2247,6 @@ [HTMLInputElement interface: createInput("url") must inherit property "checkValidity()" with the proper type] expected: FAIL - [HTMLOptionElement interface: named constructor prototype property] - expected: FAIL - [HTMLInputElement interface: createInput("week") must inherit property "validationMessage" with the proper type] expected: FAIL @@ -3147,9 +3138,6 @@ [HTMLInputElement interface: calling stepDown(long) on createInput("password") with too few arguments must throw TypeError] expected: FAIL - [HTMLOptionElement interface: named constructor object] - expected: FAIL - [HTMLFrameElement interface: document.createElement("frame") must inherit property "frameBorder" with the proper type] expected: FAIL @@ -3261,9 +3249,6 @@ [HTMLMarqueeElement interface: attribute bgColor] expected: FAIL - [Stringification of new Option()] - expected: FAIL - [HTMLInputElement interface: createInput("file") must inherit property "width" with the proper type] expected: FAIL @@ -3309,9 +3294,6 @@ [HTMLAreaElement interface: document.createElement("area") must inherit property "coords" with the proper type] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "label" with the proper type] - expected: FAIL - [HTMLTableCellElement interface: document.createElement("th") must inherit property "chOff" with the proper type] expected: FAIL @@ -3348,9 +3330,6 @@ [HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "scrollAmount" with the proper type] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "form" with the proper type] - expected: FAIL - [HTMLInputElement interface: createInput("datetime-local") must inherit property "reportValidity()" with the proper type] expected: FAIL @@ -3441,9 +3420,6 @@ [HTMLSelectElement interface: operation setCustomValidity(DOMString)] expected: FAIL - [HTMLOptionElement interface: named constructor name] - expected: FAIL - [HTMLVideoElement interface: document.createElement("video") must inherit property "height" with the proper type] expected: FAIL @@ -3456,9 +3432,6 @@ [HTMLTableElement interface: attribute rules] expected: FAIL - [HTMLOptionElement interface: named constructor length] - expected: FAIL - [HTMLInputElement interface: createInput("email") must inherit property "stepUp(long)" with the proper type] expected: FAIL @@ -3744,9 +3717,6 @@ [HTMLInputElement interface: document.createElement("input") must inherit property "valueAsNumber" with the proper type] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "disabled" with the proper type] - expected: FAIL - [HTMLFieldSetElement interface: attribute name] expected: FAIL @@ -3963,9 +3933,6 @@ [HTMLAreaElement interface: attribute noHref] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "value" with the proper type] - expected: FAIL - [HTMLInputElement interface: createInput("number") must inherit property "valueAsNumber" with the proper type] expected: FAIL @@ -4182,9 +4149,6 @@ [HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "trueSpeed" with the proper type] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "selected" with the proper type] - expected: FAIL - [HTMLElement interface: attribute contentEditable] expected: FAIL @@ -4290,9 +4254,6 @@ [HTMLFormElement interface: document.createElement("form") must inherit property "rel" with the proper type] expected: FAIL - [HTMLOptionElement must be primary interface of new Option()] - expected: FAIL - [HTMLIFrameElement interface: attribute allowPaymentRequest] expected: FAIL @@ -4350,9 +4311,6 @@ [HTMLBodyElement interface: document.createElement("body") must inherit property "vLink" with the proper type] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "text" with the proper type] - expected: FAIL - [HTMLMediaElement interface: new Audio() must inherit property "seekable" with the proper type] expected: FAIL @@ -4521,9 +4479,6 @@ [HTMLMediaElement interface: operation getStartDate()] expected: FAIL - [HTMLOptionElement interface: new Option() must inherit property "defaultSelected" with the proper type] - expected: FAIL - [HTMLInputElement interface: createInput("email") must inherit property "list" with the proper type] expected: FAIL @@ -5028,3 +4983,6 @@ [SVGAElement includes HTMLHyperlinkElementUtils: member names are unique] expected: FAIL + [HTMLOptionElement interface: named constructor without 'new'] + expected: FAIL + diff --git a/tests/wpt/metadata/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html.ini b/tests/wpt/metadata/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html.ini deleted file mode 100644 index 76dbb504708..00000000000 --- a/tests/wpt/metadata/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[htmloptionscollection.html] - type: testharness - [HTMLOptionsCollection.add method insert HTMLOptionElement Option element] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html.ini index e440b1e38c6..dc856a3d5a3 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html.ini @@ -1,6 +1,5 @@ [iframe_sandbox_popups_nonescaping-3.html] type: testharness - expected: TIMEOUT [Check that popups from a sandboxed iframe do not escape the sandbox] - expected: NOTRUN + expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-checkValidity.html.ini b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-checkValidity.html.ini index b83b69dd2bc..ee0eac0e9a4 100644 --- a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-checkValidity.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-checkValidity.html.ini @@ -1,6 +1,5 @@ [form-validation-checkValidity.html] type: testharness - expected: ERROR [[INPUT in TEXT status\] no constraint] expected: FAIL @@ -427,3 +426,27 @@ [[INPUT in EMAIL status\] not suffering from being too long (in a form)] expected: FAIL + [[select\] no constraint (in a form)] + expected: FAIL + + [[select\] suffering from being missing (in a form)] + expected: FAIL + + [[textarea\] suffering from being missing (in a form)] + expected: FAIL + + [[select\] no constraint] + expected: FAIL + + [[select\] suffering from being missing] + expected: FAIL + + [[textarea\] no constraint] + expected: FAIL + + [[textarea\] suffering from being missing] + expected: FAIL + + [[textarea\] no constraint (in a form)] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-reportValidity.html.ini b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-reportValidity.html.ini index 4dbcff22c2c..d8114fa0ed1 100644 --- a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-reportValidity.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-reportValidity.html.ini @@ -1,6 +1,5 @@ [form-validation-reportValidity.html] type: testharness - expected: ERROR [[INPUT in TEXT status\] no constraint] expected: FAIL @@ -433,3 +432,27 @@ [[INPUT in EMAIL status\] not suffering from being too long (in a form)] expected: FAIL + [[select\] no constraint (in a form)] + expected: FAIL + + [[select\] suffering from being missing (in a form)] + expected: FAIL + + [[textarea\] suffering from being missing (in a form)] + expected: FAIL + + [[select\] no constraint] + expected: FAIL + + [[select\] suffering from being missing] + expected: FAIL + + [[textarea\] no constraint] + expected: FAIL + + [[textarea\] suffering from being missing] + expected: FAIL + + [[textarea\] no constraint (in a form)] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-customError.html.ini b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-customError.html.ini index e9618f1c032..25ad3f2bd44 100644 --- a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-customError.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-customError.html.ini @@ -1,6 +1,5 @@ [form-validation-validity-customError.html] type: testharness - expected: ERROR [[input\] The validity.customError must be true if the custom validity error message is not empty] expected: FAIL @@ -13,3 +12,15 @@ [[button\] The validity.customError must be false if the custom validity error message is empty] expected: FAIL + [[select\] The validity.customError must be false i the custom validity error message is empty] + expected: FAIL + + [[select\] The validity.customError must be true if the custom validity error message is not empty] + expected: FAIL + + [[textarea\] The validity.customError must be false if the custom validity error message is empty] + expected: FAIL + + [[textarea\] The validity.customError must be true if the custom validity error message is not empty] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valid.html.ini b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valid.html.ini index 3f11b627f2a..9fb1fc2bf7a 100644 --- a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valid.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valid.html.ini @@ -1,6 +1,5 @@ [form-validation-validity-valid.html] type: testharness - expected: ERROR [[INPUT in TEXT status\] validity.valid must be false if validity.tooLong is true] expected: FAIL @@ -154,3 +153,6 @@ [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.valueMissing is true] expected: FAIL + [[textarea\] validity.valid must be false if validity.valueMissing is true] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini index de840378f42..f6390136918 100644 --- a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini @@ -1,6 +1,5 @@ [form-validation-validity-valueMissing.html] type: testharness - expected: ERROR [[INPUT in TEXT status\] The required attribute is not set] expected: FAIL @@ -304,3 +303,15 @@ [[INPUT in DATETIME-LOCAL status\] The value attribute is empty string] expected: FAIL + [[textarea\] The value is not empty] + expected: FAIL + + [[textarea\] The value is empty] + expected: FAIL + + [[textarea\] The required attribute is not set] + expected: FAIL + + [[select\] Selected the option with value equals to empty] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-willValidate.html.ini b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-willValidate.html.ini index 599a5aeb57c..3823eb5fe6a 100644 --- a/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-willValidate.html.ini +++ b/tests/wpt/metadata/html/semantics/forms/constraints/form-validation-willValidate.html.ini @@ -1,6 +1,5 @@ [form-validation-willValidate.html] type: testharness - expected: ERROR [[INPUT in HIDDEN status\] Must be barred from the constraint validation] expected: FAIL @@ -268,3 +267,21 @@ [[output\] The willValidate attribute must be false since OUTPUT is not a submittable element] expected: FAIL + [[textarea\] Must be barred from the constraint validation] + expected: FAIL + + [[textarea\] The willValidate attribute must be false if it has a datalist ancestor] + expected: FAIL + + [[textarea\] The willValidate attribute must be true if an element is mutable] + expected: FAIL + + [[select\] The willValidate attribute must be false if it has a datalist ancestor] + expected: FAIL + + [[select\] The willValidate attribute must be true if an element is mutable] + expected: FAIL + + [[select\] Must be barred from the constraint validation] + expected: FAIL + diff --git a/tests/wpt/metadata/html/semantics/forms/the-button-element/button-menu-historical.html.ini b/tests/wpt/metadata/html/semantics/forms/the-button-element/button-menu-historical.html.ini deleted file mode 100644 index b548f3cb3ed..00000000000 --- a/tests/wpt/metadata/html/semantics/forms/the-button-element/button-menu-historical.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[button-menu-historical.html] - type: testharness - [button.type reflects properly] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/clone.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/clone.html.ini deleted file mode 100644 index 04df058a43f..00000000000 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/clone.html.ini +++ /dev/null @@ -1,56 +0,0 @@ -[clone.html] - type: testharness - [Checkbox must retain checked state.] - expected: FAIL - - [Checkbox must retain unchecked state.] - expected: FAIL - - [Radiobutton must retain checked state.] - expected: FAIL - - [Radiobutton must retain unchecked state.] - expected: FAIL - - [Text field must retain changed value.] - expected: FAIL - - [Search field must retain changed value.] - expected: FAIL - - [Phone number field must retain changed value.] - expected: FAIL - - [URL field must retain changed value.] - expected: FAIL - - [Email field must retain changed value.] - expected: FAIL - - [Password field must retain changed value.] - expected: FAIL - - [Date field must retain changed value.] - expected: FAIL - - [Month field must retain changed value.] - expected: FAIL - - [Week field must retain changed value.] - expected: FAIL - - [Time field must retain changed value.] - expected: FAIL - - [Datetime (local) field must retain changed value.] - expected: FAIL - - [Number field must retain changed value.] - expected: FAIL - - [Range control must retain changed value.] - expected: FAIL - - [Color picker must retain changed value.] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/cloning-steps.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/cloning-steps.html.ini deleted file mode 100644 index c3cb6115f85..00000000000 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/cloning-steps.html.ini +++ /dev/null @@ -1,14 +0,0 @@ -[cloning-steps.html] - type: testharness - [input element's value should be cloned] - expected: FAIL - - [input element's dirty value flag should be cloned, so setAttribute doesn't affect the cloned input's value] - expected: FAIL - - [input element's checkedness should be cloned] - expected: FAIL - - [input element's dirty checkedness should be cloned, so setAttribute doesn't affect the cloned input's checkedness] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-input-element/radio-groupname-case.html.ini b/tests/wpt/metadata/html/semantics/forms/the-input-element/radio-groupname-case.html.ini deleted file mode 100644 index 69e88a9bd4e..00000000000 --- a/tests/wpt/metadata/html/semantics/forms/the-input-element/radio-groupname-case.html.ini +++ /dev/null @@ -1,26 +0,0 @@ -[radio-groupname-case.html] - type: testharness - [radio button group name = paSSfield-killroyß] - expected: FAIL - - [Among names like sImPlE, everything must be checkable at the same time] - expected: FAIL - - [Among names like paSSfield-killroyß, everything must be checkable at the same time] - expected: FAIL - - [Among names like глупый, everything must be checkable at the same time] - expected: FAIL - - [Among names like åωk, everything must be checkable at the same time] - expected: FAIL - - [Among names like blah1, everything must be checkable at the same time] - expected: FAIL - - [Among names like tÉdz5アパートFi, everything must be checkable at the same time] - expected: FAIL - - [Among names like ΣΣ, everything must be checkable at the same time] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/forms/the-option-element/option-element-constructor.html.ini b/tests/wpt/metadata/html/semantics/forms/the-option-element/option-element-constructor.html.ini deleted file mode 100644 index 25d32bc456c..00000000000 --- a/tests/wpt/metadata/html/semantics/forms/the-option-element/option-element-constructor.html.ini +++ /dev/null @@ -1,35 +0,0 @@ -[option-element-constructor.html] - type: testharness - [Option constructor with no arguments] - expected: FAIL - - [Option constructor with falsy arguments] - expected: FAIL - - [Option constructor creates HTMLOptionElement with specified text and value] - expected: FAIL - - [Option constructor handles selectedness correctly when specified with defaultSelected only] - expected: FAIL - - [Option constructor handles selectedness correctly, even when incongruous with defaultSelected] - expected: FAIL - - [Option constructor treats undefined text and value correctly] - expected: FAIL - - [Option constructor treats empty text and value correctly] - expected: FAIL - - [Option constructor treats falsy selected and defaultSelected correctly] - expected: FAIL - - [Option constructor treats truthy selected and defaultSelected correctly] - expected: FAIL - - [Option constructor does not set dirtiness (so, manipulating the selected content attribute still updates the selected IDL attribute)] - expected: FAIL - - [Prototype of object created with named constructor] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/077.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/077.html.ini deleted file mode 100644 index bcd2fd0eab8..00000000000 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/077.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[077.html] - [ adding several types of scripts through the DOM and removing some of them confuses scheduler ] - expected: FAIL - diff --git a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js.ini deleted file mode 100644 index ce482a60da8..00000000000 --- a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.js.ini +++ /dev/null @@ -1,7 +0,0 @@ -[aborted-parser.window.html] - [document.open() after parser is aborted] - expected: FAIL - - [async document.open() after parser is aborted] - expected: FAIL - diff --git a/tests/wpt/metadata/webmessaging/with-ports/018.html.ini b/tests/wpt/metadata/webmessaging/with-ports/018.html.ini new file mode 100644 index 00000000000..663a1f8fa30 --- /dev/null +++ b/tests/wpt/metadata/webmessaging/with-ports/018.html.ini @@ -0,0 +1,5 @@ +[018.html] + expected: TIMEOUT + [origin of the script that invoked the method, javascript:] + expected: TIMEOUT + diff --git a/tests/wpt/metadata/webmessaging/with-ports/017.html.ini b/tests/wpt/metadata/webmessaging/without-ports/017.html.ini index 064cf47545b..064cf47545b 100644 --- a/tests/wpt/metadata/webmessaging/with-ports/017.html.ini +++ b/tests/wpt/metadata/webmessaging/without-ports/017.html.ini diff --git a/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini b/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini index 268949ced5c..f584fce5df1 100644 --- a/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini +++ b/tests/wpt/metadata/workers/semantics/multiple-workers/005.html.ini @@ -1,4 +1,5 @@ [005.html] + expected: ERROR [dedicated worker in shared worker in dedicated worker] expected: FAIL diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index b259b7bc24d..559e6baff6c 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -19024,7 +19024,7 @@ "testharness" ], "mozilla/interfaces.html": [ - "08e8181e6e639caeaecd84c16d582c0ec3f99474", + "945a8b33a109b0cc37db9351f94b9afd3eac798e", "testharness" ], "mozilla/interfaces.js": [ diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html index 08e8181e6e6..945a8b33a10 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html @@ -186,6 +186,7 @@ test_interfaces([ "NodeList", "OfflineAudioCompletionEvent", "OfflineAudioContext", + "Option", "OscillatorNode", "PageTransitionEvent", "PannerNode", diff --git a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html index 5b155c1047d..30000329780 100644 --- a/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html +++ b/tests/wpt/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html @@ -12,6 +12,8 @@ <img src="/images/green.png"> <img src="/images/green.png" width=100 height=125> <img src="" width=100 height=125> +<img src="error.png" width=100 height=125> +<img src="error.png"> <script> let t = async_test("Image width and height attributes are used to infer aspect-ratio"); function assert_ratio(img, expected) { @@ -47,9 +49,10 @@ t.step(function() { onload = t.step_func_done(function() { let images = document.querySelectorAll("img"); - assert_ratio(images[3], 1.266); // 1.266 is the original aspect ratio of blue.png - assert_equals(getComputedStyle(images[2]).height, "0px"); // aspect-ratio doesn't override intrinsic size of images that don't have any src. - assert_ratio(images[1], 2.0); // 2.0 is the original aspect ratio of green.png assert_ratio(images[0], 2.0); // Loaded image's aspect ratio, at least by default, overrides width / height ratio. + assert_ratio(images[1], 2.0); // 2.0 is the original aspect ratio of green.png + assert_equals(getComputedStyle(images[2]).height, "0px"); // aspect-ratio doesn't override intrinsic size of images that don't have any src. + assert_equals(getComputedStyle(images[3]).height, getComputedStyle(images[4]).height); // aspect-ratio doesn't override intrinsic size of error images. + assert_ratio(images[5], 1.266); // 1.266 is the original aspect ratio of blue.png }); </script> |