mirror of
https://github.com/servo/servo.git
synced 2025-09-10 15:08:21 +01:00
Move LinkProcessingOptions into separate file (#39033)
This makes future implementations easier where we will reuse most of this code to parse Link headers. Part of #35035 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
efe9ea2306
commit
a1f9e3e133
23 changed files with 311 additions and 573 deletions
|
@ -5,25 +5,17 @@
|
|||
use std::borrow::{Borrow, ToOwned};
|
||||
use std::cell::Cell;
|
||||
use std::default::Default;
|
||||
use std::str::FromStr;
|
||||
|
||||
use base::id::WebViewId;
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::EmbedderMsg;
|
||||
use html5ever::{LocalName, Prefix, local_name, ns};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::rust::HandleObject;
|
||||
use mime::Mime;
|
||||
use net_traits::image_cache::{
|
||||
Image, ImageCache, ImageCacheResponseMessage, ImageCacheResult, ImageLoadListener,
|
||||
ImageOrMetadataAvailable, ImageResponse, PendingImageId, UsePlaceholder,
|
||||
};
|
||||
use net_traits::mime_classifier::{MediaType, MimeClassifier};
|
||||
use net_traits::policy_container::PolicyContainer;
|
||||
use net_traits::request::{
|
||||
CorsSettings, Destination, Initiator, InsecureRequestsPolicy, Referrer, RequestBuilder,
|
||||
RequestId,
|
||||
};
|
||||
use net_traits::request::{Destination, Initiator, RequestBuilder, RequestId};
|
||||
use net_traits::{
|
||||
FetchMetadata, FetchResponseListener, FetchResponseMsg, NetworkError, ReferrerPolicy,
|
||||
ResourceFetchTiming, ResourceTimingType,
|
||||
|
@ -31,7 +23,8 @@ use net_traits::{
|
|||
use pixels::PixelFormat;
|
||||
use script_bindings::root::Dom;
|
||||
use servo_arc::Arc;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use servo_url::ServoUrl;
|
||||
use strum_macros::IntoStaticStr;
|
||||
use style::attr::AttrValue;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use stylo_atoms::Atom;
|
||||
|
@ -57,13 +50,13 @@ use crate::dom::element::{
|
|||
set_cross_origin_attribute,
|
||||
};
|
||||
use crate::dom::html::htmlelement::HTMLElement;
|
||||
use crate::dom::linkprocessingoptions::LinkProcessingOptions;
|
||||
use crate::dom::medialist::MediaList;
|
||||
use crate::dom::node::{BindContext, Node, NodeTraits, UnbindContext};
|
||||
use crate::dom::performanceresourcetiming::InitiatorType;
|
||||
use crate::dom::stylesheet::StyleSheet as DOMStyleSheet;
|
||||
use crate::dom::types::{EventTarget, GlobalScope};
|
||||
use crate::dom::virtualmethods::VirtualMethods;
|
||||
use crate::fetch::create_a_potential_cors_request;
|
||||
use crate::links::LinkRelations;
|
||||
use crate::network_listener::{PreInvoke, ResourceTimingListener, submit_timing};
|
||||
use crate::script_runtime::CanGc;
|
||||
|
@ -78,24 +71,6 @@ impl RequestGenerationId {
|
|||
}
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#link-processing-options>
|
||||
struct LinkProcessingOptions {
|
||||
href: String,
|
||||
destination: Option<Destination>,
|
||||
integrity: String,
|
||||
link_type: String,
|
||||
cryptographic_nonce_metadata: String,
|
||||
cross_origin: Option<CorsSettings>,
|
||||
referrer_policy: ReferrerPolicy,
|
||||
policy_container: PolicyContainer,
|
||||
source_set: Option<()>,
|
||||
base_url: ServoUrl,
|
||||
origin: ImmutableOrigin,
|
||||
insecure_requests_policy: InsecureRequestsPolicy,
|
||||
has_trustworthy_ancestor_origin: bool,
|
||||
// Some fields that we don't need yet are missing
|
||||
}
|
||||
|
||||
#[dom_struct]
|
||||
pub(crate) struct HTMLLinkElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
@ -542,23 +517,24 @@ impl HTMLLinkElement {
|
|||
options.destination = Some(Destination::None);
|
||||
|
||||
// Step 4. Let request be the result of creating a link request given options.
|
||||
let url = options.base_url.clone();
|
||||
let Some(request) = options.create_link_request(self.owner_window().webview_id()) else {
|
||||
// Step 5. If request is null, then return.
|
||||
return;
|
||||
};
|
||||
let url = request.url.clone();
|
||||
|
||||
// Step 6. Set request's initiator to "prefetch".
|
||||
let request = request.initiator(Initiator::Prefetch);
|
||||
|
||||
// (Step 7, firing load/error events is handled in the FetchResponseListener impl for PrefetchContext)
|
||||
// (Step 7, firing load/error events is handled in the FetchResponseListener impl for LinkFetchContext)
|
||||
|
||||
// Step 8. The user agent should fetch request, with processResponseConsumeBody set to processPrefetchResponse.
|
||||
let document = self.upcast::<Node>().owner_doc();
|
||||
let fetch_context = PrefetchContext {
|
||||
let fetch_context = LinkFetchContext {
|
||||
url,
|
||||
link: Trusted::new(self),
|
||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
||||
type_: LinkFetchContextType::Prefetch,
|
||||
};
|
||||
|
||||
document.fetch_background(request, fetch_context);
|
||||
|
@ -794,129 +770,47 @@ impl HTMLLinkElement {
|
|||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#link-type-preload:fetch-and-process-the-linked-resource-2>
|
||||
/// and type matching destination steps of <https://html.spec.whatwg.org/multipage/#preload>
|
||||
fn handle_preload_url(&self) {
|
||||
// Step 1. Update the source set for el.
|
||||
// TODO
|
||||
// Step 2. Let options be the result of creating link options from el.
|
||||
let options = self.processing_options();
|
||||
// Step 3. Preload options, with the following steps given a response response:
|
||||
// Step 3.1 If response is a network error, fire an event named error at el.
|
||||
// Otherwise, fire an event named load at el.
|
||||
self.preload(options);
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#preload>
|
||||
fn preload(&self, options: LinkProcessingOptions) {
|
||||
// Step 1. If options's type doesn't match options's destination, then return.
|
||||
let type_matches_destination: bool =
|
||||
HTMLLinkElement::type_matches_destination(&options.link_type, options.destination);
|
||||
self.previous_type_matched.set(type_matches_destination);
|
||||
if !type_matches_destination {
|
||||
return;
|
||||
// Steps for https://html.spec.whatwg.org/multipage/#preload
|
||||
{
|
||||
// Step 1. If options's type doesn't match options's destination, then return.
|
||||
let type_matches_destination = options.type_matches_destination();
|
||||
self.previous_type_matched.set(type_matches_destination);
|
||||
if !type_matches_destination {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Step 2. If options's destination is "image" and options's source set is not null,
|
||||
// then set options's href to the result of selecting an image source from options's source set.
|
||||
// TODO
|
||||
// Step 3. Let request be the result of creating a link request given options.
|
||||
let url = options.base_url.clone();
|
||||
let Some(request) = options.create_link_request(self.owner_window().webview_id()) else {
|
||||
// Step 4. If request is null, then return.
|
||||
// Step 3. Preload options, with the following steps given a response response:
|
||||
let Some(request) = options.preload(self.owner_window().webview_id()) else {
|
||||
return;
|
||||
};
|
||||
let document = self.upcast::<Node>().owner_doc();
|
||||
// Step 5. Let unsafeEndTime be 0.
|
||||
// TODO
|
||||
// Step 6. Let entry be a new preload entry whose integrity metadata is options's integrity.
|
||||
// TODO
|
||||
// Step 7. Let key be the result of creating a preload key given request.
|
||||
// TODO
|
||||
// Step 8. If options's document is "pending", then set request's initiator type to "early hint".
|
||||
// TODO
|
||||
// Step 9. Let controller be null.
|
||||
// Step 10. Let reportTiming given a Document document be to report timing for controller
|
||||
// given document's relevant global object.
|
||||
// Step 11. Set controller to the result of fetching request, with processResponseConsumeBody
|
||||
// set to the following steps given a response response and null, failure, or a byte sequence bodyBytes:
|
||||
let fetch_context = PreloadContext {
|
||||
let url = request.url.clone();
|
||||
let fetch_context = LinkFetchContext {
|
||||
url,
|
||||
link: Trusted::new(self),
|
||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
||||
type_: LinkFetchContextType::Preload,
|
||||
};
|
||||
document.fetch_background(request.clone(), fetch_context);
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#match-preload-type>
|
||||
fn type_matches_destination(mime_type: &str, destination: Option<Destination>) -> bool {
|
||||
// Step 1. If type is an empty string, then return true.
|
||||
if mime_type.is_empty() {
|
||||
return true;
|
||||
}
|
||||
// Step 2. If destination is "fetch", then return true.
|
||||
//
|
||||
// Fetch is handled as an empty string destination in the spec:
|
||||
// https://fetch.spec.whatwg.org/#concept-potential-destination-translate
|
||||
let Some(destination) = destination else {
|
||||
return false;
|
||||
};
|
||||
if destination == Destination::None {
|
||||
return true;
|
||||
}
|
||||
// Step 3. Let mimeTypeRecord be the result of parsing type.
|
||||
let Ok(mime_type_record) = Mime::from_str(mime_type) else {
|
||||
// Step 4. If mimeTypeRecord is failure, then return false.
|
||||
return false;
|
||||
};
|
||||
// Step 5. If mimeTypeRecord is not supported by the user agent, then return false.
|
||||
//
|
||||
// We currently don't check if we actually support the mime type. Only if we can classify
|
||||
// it according to the spec.
|
||||
let Some(mime_type) = MimeClassifier::get_media_type(&mime_type_record) else {
|
||||
return false;
|
||||
};
|
||||
// Step 6. If any of the following are true:
|
||||
if
|
||||
// destination is "audio" or "video", and mimeTypeRecord is an audio or video MIME type;
|
||||
((destination == Destination::Audio || destination == Destination::Video) &&
|
||||
mime_type == MediaType::AudioVideo)
|
||||
// destination is a script-like destination and mimeTypeRecord is a JavaScript MIME type;
|
||||
|| (destination.is_script_like() && mime_type == MediaType::JavaScript)
|
||||
// destination is "image" and mimeTypeRecord is an image MIME type;
|
||||
|| (destination == Destination::Image && mime_type == MediaType::Image)
|
||||
// destination is "font" and mimeTypeRecord is a font MIME type;
|
||||
|| (destination == Destination::Font && mime_type == MediaType::Font)
|
||||
// destination is "json" and mimeTypeRecord is a JSON MIME type;
|
||||
|| (destination == Destination::Json && mime_type == MediaType::Json)
|
||||
// destination is "style" and mimeTypeRecord's essence is text/css; or
|
||||
|| (destination == Destination::Style && mime_type_record == mime::TEXT_CSS)
|
||||
// destination is "track" and mimeTypeRecord's essence is text/vtt,
|
||||
|| (destination == Destination::Track && mime_type_record.essence_str() == "text/vtt")
|
||||
{
|
||||
// then return true.
|
||||
return true;
|
||||
}
|
||||
// Step 7. Return false.
|
||||
false
|
||||
self.upcast::<Node>()
|
||||
.owner_doc()
|
||||
.fetch_background(request, fetch_context);
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#link-type-preload:fetch-and-process-the-linked-resource-2>
|
||||
fn fire_event_after_response(&self, response: Result<ResourceFetchTiming, NetworkError>) {
|
||||
// Step 3.1 If response is a network error, fire an event named error at el.
|
||||
// Otherwise, fire an event named load at el.
|
||||
if response.is_err() {
|
||||
self.upcast::<EventTarget>()
|
||||
.fire_event(atom!("error"), CanGc::note());
|
||||
} else {
|
||||
// TODO(35035): Figure out why we need to queue a task for the load event. Otherwise
|
||||
// the performance timing data hasn't been saved yet, which fails several preload
|
||||
// WPT tests that assume that performance timing information is available when
|
||||
// the load event is fired.
|
||||
let this = Trusted::new(self);
|
||||
self.owner_global()
|
||||
.task_manager()
|
||||
.performance_timeline_task_source()
|
||||
.queue(task!(preload_load_event: move || {
|
||||
let this = this.root();
|
||||
this
|
||||
.upcast::<EventTarget>()
|
||||
.fire_event(atom!("load"), CanGc::note());
|
||||
}));
|
||||
self.upcast::<EventTarget>()
|
||||
.fire_event(atom!("load"), CanGc::note());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1092,54 +986,6 @@ impl HTMLLinkElementMethods<crate::DomTypeHolder> for HTMLLinkElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl LinkProcessingOptions {
|
||||
/// <https://html.spec.whatwg.org/multipage/#create-a-link-request>
|
||||
fn create_link_request(self, webview_id: WebViewId) -> Option<RequestBuilder> {
|
||||
// Step 1. Assert: options's href is not the empty string.
|
||||
assert!(!self.href.is_empty());
|
||||
|
||||
// Step 2. If options's destination is null, then return null.
|
||||
let destination = self.destination?;
|
||||
|
||||
// Step 3. Let url be the result of encoding-parsing a URL given options's href, relative to options's base URL.
|
||||
// TODO: The spec passes a base url which is incompatible with the
|
||||
// "encoding-parse a URL" algorithm.
|
||||
let Ok(url) = self.base_url.join(&self.href) else {
|
||||
// Step 4. If url is failure, then return null.
|
||||
return None;
|
||||
};
|
||||
|
||||
// Step 5. Let request be the result of creating a potential-CORS request given
|
||||
// url, options's destination, and options's crossorigin.
|
||||
// Step 6. Set request's policy container to options's policy container.
|
||||
// Step 7. Set request's integrity metadata to options's integrity.
|
||||
// Step 8. Set request's cryptographic nonce metadata to options's cryptographic nonce metadata.
|
||||
// Step 9. Set request's referrer policy to options's referrer policy.
|
||||
// FIXME: Step 10. Set request's client to options's environment.
|
||||
// FIXME: Step 11. Set request's priority to options's fetch priority.
|
||||
// FIXME: Use correct referrer
|
||||
let builder = create_a_potential_cors_request(
|
||||
Some(webview_id),
|
||||
url,
|
||||
destination,
|
||||
self.cross_origin,
|
||||
None,
|
||||
Referrer::NoReferrer,
|
||||
self.insecure_requests_policy,
|
||||
self.has_trustworthy_ancestor_origin,
|
||||
self.policy_container,
|
||||
)
|
||||
.initiator(Initiator::Link)
|
||||
.origin(self.origin)
|
||||
.integrity_metadata(self.integrity)
|
||||
.cryptographic_nonce_metadata(self.cryptographic_nonce_metadata)
|
||||
.referrer_policy(self.referrer_policy);
|
||||
|
||||
// Step 12. Return request.
|
||||
Some(builder)
|
||||
}
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#translate-a-preload-destination>
|
||||
fn translate_a_preload_destination(potential_destination: &str) -> Destination {
|
||||
match potential_destination {
|
||||
|
@ -1239,7 +1085,21 @@ impl PreInvoke for FaviconFetchContext {
|
|||
}
|
||||
}
|
||||
|
||||
struct PrefetchContext {
|
||||
#[derive(Clone, IntoStaticStr)]
|
||||
#[strum(serialize_all = "lowercase")]
|
||||
enum LinkFetchContextType {
|
||||
Prefetch,
|
||||
Preload,
|
||||
}
|
||||
|
||||
impl From<LinkFetchContextType> for InitiatorType {
|
||||
fn from(other: LinkFetchContextType) -> Self {
|
||||
let name: &'static str = other.into();
|
||||
InitiatorType::LocalName(name.to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
struct LinkFetchContext {
|
||||
/// The `<link>` element that caused this prefetch operation
|
||||
link: Trusted<HTMLLinkElement>,
|
||||
|
||||
|
@ -1247,9 +1107,12 @@ struct PrefetchContext {
|
|||
|
||||
/// The url being prefetched
|
||||
url: ServoUrl,
|
||||
|
||||
/// The type of fetching we perform, used when report timings.
|
||||
type_: LinkFetchContextType,
|
||||
}
|
||||
|
||||
impl FetchResponseListener for PrefetchContext {
|
||||
impl FetchResponseListener for LinkFetchContext {
|
||||
fn process_request_body(&mut self, _: RequestId) {}
|
||||
|
||||
fn process_request_eof(&mut self, _: RequestId) {}
|
||||
|
@ -1266,97 +1129,8 @@ impl FetchResponseListener for PrefetchContext {
|
|||
_ = chunk;
|
||||
}
|
||||
|
||||
// Step 7 of `fetch and process the linked resource` in https://html.spec.whatwg.org/multipage/#link-type-prefetch
|
||||
fn process_response_eof(
|
||||
&mut self,
|
||||
_: RequestId,
|
||||
response: Result<ResourceFetchTiming, NetworkError>,
|
||||
) {
|
||||
if response.is_err() {
|
||||
// Step 1. If response is a network error, fire an event named error at el.
|
||||
self.link
|
||||
.root()
|
||||
.upcast::<EventTarget>()
|
||||
.fire_event(atom!("error"), CanGc::note());
|
||||
} else {
|
||||
// Step 2. Otherwise, fire an event named load at el.
|
||||
self.link
|
||||
.root()
|
||||
.upcast::<EventTarget>()
|
||||
.fire_event(atom!("load"), CanGc::note());
|
||||
}
|
||||
}
|
||||
|
||||
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
|
||||
&mut self.resource_timing
|
||||
}
|
||||
|
||||
fn resource_timing(&self) -> &ResourceFetchTiming {
|
||||
&self.resource_timing
|
||||
}
|
||||
|
||||
fn submit_resource_timing(&mut self) {
|
||||
submit_timing(self, CanGc::note())
|
||||
}
|
||||
|
||||
fn process_csp_violations(&mut self, _request_id: RequestId, violations: Vec<Violation>) {
|
||||
let global = &self.resource_timing_global();
|
||||
let link = self.link.root();
|
||||
let source_position = link
|
||||
.upcast::<Element>()
|
||||
.compute_source_position(link.line_number as u32);
|
||||
global.report_csp_violations(violations, None, Some(source_position));
|
||||
}
|
||||
}
|
||||
|
||||
impl ResourceTimingListener for PrefetchContext {
|
||||
fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) {
|
||||
(
|
||||
InitiatorType::LocalName("prefetch".to_string()),
|
||||
self.url.clone(),
|
||||
)
|
||||
}
|
||||
|
||||
fn resource_timing_global(&self) -> DomRoot<GlobalScope> {
|
||||
self.link.root().upcast::<Node>().owner_doc().global()
|
||||
}
|
||||
}
|
||||
|
||||
impl PreInvoke for PrefetchContext {
|
||||
fn should_invoke(&self) -> bool {
|
||||
// Prefetch requests are never aborted.
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
struct PreloadContext {
|
||||
/// The `<link>` element that caused this preload operation
|
||||
link: Trusted<HTMLLinkElement>,
|
||||
|
||||
resource_timing: ResourceFetchTiming,
|
||||
|
||||
/// The url being preloaded
|
||||
url: ServoUrl,
|
||||
}
|
||||
|
||||
impl FetchResponseListener for PreloadContext {
|
||||
fn process_request_body(&mut self, _: RequestId) {}
|
||||
|
||||
fn process_request_eof(&mut self, _: RequestId) {}
|
||||
|
||||
fn process_response(
|
||||
&mut self,
|
||||
_: RequestId,
|
||||
fetch_metadata: Result<FetchMetadata, NetworkError>,
|
||||
) {
|
||||
_ = fetch_metadata;
|
||||
}
|
||||
|
||||
fn process_response_chunk(&mut self, _: RequestId, chunk: Vec<u8>) {
|
||||
_ = chunk;
|
||||
}
|
||||
|
||||
/// Step 3.1 of <https://html.spec.whatwg.org/multipage/#link-type-preload:fetch-and-process-the-linked-resource-2>
|
||||
/// Step 7 of <https://html.spec.whatwg.org/multipage/#link-type-prefetch:fetch-and-process-the-linked-resource-2>
|
||||
/// and step 3.1 of <https://html.spec.whatwg.org/multipage/#link-type-preload:fetch-and-process-the-linked-resource-2>
|
||||
fn process_response_eof(
|
||||
&mut self,
|
||||
_: RequestId,
|
||||
|
@ -1387,12 +1161,9 @@ impl FetchResponseListener for PreloadContext {
|
|||
}
|
||||
}
|
||||
|
||||
impl ResourceTimingListener for PreloadContext {
|
||||
impl ResourceTimingListener for LinkFetchContext {
|
||||
fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) {
|
||||
(
|
||||
InitiatorType::LocalName(self.url.clone().into_string()),
|
||||
self.url.clone(),
|
||||
)
|
||||
(self.type_.clone().into(), self.url.clone())
|
||||
}
|
||||
|
||||
fn resource_timing_global(&self) -> DomRoot<GlobalScope> {
|
||||
|
@ -1400,9 +1171,9 @@ impl ResourceTimingListener for PreloadContext {
|
|||
}
|
||||
}
|
||||
|
||||
impl PreInvoke for PreloadContext {
|
||||
impl PreInvoke for LinkFetchContext {
|
||||
fn should_invoke(&self) -> bool {
|
||||
// Preload requests are never aborted.
|
||||
// Prefetch and preload requests are never aborted.
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
164
components/script/dom/linkprocessingoptions.rs
Normal file
164
components/script/dom/linkprocessingoptions.rs
Normal file
|
@ -0,0 +1,164 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 std::str::FromStr;
|
||||
|
||||
use base::id::WebViewId;
|
||||
use mime::Mime;
|
||||
use net_traits::ReferrerPolicy;
|
||||
use net_traits::mime_classifier::{MediaType, MimeClassifier};
|
||||
use net_traits::policy_container::PolicyContainer;
|
||||
use net_traits::request::{
|
||||
CorsSettings, Destination, Initiator, InsecureRequestsPolicy, Referrer, RequestBuilder,
|
||||
};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
|
||||
use crate::fetch::create_a_potential_cors_request;
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#link-processing-options>
|
||||
pub(crate) struct LinkProcessingOptions {
|
||||
pub(crate) href: String,
|
||||
pub(crate) destination: Option<Destination>,
|
||||
pub(crate) integrity: String,
|
||||
pub(crate) link_type: String,
|
||||
pub(crate) cryptographic_nonce_metadata: String,
|
||||
pub(crate) cross_origin: Option<CorsSettings>,
|
||||
pub(crate) referrer_policy: ReferrerPolicy,
|
||||
pub(crate) policy_container: PolicyContainer,
|
||||
pub(crate) source_set: Option<()>,
|
||||
pub(crate) base_url: ServoUrl,
|
||||
pub(crate) origin: ImmutableOrigin,
|
||||
pub(crate) insecure_requests_policy: InsecureRequestsPolicy,
|
||||
pub(crate) has_trustworthy_ancestor_origin: bool,
|
||||
// Some fields that we don't need yet are missing
|
||||
}
|
||||
|
||||
impl LinkProcessingOptions {
|
||||
/// <https://html.spec.whatwg.org/multipage/#create-a-link-request>
|
||||
pub(crate) fn create_link_request(self, webview_id: WebViewId) -> Option<RequestBuilder> {
|
||||
// Step 1. Assert: options's href is not the empty string.
|
||||
assert!(!self.href.is_empty());
|
||||
|
||||
// Step 2. If options's destination is null, then return null.
|
||||
let destination = self.destination?;
|
||||
|
||||
// Step 3. Let url be the result of encoding-parsing a URL given options's href, relative to options's base URL.
|
||||
let Ok(url) = ServoUrl::parse_with_base(Some(&self.base_url), &self.href) else {
|
||||
// Step 4. If url is failure, then return null.
|
||||
return None;
|
||||
};
|
||||
|
||||
// Step 5. Let request be the result of creating a potential-CORS request given
|
||||
// url, options's destination, and options's crossorigin.
|
||||
// Step 6. Set request's policy container to options's policy container.
|
||||
// Step 7. Set request's integrity metadata to options's integrity.
|
||||
// Step 8. Set request's cryptographic nonce metadata to options's cryptographic nonce metadata.
|
||||
// Step 9. Set request's referrer policy to options's referrer policy.
|
||||
// FIXME: Step 10. Set request's client to options's environment.
|
||||
// FIXME: Step 11. Set request's priority to options's fetch priority.
|
||||
// FIXME: Use correct referrer
|
||||
let builder = create_a_potential_cors_request(
|
||||
Some(webview_id),
|
||||
url,
|
||||
destination,
|
||||
self.cross_origin,
|
||||
None,
|
||||
Referrer::NoReferrer,
|
||||
self.insecure_requests_policy,
|
||||
self.has_trustworthy_ancestor_origin,
|
||||
self.policy_container,
|
||||
)
|
||||
.initiator(Initiator::Link)
|
||||
.origin(self.origin)
|
||||
.integrity_metadata(self.integrity)
|
||||
.cryptographic_nonce_metadata(self.cryptographic_nonce_metadata)
|
||||
.referrer_policy(self.referrer_policy);
|
||||
|
||||
// Step 12. Return request.
|
||||
Some(builder)
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#match-preload-type>
|
||||
pub(crate) fn type_matches_destination(&self) -> bool {
|
||||
// Step 1. If type is an empty string, then return true.
|
||||
if self.link_type.is_empty() {
|
||||
return true;
|
||||
}
|
||||
// Step 2. If destination is "fetch", then return true.
|
||||
//
|
||||
// Fetch is handled as an empty string destination in the spec:
|
||||
// https://fetch.spec.whatwg.org/#concept-potential-destination-translate
|
||||
let Some(destination) = self.destination else {
|
||||
return false;
|
||||
};
|
||||
if destination == Destination::None {
|
||||
return true;
|
||||
}
|
||||
// Step 3. Let mimeTypeRecord be the result of parsing type.
|
||||
let Ok(mime_type_record) = Mime::from_str(&self.link_type) else {
|
||||
// Step 4. If mimeTypeRecord is failure, then return false.
|
||||
return false;
|
||||
};
|
||||
// Step 5. If mimeTypeRecord is not supported by the user agent, then return false.
|
||||
//
|
||||
// We currently don't check if we actually support the mime type. Only if we can classify
|
||||
// it according to the spec.
|
||||
let Some(mime_type) = MimeClassifier::get_media_type(&mime_type_record) else {
|
||||
return false;
|
||||
};
|
||||
// Step 6. If any of the following are true:
|
||||
if
|
||||
// destination is "audio" or "video", and mimeTypeRecord is an audio or video MIME type;
|
||||
((destination == Destination::Audio || destination == Destination::Video) &&
|
||||
mime_type == MediaType::AudioVideo)
|
||||
// destination is a script-like destination and mimeTypeRecord is a JavaScript MIME type;
|
||||
|| (destination.is_script_like() && mime_type == MediaType::JavaScript)
|
||||
// destination is "image" and mimeTypeRecord is an image MIME type;
|
||||
|| (destination == Destination::Image && mime_type == MediaType::Image)
|
||||
// destination is "font" and mimeTypeRecord is a font MIME type;
|
||||
|| (destination == Destination::Font && mime_type == MediaType::Font)
|
||||
// destination is "json" and mimeTypeRecord is a JSON MIME type;
|
||||
|| (destination == Destination::Json && mime_type == MediaType::Json)
|
||||
// destination is "style" and mimeTypeRecord's essence is text/css; or
|
||||
|| (destination == Destination::Style && mime_type_record == mime::TEXT_CSS)
|
||||
// destination is "track" and mimeTypeRecord's essence is text/vtt,
|
||||
|| (destination == Destination::Track && mime_type_record.essence_str() == "text/vtt")
|
||||
{
|
||||
// then return true.
|
||||
return true;
|
||||
}
|
||||
// Step 7. Return false.
|
||||
false
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#preload>
|
||||
pub(crate) fn preload(self, webview_id: WebViewId) -> Option<RequestBuilder> {
|
||||
// Step 1. If options's type doesn't match options's destination, then return.
|
||||
//
|
||||
// Handled by callers, since we need to check the previous destination type
|
||||
assert!(self.type_matches_destination());
|
||||
// Step 2. If options's destination is "image" and options's source set is not null,
|
||||
// then set options's href to the result of selecting an image source from options's source set.
|
||||
// TODO
|
||||
// Step 3. Let request be the result of creating a link request given options.
|
||||
let Some(request) = self.create_link_request(webview_id) else {
|
||||
// Step 4. If request is null, then return.
|
||||
return None;
|
||||
};
|
||||
// Step 5. Let unsafeEndTime be 0.
|
||||
// TODO
|
||||
// Step 6. Let entry be a new preload entry whose integrity metadata is options's integrity.
|
||||
// TODO
|
||||
// Step 7. Let key be the result of creating a preload key given request.
|
||||
// TODO
|
||||
// Step 8. If options's document is "pending", then set request's initiator type to "early hint".
|
||||
// TODO
|
||||
// Step 9. Let controller be null.
|
||||
// Step 10. Let reportTiming given a Document document be to report timing for controller
|
||||
// given document's relevant global object.
|
||||
// Step 11. Set controller to the result of fetching request, with processResponseConsumeBody
|
||||
// set to the following steps given a response response and null, failure, or a byte sequence bodyBytes:
|
||||
Some(request.clone())
|
||||
}
|
||||
}
|
|
@ -345,6 +345,7 @@ pub(crate) mod inputevent;
|
|||
pub(crate) mod intersectionobserver;
|
||||
pub(crate) mod intersectionobserverentry;
|
||||
pub(crate) mod keyboardevent;
|
||||
pub(crate) mod linkprocessingoptions;
|
||||
pub(crate) mod location;
|
||||
pub(crate) mod mediadeviceinfo;
|
||||
pub(crate) mod mediadevices;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
[prefetch-allowed-by-any-directive.sub.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should succeed when restricted by default-src but allowed by other directive]
|
||||
expected: TIMEOUT
|
||||
|
||||
[Prefetch should fail when restricted by default-src and different origin allowed by other directive]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Prefetch should succeed when restricted by default-src but origin allowed by other directive]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
[prefetch-allowed-by-default.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should succeed when allowed by default-src]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
[prefetch-allowed-no-default.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should succeed when there is no default-src]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
[prefetch-allowed-with-conflicting-permissive-policies.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should succeed when a directive in a policy is permissive, even if a subsequent policy overrides that.]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[prefetch-blocked-by-default-multiple-policies.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should fail when restricted by default-src]
|
||||
expected: TIMEOUT
|
|
@ -1,4 +0,0 @@
|
|||
[prefetch-blocked-by-default.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should fail when restricted by default-src]
|
||||
expected: TIMEOUT
|
|
@ -1,79 +1,72 @@
|
|||
[prefetch-generate-directives.html]
|
||||
expected: TIMEOUT
|
||||
[Test that script-src enabled with everything else disabled allows prefetching]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
||||
[Test that script-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that img-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that img-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that connect-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that connect-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that object-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that object-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that font-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that font-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that manifest-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that manifest-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that media-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that media-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that style-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that style-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that child-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that child-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that frame-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that frame-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that worker-src enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that worker-src enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
|
||||
[Test that base-uri enabled with everything else disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
|
||||
[Test that base-uri enabled with default-src disabled allows prefetching]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that permissive script-src-elem supersedes script-src]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[Test that permissive script-src supersedes script-src-elem]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[prefetch-ignores-prefetch-src.sub.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch should fail when restricted by default-src and allowed by unsupported prefetch-src directive (prefetch-src should be ignored)]
|
||||
expected: TIMEOUT
|
|
@ -1,4 +1,3 @@
|
|||
[prefetch-no-csp.html]
|
||||
expected: TIMEOUT
|
||||
[Prefetch succeeds when no CSP]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[dynamic-adding-preload.html]
|
||||
[Makes sure that a dynamically added preloaded resource is downloaded]
|
||||
expected: FAIL
|
|
@ -1,4 +1,5 @@
|
|||
[preload-error.sub.html]
|
||||
expected: TIMEOUT
|
||||
[404 (image): main]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -26,12 +27,6 @@
|
|||
[CSP-error (xhr): main]
|
||||
expected: FAIL
|
||||
|
||||
[success (fetch): main]
|
||||
expected: FAIL
|
||||
|
||||
[404 (fetch): main]
|
||||
expected: FAIL
|
||||
|
||||
[CORS (fetch): main]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -55,21 +50,3 @@
|
|||
|
||||
[MIME-blocked-nosniff (script): main]
|
||||
expected: FAIL
|
||||
|
||||
[success (xhr): main]
|
||||
expected: FAIL
|
||||
|
||||
[CORS (style): main]
|
||||
expected: FAIL
|
||||
|
||||
[success (style): main]
|
||||
expected: FAIL
|
||||
|
||||
[404 (script): main]
|
||||
expected: FAIL
|
||||
|
||||
[Decode-error (style): main]
|
||||
expected: FAIL
|
||||
|
||||
[CORS (xhr): main]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
[preload-font-crossorigin.html]
|
||||
[Same origin font preload with crossorigin attribute]
|
||||
expected: FAIL
|
||||
|
||||
[Same origin font preload without crossorigin attribute]
|
||||
expected: FAIL
|
||||
|
||||
[Cross origin font preload with crossorigin attribute]
|
||||
expected: FAIL
|
||||
|
||||
[Cross origin font preload without crossorigin attribute]
|
||||
expected: FAIL
|
||||
|
|
3
tests/wpt/meta/preload/preload-invalid-resources.html.ini
vendored
Normal file
3
tests/wpt/meta/preload/preload-invalid-resources.html.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[preload-invalid-resources.html]
|
||||
[Preloading an invalid image (invalid data) should preload and not re-fetch]
|
||||
expected: FAIL
|
|
@ -1,11 +1,5 @@
|
|||
[preload-referrer-policy.html]
|
||||
expected: TIMEOUT
|
||||
[referrer policy ( -> , element, cross-origin)]
|
||||
expected: FAIL
|
||||
|
||||
[referrer policy ( -> , element, same-origin)]
|
||||
expected: FAIL
|
||||
|
||||
[referrer policy ( -> , header, cross-origin)]
|
||||
expected: TIMEOUT
|
||||
|
||||
|
|
|
@ -1,47 +1,11 @@
|
|||
[preload-resource-match.https.html]
|
||||
expected: TIMEOUT
|
||||
[Loading image (no-cors) with link (anonymous) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (no-cors) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (anonymous) with link (no-cors) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (anonymous) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (use-credentials) with link (no-cors) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (use-credentials) with link (anonymous) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading font (anonymous) with link (no-cors) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading font (anonymous) with link (anonymous) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading font (anonymous) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading font (same-origin) with link (same-origin) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading backgroundImage (no-cors) with link (anonymous) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading backgroundImage (no-cors) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading fetch (same-origin) with link (same-origin) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading fetch (no-cors) with link (no-cors) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading fetch (no-cors) with link (anonymous) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -51,9 +15,6 @@
|
|||
[Loading fetch (anonymous) with link (no-cors) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading fetch (anonymous) with link (anonymous) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading fetch (anonymous) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -63,53 +24,8 @@
|
|||
[Loading fetch (use-credentials) with link (anonymous) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading fetch (use-credentials) with link (use-credentials) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading script (no-cors) with link (anonymous) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading script (no-cors) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading script (anonymous) with link (no-cors) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading script (anonymous) with link (use-credentials) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading script (use-credentials) with link (no-cors) should discard the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading script (use-credentials) with link (anonymous) should discard the preloaded response]
|
||||
expected: TIMEOUT
|
||||
|
||||
[Loading script (use-credentials) with link (use-credentials) should reuse the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (same-origin) with link (same-origin) should reuse the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (no-cors) with link (no-cors) should reuse the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (no-cors) with link (anonymous) should discard the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (no-cors) with link (use-credentials) should discard the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (anonymous) with link (no-cors) should discard the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (anonymous) with link (anonymous) should reuse the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (anonymous) with link (use-credentials) should discard the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading module (use-credentials) with link (no-cors) should discard the preloaded response]
|
||||
expected: NOTRUN
|
||||
expected: TIMEOUT
|
||||
|
||||
[Loading module (use-credentials) with link (anonymous) should discard the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
@ -146,3 +62,21 @@
|
|||
|
||||
[Loading style (use-credentials) with link (use-credentials) should reuse the preloaded response]
|
||||
expected: NOTRUN
|
||||
|
||||
[Loading image (same-origin) with link (same-origin) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (no-cors) with link (no-cors) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (anonymous) with link (anonymous) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading image (use-credentials) with link (use-credentials) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading backgroundImage (no-cors) with link (no-cors) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
||||
[Loading backgroundImage (same-origin) with link (same-origin) should reuse the preloaded response]
|
||||
expected: FAIL
|
||||
|
|
3
tests/wpt/meta/preload/preload-xhr.html.ini
vendored
3
tests/wpt/meta/preload/preload-xhr.html.ini
vendored
|
@ -1,6 +1,3 @@
|
|||
[preload-xhr.html]
|
||||
[Make an XHR request immediately after creating link rel=preload.]
|
||||
expected: FAIL
|
||||
|
||||
[Make an XHR request after loading link rel=preload.]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[single-download-preload.html]
|
||||
[Makes sure that preloaded resources are not downloaded again when used]
|
||||
expected: FAIL
|
|
@ -8,21 +8,12 @@
|
|||
[<crossorigin="anonymous"> Same-origin with correct sha512 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Same-origin with empty integrity.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Same-origin with no integrity.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Same-origin with incorrect hash.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Same-origin with correct sha256 hash, options.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Same-origin with unknown algorithm only.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Same-origin with multiple sha256 hashes, including correct.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -56,9 +47,6 @@
|
|||
[Cross-origin, not CORS request, with incorrect sha256.]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin="anonymous"> Cross-origin with empty integrity.]
|
||||
expected: FAIL
|
||||
|
||||
[Cross-origin, not CORS request, with empty integrity.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,40 +1,13 @@
|
|||
[subresource-integrity.html]
|
||||
[Same-origin script with correct sha256 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with correct sha384 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with correct sha512 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with empty integrity.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with incorrect hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with multiple sha256 hashes, including correct.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with multiple sha256 hashes, including unknown algorithm.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with sha256 mismatch, sha512 match]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with sha256 match, sha512 mismatch]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='anonymous'> script with correct hash, ACAO: *]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='anonymous'> script with incorrect hash, ACAO: *]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='use-credentials'> script with correct hash, CORS-eligible]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='use-credentials'> script with incorrect hash CORS-eligible]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -47,21 +20,6 @@
|
|||
[Cross-origin script, not CORS request, with hash mismatch]
|
||||
expected: FAIL
|
||||
|
||||
[Cross-origin script, empty integrity]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with correct hash, options.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with unknown algorithm only.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with matching digest re-uses preload with matching digest.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with matching digest re-uses preload with matching digest and options.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin script with non-matching digest does not re-use preload with matching digest.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -86,42 +44,15 @@
|
|||
[Same-origin script with non-matching digest reuses preload with no digest but fails.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with correct sha256 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with correct sha384 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with correct sha512 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with empty integrity.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with incorrect hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with multiple sha256 hashes, including correct.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with multiple sha256 hashes, including unknown algorithm.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with sha256 mismatch, sha512 match]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with sha256 match, sha512 mismatch]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='anonymous'> style with correct hash, ACAO: *]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='anonymous'> style with incorrect hash, ACAO: *]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='use-credentials'> style with correct hash, CORS-eligible]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='use-credentials'> style with incorrect hash CORS-eligible]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -134,21 +65,6 @@
|
|||
[Cross-origin style, not CORS request, with hash mismatch]
|
||||
expected: FAIL
|
||||
|
||||
[Cross-origin style, empty integrity]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with correct hash, options.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with unknown algorithm only.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with matching digest re-uses preload with matching digest.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with matching digest re-uses preload with matching digest and options.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin style with non-matching digest does not re-use preload with matching digest.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -193,3 +109,39 @@
|
|||
|
||||
[Cross-origin image, not CORS request, with hash mismatch]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with correct sha256 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with correct sha384 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with correct sha512 hash.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with empty integrity.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with multiple sha256 hashes, including correct.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with multiple sha256 hashes, including unknown algorithm.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with sha256 mismatch, sha512 match]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='anonymous'> image with correct hash, ACAO: *]
|
||||
expected: FAIL
|
||||
|
||||
[<crossorigin='use-credentials'> image with correct hash, CORS-eligible]
|
||||
expected: FAIL
|
||||
|
||||
[Cross-origin image, empty integrity]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with correct hash, options.]
|
||||
expected: FAIL
|
||||
|
||||
[Same-origin image with unknown algorithm only.]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[link.html]
|
||||
expected: TIMEOUT
|
||||
[The initiator type for css resources embedded in css must be 'css']
|
||||
expected: FAIL
|
||||
|
||||
|
@ -15,11 +14,8 @@
|
|||
[The initiator type for <link preload> must be 'link']
|
||||
expected: FAIL
|
||||
|
||||
[The initiator type for <link prerender> must be 'link']
|
||||
expected: TIMEOUT
|
||||
|
||||
[The initiator type for <link manifest> must be 'link']
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
||||
[The initiator type for module preload must be 'other']
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue