mirror of
https://github.com/servo/servo
synced 2026-05-09 16:42:16 +02:00
This change makes it so that `<iframe>` sanboxing is equivalent to the one used for Content Security Policy, which is how the specification is written. In addition, these sandboxing flags are passed through to `<iframe>` `Document`s via `LoadData` and stored as `Document::creation_sandboxing_flag_set`. The flags are used to calculate the final `Document::active_sandboxing_flag_set` when loading a `Document`. This change makes it so that `<iframe>`s actually behave in a sandboxed way, the same way that `Document`s with CSP configurations do. For instance, now scripts and popups are blocked by default in `<iframe>`s with the `sandbox` attribute. Testing: This causes many WPT tests to start to pass or to move from ERROR to TIMEOUT or failing later. Some tests start to fail: - `/html/semantics/embedded-content/the-canvas-element/canvas-descendants-focusability-005.html`: This test uses a combination of `<iframe allow>` and Canvas fallback content, which we do not support. - `/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_other_frame_popup.sub.html`: This test is now failing because the iframe is sanboxed but in the ScriptThread now due to `allow-same-origin`. More implementation is needed to add support for the "one permitted sandbox navigator concept." Fixes: This is part of #31973. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>