Fixed payment.js wrongly assumes all iframes have name attribute

Lukas W.

Well-known member
Affected version
2.1.2
Line 528 of js/xf/payment.js wrongly assumes that all iframes present on the given page have a name attribute set. If any iframe on the page does not have a name attribute, the following error is triggered, aborting the script:

Code:
payment.min.js?_v=2ef5b26b:17 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
at HTMLIFrameElement. (payment.min.js?_v=2ef5b26b:17)
at Function.each (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at w.fn.init.each (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at HTMLDivElement. (payment.min.js?_v=2ef5b26b:16)
at HTMLDivElement.dispatch (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at HTMLDivElement.y.handle (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at Object.trigger (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at HTMLDivElement. (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at Function.each (jquery-3.3.1.min.js?_v=2ef5b26b:2)
at w.fn.init.each (jquery-3.3.1.min.js?_v=2ef5b26b:2)

Potential fix:
Change line to
if ($iframe.attr('name') && $iframe.attr('name').toLowerCase().indexOf('stripe') >= 0)
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
Prevent an error in payment.js if a Stripe iframe is missing a name attribute.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom