mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🦺 Add check for config that causes infinite loop
This commit is contained in:
parent
33c6c06e85
commit
93f3e4e7ac
2 changed files with 8 additions and 0 deletions
|
@ -135,6 +135,10 @@ class ApplepayButton {
|
||||||
const { wrapper, ppcpButtonWrapper } = this.contextConfig();
|
const { wrapper, ppcpButtonWrapper } = this.contextConfig();
|
||||||
const wrapper_id = '#' + wrapper;
|
const wrapper_id = '#' + wrapper;
|
||||||
|
|
||||||
|
if (wrapper_id === ppcpButtonWrapper) {
|
||||||
|
throw new Error(`[ApplePayButton] "wrapper" and "ppcpButtonWrapper" values must differ to avoid infinite loop. Current value: "${wrapper_id}"`);
|
||||||
|
}
|
||||||
|
|
||||||
const syncButtonVisibility = () => {
|
const syncButtonVisibility = () => {
|
||||||
if (!this.isEligible) {
|
if (!this.isEligible) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -139,6 +139,10 @@ class GooglepayButton {
|
||||||
initEventHandlers() {
|
initEventHandlers() {
|
||||||
const { wrapper, ppcpButtonWrapper } = this.contextConfig();
|
const { wrapper, ppcpButtonWrapper } = this.contextConfig();
|
||||||
|
|
||||||
|
if (wrapper === ppcpButtonWrapper) {
|
||||||
|
throw new Error(`[GooglePayButton] "wrapper" and "ppcpButtonWrapper" values must differ to avoid infinite loop. Current value: "${wrapper}"`);
|
||||||
|
}
|
||||||
|
|
||||||
const syncButtonVisibility = () => {
|
const syncButtonVisibility = () => {
|
||||||
const $ppcpButtonWrapper = jQuery(ppcpButtonWrapper);
|
const $ppcpButtonWrapper = jQuery(ppcpButtonWrapper);
|
||||||
setVisible(wrapper, $ppcpButtonWrapper.is(':visible'));
|
setVisible(wrapper, $ppcpButtonWrapper.is(':visible'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue