Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: third_party/WebKit/LayoutTests/presentation/presentation-request-iframe-sandbox-error.html

Issue 2782663002: [Presentation API] Move sandbox check to PresentationRequest constructor. (Closed)
Patch Set: Respond to imcheng@ comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/presentation/presentation-request-iframe-sandbox-error.html
diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-request-iframe-sandbox-error.html b/third_party/WebKit/LayoutTests/presentation/presentation-request-iframe-sandbox-error.html
new file mode 100644
index 0000000000000000000000000000000000000000..503f98213b9209b0af13f5d1b250aa03688dcff5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-request-iframe-sandbox-error.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<iframe sandbox="allow-scripts allow-same-origin"></iframe>
+<script>
+
+var iframe = document.querySelector('iframe');
+
+async_test(t => {
+ iframe.onload = t.step_func(() => {
+ iframe.contentWindow.postMessage('create', '*');
+ });
+
+ window.addEventListener('message', t.step_func_done(e => {
+ assert_equals(e.data, 'SecurityError');
+ }));
+
+ // Navigate the iframe
+ iframe.src = 'resources/iframe-sandbox.html';
+}, "Test that creating PresentationRequest throws SecurityError if 'allow-presentation' keyword is missing on a sandboxed iframe.");
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698