summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/document-picture-in-picture/beforeunload-is-disabled.https.html
blob: 35e3e2c5470184253dd071602909ad3699024061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<title>Test that onbeforeunload is disabled for document picture in picture</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<body>
  <script>
    promise_test(async (t) => {
      await test_driver.bless('request PiP window from top window');
      const pipWindow = await documentPictureInPicture.requestWindow();
      var onbeforeunloadDisabled = true;
      pipWindow.onbeforeunload = () => {
        onbeforeunloadDisabled = false;
        return "This is a test";
      }
      pipWindow.close();
      assert_true(onbeforeunloadDisabled, 'onbeforeunload should be disabled for document picture in picture');
    });
  </script>
</body>