Backed out changeset d232f991af6a (bug 1882670) for causing cdp failures at frame.spec.js CLOSED TREE

This commit is contained in:
Cristina Horotan 2024-09-04 02:35:14 +03:00
Родитель 3ca588520a
Коммит 219dd93d86
13 изменённых файлов: 59 добавлений и 73 удалений

Просмотреть файл

@ -10049,14 +10049,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())) {
// Per spec, reload doesn't cacel lazy loading iframes.
if (!(aLoadState->LoadType() & LOAD_RELOAD_NORMAL)) {
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();
@ -372,20 +381,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;
}

Просмотреть файл

@ -1547,6 +1547,20 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should support lazy frames",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[frame.spec] Frame specs Frame Management should support lazy frames",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[frame.spec] Frame specs Frame.evaluate should throw for detached frames",
"platforms": ["darwin", "linux", "win32"],
@ -2580,6 +2594,13 @@
"expectations": ["FAIL"],
"comment": "Firefox does not support multiple sessions in BiDi."
},
{
"testIdPattern": "[oopif.spec] OOPIF should support lazy OOP frames",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"],
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1878166"
},
{
"testIdPattern": "[oopif.spec] OOPIF should support wait for navigation for transitions from local to OOPIF",
"platforms": ["darwin", "linux", "win32"],

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1,5 @@
[iframe-loading-lazy-nav-meta-refresh.optional.html]
expected:
if (os == "mac") and debug: CRASH
[Navigating iframe loading='lazy' before it is loaded: meta refresh]
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>