From d7a53d92bce90664f784a410654256a65fb7b9c4 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Tue, 4 Mar 2025 22:54:05 +0000 Subject: [PATCH] Bug 1951772 - Disable Mutation Events in Nightly, r=emilio Differential Revision: https://phabricator.services.mozilla.com/D240375 --- dom/tests/mochitest/general/test_interfaces.js | 2 +- dom/webidl/MutationEvent.webidl | 2 +- .../tests/mochitest/test_bug790732.html | 4 +++- modules/libpref/init/StaticPrefList.yaml | 2 +- .../dom/historical-mutation-events.html.ini | 18 +----------------- 5 files changed, 7 insertions(+), 21 deletions(-) diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index 145d579d6b49..ce60900e9001 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -905,7 +905,7 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "MouseScrollEvent", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "MutationEvent", insecureContext: true }, + { name: "MutationEvent", insecureContext: true, nightly: false }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "MutationObserver", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! diff --git a/dom/webidl/MutationEvent.webidl b/dom/webidl/MutationEvent.webidl index 2f8bfc6b4246..beb686eb2694 100644 --- a/dom/webidl/MutationEvent.webidl +++ b/dom/webidl/MutationEvent.webidl @@ -9,7 +9,7 @@ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C * liability, trademark and document use rules apply. */ -[Exposed=Window] +[Exposed=Window, Pref="dom.mutation_events.enabled"] interface MutationEvent : Event { const unsigned short MODIFICATION = 1; diff --git a/js/xpconnect/tests/mochitest/test_bug790732.html b/js/xpconnect/tests/mochitest/test_bug790732.html index c7022739003d..0e28a064f341 100644 --- a/js/xpconnect/tests/mochitest/test_bug790732.html +++ b/js/xpconnect/tests/mochitest/test_bug790732.html @@ -29,7 +29,9 @@ async function doTest() { is(Ci.nsIDOMKeyEvent, KeyEvent); is(Ci.nsIDOMMouseEvent, MouseEvent); is(Ci.nsIDOMMouseScrollEvent, MouseScrollEvent); - is(Ci.nsIDOMMutationEvent, MutationEvent); + if (SpecialPowers.getBoolPref("dom.mutation_events.enabled")) { + is(Ci.nsIDOMMutationEvent, MutationEvent); + } is(Ci.nsIDOMUIEvent, UIEvent); is(Ci.nsIDOMHTMLMediaElement, HTMLMediaElement); is(Ci.nsIDOMRange, Range); diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index f267c7146770..7a2ddbcc44cd 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -3518,7 +3518,7 @@ # Whether to dispatch mutation events. - name: dom.mutation_events.enabled type: bool - value: true + value: @IS_NOT_NIGHTLY_BUILD@ mirror: always # Limit of location change caused by content scripts in a time span per diff --git a/testing/web-platform/meta/dom/historical-mutation-events.html.ini b/testing/web-platform/meta/dom/historical-mutation-events.html.ini index 6a3cf004ca6a..f7830852f8fb 100644 --- a/testing/web-platform/meta/dom/historical-mutation-events.html.ini +++ b/testing/web-platform/meta/dom/historical-mutation-events.html.ini @@ -1,18 +1,2 @@ [historical-mutation-events.html] - [Historical DOM features must be removed: MutationEvent] - expected: FAIL - - [The DOMSubtreeModified mutation event must not be fired.] - expected: FAIL - - [The DOMNodeInserted mutation event must not be fired.] - expected: FAIL - - [The DOMNodeRemoved mutation event must not be fired.] - expected: FAIL - - [The DOMCharacterDataModified mutation event must not be fired.] - expected: FAIL - - [The DOMAttrModified mutation event must not be fired.] - expected: FAIL + prefs: [dom.mutation_events.enabled:false]