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

fix(flame): failure when accessing visualViewport.visualViewport from within iFrame #2502

Merged
merged 4 commits into from
Aug 9, 2024

Conversation

nickofthyme
Copy link
Collaborator

Summary

Fixes issue where the Flame chart was attempting to access window.visualViewport from within an iframe.

Details

The Flame chart was attempting to access the window.visualViewport of the top most window from an iframe. However this triggered a DOMException error as the visualViewport property is forbidden expect when accessed by the top window context, for cross-origins.

DOMException: Failed to read a named property 'visualViewport' from 'Window': Blocked a frame with origin "https://my.kibana.com" from accessing a cross-origin frame.

We were only updating this value every 100ms to capture the latest pinchZoomScale. Since this is not accessible from an iframe I elected to simply disable this update loop when in the iframe and access the value in place directly from window.visualViewport?.scale;

Now renders fine within iframe 👇🏼

Zight Recording 2024-08-07 at 01 21 10 PM

Issues

Related to elastic/kibana#188288

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • Unit tests have been added or updated to match the most common scenarios

@nickofthyme nickofthyme added bug Something isn't working :flamegraph Flame/Icicle chart related issues labels Aug 7, 2024
@nickofthyme nickofthyme requested a review from a team August 7, 2024 21:34
@nickofthyme nickofthyme requested a review from dej611 August 8, 2024 19:35
@nickofthyme nickofthyme requested a review from dej611 August 9, 2024 14:48
@nickofthyme nickofthyme merged commit 84f5328 into elastic:main Aug 9, 2024
14 checks passed
@nickofthyme nickofthyme deleted the fix-frame-viewport branch August 9, 2024 23:42
nickofthyme pushed a commit that referenced this pull request Aug 9, 2024
## [66.1.1](v66.1.0...v66.1.1) (2024-08-09)

### Bug Fixes

* **deps:** update dependency @elastic/eui to ^95.5.0 ([#2496](#2496)) ([803a56a](803a56a))
* **deps:** update dependency @playwright/test to ^1.45.3 ([#2495](#2495)) ([4b82ee2](4b82ee2))
* **deps:** update dependency json-schema-to-typescript to v15 ([#2497](#2497)) ([d635ebb](d635ebb))
* **flame:** failure when accessing `visualViewport.visualViewport` from within `iFrame` ([#2502](#2502)) ([84f5328](84f5328))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working :flamegraph Flame/Icicle chart related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants