Closed Bug 1718200 Opened 3 years ago Closed 3 years ago

In nsDocumentViewer::SetDocument, call Document::Destroy if the new document is a static document.

Categories

(Toolkit :: Printing, defect)

defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

No description provided.

Even if the old one isn't, otherwise we can leak.

This doesn't happen at the moment because our printing code creates its
own browser with the initial about:blank loaded (which not Destroy()ing
is fine), and then host the clone in there.

In bug 1666247, for simplify mode the front-end is creating a non-static
document with the simplify mode, then reusing the same docshell for the
static document. That means that we forget the non-static document and
we can leak.

In comment 16 on that bug, the leak comes from a <link rel=stylesheet>
whose SheetLoadData we keep in Document::mPreloadService (which uses
Document::Destroy() to call ClearAllPreloads() and break cycles).

To fix it, check aDocument->IsStaticDocument(), not just
mDocument->IsStaticDocument()... That's the right check since it is the
cloning codepath the one that otherwise doesn't care about what was in
the viewer before.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b783cedbc8fb
In nsDocumentViewer::SetDocument, call Document::Destroy if the new document is a static document. r=smaug
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch

Backed out for failures on browser_preview_print_coop.js

[task 2021-07-02T08:21:31.687Z] 08:21:31     INFO - 
[task 2021-07-02T08:21:31.687Z] 08:21:31     INFO - Buffered messages logged at 08:20:02
[task 2021-07-02T08:21:31.688Z] 08:21:31     INFO - Console message: [JavaScript Error: "remote browser crashed while on about:printpreview
[task 2021-07-02T08:21:31.688Z] 08:21:31     INFO - " {file: "chrome://mochikit/content/mochitest-e10s-utils.js" line: 10}]
[task 2021-07-02T08:21:31.688Z] 08:21:31     INFO - e10s_init/<@chrome://mochikit/content/mochitest-e10s-utils.js:10:10
[task 2021-07-02T08:21:31.688Z] 08:21:31     INFO - 
[task 2021-07-02T08:21:31.689Z] 08:21:31     INFO - Console message: [JavaScript Error: "remote browser crashed while on https://example.com/browser/toolkit/components/printing/tests/file_coop_header.html
[task 2021-07-02T08:21:31.689Z] 08:21:31     INFO - " {file: "chrome://mochikit/content/mochitest-e10s-utils.js" line: 10}]
[task 2021-07-02T08:21:31.689Z] 08:21:31     INFO - e10s_init/<@chrome://mochikit/content/mochitest-e10s-utils.js:10:10
[task 2021-07-02T08:21:31.689Z] 08:21:31     INFO - 
[task 2021-07-02T08:21:31.689Z] 08:21:31     INFO - Buffered messages finished
[task 2021-07-02T08:21:31.690Z] 08:21:31     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/printing/tests/browser_preview_print_coop.js | Test timed out - 
[task 2021-07-02T08:21:31.690Z] 08:21:31     INFO - GECKO(5502) | MEMORY STAT | vsize 8072MB | residentFast 399MB | heapAllocated 114MB
[task 2021-07-02T08:21:31.690Z] 08:21:31     INFO - TEST-OK | toolkit/components/printing/tests/browser_preview_print_coop.js | took 90058ms
[task 2021-07-02T08:21:31.691Z] 08:21:31     INFO - Not taking screenshot here: see the one that was previously logged
[task 2021-07-02T08:21:31.691Z] 08:21:31     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/printing/tests/browser_preview_print_coop.js | Found a tab after previous test timed out: about:printpreview - 
[task 2021-07-02T08:21:31.692Z] 08:21:31     INFO - GECKO(5502) | [Parent 5502, Main Thread] WARNING: '!inner', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorProtocol.cpp:184
[task 2021-07-02T08:21:31.692Z] 08:21:31     INFO - Not taking screenshot here: see the one that was previously logged
[task 2021-07-02T08:21:31.693Z] 08:21:31     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/printing/tests/browser_preview_print_coop.js | Found a tab after previous test timed out: about:blank - 
[task 2021-07-02T08:21:31.693Z] 08:21:31     INFO - GECKO(5502) | [Parent 5502, Main Thread] WARNING: '!inner', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorProtocol.cpp:184
[task 2021-07-02T08:21:31.694Z] 08:21:31     INFO - GECKO(5502) | [Child 5504: Main Thread]: I/DocShellAndDOMWindowLeak ++DOCSHELL 105a42800 == 1 [pid = 5504] [id = 36]
[task 2021-07-02T08:21:31.694Z] 08:21:31     INFO - GECKO(5502) | [Child 5504: Main Thread]: I/DocShellAndDOMWindowLeak ++DOMWINDOW == 1 (105abcac0) [pid = 5504] [serial = 93] [outer = 0]
[task 2021-07-02T08:21:31.695Z] 08:21:31     INFO - GECKO(5502) | [Child 5504: Main Thread]: I/DocShellAndDOMWindowLeak ++DOMWINDOW == 2 (105c08400) [pid = 5504] [serial = 94] [outer = 105abcac0]
[task 2021-07-02T08:21:31.695Z] 08:21:31     INFO - checking window state
Status: RESOLVED → REOPENED
Flags: needinfo?(emilio)
Resolution: FIXED → ---
Target Milestone: 91 Branch → ---
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eaea2172c5e6
In nsDocumentViewer::SetDocument, call Document::Destroy if the new document is a static document. r=smaug
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: