Skip to content

Commit

Permalink
wakelock: Fix active document test
Browse files Browse the repository at this point in the history
Use DOMException constructor from the proper realm (regression after
b7f2dd3).
  • Loading branch information
TimothyGu committed Mar 2, 2020
1 parent d62b514 commit 7cb7fde
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wake-lock/wakelock-active-document.https.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ promise_test(async t => {
iframe,
"/wake-lock/resources/page1.html"
);
// Save the DOMException of page1.html before navigating away.
const frameDOMException1 = iframe.contentWindow.DOMException;
// We navigate the iframe again, putting wakeLock1's document into an inactive state.
const wakeLock2 = await getWakeLockObject(
iframe,
Expand All @@ -30,6 +32,7 @@ promise_test(async t => {
await promise_rejects_dom(
t,
"NotAllowedError",
frameDOMException1,
wakeLock1.request('screen'),
"Inactive document, so must throw NotAllowedError"
);
Expand Down Expand Up @@ -58,6 +61,8 @@ promise_test(async t => {
innerIframe,
"/wake-lock/resources/page2.html"
);
// Save DOMException from innerIframe before navigating away.
const innerIframeDOMException = innerIframe.contentWindow.DOMException;

// Navigate the outer iframe to a new location.
// Wait for the load event to fire.
Expand All @@ -73,6 +78,7 @@ promise_test(async t => {
await promise_rejects_dom(
t,
"NotAllowedError",
innerIframeDOMException,
wakeLock.request('screen'),
"Active, but not fully active, so must throw NotAllowedError"
);
Expand Down

0 comments on commit 7cb7fde

Please sign in to comment.