diff --git a/fullscreen/api/document-exit-fullscreen-twice.html b/fullscreen/api/document-exit-fullscreen-twice.html index aa8538cce4ba95..96c9097690c3df 100644 --- a/fullscreen/api/document-exit-fullscreen-twice.html +++ b/fullscreen/api/document-exit-fullscreen-twice.html @@ -35,12 +35,10 @@ "fullscreenElement after second exitFullscreen()" ); const eventChange = new Promise((resolve) => { - document.addEventListener("fullscreenchange", resolve, once); - document.addEventListener( - "fullscreenchange", - t.unreached_func("second event fired"), - once - ); + document.addEventListener("fullscreenchange", () => { + document.addEventListener("fullscreenchange", t.unreached_func("second event fired"), once); + resolve(); + }, once); }); await Promise.all([