mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Delay stylesheet load in test to increase confidence.
This commit is contained in:
parent
f3cdba6b8b
commit
a1ae53a230
12 changed files with 82 additions and 116 deletions
|
@ -108,7 +108,7 @@ impl Pipeline {
|
||||||
script_port,
|
script_port,
|
||||||
constellation_chan.clone(),
|
constellation_chan.clone(),
|
||||||
failure.clone(),
|
failure.clone(),
|
||||||
resource_task.clone(),
|
resource_task,
|
||||||
storage_task.clone(),
|
storage_task.clone(),
|
||||||
image_cache_task.clone(),
|
image_cache_task.clone(),
|
||||||
devtools_chan,
|
devtools_chan,
|
||||||
|
|
|
@ -610,7 +610,7 @@ impl LayoutTask {
|
||||||
Some(environment_encoding),
|
Some(environment_encoding),
|
||||||
Origin::Author);
|
Origin::Author);
|
||||||
|
|
||||||
//TODO: mark critical subresources as blocking load as well
|
//TODO: mark critical subresources as blocking load as well (#5974)
|
||||||
let ScriptControlChan(ref chan) = self.script_chan;
|
let ScriptControlChan(ref chan) = self.script_chan;
|
||||||
chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, url, responder)).unwrap();
|
chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, url, responder)).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -126,13 +126,14 @@ pub enum ControlMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialized but unsent request. Encapsulates everything necessary to instruct
|
/// Initialized but unsent request. Encapsulates everything necessary to instruct
|
||||||
/// the resource task to make a new request.
|
/// the resource task to make a new request. The `load` method *must* be called before
|
||||||
|
/// destruction or the task will panic.
|
||||||
pub struct PendingAsyncLoad {
|
pub struct PendingAsyncLoad {
|
||||||
resource_task: ResourceTask,
|
resource_task: ResourceTask,
|
||||||
url: Url,
|
url: Url,
|
||||||
pipeline: Option<PipelineId>,
|
pipeline: Option<PipelineId>,
|
||||||
input_chan: Sender<LoadResponse>,
|
input_sender: Sender<LoadResponse>,
|
||||||
input_port: Receiver<LoadResponse>,
|
input_receiver: Receiver<LoadResponse>,
|
||||||
guard: PendingLoadGuard,
|
guard: PendingLoadGuard,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,13 +156,13 @@ impl Drop for PendingLoadGuard {
|
||||||
impl PendingAsyncLoad {
|
impl PendingAsyncLoad {
|
||||||
pub fn new(resource_task: ResourceTask, url: Url, pipeline: Option<PipelineId>)
|
pub fn new(resource_task: ResourceTask, url: Url, pipeline: Option<PipelineId>)
|
||||||
-> PendingAsyncLoad {
|
-> PendingAsyncLoad {
|
||||||
let (tx, rx) = channel();
|
let (sender, receiver) = channel();
|
||||||
PendingAsyncLoad {
|
PendingAsyncLoad {
|
||||||
resource_task: resource_task,
|
resource_task: resource_task,
|
||||||
url: url,
|
url: url,
|
||||||
pipeline: pipeline,
|
pipeline: pipeline,
|
||||||
input_chan: tx,
|
input_sender: sender,
|
||||||
input_port: rx,
|
input_receiver: receiver,
|
||||||
guard: PendingLoadGuard { loaded: false, },
|
guard: PendingLoadGuard { loaded: false, },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,8 +171,9 @@ impl PendingAsyncLoad {
|
||||||
pub fn load(mut self) -> Receiver<LoadResponse> {
|
pub fn load(mut self) -> Receiver<LoadResponse> {
|
||||||
self.guard.neuter();
|
self.guard.neuter();
|
||||||
let load_data = LoadData::new(self.url, self.pipeline);
|
let load_data = LoadData::new(self.url, self.pipeline);
|
||||||
self.resource_task.send(ControlMsg::Load(load_data, LoadConsumer::Channel(self.input_chan))).unwrap();
|
let consumer = LoadConsumer::Channel(self.input_sender);
|
||||||
self.input_port
|
self.resource_task.send(ControlMsg::Load(load_data, consumer)).unwrap();
|
||||||
|
self.input_receiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,7 @@ impl DocumentLoader {
|
||||||
data: Option<NotifierData>,
|
data: Option<NotifierData>,
|
||||||
initial_load: Option<Url>,)
|
initial_load: Option<Url>,)
|
||||||
-> DocumentLoader {
|
-> DocumentLoader {
|
||||||
let mut initial_loads = vec!();
|
let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect();
|
||||||
if let Some(load) = initial_load {
|
|
||||||
initial_loads.push(LoadType::PageSource(load));
|
|
||||||
}
|
|
||||||
|
|
||||||
DocumentLoader {
|
DocumentLoader {
|
||||||
resource_task: resource_task,
|
resource_task: resource_task,
|
||||||
|
@ -70,15 +67,16 @@ impl DocumentLoader {
|
||||||
|
|
||||||
/// Create a new pending network request, which can be initiated at some point in
|
/// Create a new pending network request, which can be initiated at some point in
|
||||||
/// the future.
|
/// the future.
|
||||||
pub fn prep_async_load(&mut self, load: LoadType) -> PendingAsyncLoad {
|
pub fn prepare_async_load(&mut self, load: LoadType) -> PendingAsyncLoad {
|
||||||
self.blocking_loads.push(load.clone());
|
let url = load.url().clone();
|
||||||
|
self.blocking_loads.push(load);
|
||||||
let pipeline = self.notifier_data.as_ref().map(|data| data.pipeline);
|
let pipeline = self.notifier_data.as_ref().map(|data| data.pipeline);
|
||||||
PendingAsyncLoad::new(self.resource_task.clone(), load.url().clone(), pipeline)
|
PendingAsyncLoad::new(self.resource_task.clone(), url, pipeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create and initiate a new network request.
|
/// Create and initiate a new network request.
|
||||||
pub fn load_async(&mut self, load: LoadType) -> Receiver<LoadResponse> {
|
pub fn load_async(&mut self, load: LoadType) -> Receiver<LoadResponse> {
|
||||||
let pending = self.prep_async_load(load);
|
let pending = self.prepare_async_load(load);
|
||||||
pending.load()
|
pending.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ pub trait DocumentHelpers<'a> {
|
||||||
fn cancel_animation_frame(self, ident: i32);
|
fn cancel_animation_frame(self, ident: i32);
|
||||||
/// http://w3c.github.io/animation-timing/#dfn-invoke-callbacks-algorithm
|
/// http://w3c.github.io/animation-timing/#dfn-invoke-callbacks-algorithm
|
||||||
fn invoke_animation_callbacks(self);
|
fn invoke_animation_callbacks(self);
|
||||||
fn prep_async_load(self, load: LoadType) -> PendingAsyncLoad;
|
fn prepare_async_load(self, load: LoadType) -> PendingAsyncLoad;
|
||||||
fn load_async(self, load: LoadType) -> Receiver<LoadResponse>;
|
fn load_async(self, load: LoadType) -> Receiver<LoadResponse>;
|
||||||
fn load_sync(self, load: LoadType) -> Result<(Metadata, Vec<u8>), String>;
|
fn load_sync(self, load: LoadType) -> Result<(Metadata, Vec<u8>), String>;
|
||||||
fn finish_load(self, load: LoadType);
|
fn finish_load(self, load: LoadType);
|
||||||
|
@ -885,9 +885,9 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prep_async_load(self, load: LoadType) -> PendingAsyncLoad {
|
fn prepare_async_load(self, load: LoadType) -> PendingAsyncLoad {
|
||||||
let mut loader = self.loader.borrow_mut();
|
let mut loader = self.loader.borrow_mut();
|
||||||
loader.prep_async_load(load)
|
loader.prepare_async_load(load)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_async(self, load: LoadType) -> Receiver<LoadResponse> {
|
fn load_async(self, load: LoadType) -> Receiver<LoadResponse> {
|
||||||
|
|
|
@ -159,7 +159,7 @@ impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
|
||||||
let link_element = Trusted::new(window.get_cx(), self, window.script_chan().clone());
|
let link_element = Trusted::new(window.get_cx(), self, window.script_chan().clone());
|
||||||
let load_dispatcher = StylesheetLoadDispatcher::new(link_element);
|
let load_dispatcher = StylesheetLoadDispatcher::new(link_element);
|
||||||
|
|
||||||
let pending = doc.r().prep_async_load(LoadType::Stylesheet(url.clone()));
|
let pending = doc.r().prepare_async_load(LoadType::Stylesheet(url.clone()));
|
||||||
let LayoutChan(ref layout_chan) = window.layout_chan();
|
let LayoutChan(ref layout_chan) = window.layout_chan();
|
||||||
layout_chan.send(Msg::LoadStylesheet(url, media, pending, box load_dispatcher)).unwrap();
|
layout_chan.send(Msg::LoadStylesheet(url, media, pending, box load_dispatcher)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -732,8 +732,8 @@ impl ScriptTask {
|
||||||
ConstellationControlMsg::TickAllAnimations(pipeline_id) =>
|
ConstellationControlMsg::TickAllAnimations(pipeline_id) =>
|
||||||
self.handle_tick_all_animations(pipeline_id),
|
self.handle_tick_all_animations(pipeline_id),
|
||||||
ConstellationControlMsg::StylesheetLoadComplete(id, url, responder) => {
|
ConstellationControlMsg::StylesheetLoadComplete(id, url, responder) => {
|
||||||
self.handle_resource_loaded(id, LoadType::Stylesheet(url));
|
|
||||||
responder.respond();
|
responder.respond();
|
||||||
|
self.handle_resource_loaded(id, LoadType::Stylesheet(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12553,6 +12553,10 @@
|
||||||
"path": "html/semantics/document-metadata/the-base-element/base_multiple.html",
|
"path": "html/semantics/document-metadata/the-base-element/base_multiple.html",
|
||||||
"url": "/html/semantics/document-metadata/the-base-element/base_multiple.html"
|
"url": "/html/semantics/document-metadata/the-base-element/base_multiple.html"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "html/semantics/document-metadata/the-link-element/link-load-event.html",
|
||||||
|
"url": "/html/semantics/document-metadata/the-link-element/link-load-event.html"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "html/semantics/document-metadata/the-link-element/link-rellist.html",
|
"path": "html/semantics/document-metadata/the-link-element/link-rellist.html",
|
||||||
"url": "/html/semantics/document-metadata/the-link-element/link-rellist.html"
|
"url": "/html/semantics/document-metadata/the-link-element/link-rellist.html"
|
||||||
|
@ -25924,4 +25928,4 @@
|
||||||
"rev": "fef3eb9bbb033d1d7150f4c70ecc1a5f59bcf115",
|
"rev": "fef3eb9bbb033d1d7150f4c70ecc1a5f59bcf115",
|
||||||
"url_base": "/",
|
"url_base": "/",
|
||||||
"version": 2
|
"version": 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,55 @@
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
[src removed]
|
[src removed]
|
||||||
expected: FAIL
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[inserted into picture]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[removed from picture]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source inserted]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source removed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has srcset set]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has srcset changed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has srcset removed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has sizes set]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has sizes changed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has sizes removed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has media set]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has media changed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has media removed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has type set]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has type changed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
[parent is picture, previous source has type removed]
|
||||||
|
expected: TIMEOUT
|
||||||
|
|
||||||
[srcset set]
|
[srcset set]
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
|
@ -52,84 +100,3 @@
|
||||||
[crossorigin use-credentials to anonymous]
|
[crossorigin use-credentials to anonymous]
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
|
|
||||||
[crossorigin state not changed: absent, removeAttribute]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[crossorigin state not changed: empty to anonymous]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[crossorigin state not changed: anonymous to foobar]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[crossorigin state not changed: use-credentials to USE-CREDENTIALS]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[inserted into picture ancestor]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[removed from picture ancestor]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[ancestor picture has a source inserted]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[ancestor picture has a source removed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[ancestor picture; previous sibling source inserted]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[ancestor picture; previous sibling source removed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following sibling source inserted]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following sibling source removed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following sibling source has srcset set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[media on img set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[type on img set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[class on img set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[alt on img set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[src on previous sibling source set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[class on previous sibling source set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[inserted/removed children of img]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[picture is inserted]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[picture is removed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following img inserted]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following img removed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following img has src set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following img has srcset set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[parent is picture, following img has sizes set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
|
@ -521,12 +521,6 @@
|
||||||
"url": "/_mozilla/mozilla/storage.html"
|
"url": "/_mozilla/mozilla/storage.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"mozilla/stylesheet_load.html": [
|
|
||||||
{
|
|
||||||
"path": "mozilla/stylesheet_load.html",
|
|
||||||
"url": "/_mozilla/mozilla/stylesheet_load.html"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"mozilla/textcontent.html": [
|
"mozilla/textcontent.html": [
|
||||||
{
|
{
|
||||||
"path": "mozilla/textcontent.html",
|
"path": "mozilla/textcontent.html",
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<link rel="author" title="Josh Matthews" href="mailto:josh@joshmatthews.net">
|
||||||
|
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<link href="resources/style.css" rel="stylesheet" id="style_test"></link>
|
<link href="style.css?pipe=trickle(d3)" rel="stylesheet" id="style_test"></link>
|
||||||
<script>
|
<script>
|
||||||
var saw_link_onload = false;
|
var saw_link_onload = false;
|
||||||
var t = async_test();
|
var t = async_test("Check if the stylesheet's load event blocks the document load event");
|
||||||
document.getElementById('style_test').onload = t.step_func(function() {
|
document.getElementById('style_test').onload = t.step_func(function() {
|
||||||
saw_link_onload = true;
|
saw_link_onload = true;
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue