summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/resources/disable_bfcache.js
blob: dea70ef4bdf17c87a8e01d71d1faa592a93c0b65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Try to disable BFCache by acquiring and never releasing a Web Lock.
// This requires HTTPS.
// Note: This is a workaround depending on non-specified WebLock+BFCache
// behavior, and doesn't work on Safari. We might want to introduce a
// test-only BFCache-disabling API instead in the future.
// https://github.com/web-platform-tests/wpt/issues/16359#issuecomment-795004780
// https://crbug.com/1298336
window.disableBFCache = () => {
  return new Promise(resolve => {
    navigator.locks.request("disablebfcache", () => {
      resolve();
      return new Promise(() => {});
    });
  });
};