Backed out changeset b6399ca8a2c1 (bug 1706347) for failures on iframe-cross-origin-print.sub.html. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2021-07-20 00:41:23 +03:00
Родитель fa28658d94
Коммит 1b9596a92c
9 изменённых файлов: 39 добавлений и 128 удалений

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

@ -1,5 +0,0 @@
<html>
<body>
<iframe id="inner" src="iframe_slow_onload_inner.html">
</body>
</html>

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

@ -1,19 +0,0 @@
<html>
<head>
<script>
function load() {
// Let the test page know that it can try to navigate.
top.postMessage("onload", "*");
// We're starting an infinite loop, but we need to time out after a
// while, or the loop will keep running until shutdown.
let t0 = performance.now();
while (performance.now() - t0 < 5000) {
document.getElementById("output").innerText = Math.random();
}
}
</script>
</head>
<body onload="load()">
<p id="output"></p>
</body>
</html>

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

@ -106,8 +106,6 @@ support-files = file_bug1536471.html
support-files =
file_blockBFCache.html
slow.sjs
iframe_slow_onload.html
iframe_slow_onload_inner.html
[test_child.html]
[test_docshell_gotoindex.html]
support-files = file_docshell_gotoindex.html

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

@ -98,30 +98,6 @@ const blockBFCacheTests = [
},
];
if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
blockBFCacheTests.push({
name: "Loading OOP iframe",
test: () => {
return new Promise((resolve) => {
const el = document.body.appendChild(document.createElement("iframe"));
el.id = "frame";
addEventListener("message", ({ data }) => {
if (data == "onload") {
resolve();
}
});
el.src = "https://example.com/tests/docshell/test/navigation/iframe_slow_onload.html";
});
},
waitForDone: () => {
SimpleTest.requestFlakyTimeout("Test has a loop in an onload handler that runs for 5000ms, we need to make sure the loop is done before moving to the next test.");
return new Promise(resolve => {
setTimeout(resolve, 5000);
});
},
});
}
const dontBlockBFCacheTests = [
{
name: "getUserMedia",
@ -182,7 +158,7 @@ function promisePageShowNotFromBFCache(e) {
}
function runTests(testArray, shouldBlockBFCache) {
for (const { name, prefs = {}, test, waitForDone } of testArray) {
for (const { name, prefs = {}, test } of testArray) {
add_task(async function() {
await SpecialPowers.pushPrefEnv(prefs, async function() {
// Load a mostly blank page that we can communicate with over
@ -213,15 +189,6 @@ function runTests(testArray, shouldBlockBFCache) {
let result = await goneForward;
ok(result, `Page ${shouldBlockBFCache ? "should" : "should not"} have been blocked from going into the BFCache (${name})`);
// If the test will keep running after navigation, then we need to make
// sure it's completely done before moving to the next test, to avoid
// interfering with any following tests. If waitForDone is defined then
// it'll return a Promise that we can use to wait for the end of the
// test.
if (waitForDone) {
await waitForDone();
}
bc.postMessage({ message: "close" });
SpecialPowers.popPrefEnv();

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

@ -17397,37 +17397,4 @@ void Document::UnregisterFromMemoryReportingForDataDocument() {
}
}
}
void Document::OOPChildLoadStarted(BrowserBridgeChild* aChild) {
MOZ_DIAGNOSTIC_ASSERT(!mOOPChildrenLoading.Contains(aChild));
mOOPChildrenLoading.AppendElement(aChild);
if (mOOPChildrenLoading.Length() == 1) {
// Let's block unload so that we're blocked from going into the BFCache
// until the child has actually notified us that it has done loading.
BlockOnload();
}
}
void Document::OOPChildLoadDone(BrowserBridgeChild* aChild) {
// aChild will not be in the list if nsDocLoader::Stop() was called, since
// that clears mOOPChildrenLoading. It also dispatches the 'load' event,
// so we don't need to call DocLoaderIsEmpty in that case.
if (mOOPChildrenLoading.RemoveElement(aChild)) {
if (mOOPChildrenLoading.IsEmpty()) {
UnblockOnload(false);
}
RefPtr<nsDocLoader> docLoader(mDocumentContainer);
if (docLoader) {
docLoader->OOPChildrenLoadingIsEmpty();
}
}
}
void Document::ClearOOPChildrenLoading() {
nsTArray<const BrowserBridgeChild*> oopChildrenLoading;
mOOPChildrenLoading.SwapElements(oopChildrenLoading);
if (!oopChildrenLoading.IsEmpty()) {
UnblockOnload(false);
}
}
} // namespace mozilla::dom

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

@ -220,7 +220,6 @@ class AnonymousContent;
class Attr;
class XULBroadcastManager;
class XULPersist;
class BrowserBridgeChild;
class ChromeObserver;
class ClientInfo;
class ClientState;
@ -4018,20 +4017,6 @@ class Document : public nsINode,
static bool IsValidDomain(nsIURI* aOrigHost, nsIURI* aNewURI);
// Inform a parent document that a BrowserBridgeChild has been created for
// an OOP sub-document.
// (This is the OOP counterpart to nsDocLoader::ChildEnteringOnload)
void OOPChildLoadStarted(BrowserBridgeChild* aChild);
// Inform a parent document that the BrowserBridgeChild for one of its
// OOP sub-documents is done calling its onload handler.
// (This is the OOP counterpart to nsDocLoader::ChildDoneWithOnload)
void OOPChildLoadDone(BrowserBridgeChild* aChild);
void ClearOOPChildrenLoading();
bool HasOOPChildrenLoading() { return !mOOPChildrenLoading.IsEmpty(); }
protected:
// Returns the WindowContext for the document that we will contribute
// page use counters to.
@ -5261,10 +5246,6 @@ class Document : public nsINode,
// Accumulate page load metrics
void AccumulatePageLoadTelemetry();
// The OOP counterpart to nsDocLoader::mChildrenInOnload.
// Not holding strong refs here since we don't actually use the BBCs.
nsTArray<const BrowserBridgeChild*> mOOPChildrenLoading;
public:
// Needs to be public because the bindings code pokes at it.
JS::ExpandoAndGeneration mExpandoAndGeneration;

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

@ -43,11 +43,14 @@ already_AddRefed<BrowserBridgeHost> BrowserBridgeChild::FinishInit(
mFrameLoader = aFrameLoader;
RefPtr<Element> owner = mFrameLoader->GetOwnerContent();
Document* doc = owner->OwnerDoc();
doc->OOPChildLoadStarted(this);
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(owner->GetOwnerGlobal());
MOZ_DIAGNOSTIC_ASSERT(docShell);
nsDocShell::Cast(docShell)->OOPChildLoadStarted(this);
#if defined(ACCESSIBILITY)
if (a11y::DocAccessible* docAcc = a11y::GetExistingDocAccessible(doc)) {
if (a11y::DocAccessible* docAcc =
a11y::GetExistingDocAccessible(owner->OwnerDoc())) {
if (a11y::LocalAccessible* ownerAcc = docAcc->GetAccessible(owner)) {
if (a11y::OuterDocAccessible* outerAcc = ownerAcc->AsOuterDoc()) {
outerAcc->SendEmbedderAccessible(this);
@ -227,9 +230,9 @@ void BrowserBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
void BrowserBridgeChild::UnblockOwnerDocsLoadEvent() {
if (!mHadInitialLoad) {
mHadInitialLoad = true;
if (Document* doc = mBrowsingContext->GetParent()->GetExtantDocument()) {
doc->OOPChildLoadDone(this);
if (auto* docShell =
nsDocShell::Cast(mBrowsingContext->GetParent()->GetDocShell())) {
docShell->OOPChildLoadDone(this);
}
}
}

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

@ -266,11 +266,7 @@ nsDocLoader::Stop(void) {
// after this, since mDocumentRequest will be null after the
// DocLoaderIsEmpty() call.
mChildrenInOnload.Clear();
nsCOMPtr<nsIDocShell> ds = do_QueryInterface(GetAsSupports(this));
Document* doc = ds ? ds->GetExtantDocument() : nullptr;
if (doc) {
doc->ClearOOPChildrenLoading();
}
mOOPChildrenLoading.Clear();
// Make sure to call DocLoaderIsEmpty now so that we reset mDocumentRequest,
// etc, as needed. We could be getting into here from a subframe onload, in
@ -310,9 +306,7 @@ bool nsDocLoader::IsBusy() {
// 3. It's currently flushing layout in DocLoaderIsEmpty().
//
nsCOMPtr<nsIDocShell> ds = do_QueryInterface(GetAsSupports(this));
Document* doc = ds ? ds->GetExtantDocument() : nullptr;
if (!mChildrenInOnload.IsEmpty() || (doc && doc->HasOOPChildrenLoading()) ||
if (!mChildrenInOnload.IsEmpty() || !mOOPChildrenLoading.IsEmpty() ||
mIsFlushingLayout) {
return true;
}

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

@ -30,6 +30,7 @@
namespace mozilla {
namespace dom {
class BrowserBridgeChild;
class BrowsingContext;
} // namespace dom
} // namespace mozilla
@ -54,6 +55,8 @@ class nsDocLoader : public nsIDocumentLoader,
public nsIChannelEventSink,
public nsISupportsPriority {
public:
using BrowserBridgeChild = mozilla::dom::BrowserBridgeChild;
NS_DECLARE_STATIC_IID_ACCESSOR(NS_THIS_DOCLOADER_IMPL_CID)
nsDocLoader() : nsDocLoader(false) {}
@ -133,9 +136,27 @@ class nsDocLoader : public nsIDocumentLoader,
mTreatAsBackgroundLoad = false;
};
uint32_t ChildCount() const { return mChildList.Length(); }
// Inform a parent docloader that a BrowserBridgeChild has been created for
// an OOP sub-document.
// (This is the OOP counterpart to ChildEnteringOnload below.)
void OOPChildLoadStarted(BrowserBridgeChild* aChild) {
MOZ_DIAGNOSTIC_ASSERT(!mOOPChildrenLoading.Contains(aChild));
mOOPChildrenLoading.AppendElement(aChild);
}
void OOPChildrenLoadingIsEmpty() { DocLoaderIsEmpty(true); }
// Inform a parent docloader that the BrowserBridgeChild for one of its
// OOP sub-documents is done calling its onload handler.
// (This is the OOP counterpart to ChildDoneWithOnload below.)
void OOPChildLoadDone(BrowserBridgeChild* aChild) {
// aChild will not be in the list if nsDocLoader::Stop() was called, since
// that clears mOOPChildrenLoading. It also dispatches the 'load' event,
// so we don't need to call DocLoaderIsEmpty in that case.
if (mOOPChildrenLoading.RemoveElement(aChild)) {
DocLoaderIsEmpty(true);
}
}
uint32_t ChildCount() const { return mChildList.Length(); }
protected:
explicit nsDocLoader(bool aNotifyAboutBackgroundRequests);
@ -353,6 +374,10 @@ class nsDocLoader : public nsIDocumentLoader,
// loadgroup) unless this is empty.
nsCOMArray<nsIDocumentLoader> mChildrenInOnload;
// The OOP counterpart to mChildrenInOnload.
// Not holding strong refs here since we don't actually use the BBCs.
nsTArray<const BrowserBridgeChild*> mOOPChildrenLoading;
int64_t GetMaxTotalProgress();
nsresult AddRequestInfo(nsIRequest* aRequest);