Closed
Bug 1408234
Opened 7 years ago
Closed 6 years ago
PaymentRequestService doesn't clear requests from closed documents
Categories
(Core :: DOM: Web Payments, enhancement, P1)
Core
DOM: Web Payments
Tracking
()
RESOLVED
FIXED
mozilla63
People
(Reporter: MattN, Assigned: edenchuang)
Details
(Keywords: memory-leak, Whiteboard: [webpayments] [MemShrink:P2])
Attachments
(2 files, 2 obsolete files)
(deleted),
patch
|
edenchuang
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
edenchuang
:
review+
|
Details | Diff | Splinter Review |
While working on payment UI tests, I noticed that PaymentRequestService's enumerator continues to hold payment requests after the document that created them was closed (if there was no response to showing the dialog).
If a page simply constructs a PaymentRequest without calling .show() then the service in the parent process will leak requests until shutdown.
The automated tests likely pave over the leak checking since they call `paymentSrv.cleanup()` all the time. We should definitely add a test that doesn't call cleanup in order to catch leaks like this. We should probably also consider replacing `cleanup` calls in other tests with `SpecialPowers.exactGC` in order to test the end-to-end cleanup.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → echuang
Status: NEW → ASSIGNED
Assignee | ||
Updated•7 years ago
|
Priority: -- → P2
Updated•7 years ago
|
Whiteboard: [memshrink] → [MemShrink:P2]
Updated•7 years ago
|
Assignee: echuang → chenyu.chuang
Priority: P2 → P1
Comment 1•7 years ago
|
||
Hello
I am Eden, back to continue this bug I worked.
Updated•7 years ago
|
Whiteboard: [MemShrink:P2] → [webpayments] [MemShrink:P2]
Eden, do you have an estimate on when you'd be able to fix this bug?
What does the expected fix look like? Should the inner window maintain a list of the IDs of the PaymentRequests created in its context and call PaymentRequestManager::AbortPayment() for each one upon the destruction of the inner window?
Does calling AbortPayment() with IDs of payments that don't exist or that have succeeded previously have any adverse effects?
Flags: needinfo?(chenyu.chuang)
Comment 3•7 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #2)
> Eden, do you have an estimate on when you'd be able to fix this bug?
>
> What does the expected fix look like? Should the inner window maintain a
> list of the IDs of the PaymentRequests created in its context and call
> PaymentRequestManager::AbortPayment() for each one upon the destruction of
> the inner window?
>
I will fix this in these two days.
No, the PaymentRequest IDs and document association would be maintained in PaymentRequestManager.
While Document::Destory() is called, PaymentRequestManager.cleanup will be called to remove PaymentRequests associated with the document.
> Does calling AbortPayment() with IDs of payments that don't exist or that
> have succeeded previously have any adverse effects?
I think no any adverse effects.
Flags: needinfo?(chenyu.chuang)
Comment 4•6 years ago
|
||
Let PaymentRequest inherit from nsIDocumentActivity interface.
Calling RegisterActivityObserver() and UnregisterActivityObserver() in constructor and destructor to get activity notifications from document.
When receiving the notification, NotifyOwnerDocumentActivityChanged() will check the owner document's activity status. If the status is disabled, calling PaymentRequestManager::CleanupPayment() to clean the PaymentRequest in content process and also sending the clean information to chrome process.
Attachment #8982120 -
Flags: review?(amarchesini)
Comment 5•6 years ago
|
||
1. add a new mochitest to test cleanup function by changing the attribute of iframe.src.
2. remove unnecessary PaymentRequestService.cleanup() call in the test suite.
Attachment #8982121 -
Flags: review?(amarchesini)
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Comment on attachment 8982120 [details] [diff] [review]
Bug1408234 - Cleanup the PaymentRequests when document close. r?baku
Review of attachment 8982120 [details] [diff] [review]:
-----------------------------------------------------------------
IsActive() returns false if the page is not focused. Are we sure this is the behavior we want?
Attachment #8982120 -
Flags: review?(amarchesini) → review-
Updated•6 years ago
|
Attachment #8982121 -
Flags: review?(amarchesini) → review+
Comment 8•6 years ago
|
||
(In reply to Andrea Marchesini [:baku] from comment #7)
> Comment on attachment 8982120 [details] [diff] [review]
> Bug1408234 - Cleanup the PaymentRequests when document close. r?baku
>
> Review of attachment 8982120 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> IsActive() returns false if the page is not focused. Are we sure this is the
> behavior we want?
Maybe I missed something. I am a little bit confused why IsActive() returns false if the page is not focused?
I had tried by switching to another tab or another window and minimize the window which the page creates a PaymentRequest.
But I all get true from nsIDocument::IsActive().
According to the definition of nsIDocument::IsActive()
https://searchfox.org/mozilla-central/source/dom/base/nsIDocument.h#2522
nsIDocument::IsActive() returns false when the mDocumentContainer is null or mRemovedFromDocShell is false.
However, removing the focus or hiding the page would not set mDocumentContainer as null or set mRemovedFromDocShell as false.
Did I misunderstand something?
Flags: needinfo?(amarchesini)
Comment 9•6 years ago
|
||
P1, has an open need info for 20 days. Andrea, can you respond when you have time?
Updated•6 years ago
|
Attachment #8982120 -
Flags: review- → review+
Updated•6 years ago
|
Keywords: checkin-needed
Updated•6 years ago
|
Keywords: checkin-needed
Comment 10•6 years ago
|
||
So this isn't ready to land, Eden?
Flags: needinfo?(amarchesini) → needinfo?(chenyu.chuang)
Comment 11•6 years ago
|
||
Because the fix of bug 1442453, the patches need to be updated. Will update the patches in these two days.
Flags: needinfo?(chenyu.chuang)
Comment 12•6 years ago
|
||
Eden, Do you have an update on the patch for this bug?
Flags: needinfo?(chenyu.chuang)
Updated•6 years ago
|
Whiteboard: [webpayments] [MemShrink:P2] → [webpayments-reserve] [MemShrink:P2]
Updated•6 years ago
|
Flags: qe-verify?
Whiteboard: [webpayments-reserve] [MemShrink:P2] → [webpayments] [MemShrink:P2]
Updated•6 years ago
|
Assignee: chenyu.chuang → echuang
Reporter | ||
Updated•6 years ago
|
Flags: qe-verify? → qe-verify-
Assignee | ||
Comment 13•6 years ago
|
||
Update the patch according to the code base change.
Attachment #8982120 -
Attachment is obsolete: true
Flags: needinfo?(chenyu.chuang)
Attachment #8999579 -
Flags: review+
Assignee | ||
Comment 14•6 years ago
|
||
Update the patch according to the code base change.
Attachment #8982121 -
Attachment is obsolete: true
Attachment #8999580 -
Flags: review+
Assignee | ||
Comment 15•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Comment 16•6 years ago
|
||
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c7536967b2f9
Cleanup the PaymentRequests when document close. r=baku
https://hg.mozilla.org/integration/mozilla-inbound/rev/19f9ed0f53b9
mochitest for PaymentRequest cleanup after document closed. r=baku
Keywords: checkin-needed
Comment 17•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c7536967b2f9
https://hg.mozilla.org/mozilla-central/rev/19f9ed0f53b9
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•6 years ago
|
status-firefox61:
--- → wontfix
status-firefox62:
--- → wontfix
status-firefox-esr52:
--- → unaffected
status-firefox-esr60:
--- → wontfix
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•