2

I've implement the Magento PayPal Captcha module and everything is working great except for IE11. When I pass the captcha and click Place Order on the billing step I get the following error in the browser: SCRIPT65535: Argument not optional and links to a minified/bundled file.

After un-bundling my js (php bin/magento config:set dev/js/enable_js_bundling 1) I see that the error is coming from the list-mixin.min.js file. When I search the codebase for list-mixin, I get the following file: vendor/magento/module-paypal-captcha/view/frontend/web/js/view/payment/list-mixin.js. This file is declaring a clearTimeout function to override the window.clearTimeout() function. However, there is no parameter for this function. If I throw a junk parameter into this file, the console error goes away, but I can't proceed to the order confirmation step. It just spins and I stay on that page - No console errors or log entries.

Based on some googling, it looks as though most browsers handle the lack of a parameter in clearTimeout() function, but IE11 does not. The parameter is required and is the ID value of the timer returned by the setTimeout() method.

TLDR:

  1. How do I determine what setTimeout() call is referenced in a clearTimeout() call so I can pass the correct parameter?
  2. Has anyone else come across this issue on Magento2?

Thanks!

2

We just implemented the Paypal recaptcha workflow in Magento, and were affected by the same error in IE11. Your post actually helped me identify the error in list-mixin.js, so thank you for that. In return I will share what I did to fix it.

As you pointed out, that file is overriding the built-in window clearTimeout function. That function normally takes a parameter timeoutID. So, I simply added that parameter to the overridden version, and passed it through to the other call, and then everything worked.

The new implementation looks like this, hope it works for you as well:

/**
 * Overrides default window.clearTimeout() to catch errors from iframe and reload Captcha.
 */
clearTimeout: function (timeoutID) {
    var captcha = captchaList.getCaptchaByFormId(this.formId);

    if (captcha !== null) {
        captcha.refresh();
    }
    clearTimeout(timeoutID);
}
1
  • 1
    I started down this same route initially. While it resolved the specific error, I was still not able to place the order. I'm voting this answer up for the confirmation that the approach should work. I think the issue I'm facing now is a PayPal error response. Thanks for the validation! – mlunt May 17 '19 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.