Fix captcha cleanup. #1341

This commit is contained in:
ccd0 2017-04-22 18:03:26 -07:00
parent 47e7cb26fa
commit 1e4abc6a7e

View File

@ -143,15 +143,12 @@ Captcha.v2 =
return unless @isEnabled return unless @isEnabled
delete @timeouts.destroy delete @timeouts.destroy
$.rmClass QR.nodes.el, 'captcha-open' $.rmClass QR.nodes.el, 'captcha-open'
$.rm @nodes.container if @nodes.container if @nodes.container
delete @nodes.container $.global ->
# Clean up abandoned iframes. container = document.querySelector '#qr .captcha-container'
garbage = $.X '//iframe[starts-with(@src, "https://www.google.com/recaptcha/api2/frame")]/ancestor-or-self::*[parent::body]' window.grecaptcha.reset container.dataset.widgetID
i = 0 $.rm @nodes.container
while node = garbage.snapshotItem i++ delete @nodes.container
$.rm ins if (ins = node.nextSibling)?.nodeName is 'INS'
$.rm node
return
getOne: (isReply) -> getOne: (isReply) ->
Captcha.cache.getOne isReply Captcha.cache.getOne isReply