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

pace.min.js is corrupting XMLHttpRequest.DONE value #170

Closed
a2intl opened this issue Nov 4, 2020 · 3 comments
Closed

pace.min.js is corrupting XMLHttpRequest.DONE value #170

a2intl opened this issue Nov 4, 2020 · 3 comments

Comments

@a2intl
Copy link

a2intl commented Nov 4, 2020

We had a customer that was using this plugin report a bug that our Consent Manager (Quantcast Choice) was not working. We tracked it down XMLHttpRequest.DONE no longer having a value of 4 due to an override done by extendNative at

https://github.com/dcooney/wordpress-ajax-load-more/blob/master/vendor/js/pace/pace.js#L444

The specific bug is on line

https://github.com/dcooney/wordpress-ajax-load-more/blob/master/vendor/js/pace/pace.js#L360

where key is not localized per loop iteration, so all the properties of the "extended-native" version of XMLHttpRequest end up retrieving the last-property-iterated.

I don't see a fix in the latest version of pace-js on github: https://github.com/HubSpot/pace/blob/master/pace.js , but I think you can fix this by replacing lines 359-361 with:

              get: (function(keyIn) { return function() {
                return from.prototype[keyIn];
              })(key),
@a2intl
Copy link
Author

a2intl commented Nov 4, 2020

It looks like this has been reported as CodeByZach/pace#261

@a2intl
Copy link
Author

a2intl commented Nov 4, 2020

I've submitted a fix CodeByZach/pace#504 which has been merged upstream, if you want to grab the new pace.js and pace.min.js files.

@dcooney
Copy link
Owner

dcooney commented Nov 11, 2020

Thanks @a2intl I've added this update to the next ALM update. 5.4.0

@dcooney dcooney closed this as completed Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants