From 7f1616242ce1bc20e91f475b95677a908a1ee33f Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Thu, 13 Jun 2024 15:38:27 +0200 Subject: [PATCH] Fix CYS crash when loads in WordPress Playground (#48129) * Fix CYS crash when loads in WordPress Plaground * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions --- plugins/woocommerce-admin/client/customize-store/utils.js | 7 ++++++- plugins/woocommerce/changelog/48129-fix-cys-playground | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/48129-fix-cys-playground diff --git a/plugins/woocommerce-admin/client/customize-store/utils.js b/plugins/woocommerce-admin/client/customize-store/utils.js index d2175d52147..9cec3aa88d4 100644 --- a/plugins/woocommerce-admin/client/customize-store/utils.js +++ b/plugins/woocommerce-admin/client/customize-store/utils.js @@ -8,7 +8,12 @@ export function sendMessageToParent( message ) { } export function isIframe( windowObject ) { - return windowObject.document !== windowObject.parent.document; + return ( + windowObject.document !== windowObject.parent.document && + windowObject.parent.document.body.querySelector( + '.woocommerce-customize-store__container' + ) !== null + ); } export function editorIsLoaded() { diff --git a/plugins/woocommerce/changelog/48129-fix-cys-playground b/plugins/woocommerce/changelog/48129-fix-cys-playground new file mode 100644 index 00000000000..88af97bb74d --- /dev/null +++ b/plugins/woocommerce/changelog/48129-fix-cys-playground @@ -0,0 +1,4 @@ +Significance: patch +Type: tweak +Comment: Fix CYS crash when loads in WordPress Playground +