From fd640bb7a6ff57780cb8af7e887046a9e111134b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 22 Apr 2017 18:03:26 -0700 Subject: [PATCH] Fix captcha cleanup. #1341 --- src/Posting/Captcha.v2.coffee | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Posting/Captcha.v2.coffee b/src/Posting/Captcha.v2.coffee index f6bc6f075..070538c26 100644 --- a/src/Posting/Captcha.v2.coffee +++ b/src/Posting/Captcha.v2.coffee @@ -143,15 +143,12 @@ Captcha.v2 = return unless @isEnabled delete @timeouts.destroy $.rmClass QR.nodes.el, 'captcha-open' - $.rm @nodes.container if @nodes.container - delete @nodes.container - # Clean up abandoned iframes. - garbage = $.X '//iframe[starts-with(@src, "https://www.google.com/recaptcha/api2/frame")]/ancestor-or-self::*[parent::body]' - i = 0 - while node = garbage.snapshotItem i++ - $.rm ins if (ins = node.nextSibling)?.nodeName is 'INS' - $.rm node - return + if @nodes.container + $.global -> + container = document.querySelector '#qr .captcha-container' + window.grecaptcha.reset container.dataset.widgetID + $.rm @nodes.container + delete @nodes.container getOne: (isReply) -> Captcha.cache.getOne isReply