OLD | NEW |
(Empty) | |
| 1 <?php |
| 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. |
| 5 |
| 6 // This test ensures that fullscreen feature when disabled may not be called by |
| 7 // any iframe even when allowfullscreen is set. |
| 8 |
| 9 Header("Feature-Policy: {\"fullscreen\": []}"); |
| 10 ?> |
| 11 |
| 12 <!DOCTYPE html> |
| 13 <script src="../../resources/testharness.js"></script> |
| 14 <script src="../../resources/testharnessreport.js"></script> |
| 15 <iframe id="f1"></iframe> |
| 16 <iframe id="f2" allowfullscreen></iframe> |
| 17 <script> |
| 18 var srcs = [ |
| 19 "resources/feature-policy-fullscreen.html", |
| 20 "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html
" |
| 21 ]; |
| 22 var f1 = document.getElementById('f1'); |
| 23 var f2 = document.getElementById('f2'); |
| 24 |
| 25 function loadFrames(iframe) { |
| 26 for (var src of srcs) { |
| 27 promise_test(function() { |
| 28 iframe.src = src; |
| 29 return new Promise(function(resolve, reject) { |
| 30 window.addEventListener('message', function(e) { |
| 31 resolve(e.data); |
| 32 }, { once: true }); |
| 33 }).then(function(data) { |
| 34 assert_false(data.enabled, 'Document.fullscreenEnabled:'); |
| 35 assert_equals(data.type, 'error', 'Document.requestFullscreen():'); |
| 36 }); |
| 37 }, 'Fullscreen disabled on URL: ' + src + ' with allowfullscreen = ' + ifram
e.allowFullscreen); |
| 38 } |
| 39 } |
| 40 |
| 41 loadFrames(f1); |
| 42 loadFrames(f2); |
| 43 </script> |
OLD | NEW |