wp-calypso icon indicating copy to clipboard operation
wp-calypso copied to clipboard

Accessing "New Page" via the Command Pallete While Writing a Post in Calypso Causes "Refused to display (..) 'X-Frame-Options' to 'sameorigin'" error #92634

Open mrfoxtalbot opened this issue 1 year ago • 2 comments

Quick summary

While working on the Calypso editor, I tried to create a new page but the editor crashed:

https://github.com/user-attachments/assets/33407f03-67c8-4f09-a189-8ca4174cc224

I see this error: Refused to display 'https://gomezsorianoclara.wordpress.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Interestingly enough, creating a new post works correctly (it redirects to foo.wordpress.com/wp-admin/post-new.php)

Steps to reproduce

  1. Go to https://wordpress.com/post/
  2. Go to the command palette and search for "Page"
  3. Click on "New Page"

What you expected to happen

It should create a new page

What actually happened

It crashed

Impact

All

Available workarounds?

Yes, easy to implement

If the above answer is "Yes...", outline the workaround.

The wp-admin at wp-admin/post-new.php works fine.

Platform (Simple and/or Atomic)

Simple

Logs or notes

This seems directly related to this other bug that was affecting patterns:

  • https://github.com/Automattic/wp-calypso/issues/92634

mrfoxtalbot avatar Aug 28 '24 07:08 mrfoxtalbot

@xavier-lc, I see you fixed the previous related issue. Is this a regression? Could you please take a look? Thank you!

mrfoxtalbot avatar Aug 28 '24 07:08 mrfoxtalbot

We have fixed a similar error in another screen by using the function openLinksInParentFrame. See https://github.com/Automattic/wp-calypso/issues/83472

miksansegundo avatar Aug 28 '24 08:08 miksansegundo

@mrfoxtalbot hey, sorry for the late reply, I was AFK last week.

@epeicher are you working on this? If not, I can take over.

xavier-lc avatar Sep 02 '24 16:09 xavier-lc

@xavier-lc I have created this draft PR as proof of concept for a potential fix for the Add new Page command: https://github.com/Automattic/wp-calypso/pull/94114.

But I think this can be generalized, as it also affects the Add new Post command. I have based the changes in this PR from you, so I am happy if you take over because you probably have more context on this than me, as I'm modifying this code for the first time 😄

epeicher avatar Sep 02 '24 16:09 epeicher

We have fixed a similar error in another screen by using the function openLinksInParentFrame. See #83472

Thanks for sharing. I don't think it works in this case, though, because the commands don't have an actual link, they run a callback.

xavier-lc avatar Sep 03 '24 10:09 xavier-lc

Fixed in https://github.com/Automattic/wp-calypso/pull/94114 Deployed in r303334-wpcom

Waiting for the wpcom-block-editor cache to expire to test the changes in production

epeicher avatar Sep 03 '24 12:09 epeicher

After the wpcom-block-editor is deployed and the cache has expired, we can see this is fixed. Here are some videos:

Add new page

https://github.com/user-attachments/assets/377b6185-900c-48c3-8e55-01aea58f907d

Add new post

https://github.com/user-attachments/assets/ee8aedba-1042-4c40-85ab-3cdb7a84dc9a

epeicher avatar Sep 03 '24 16:09 epeicher