maximebf / php-debugbar

Debug bar for PHP
phpdebugbar.com
MIT License
4.2k stars 401 forks source link

Debugbar not showing in embed iframe #650

Closed bastos71 closed 6 months ago

bastos71 commented 7 months ago

Hello, i'm devloping Shopify Apps under Laravel framework, which is using php-debugbar package

Because of this line, we cannot print the debug bar :

https://github.com/maximebf/php-debugbar/blob/cd46685df82a370f6682ad92a81adfc44326f438/src/DebugBar/Resources/debugbar.js#L428

The concept of shopify apps is really simple : embed apps into an iframe, so it makes it completely incompatible with the debug bar, and generates the following error :

Uncaught DOMException: Failed to read a named property 'phpdebugbar' from 'Window': Blocked a frame with origin "https://[subdomain].ngrok-free.app" from accessing a cross-origin frame.
    at child.addDataSet (https://[subdomain].ngrok-free.app/_debugbar/assets/javascript?v=1712740545:949:28)
    at https://[subdomain].ngrok-free.app/admin/dashboard?shop=[subdomain].myshopify.com&host=[...]:633:13

What should we do ?

erikn69 commented 7 months ago

cross-origin problem, try #651