diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 13a76ce992..77993a1aff 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -715,8 +715,6 @@ var interfaceNamesInGlobalScope = "NodeList", // IMPORTANT: Do not change this list without review from a DOM peer! "Notification", -// IMPORTANT: Do not change this list without review from a DOM peer! - "NotifyPaintEvent", // IMPORTANT: Do not change this list without review from a DOM peer! {name: "OffscreenCanvas", disabled: true}, // IMPORTANT: Do not change this list without review from a DOM peer! diff --git a/dom/webidl/NotifyPaintEvent.webidl b/dom/webidl/NotifyPaintEvent.webidl index 799abbb299..b4be1c3a79 100644 --- a/dom/webidl/NotifyPaintEvent.webidl +++ b/dom/webidl/NotifyPaintEvent.webidl @@ -6,13 +6,18 @@ * For more information about this interface see nsIDOMNotifyPaintEvent.idl */ +[ChromeOnly] interface NotifyPaintEvent : Event { + [ChromeOnly] readonly attribute DOMRectList clientRects; + [ChromeOnly] readonly attribute DOMRect boundingClientRect; + [ChromeOnly] readonly attribute PaintRequestList paintRequests; + [ChromeOnly] readonly attribute unsigned long long transactionId; }; diff --git a/layout/base/tests/test_after_paint_pref.html b/layout/base/tests/test_after_paint_pref.html index 33a8c71625..c1a8e6a294 100644 --- a/layout/base/tests/test_after_paint_pref.html +++ b/layout/base/tests/test_after_paint_pref.html @@ -24,14 +24,19 @@ window.addEventListener("load", step0, false); is(SpecialPowers.getBoolPref("dom.send_after_paint_to_content"), true, "pref defaults to true in mochitest harness"); function print_rect(rect) { + if (!rect) { + rect = { top: 0, left: 0, width: 0, right: 0 }; + } return "(top=" + rect.top + ",left=" + rect.left + ",width=" + rect.width + ",height=" + rect.height + ")"; } function print_event(event) { var res = "boundingClientRect=" + print_rect(event.boundingClientRect); var rects = event.clientRects; - for (var i = 0; i < rects.length; ++i) { - res += " clientRects[" + i + "]=" + print_rect(rects[i]); + if (rects) { + for (var i = 0; i < rects.length; ++i) { + res += " clientRects[" + i + "]=" + print_rect(rects[i]); + } } return res; } diff --git a/testing/mochitest/tests/SimpleTest/paint_listener.js b/testing/mochitest/tests/SimpleTest/paint_listener.js index 304a0fd629..4054ce0d0e 100644 --- a/testing/mochitest/tests/SimpleTest/paint_listener.js +++ b/testing/mochitest/tests/SimpleTest/paint_listener.js @@ -10,11 +10,15 @@ function paintListener(event) { if (event.target != window) return; - var eventRect = - [ event.boundingClientRect.left, - event.boundingClientRect.top, - event.boundingClientRect.right, - event.boundingClientRect.bottom ]; + var clientRect = event.boundingClientRect; + var eventRect; + if (clientRect) { + eventRect = + [ clientRect.left, clientRect.top, + clientRect.right, clientRect.bottom ]; + } else { + eventRect = [ 0, 0, 0, 0 ]; + } if (debug) { dump("got MozAfterPaint: " + eventRect.join(",") + "\n"); }