unload-disallowed-subframe.tentative.window.js (987B)
1 // META: title='unload' Policy : allowed in main frame but disallowed in subframe 2 // META: script=/common/dispatcher/dispatcher.js 3 // META: script=/common/utils.js 4 // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js 5 // META: script=./resources/unload-helper.js 6 // META: timeout=long 7 8 'use strict'; 9 10 // Check that unload is allowed by policy in main but can be disabled in the 11 // subframe. 12 promise_test(async t => { 13 const rcHelper = 14 new RemoteContextHelper({scripts: ['./resources/unload-helper.js']}); 15 // In the same browsing context group to ensure BFCache is not used. 16 const main = await rcHelper.addWindow( 17 {headers: [['Permissions-Policy', 'unload=*']]}, 18 ); 19 const subframe = 20 await main.addIframe({headers: [['Permissions-Policy', 'unload=()']]}); 21 await assertWindowRunsUnload(subframe, 'subframe', {shouldRunUnload: false}); 22 await assertWindowRunsUnload(main, 'main', {shouldRunUnload: true}); 23 });