Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript Exception #16

Closed
manderson420 opened this issue Dec 22, 2017 · 8 comments
Closed

Javascript Exception #16

manderson420 opened this issue Dec 22, 2017 · 8 comments

Comments

@manderson420
Copy link
Contributor

manderson420 commented Dec 22, 2017

This is still broken on version 1.0.1 for us. iOS 11.0 iPhone 6 device. This ONLY seems to be an issue on iOS 11.0 so far; not on any minor/major revisions after it. We are getting the following error from the ReCaptcha library: Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=16, WKJavaScriptExceptionMessage=TypeError: undefined is not an object (evaluating 'document.getElementsByTagName("div")[4].outerHTML = ""'), WKJavaScriptExceptionColumnNumber=44, WKJavaScriptExceptionSourceURL=https://ourdomain.com/, NSLocalizedDescription=A JavaScript exception occurred}

The curious thing is that this causes an exception every other time we kick off the ReCaptcha webview flow. The following time we get a successful result. Any ideas?

Update: As mentioned from @fjcaetano: that seems to be a different error. It appears to have been introduced with 78fa352, since it fails on getElementsByTagName("div")[4].

Could you open a new issue so we can address this?

Also, as a workaround, could you try removing that line from recaptcha.html to check if the issue stops?

@zoewenRB
Copy link

zoewenRB commented Jan 2, 2018

@manderson420 I got the same JavaScript exception, tried to fix it with your solution (remove the line of code you mentioned), but it didn't help. Could you please let me know have you ended up have it resolved?

@fjcaetano what I found different with @manderson420 's findings was: I only get the javascript exception for the first time call of recaptcha on a fresh install, after that captcha?.validate(on: view) gets no result anymore, neither .success or .failure. Could yo help to take a look of what's going on? Thanks very much!

@fjcaetano
Copy link
Owner

@manderson420 and @zoewenRB, could you check if the branch fix/js-exception fixes it for you?

@zoewenRB, the lib does not reset a ReCaptcha after it has been used or it fails. Google's API has no feature for this, so it's simpler and safer to just initialise a new ReCaptcha object.

@zoewenRB
Copy link

zoewenRB commented Jan 3, 2018

@fjcaetano thanks very much for the fix and response, helped a lot. I don't get the javascript exception anymore. Tried to use a new ReCaptcha instance after every time it fails, didn't help with the none recaptcha response issue. So i just set a timer to let it fail after waiting for 30 seconds.

@fjcaetano
Copy link
Owner

Glad to know that the fix worked for you, though it's super weird that a new ReCaptcha didn't work. Feel free to post more details or open a new issue if you need to. Adding a delay and forcing a failure shouldn't be the solution.

@manderson420
Copy link
Contributor Author

Hi @fjcaetano, I will test and let you know. It is a specific device that this seems to fail for us on, so may need to wait until Monday to verify. Thanks for the quick turnaround!

@manderson420
Copy link
Contributor Author

Hi @fjcaetano I tested on the device in question and we aren't getting the JS exception anymore on that branch. Thanks for the fix! Is it safe to point our podfile to that branch or are you planning a release/patch soon?

@fjcaetano
Copy link
Owner

I'll be releasing it now

@manderson420
Copy link
Contributor Author

Great we will be integrating this soon so will keep you posted if there are any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants