Bug 1473856 - MediaQueryList could use ProbablyShortLivingWrapper + LastRelease, r=bz

--HG--
extra : rebase_source : 71091f1a58a11648fb87c5639f5ac85bd1e9760e
This commit is contained in:
Olli Pettay 2018-07-07 03:08:35 +03:00
parent 2ced7f0d8b
commit 9456afdee0
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,7 @@
* liability, trademark and document use rules apply.
*/
[ProbablyShortLivingWrapper]
interface MediaQueryList : EventTarget {
readonly attribute DOMString media;
readonly attribute boolean matches;

View File

@ -66,6 +66,14 @@ public:
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
private:
void LastRelease() final
{
auto listElement = static_cast<LinkedListElement<MediaQueryList>*>(this);
if (listElement->isInList()) {
listElement->remove();
}
}
void RecomputeMatches();
// We only need a pointer to the document to support lazy