Codeinwp / tweet-old-post

Plugin to tweet about your old posts to get more hits for them and keep them alive.
GNU General Public License v2.0
13 stars 16 forks source link

fix: page reload when failing to close the popup #918

Closed Soare-Robert-Daniel closed 6 months ago

Soare-Robert-Daniel commented 6 months ago

Problem

The closing of the auth popup is affected by this https://developer.mozilla.org/en-US/docs/Web/API/Window/open#same-origin_policy since the authentication is done on a different origin.

The data communication still happens, but accessing the opener raised a DOM exception.

Because of this exception, the page refresh does not happen. Thus, the user does not see the account added, and it gets confusing because the message from the authorization popup tells him that a redirection needs to happen; otherwise, he needs to contact support.

Solution

By using a try block, even if the code fails to close the popup, the page reload will happen, and the user will see their account added.

Screenshots

https://github.com/Codeinwp/tweet-old-post/assets/17597852/eb7ab11a-2cca-4a23-8869-cfc8cfe030d5

Testing

github-actions[bot] commented 6 months ago

Plugin build for 9a9a51858f72409b3995b6e1cc5227f73b012dbe is ready :bellhop_bell:!

pirate-bot commented 6 months ago

:tada: This PR is included in version 9.0.25 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: