[DOM] Stop exposing NotifyPaintEvent to web content.

There's no reason this should be available to the web, as it's an
indicator of browser internals.
This commit is contained in:
Moonchild 2024-09-04 13:31:23 +02:00 • committed by roytam1
commit b9e7ecd8bc
4 changed files with 21 additions and 9 deletions

View file

@ -715,8 +715,6 @@ var interfaceNamesInGlobalScope =
"NodeList", "NodeList",
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"Notification", "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! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "OffscreenCanvas", disabled: true}, {name: "OffscreenCanvas", disabled: true},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!

View file

@ -6,13 +6,18 @@
* For more information about this interface see nsIDOMNotifyPaintEvent.idl * For more information about this interface see nsIDOMNotifyPaintEvent.idl
*/ */
[ChromeOnly]
interface NotifyPaintEvent : Event interface NotifyPaintEvent : Event
{ {
[ChromeOnly]
readonly attribute DOMRectList clientRects; readonly attribute DOMRectList clientRects;
[ChromeOnly]
readonly attribute DOMRect boundingClientRect; readonly attribute DOMRect boundingClientRect;
[ChromeOnly]
readonly attribute PaintRequestList paintRequests; readonly attribute PaintRequestList paintRequests;
[ChromeOnly]
readonly attribute unsigned long long transactionId; readonly attribute unsigned long long transactionId;
}; };

View file

@ -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"); is(SpecialPowers.getBoolPref("dom.send_after_paint_to_content"), true, "pref defaults to true in mochitest harness");
function print_rect(rect) { 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 + ")"; return "(top=" + rect.top + ",left=" + rect.left + ",width=" + rect.width + ",height=" + rect.height + ")";
} }
function print_event(event) { function print_event(event) {
var res = "boundingClientRect=" + print_rect(event.boundingClientRect); var res = "boundingClientRect=" + print_rect(event.boundingClientRect);
var rects = event.clientRects; var rects = event.clientRects;
for (var i = 0; i < rects.length; ++i) { if (rects) {
res += " clientRects[" + i + "]=" + print_rect(rects[i]); for (var i = 0; i < rects.length; ++i) {
res += " clientRects[" + i + "]=" + print_rect(rects[i]);
}
} }
return res; return res;
} }

View file

@ -10,11 +10,15 @@
function paintListener(event) { function paintListener(event) {
if (event.target != window) if (event.target != window)
return; return;
var eventRect = var clientRect = event.boundingClientRect;
[ event.boundingClientRect.left, var eventRect;
event.boundingClientRect.top, if (clientRect) {
event.boundingClientRect.right, eventRect =
event.boundingClientRect.bottom ]; [ clientRect.left, clientRect.top,
clientRect.right, clientRect.bottom ];
} else {
eventRect = [ 0, 0, 0, 0 ];
}
if (debug) { if (debug) {
dump("got MozAfterPaint: " + eventRect.join(",") + "\n"); dump("got MozAfterPaint: " + eventRect.join(",") + "\n");
} }