mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Handle HTTP Refresh header (#36393)
Move parsing of Refresh values to Document. Send Refresh header to Document and have meta tags reuse the logic. I transplanted the existing Regex and made some updates so that it passed all the existing parser tests. I added the comments that made sense but it is not very clean to add many comments within the regex. Testing: There are existing WPT tests --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
This commit is contained in:
parent
80a6ba5e42
commit
2c7aeca404
13 changed files with 147 additions and 373 deletions
|
@ -55,6 +55,7 @@ use euclid::default::Rect;
|
|||
use fonts::{FontContext, SystemFontServiceProxy};
|
||||
use headers::{HeaderMapExt, LastModified, ReferrerPolicy as ReferrerPolicyHeader};
|
||||
use html5ever::{local_name, namespace_url, ns};
|
||||
use http::header::REFRESH;
|
||||
use hyper_serde::Serde;
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
|
@ -3205,8 +3206,14 @@ impl ScriptThread {
|
|||
.as_deref()
|
||||
.and_then(|h| h.typed_get::<ReferrerPolicyHeader>())
|
||||
.into();
|
||||
|
||||
document.set_referrer_policy(referrer_policy);
|
||||
|
||||
let refresh_header = metadata.headers.as_deref().and_then(|h| h.get(REFRESH));
|
||||
if let Some(refresh_val) = refresh_header {
|
||||
// There are tests that this header handles Unicode code points
|
||||
document.shared_declarative_refresh_steps(refresh_val.as_bytes());
|
||||
}
|
||||
|
||||
document.set_ready_state(DocumentReadyState::Loading, can_gc);
|
||||
|
||||
self.documents
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue