back-forward-cache-with-open-websocket-connection-ccns.tentative.window.js (1338B)
1 // META: title=Testing BFCache support for page with open WebSocket connection and "Cache-Control: no-store" header. 2 // META: script=/common/dispatcher/dispatcher.js 3 // META: script=/common/utils.js 4 // META: script=/html/browsers/browsing-the-web/back-forward-cache/resources/rc-helper.js 5 // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js 6 // META: script=/websockets/constants.sub.js 7 // META: script=resources/websockets-test-helpers.sub.js 8 9 'use strict'; 10 11 promise_test(async t => { 12 const rcHelper = new RemoteContextHelper(); 13 14 // Open a window with noopener so that BFCache will work. 15 const rc1 = await rcHelper.addWindow( 16 /*config=*/ { headers: [['Cache-Control', 'no-store']] }, 17 /*options=*/ { features: 'noopener' } 18 ); 19 // Make sure that we only run the remaining of the test when page with 20 // "Cache-Control: no-store" header is eligible for BFCache. 21 await assertBFCacheEligibility(rc1, /*shouldRestoreFromBFCache=*/ true); 22 23 await openWebSocket(rc1); 24 // The page should not be eligible for BFCache because of the usage 25 // of WebSocket. 26 await assertBFCacheEligibility(rc1, /*shouldRestoreFromBFCache=*/ false); 27 await assertNotRestoredFromBFCache(rc1, [ 28 'WebSocket', 29 'WebSocketSticky', 30 'MainResourceHasCacheControlNoStore' 31 ]); 32 });