Backed out changeset 583b98909672 (bug 1759549) for causing failures at browser_sessionHistory.js.

This commit is contained in:
Butkovits Atila
2022-03-21 19:34:29 +02:00
parent 6fb3844eb7
commit cd585508ce
10 changed files with 4 additions and 83 deletions

View File

@@ -291,32 +291,3 @@ add_task(async function test_slow_subframe_load() {
// Cleanup.
gBrowser.removeTab(tab);
});
/**
* Ensure that document wireframes can be persisted when they're enabled.
*/
add_task(async function test_wireframes() {
await SpecialPowers.pushPrefEnv({
set: [["browser.history.collectWireframes", true]],
});
let tab = BrowserTestUtils.addTab(gBrowser, "http://example.com");
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser);
let { entries } = JSON.parse(ss.getTabState(tab));
// Check the number of children.
is(entries.length, 1, "there is one shistory entry");
// Check for the wireframe
ok(entries[0].wireframe, "A wireframe was captured and serialized.");
ok(
entries[0].wireframe.rects.length,
"Several wireframe rects were captured."
);
// Cleanup.
gBrowser.removeTab(tab);
});

View File

@@ -739,12 +739,12 @@ class nsDocShell final : public nsDocLoader,
nsIContentSecurityPolicy* aCsp, bool aFireOnLocationChange,
bool aAddToGlobalHistory, bool aCloneSHChildren);
public:
// If wireframe collection is enabled, will attempt to gather the
// wireframe for the document and stash it inside of the active history
// entry.
void CollectWireframe();
public:
// Helper method that is called when a new document (including any
// sub-documents - ie. frames) has been completely loaded.
MOZ_CAN_RUN_SCRIPT_BOUNDARY

View File

@@ -1367,22 +1367,6 @@ SessionHistoryEntry::GetWireframe(JSContext* aCx, JS::MutableHandleValue aOut) {
return NS_OK;
}
NS_IMETHODIMP
SessionHistoryEntry::SetWireframe(JSContext* aCx, JS::HandleValue aArg) {
if (aArg.isNullOrUndefined()) {
mWireframe = Nothing();
return NS_OK;
}
Wireframe wireframe;
if (aArg.isObject() && wireframe.Init(aCx, aArg)) {
mWireframe = Some(std::move(wireframe));
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP_(void)
SessionHistoryEntry::SyncTreesForSubframeNavigation(
nsISHEntry* aEntry, mozilla::dom::BrowsingContext* aTopBC,

View File

@@ -465,5 +465,5 @@ interface nsISHEntry : nsISupports
* sessionHistoryInParent enabled. See Document.webidl for more details on
* what a Wireframe is.
*/
[implicit_jscontext] attribute jsval wireframe;
[implicit_jscontext] readonly attribute jsval wireframe;
};

View File

@@ -1111,8 +1111,3 @@ nsSHEntry::GetWireframe(JSContext* aCx, JS::MutableHandleValue aOut) {
aOut.set(JS::NullValue());
return NS_OK;
}
NS_IMETHODIMP
nsSHEntry::SetWireframe(JSContext* aCx, JS::HandleValue aArg) {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -92,22 +92,5 @@ add_task(async function() {
!sh.getEntryAtIndex(3).wireframe,
"No wireframe for the loaded entry."
);
// Now check that wireframes can be written to in case we're restoring
// an nsISHEntry from serialization.
let wireframe = sh.getEntryAtIndex(2).wireframe;
sh.getEntryAtIndex(2).wireframe = null;
Assert.equal(
sh.getEntryAtIndex(2).wireframe,
null,
"Successfully cleared wireframe."
);
sh.getEntryAtIndex(3).wireframe = wireframe;
Assert.deepEqual(
sh.getEntryAtIndex(3).wireframe,
wireframe,
"Successfully wrote a wireframe to an nsISHEntry."
);
});
});

View File

@@ -4541,10 +4541,6 @@ mozilla::ipc::IPCResult ContentChild::RecvFlushTabState(
return IPC_OK();
}
if (auto* docShell = nsDocShell::Cast(aContext->GetDocShell())) {
docShell->CollectWireframe();
}
aContext->FlushSessionStore();
aResolver(true);

View File

@@ -7427,12 +7427,12 @@ mozilla::ipc::IPCResult ContentParent::RecvSessionHistoryEntryCacheKey(
mozilla::ipc::IPCResult ContentParent::RecvSessionHistoryEntryWireframe(
const MaybeDiscarded<BrowsingContext>& aContext,
const Wireframe& aWireframe) {
if (aContext.IsNull()) {
if (aContext.IsNullOrDiscarded()) {
return IPC_OK();
}
SessionHistoryEntry* entry =
aContext.GetMaybeDiscarded()->Canonical()->GetActiveSessionHistoryEntry();
aContext.get_canonical()->GetActiveSessionHistoryEntry();
if (entry) {
entry->SetWireframe(Some(aWireframe));
}

View File

@@ -736,7 +736,6 @@ dictionary WireframeTaggedRect {
WireframeRectType type;
Node? node;
};
[GenerateInit]
dictionary Wireframe {
unsigned long canvasBackground = 0; // in nscolor format
sequence<WireframeTaggedRect> rects;

View File

@@ -285,10 +285,6 @@ var SessionHistoryInternal = {
entry.structuredCloneVersion = stateData.formatVersion;
}
if (shEntry.wireframe != null) {
entry.wireframe = shEntry.wireframe;
}
if (shEntry.childCount > 0 && !shEntry.hasDynamicallyAddedChild()) {
let children = [];
for (let i = 0; i < shEntry.childCount; i++) {
@@ -564,9 +560,6 @@ var SessionHistoryInternal = {
if (entry.csp) {
shEntry.csp = E10SUtils.deserializeCSP(entry.csp);
}
if (entry.wireframe) {
shEntry.wireframe = entry.wireframe;
}
if (entry.children) {
for (var i = 0; i < entry.children.length; i++) {