Closed
Bug 1395994
Opened 7 years ago
Closed 7 years ago
Various tests leak windows when run by themselves due to async PlacesTransactions being passed arrays
Categories
(Toolkit :: Places, enhancement, P1)
Toolkit
Places
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox57 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
Details
(Whiteboard: [fxsearch])
Attachments
(1 file)
bookmarkProperties.js & other places pass arrays to PlacesTransactions, which then stores them for a period of time.
This can cause tests to leak when run by themselves:
51 ERROR TEST-UNEXPECTED-FAIL | browser/components/places/tests/browser/browser_addBookmarkForFrame.js | leaked 1 window(s) until shutdown [url = about:blank]
52 ERROR TEST-UNEXPECTED-FAIL | browser/components/places/tests/browser/browser_addBookmarkForFrame.js | leaked 1 window(s) until shutdown [url = chrome://browser/content/places/bookmarkProperties2.xul]
To fix this, Marco put me onto the fact that we need to clone Arrays into a different global scope, this then fixes the issues.
Comment hidden (mozreview-request) |
Assignee | ||
Updated•7 years ago
|
Status: NEW → ASSIGNED
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8903727 [details]
Bug 1395994 - Clone arrays to fix a leak of windows caused by PlacesTransactions keeping references to arrays passed to it.
https://reviewboard.mozilla.org/r/175486/#review181016
::: toolkit/components/places/PlacesTransactions.jsm:808
(Diff revision 1)
>
> if (!Array.isArray(aValue))
> throw new Error(`${name} input property value must be an array`);
>
> - // This also takes care of abandoning the global scope of the input
> - // array (through Array.prototype).
> + // We must create a new array in the local scope to keep the memory
> + // allocators happy. We can't use Cu.cloneInto as that doesn't handle
I'd probably s/to keep the memory allocators happy/to avoid a memory leak due to the array global object./
::: toolkit/components/places/PlacesTransactions.jsm:813
(Diff revision 1)
> - // array (through Array.prototype).
> - return aValue.map(baseProp.validateValue);
> + // allocators happy. We can't use Cu.cloneInto as that doesn't handle
> + // the URIs. Slice & map also aren't good enough, so we start off with
> + // a clean array and insert what we need into it.
> + let newArray = [];
> +
> + for (let item of aValue) {
nit: remove empty newline
Attachment #8903727 -
Flags: review?(mak77) → review+
Comment hidden (mozreview-request) |
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c0d3dbb49f68
Clone arrays to fix a leak of windows caused by PlacesTransactions keeping references to arrays passed to it. r=mak
Comment 5•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in
before you can comment on or make changes to this bug.
Description
•