unload-allowed-by-default.tentative.window.js (1101B)
1 // META: title='unload' Policy : allowed by default 2 // META: script=/common/dispatcher/dispatcher.js 3 // META: script=/common/get-host-info.sub.js 4 // META: script=/common/utils.js 5 // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js 6 // META: script=./resources/unload-helper.js 7 // META: timeout=long 8 9 'use strict'; 10 11 // Check that unload is allowed by policy in main frame and subframe by default. 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 const sameOriginSubframe = await main.addIframe(); 18 const crossOriginSubframe = await main.addIframe({ origin: 'HTTP_REMOTE_ORIGIN' }); 19 await assertWindowRunsUnload(sameOriginSubframe, 'sameOriginSubframe', { shouldRunUnload: true }); 20 await assertWindowRunsUnload(crossOriginSubframe, 'crossOriginSubframe', { shouldRunUnload: true }); 21 await assertWindowRunsUnload(main, 'main', {shouldRunUnload: true}); 22 });