Bug 1080361 - Add check in setPointerCapture function. r=smaug
authorLebedev Maksim <Alessarik@gmail.com>
Thu, 09 Oct 2014 05:41:00 +0200
changeset 210511 4401c5453e50823d0ad83d126944aaebd63f1d49
parent 210510 a542486a085251f1516007605cf75f21a7075199
child 210512 631716528bf817b1273a25090de6db8160f3fc0e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssmaug
bugs1080361
milestone36.0a1
Bug 1080361 - Add check in setPointerCapture function. r=smaug
content/base/public/Element.h
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -669,16 +669,20 @@ public:
   }
   void SetPointerCapture(int32_t aPointerId, ErrorResult& aError)
   {
     bool activeState = false;
     if (!nsIPresShell::GetPointerInfo(aPointerId, activeState)) {
       aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR);
       return;
     }
+    if (!IsInDoc()) {
+      aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+      return;
+    }
     if (!activeState) {
       return;
     }
     nsIPresShell::SetPointerCapturingContent(aPointerId, this);
   }
   void ReleasePointerCapture(int32_t aPointerId, ErrorResult& aError)
   {
     bool activeState = false;