commit a1b7dfd249667d1aa5b183523fc5cc28f1a6a2b9
parent 9748cd497aeabd24a6b25fcb9f4f268ff45e5b2b
Author: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Fri, 19 Dec 2025 09:40:22 +0000
Bug 2007016 - Implement PageSwapEvent and PageRevealEvent interfaces, r=dom-core,webidl,edgar
Differential Revision: https://phabricator.services.mozilla.com/D277112
Diffstat:
4 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/dom/webidl/PageRevealEvent.webidl b/dom/webidl/PageRevealEvent.webidl
@@ -0,0 +1,18 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * https://html.spec.whatwg.org/#the-pagerevealevent-interface
+ */
+
+[Exposed=Window, Pref="dom.viewTransitions.cross-document.enabled"]
+interface PageRevealEvent : Event {
+ constructor(DOMString type, optional PageRevealEventInit eventInitDict = {});
+ readonly attribute ViewTransition? viewTransition;
+};
+
+dictionary PageRevealEventInit : EventInit {
+ ViewTransition? viewTransition = null;
+};
diff --git a/dom/webidl/PageSwapEvent.webidl b/dom/webidl/PageSwapEvent.webidl
@@ -0,0 +1,20 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * https://html.spec.whatwg.org/#the-pageswapevent-interface
+ */
+
+[Exposed=Window, Pref="dom.viewTransitions.cross-document.enabled"]
+interface PageSwapEvent : Event {
+ constructor(DOMString type, optional PageSwapEventInit eventInitDict = {});
+ readonly attribute NavigationActivation? activation;
+ readonly attribute ViewTransition? viewTransition;
+};
+
+dictionary PageSwapEventInit : EventInit {
+ NavigationActivation? activation = null;
+ ViewTransition? viewTransition = null;
+};
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
@@ -1241,6 +1241,8 @@ GENERATED_EVENTS_WEBIDL_FILES = [
"NavigationCurrentEntryChangeEvent.webidl",
"NotificationEvent.webidl",
"OfflineAudioCompletionEvent.webidl",
+ "PageRevealEvent.webidl",
+ "PageSwapEvent.webidl",
"PageTransitionEvent.webidl",
"PerformanceEntryEvent.webidl",
"PopStateEvent.webidl",
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -5241,6 +5241,12 @@
mirror: always
rust: true
+- name: dom.viewTransitions.cross-document.enabled
+ type: RelaxedAtomicBool
+ value: false
+ mirror: always
+ rust: true
+
# Timeout for view transitions.
# TODO(emilio): Figure out the right time-out, Blink uses between 4 and 15
# seconds.