You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I just found the cause of an issue that's been bugging me for a while.
Describe the bug
There's a bug in inpage.js at line 35. Repeated calls to isApproved or isUnlocked add event listeners on window that are never removed. To properly remove event listeners, removeEventListener must be called with the exact reference to the original handler, which is not the case here.
To Reproduce
With metamask installed, open chrome devtools in a new window. Then:
Browser details (please complete the following information):
I assume anywhere that inpage.js runs is affected by this, but I'm using the latest version of chrome and metamask 6.0.1.
Additional context
This causes memory and CPU to go off the charts in windows that have called isUnlocked or isApproved a bunch of times, which is common when polling for wallet status. Also I think there are a number of similar leaks in inpage.js--the onMessage function never successfully removes listeners.
It should be pretty trivial to fix this--let me know if you need help with it.
The text was updated successfully, but these errors were encountered:
gkaemmer
added a commit
to gkaemmer/metamask-extension
that referenced
this issue
Feb 17, 2019
Hello! I just found the cause of an issue that's been bugging me for a while.
Describe the bug
There's a bug in
inpage.js
at line 35. Repeated calls toisApproved
orisUnlocked
add event listeners onwindow
that are never removed. To properly remove event listeners,removeEventListener
must be called with the exact reference to the original handler, which is not the case here.To Reproduce
With metamask installed, open chrome devtools in a new window. Then:
Expected behavior
Events should be cleaned up.
Screenshots
N/A
Browser details (please complete the following information):
I assume anywhere that
inpage.js
runs is affected by this, but I'm using the latest version of chrome and metamask 6.0.1.Additional context
This causes memory and CPU to go off the charts in windows that have called
isUnlocked
orisApproved
a bunch of times, which is common when polling for wallet status. Also I think there are a number of similar leaks ininpage.js
--theonMessage
function never successfully removes listeners.It should be pretty trivial to fix this--let me know if you need help with it.
The text was updated successfully, but these errors were encountered: