зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 437beb1efdd2 (bug 1882670) for causing web platform failures CLOSED TREE
This commit is contained in:
Родитель
4e3c650cd5
Коммит
c02bd2b7ec
|
@ -10115,11 +10115,6 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
|
|||
contentPolicyType == nsIContentPolicy::TYPE_INTERNAL_FRAME,
|
||||
"DoURILoad thinks this is a frame and InternalLoad does not");
|
||||
|
||||
if (auto* iframe = HTMLIFrameElement::FromNodeOrNull(
|
||||
mBrowsingContext->GetEmbedderElement())) {
|
||||
iframe->CancelLazyLoading(true /* aClearLazyLoadState */);
|
||||
}
|
||||
|
||||
if (StaticPrefs::dom_block_external_protocol_in_iframes()) {
|
||||
// Only allow URLs able to return data in iframes.
|
||||
if (nsContentUtils::IsExternalProtocol(aLoadState->URI())) {
|
||||
|
|
|
@ -349,7 +349,16 @@ void HTMLIFrameElement::SetLazyLoading() {
|
|||
}
|
||||
|
||||
void HTMLIFrameElement::StopLazyLoading() {
|
||||
CancelLazyLoading(false /* aClearLazyLoadState */);
|
||||
if (!mLazyLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
mLazyLoading = false;
|
||||
|
||||
Document* doc = OwnerDoc();
|
||||
if (auto* obs = doc->GetLazyLoadObserver()) {
|
||||
obs->Unobserve(*this);
|
||||
}
|
||||
|
||||
LoadSrc();
|
||||
|
||||
|
@ -369,20 +378,4 @@ void HTMLIFrameElement::NodeInfoChanged(Document* aOldDoc) {
|
|||
}
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::CancelLazyLoading(bool aClearLazyLoadState) {
|
||||
if (!mLazyLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
Document* doc = OwnerDoc();
|
||||
if (auto* obs = doc->GetLazyLoadObserver()) {
|
||||
obs->Unobserve(*this);
|
||||
}
|
||||
|
||||
mLazyLoading = false;
|
||||
|
||||
if (aClearLazyLoadState) {
|
||||
mLazyLoadState.Clear();
|
||||
}
|
||||
}
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -160,7 +160,6 @@ class HTMLIFrameElement final : public nsGenericHTMLFrameElement {
|
|||
|
||||
void SetLazyLoading();
|
||||
void StopLazyLoading();
|
||||
void CancelLazyLoading(bool aClearLazyLoadState);
|
||||
|
||||
const LazyLoadFrameResumptionState& GetLazyLoadFrameResumptionState() const {
|
||||
return mLazyLoadState;
|
||||
|
|
|
@ -154,21 +154,14 @@ void nsGenericHTMLFrameElement::SwapFrameLoaders(
|
|||
}
|
||||
|
||||
void nsGenericHTMLFrameElement::LoadSrc() {
|
||||
EnsureFrameLoader();
|
||||
|
||||
if (!mFrameLoader) {
|
||||
// Waiting for lazy load, do nothing.
|
||||
if (mLazyLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mLazyLoading) {
|
||||
// Waiting for lazy load, do nothing.
|
||||
if (!mFrameLoader->GetExtantBrowsingContext()) {
|
||||
// We still want to initialize the frame loader for the browsing
|
||||
// context to exist, so that it can be found by name and such.
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NewRunnableMethod("InitializeLazyFrameLoader", mFrameLoader.get(),
|
||||
&nsFrameLoader::GetBrowsingContext));
|
||||
}
|
||||
EnsureFrameLoader();
|
||||
|
||||
if (!mFrameLoader) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[iframe-loading-lazy-nav-form-submit.html]
|
||||
[Navigating iframe loading='lazy' before it is loaded: form submit]
|
||||
expected: FAIL
|
|
@ -0,0 +1,3 @@
|
|||
[iframe-loading-lazy-nav-link-click-fragment.html]
|
||||
[Navigating iframe loading='lazy' before it is loaded: link click (fragment)]
|
||||
expected: FAIL
|
|
@ -0,0 +1,3 @@
|
|||
[iframe-loading-lazy-nav-link-click.html]
|
||||
[Navigating iframe loading='lazy' before it is loaded: link click]
|
||||
expected: FAIL
|
|
@ -0,0 +1,3 @@
|
|||
[iframe-loading-lazy-nav-location-assign.html]
|
||||
[Navigating iframe loading='lazy' before it is loaded: location.assign]
|
||||
expected: FAIL
|
|
@ -0,0 +1,3 @@
|
|||
[iframe-loading-lazy-nav-location-replace.html]
|
||||
[Navigating iframe loading='lazy' before it is loaded: location.replace]
|
||||
expected: FAIL
|
|
@ -1,4 +1,3 @@
|
|||
[iframe-loading-lazy-nav-meta-refresh.optional.html]
|
||||
expected: [PASS, CRASH]
|
||||
[Navigating iframe loading='lazy' before it is loaded: meta refresh]
|
||||
expected: [PASS, CRASH] # see bug 1910951
|
||||
expected: FAIL
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[iframe-loading-lazy-nav-window-open.html]
|
||||
[Navigating iframe loading='lazy' before it is loaded: location.replace]
|
||||
expected: FAIL
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Navigating to a cross-origin for iframe loading='lazy' before it is loaded: location.replace</title>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<iframe src="support/blank.htm?src" loading="lazy" hidden></iframe>
|
||||
<script>
|
||||
const iframe = document.querySelector('iframe');
|
||||
iframe.setAttribute(
|
||||
"data-src",
|
||||
`${get_host_info().HTTP_NOTSAMESITE_ORIGIN}/html/semantics/embedded-content/the-iframe-element/support/blank.htm?nav`
|
||||
);
|
||||
|
||||
const iframeLoaded = new Promise(resolve => {
|
||||
iframe.onload = resolve;
|
||||
});
|
||||
iframe.contentWindow.location.replace(iframe.dataset.src);
|
||||
iframe.hidden = false;
|
||||
</script>
|
||||
<!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. -->
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({single_test: true});
|
||||
iframeLoaded.then(() => {
|
||||
// Need a timeout to detect failure when there are two navigations.
|
||||
step_timeout(() => {
|
||||
assert_throws_dom(
|
||||
"SecurityError", // Use the SecurityError to assert this is a cross-origin iframe
|
||||
() => {
|
||||
iframe.contentWindow.location.href
|
||||
},
|
||||
"The iframe should load the cross-site url via locaiton.replace");
|
||||
done();
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче