Pollution of global namespace with ___grecaptcha_cfg.clients even after the appropriate elements were removed from DOM

201 views
Skip to first unread message

Ruslan Arkhipau

unread,
Apr 26, 2017, 9:03:07 PM4/26/17
to reCAPTCHA
The problem I have boils down to the following. I have 2 pages with reCAPTCHA. Say, I open the first one. Then the second one, then first, then second, and so on. After all of these manipulations the window.___grecaptcha_cfg.clients variable has grown to contain references to widgets that no longer exist on the page. I'm using explicit rendering of reCAPTCHA, and call "grecaptcha.reset(widgetId)" method before the recaptcha container element is removed from DOM. Yet, for some reason, not everything is being cleaned up.

The other thing I ran into is - it looks like some of the "setTimeout" for recaptcha is not being cleaned up either. I think its about recaptcha after extensive Angular/Zone.js debugging, which finally pointed me to a function inside recaptcha__en.js. Basically, my protractor-based tests fail because of the macroTasks leftovers from recaptcha, even though recaptcha is no longer present on the page.

I would appreciate any guidance on how to fully destroy recaptcha after it's no longer needed.

Ruslan Arkhipau

unread,
May 5, 2017, 3:11:46 PM5/5/17
to reCAPTCHA
About the other thing (setTimeout not being clear) - that was my bad, jsut forget about it for now. Yet, the problem with not clearing up globally accessible object persists.

Jeremy Reed

unread,
Oct 11, 2017, 8:50:07 AM10/11/17
to reCAPTCHA
I'm facing the same issue.  Did you ever find a fix for this issue?  
Reply all
Reply to author
Forward
0 new messages