From 259f4671ddbc40d8427f751b51f32ce80b21e128 Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Mon, 31 Aug 2020 19:10:23 +0000 Subject: [PATCH] Bug 1662124 - element.setPointerCapture should throw NotFoundError if the pointer id is invalid; r=smaug https://github.com/w3c/pointerevents/issues/256 Differential Revision: https://phabricator.services.mozilla.com/D88859 --- dom/base/Element.h | 8 ++++---- dom/base/domerr.msg | 1 - ...nterevent_setpointercapture_invalid_pointerid.html.ini | 8 -------- xpcom/base/ErrorList.py | 1 - 4 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 testing/web-platform/meta/pointerevents/pointerevent_setpointercapture_invalid_pointerid.html.ini diff --git a/dom/base/Element.h b/dom/base/Element.h index 86460e9ddf87b..383b3cdb94672 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -1192,11 +1192,11 @@ class Element : public FragmentOrElement { bool activeState = false; if (nsContentUtils::ShouldResistFingerprinting(GetComposedDoc()) && aPointerId != PointerEventHandler::GetSpoofedPointerIdForRFP()) { - aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR); + aError.ThrowNotFoundError("Invalid pointer id"); return; } if (!PointerEventHandler::GetPointerInfo(aPointerId, activeState)) { - aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR); + aError.ThrowNotFoundError("Invalid pointer id"); return; } if (!IsInComposedDoc()) { @@ -1218,11 +1218,11 @@ class Element : public FragmentOrElement { bool activeState = false; if (nsContentUtils::ShouldResistFingerprinting(GetComposedDoc()) && aPointerId != PointerEventHandler::GetSpoofedPointerIdForRFP()) { - aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR); + aError.ThrowNotFoundError("Invalid pointer id"); return; } if (!PointerEventHandler::GetPointerInfo(aPointerId, activeState)) { - aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR); + aError.ThrowNotFoundError("Invalid pointer id"); return; } if (HasPointerCapture(aPointerId)) { diff --git a/dom/base/domerr.msg b/dom/base/domerr.msg index 3222d2830e629..81a21467a8cea 100644 --- a/dom/base/domerr.msg +++ b/dom/base/domerr.msg @@ -30,7 +30,6 @@ DOM4_MSG_DEF(QuotaExceededError, "The quota has been exceeded.", NS_ERROR_DOM_QU DOM4_MSG_DEF(TimeoutError, "The operation timed out.", NS_ERROR_DOM_TIMEOUT_ERR) DOM4_MSG_DEF(InvalidNodeTypeError, "The supplied node is incorrect or has an incorrect ancestor for this operation.", NS_ERROR_DOM_INVALID_NODE_TYPE_ERR) DOM4_MSG_DEF(DataCloneError, "The object could not be cloned.", NS_ERROR_DOM_DATA_CLONE_ERR) -DOM4_MSG_DEF(InvalidPointerId, "Invalid pointer id.", NS_ERROR_DOM_INVALID_POINTER_ERR) DOM4_MSG_DEF(NotAllowedError, "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.", NS_ERROR_DOM_NOT_ALLOWED_ERR) /* StringEncoding API errors from http://wiki.whatwg.org/wiki/StringEncoding */ diff --git a/testing/web-platform/meta/pointerevents/pointerevent_setpointercapture_invalid_pointerid.html.ini b/testing/web-platform/meta/pointerevents/pointerevent_setpointercapture_invalid_pointerid.html.ini deleted file mode 100644 index 44cfd20911723..0000000000000 --- a/testing/web-platform/meta/pointerevents/pointerevent_setpointercapture_invalid_pointerid.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[pointerevent_setpointercapture_invalid_pointerid.html] - expected: - if (os == "android") and not e10s: TIMEOUT - [setPointerCapture: DOMException NotFoundError] - expected: - if (os == "android") and not e10s: NOTRUN - FAIL - diff --git a/xpcom/base/ErrorList.py b/xpcom/base/ErrorList.py index 5451127bcffeb..8a0278ba3cdd0 100755 --- a/xpcom/base/ErrorList.py +++ b/xpcom/base/ErrorList.py @@ -656,7 +656,6 @@ def SUCCESS(code): errors["NS_ERROR_DOM_DATA_CLONE_ERR"] = FAILURE(25) # StringEncoding API errors from http://wiki.whatwg.org/wiki/StringEncoding errors["NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR"] = FAILURE(28) - errors["NS_ERROR_DOM_INVALID_POINTER_ERR"] = FAILURE(29) # WebCrypto API errors from http://www.w3.org/TR/WebCryptoAPI/ errors["NS_ERROR_DOM_UNKNOWN_ERR"] = FAILURE(30) errors["NS_ERROR_DOM_DATA_ERR"] = FAILURE(31)