mirror of
https://github.com/lexmount/moli.git
synced 2026-11-21 16:03:10 +00:00
fix(history): restore historical srcdoc documents
Retain srcdoc resources by history Document identity, including the original source, base URL, policy and origin. Restore each entry URL separately and apply the current iframe sandbox flags when reconstructing the Document. Cover top-level and popup child traversal, classic and Navigation API state, and sandbox script/origin changes.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
async function iframeSrcdocSandboxHistory(before, after, ordinaryURL) {
|
||||
const frame = document.createElement('iframe');
|
||||
const loaded = () => new Promise(resolve => frame.addEventListener('load', resolve, {once: true}));
|
||||
const settle = () => new Promise(resolve => setTimeout(resolve, 0));
|
||||
const messages = [];
|
||||
const receive = event => { if (event.source === frame.contentWindow) messages.push(event.data); };
|
||||
addEventListener('message', receive);
|
||||
const navigate = async action => {
|
||||
const ready = loaded();
|
||||
action();
|
||||
await ready;
|
||||
await settle();
|
||||
};
|
||||
try {
|
||||
frame.setAttribute('sandbox', before);
|
||||
await navigate(() => { frame.src = ordinaryURL; document.body.append(frame); });
|
||||
await navigate(() => frame.srcdoc = '<p>historical sandbox source</p>' +
|
||||
'<script>parent.postMessage({origin:origin, text:document.querySelector("p").textContent}, "*")<' + '/script>');
|
||||
await navigate(() => frame.contentWindow.location.href = ordinaryURL + '&away');
|
||||
messages.length = 0;
|
||||
frame.setAttribute('sandbox', after);
|
||||
await navigate(() => history.back());
|
||||
// Messages queued by parser scripts precede the load/next-task boundary.
|
||||
return {messages, accessible: frame.contentDocument !== null};
|
||||
} finally {
|
||||
removeEventListener('message', receive);
|
||||
frame.remove();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
async function iframeSrcdocTraversal(root, api, route, originalURL) {
|
||||
const frame = root.document.createElement('iframe');
|
||||
const loaded = () => new Promise(resolve => frame.addEventListener('load', resolve, {once: true}));
|
||||
const settle = () => new Promise(resolve => setTimeout(resolve, 0));
|
||||
const steps = [];
|
||||
const check = (condition, message) => { if (!condition) throw new Error(message); };
|
||||
const source = label => '<!doctype html><meta charset="utf-8"><base href="/historical/">' +
|
||||
'<p>' + label + '</p><script>window.sourceMarker=' + JSON.stringify(label) + ';<' + '/script>';
|
||||
const change = async action => {
|
||||
const ready = loaded();
|
||||
action();
|
||||
await ready;
|
||||
await settle();
|
||||
};
|
||||
const setSource = value => api === 'property' ? frame.srcdoc = value : frame.setAttribute('srcdoc', value);
|
||||
const remember = () => {
|
||||
const child = frame.contentWindow;
|
||||
const entry = child.navigation.currentEntry;
|
||||
return {key: entry.key, id: entry.id, url: child.location.href, charset: child.document.characterSet};
|
||||
};
|
||||
let initialLength;
|
||||
const restored = (label, expected, text, state, navigationState, activation = expected) => {
|
||||
const child = frame.contentWindow;
|
||||
check(child.location.href === expected.url, label + ': URL');
|
||||
check(child.navigation.currentEntry.key === expected.key, label + ': key');
|
||||
check(child.navigation.currentEntry.id === expected.id, label + ': id');
|
||||
check(child.navigation.activation.navigationType === 'traverse', label + ': activation');
|
||||
check(child.navigation.activation.entry.id === activation.id, label + ': activation entry');
|
||||
check(child.document.querySelector('p').textContent === text, label + ': source');
|
||||
check(child.sourceMarker === text, label + ': script execution');
|
||||
check(child.document.characterSet === expected.charset, label + ': charset');
|
||||
check(child.document.baseURI === new URL('/historical/', originalURL).href, label + ': base URL');
|
||||
check(JSON.stringify(child.history.state) === JSON.stringify(state), label + ': classic state');
|
||||
check(JSON.stringify(child.navigation.currentEntry.getState()) === JSON.stringify(navigationState), label + ': navigation state');
|
||||
check(frame.getAttribute('srcdoc') === source('new'), label + ': attribute changed during traversal');
|
||||
check(root.history.length === initialLength + 3, label + ': joint history length');
|
||||
steps.push(label);
|
||||
};
|
||||
try {
|
||||
await change(() => { frame.src = originalURL; root.document.body.append(frame); });
|
||||
initialLength = root.history.length;
|
||||
await change(() => setSource(source('discarded')));
|
||||
await change(() => setSource(source('old')));
|
||||
frame.contentWindow.history.replaceState({label: 'old'}, '');
|
||||
frame.contentWindow.navigation.updateCurrentEntry({state: {label: 'old-navigation'}});
|
||||
const old = remember();
|
||||
if (route === 'fragment') {
|
||||
frame.contentWindow.history.pushState({label: 'fragment'}, '', 'about:srcdoc#old');
|
||||
frame.contentWindow.navigation.updateCurrentEntry({state: {label: 'fragment-navigation'}});
|
||||
} else {
|
||||
await change(() => frame.contentWindow.location.href = originalURL + '&middle');
|
||||
}
|
||||
const middle = remember();
|
||||
await change(() => setSource(source('new')));
|
||||
const newer = remember();
|
||||
await change(() => root.history.back());
|
||||
if (route === 'fragment') {
|
||||
restored('back-middle', middle, 'old', {label: 'fragment'}, {label: 'fragment-navigation'});
|
||||
const documentBefore = frame.contentDocument;
|
||||
const popped = new Promise(resolve => frame.contentWindow.addEventListener('popstate', resolve, {once: true}));
|
||||
root.history.back();
|
||||
await popped;
|
||||
check(frame.contentDocument === documentBefore, 'same-document back replaced the Document');
|
||||
} else {
|
||||
check(frame.contentWindow.location.href === middle.url, 'ordinary URL was replaced by srcdoc');
|
||||
check(frame.contentWindow.sourceMarker === undefined, 'ordinary URL reused srcdoc source');
|
||||
steps.push('back-middle');
|
||||
await change(() => root.history.back());
|
||||
}
|
||||
restored('back-old', old, 'old', {label: 'old'}, {label: 'old-navigation'}, route === 'fragment' ? middle : old);
|
||||
await change(() => root.history.go(2));
|
||||
restored('forward-new', newer, 'new', null, undefined);
|
||||
await change(() => frame.contentWindow.history.go(-2));
|
||||
restored('child-back-old', old, 'old', {label: 'old'}, {label: 'old-navigation'});
|
||||
return steps;
|
||||
} finally {
|
||||
frame.remove();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,115 @@ use serde_json::{Value, json};
|
||||
use tokio::time::Duration;
|
||||
use url::Url;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn iframe_srcdoc_traversal_reapplies_sandbox_flags_and_preserves_origin() -> Result<()> {
|
||||
let fixture = include_str!("fixtures/iframe-srcdoc-sandbox-history.js");
|
||||
let server = FixtureServer::spawn().await?;
|
||||
for (before, after, scripts, accessible) in [
|
||||
(
|
||||
"allow-same-origin",
|
||||
"allow-same-origin allow-scripts",
|
||||
true,
|
||||
true,
|
||||
),
|
||||
(
|
||||
"allow-same-origin allow-scripts",
|
||||
"allow-same-origin",
|
||||
false,
|
||||
true,
|
||||
),
|
||||
(
|
||||
"allow-scripts",
|
||||
"allow-same-origin allow-scripts",
|
||||
true,
|
||||
false,
|
||||
),
|
||||
(
|
||||
"allow-same-origin allow-scripts",
|
||||
"allow-scripts",
|
||||
true,
|
||||
false,
|
||||
),
|
||||
] {
|
||||
let browser = Browser::new(BrowserConfig::default())?;
|
||||
let markup = format!(
|
||||
r#"<!doctype html><body><script>{fixture}
|
||||
window.finished = iframeSrcdocSandboxHistory({before:?}, {after:?}, new URL('/static?sandbox-source', location.href).href);
|
||||
</script>"#
|
||||
);
|
||||
let mut url = Url::parse(&server.url("/compat/child-dynamic-markup-document"))?;
|
||||
url.query_pairs_mut().append_pair("markup", &markup);
|
||||
let result = tokio::time::timeout(Duration::from_secs(10), async {
|
||||
let mut page = browser.fetch(url.as_str()).await?;
|
||||
page.evaluate_runtime_expression_with_await_async(
|
||||
"finished.then(value => JSON.stringify(value))",
|
||||
true,
|
||||
)
|
||||
.await
|
||||
})
|
||||
.await??;
|
||||
let result: Value =
|
||||
serde_json::from_str(result["value"].as_str().expect("sandbox history result"))?;
|
||||
let messages = if scripts {
|
||||
json!([{"origin": if accessible { url.origin().ascii_serialization() } else { "null".to_owned() },
|
||||
"text": "historical sandbox source"}])
|
||||
} else {
|
||||
json!([])
|
||||
};
|
||||
assert_eq!(
|
||||
result,
|
||||
json!({"messages": messages, "accessible": accessible}),
|
||||
"{before} -> {after}"
|
||||
);
|
||||
}
|
||||
server.shutdown().await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn iframe_srcdoc_traversal_restores_each_historical_document_resource() -> Result<()> {
|
||||
let fixture = include_str!("fixtures/iframe-srcdoc-traversal.js");
|
||||
let server = FixtureServer::spawn().await?;
|
||||
for mode in ["top", "popup"] {
|
||||
for api in ["property", "setAttribute"] {
|
||||
for route in ["fragment", "url"] {
|
||||
let browser = Browser::new(BrowserConfig::default())?;
|
||||
let markup = format!(
|
||||
r#"<!doctype html><body><script>{fixture}
|
||||
window.finished = (async () => {{
|
||||
const root = {mode:?} === 'popup' ? open('/static?traversal-popup') : window;
|
||||
if (root !== window) await new Promise(resolve => root.addEventListener('load', resolve, {{once:true}}));
|
||||
const openerLength = history.length;
|
||||
try {{
|
||||
const result = await iframeSrcdocTraversal(root, {api:?}, {route:?}, new URL('/static?traversal-original', location.href).href);
|
||||
if (root !== window && history.length !== openerLength) throw new Error('popup changed opener history');
|
||||
return result;
|
||||
}} finally {{ if (root !== window) root.close(); }}
|
||||
}})();</script>"#
|
||||
);
|
||||
let mut url = Url::parse(&server.url("/compat/child-dynamic-markup-document"))?;
|
||||
url.query_pairs_mut().append_pair("markup", &markup);
|
||||
let result = tokio::time::timeout(Duration::from_secs(10), async {
|
||||
let mut page = browser.fetch(url.as_str()).await?;
|
||||
page.evaluate_runtime_expression_with_await_async(
|
||||
"finished.then(value => JSON.stringify(value))",
|
||||
true,
|
||||
)
|
||||
.await
|
||||
})
|
||||
.await??;
|
||||
assert_eq!(
|
||||
result["value"],
|
||||
json!(r#"["back-middle","back-old","forward-new","child-back-old"]"#),
|
||||
"{mode}/{api}/{route}: {result}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
server.shutdown().await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn iframe_attribute_history(phase: &str, api: &str, attribute: &str) -> Result<Value> {
|
||||
let child = r#"<!doctype html><body><script>
|
||||
const phase = new URL(location.href).searchParams.get('phase');
|
||||
|
||||
@@ -239,6 +239,11 @@ impl PageScriptHost {
|
||||
let current_owner = owner_transition
|
||||
.current_owner()
|
||||
.expect("child document commit must install a current owner");
|
||||
if let Some(origin) = self.child_window_access_origin(handle)
|
||||
&& let Some(entry) = self.child_browsing_contexts.get_mut(&handle)
|
||||
{
|
||||
entry.remember_srcdoc_history_resource(snapshot, origin);
|
||||
}
|
||||
let owner_local_window_id = current_owner.local_window_id;
|
||||
let owner_document_id = current_owner.document_id;
|
||||
self.dom_host_mut()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::super::{ChildBrowsingContextBootstrap, ChildBrowsingContextSnapshot, PageScriptHost};
|
||||
use crate::document_response_decoder::decode_document_response;
|
||||
use crate::document_runtime::{DocumentPolicyContainer, DomHandle};
|
||||
#[cfg(test)]
|
||||
use moli_web_mime::resource_mime_essence_for_url;
|
||||
use moli_web_mime::{
|
||||
is_html_document_mime, resource_mime_essence_for_url, response_document_content_type,
|
||||
};
|
||||
@@ -102,13 +104,22 @@ impl PageScriptHost {
|
||||
),
|
||||
)
|
||||
}
|
||||
ChildBrowsingContextBootstrap::Srcdoc { base_url, markup } => Some(
|
||||
self.apply_page_csp_bypass_to_child_snapshot(ChildBrowsingContextSnapshot::srcdoc(
|
||||
base_url.clone(),
|
||||
markup.clone(),
|
||||
self.document_character_set().to_owned(),
|
||||
)),
|
||||
),
|
||||
ChildBrowsingContextBootstrap::Srcdoc { base_url, markup } => {
|
||||
if let Some(snapshot) = self
|
||||
.child_browsing_contexts
|
||||
.get(&handle)
|
||||
.and_then(|entry| entry.pending_srcdoc_history_snapshot())
|
||||
{
|
||||
return Some(self.apply_page_csp_bypass_to_child_snapshot(snapshot));
|
||||
}
|
||||
Some(self.apply_page_csp_bypass_to_child_snapshot(
|
||||
ChildBrowsingContextSnapshot::srcdoc(
|
||||
base_url.clone(),
|
||||
markup.clone(),
|
||||
self.document_character_set().to_owned(),
|
||||
),
|
||||
))
|
||||
}
|
||||
ChildBrowsingContextBootstrap::Url(url) => {
|
||||
self.materialize_local_child_snapshot_for_navigation_url(handle, url)
|
||||
}
|
||||
@@ -127,6 +138,7 @@ fn child_document_content_type_from_header_value(value: &str) -> Option<String>
|
||||
moli_web_mime::mime_essence(value)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(in crate::native_bridge::context_host) fn child_document_content_type_for_url(
|
||||
url: &Url,
|
||||
) -> Option<String> {
|
||||
|
||||
@@ -188,6 +188,11 @@ impl PageScriptHost {
|
||||
let Some(url) = Url::parse(resolved_url).ok() else {
|
||||
return false;
|
||||
};
|
||||
let bootstrap = self
|
||||
.child_browsing_contexts
|
||||
.get(&handle)
|
||||
.and_then(|entry| entry.srcdoc_history_bootstrap(&entry_seed))
|
||||
.unwrap_or_else(|| ChildBrowsingContextBootstrap::Url(url.clone()));
|
||||
self.reject_replaced_service_worker_child_client_navigation(
|
||||
handle,
|
||||
"The navigation was canceled.".to_owned(),
|
||||
@@ -196,12 +201,7 @@ impl PageScriptHost {
|
||||
entry.replace_navigation_entry_seed(entry_seed);
|
||||
}
|
||||
if self
|
||||
.set_child_browsing_context_pending_navigation(
|
||||
handle,
|
||||
ChildBrowsingContextBootstrap::Url(url.clone()),
|
||||
initiator_url,
|
||||
false,
|
||||
)
|
||||
.set_child_browsing_context_pending_navigation(handle, bootstrap, initiator_url, false)
|
||||
.is_none()
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -24,7 +24,8 @@ use moli_page_types::{
|
||||
apply_child_browsing_context_navigation_to_entry_seed as apply_child_navigation_to_seed,
|
||||
replace_child_browsing_context_navigation_in_entry_seed as replace_child_navigation_in_seed,
|
||||
};
|
||||
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
use url::Url;
|
||||
|
||||
mod classic_scripts;
|
||||
@@ -33,6 +34,7 @@ mod lookup;
|
||||
mod module_scripts;
|
||||
mod registry;
|
||||
mod request_scope;
|
||||
mod srcdoc_history;
|
||||
mod stylesheets;
|
||||
|
||||
pub(in crate::native_bridge::context_host) use classic_scripts::ChildParserClassicScriptCandidate;
|
||||
@@ -60,6 +62,8 @@ pub(super) struct ChildBrowsingContextEntry {
|
||||
navigation_entry_seed: NavigationHistoryEntrySeed,
|
||||
committed_navigation_entry_seed: NavigationHistoryEntrySeed,
|
||||
cached_snapshot: Option<ChildBrowsingContextSnapshot>,
|
||||
srcdoc_history:
|
||||
HashMap<NavigationHistoryDocumentId, Arc<srcdoc_history::SrcdocHistoryResource>>,
|
||||
document_policy_container: ChildDocumentPolicyContainer,
|
||||
document_internal_ancestor_origins: Vec<WindowAccessOrigin>,
|
||||
ancestor_origins_referrer_policy_snapshot: ChildAncestorOriginsReferrerPolicy,
|
||||
@@ -219,7 +223,8 @@ impl ChildBrowsingContextEntry {
|
||||
self.live_bootstrap,
|
||||
ChildBrowsingContextBootstrap::Srcdoc { .. }
|
||||
) {
|
||||
return child_document_url_for_bootstrap(&self.live_bootstrap);
|
||||
return child_navigation_current_url_as_url(&self.committed_navigation_entry_seed)
|
||||
.or_else(|| child_document_url_for_bootstrap(&self.live_bootstrap));
|
||||
}
|
||||
if self.pending_attribute_bootstrap_commit || self.has_pending_window_state() {
|
||||
return child_document_url_for_bootstrap(&self.live_bootstrap);
|
||||
@@ -619,6 +624,7 @@ impl ChildBrowsingContextEntry {
|
||||
|
||||
pub(super) fn commit_current_navigation_entry_seed(&mut self) {
|
||||
self.committed_navigation_entry_seed = self.navigation_entry_seed.clone();
|
||||
self.prune_srcdoc_history();
|
||||
}
|
||||
|
||||
pub(super) fn restore_navigation_entry_seed_from_committed(&mut self) {
|
||||
@@ -744,6 +750,7 @@ impl ChildBrowsingContextEntry {
|
||||
}
|
||||
if same_document_update {
|
||||
self.committed_navigation_entry_seed = entry_seed;
|
||||
self.prune_srcdoc_history();
|
||||
if !self.pending_attribute_bootstrap_commit {
|
||||
self.pending_live_navigation_reflects_window_state = false;
|
||||
}
|
||||
|
||||
@@ -544,6 +544,10 @@ impl PageScriptHost {
|
||||
navigation_entry_seed,
|
||||
committed_navigation_entry_seed,
|
||||
cached_snapshot,
|
||||
srcdoc_history: existing
|
||||
.as_ref()
|
||||
.map(|entry| entry.srcdoc_history.clone())
|
||||
.unwrap_or_default(),
|
||||
document_policy_container,
|
||||
document_internal_ancestor_origins,
|
||||
ancestor_origins_referrer_policy_snapshot,
|
||||
|
||||
@@ -405,6 +405,9 @@ impl PageScriptHost {
|
||||
if entry.document_sandbox_forces_opaque_origin() {
|
||||
return Some("null".to_owned());
|
||||
}
|
||||
if let Some(origin) = entry.current_srcdoc_history_origin() {
|
||||
return Some(origin.serialized_origin());
|
||||
}
|
||||
if entry.security_origin_inherited() {
|
||||
return Some(self.child_browsing_context_creator_origin(handle));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
use super::{
|
||||
ChildBrowsingContextBootstrap, ChildBrowsingContextEntry, ChildBrowsingContextSnapshot,
|
||||
NavigationHistoryEntrySeed, NavigationHistorySerializedEntry, WindowAccessOrigin,
|
||||
};
|
||||
use crate::document_runtime::DocumentSandboxPolicy;
|
||||
use std::sync::Arc;
|
||||
use url::Url;
|
||||
|
||||
/// The resource belongs to a historical Document, not to its owner element's
|
||||
/// current srcdoc attribute. Same-document entries share the original source,
|
||||
/// fallback base URL and policy, while each entry retains its own URL/state.
|
||||
#[derive(Debug)]
|
||||
pub(super) struct SrcdocHistoryResource {
|
||||
snapshot: ChildBrowsingContextSnapshot,
|
||||
origin: WindowAccessOrigin,
|
||||
}
|
||||
|
||||
fn current_entry(seed: &NavigationHistoryEntrySeed) -> Option<&NavigationHistorySerializedEntry> {
|
||||
seed.entries
|
||||
.iter()
|
||||
.find(|entry| entry.history_index == seed.current_index)
|
||||
}
|
||||
|
||||
impl ChildBrowsingContextEntry {
|
||||
pub(in crate::native_bridge::context_host) fn srcdoc_history_bootstrap(
|
||||
&self,
|
||||
seed: &NavigationHistoryEntrySeed,
|
||||
) -> Option<ChildBrowsingContextBootstrap> {
|
||||
let resource = self.srcdoc_history.get(¤t_entry(seed)?.document_id)?;
|
||||
Some(ChildBrowsingContextBootstrap::Srcdoc {
|
||||
base_url: resource.snapshot.fallback_base_url.clone()?,
|
||||
markup: resource.snapshot.markup.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
pub(in crate::native_bridge::context_host) fn pending_srcdoc_history_snapshot(
|
||||
&self,
|
||||
) -> Option<ChildBrowsingContextSnapshot> {
|
||||
let entry = current_entry(&self.navigation_entry_seed)?;
|
||||
let mut snapshot = self
|
||||
.srcdoc_history
|
||||
.get(&entry.document_id)?
|
||||
.snapshot
|
||||
.clone();
|
||||
snapshot.url = Url::parse(&entry.url).ok()?;
|
||||
// The iframe's current sandbox attribute is applied at commit. Only
|
||||
// CSP restrictions belong to the historical policy container; keeping
|
||||
// the old owner flags would prevent a later relaxation from taking
|
||||
// effect when the historical Document is reconstructed.
|
||||
snapshot.policy_container.sandbox =
|
||||
DocumentSandboxPolicy::from_response_content_security_policies(
|
||||
&snapshot.policy_container.response_content_security_policies,
|
||||
);
|
||||
Some(snapshot)
|
||||
}
|
||||
|
||||
pub(in crate::native_bridge::context_host) fn current_srcdoc_history_origin(
|
||||
&self,
|
||||
) -> Option<&WindowAccessOrigin> {
|
||||
if !matches!(
|
||||
self.live_bootstrap,
|
||||
ChildBrowsingContextBootstrap::Srcdoc { .. }
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
let entry = current_entry(&self.committed_navigation_entry_seed)?;
|
||||
Some(&self.srcdoc_history.get(&entry.document_id)?.origin)
|
||||
}
|
||||
|
||||
pub(in crate::native_bridge::context_host) fn remember_srcdoc_history_resource(
|
||||
&mut self,
|
||||
snapshot: &ChildBrowsingContextSnapshot,
|
||||
origin: WindowAccessOrigin,
|
||||
) {
|
||||
if !matches!(
|
||||
self.live_bootstrap,
|
||||
ChildBrowsingContextBootstrap::Srcdoc { .. }
|
||||
) {
|
||||
return;
|
||||
}
|
||||
let Some(entry) = current_entry(&self.committed_navigation_entry_seed) else {
|
||||
return;
|
||||
};
|
||||
self.srcdoc_history
|
||||
.entry(entry.document_id.clone())
|
||||
.or_insert_with(|| {
|
||||
Arc::new(SrcdocHistoryResource {
|
||||
snapshot: snapshot.clone(),
|
||||
origin,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn prune_srcdoc_history(&mut self) {
|
||||
self.srcdoc_history.retain(|document_id, _| {
|
||||
self.committed_navigation_entry_seed
|
||||
.entries
|
||||
.iter()
|
||||
.any(|entry| &entry.document_id == document_id)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -873,6 +873,9 @@ impl PageScriptHost {
|
||||
return WindowAccessOrigin::from_serialized_origin(serialized_origin, document_domain);
|
||||
}
|
||||
if entry.security_origin_inherited() && !entry.document_sandbox_forces_opaque_origin() {
|
||||
if let Some(origin) = entry.current_srcdoc_history_origin() {
|
||||
return Some(origin.clone());
|
||||
}
|
||||
if let Some(popup_id) = self.child_browsing_context_popup_owner_id(handle) {
|
||||
return self.lightweight_popup_window_access_origin(popup_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user