I’ve been trying to implement the validation on MouseLock to check if the element being locked belonged to the “right” DOM.
What happens is that if the parent document tries to lock an element that belongs to a different document, for example: the document of an iframe, the mouse shouldn’t lock. So it’s only possible to lock an element if he belongs to the same DOM as the one the MouseLockable object has access to.

The Fix

 nsCOMPtr targetDoc;  
 if (targetDoc != domDoc) {  
 return false;  


While testing, I came across some interesting data:

All the objects from the parent window have a different memory address from the ones on the iframe.
I always knew that the iframe had a different scope from the parent page, but I never realized that having a different scope literally meant creating all the objects needed in a page, pretty much loading a page inside a page.
It’s amazing how many things we take for granted when using a browser, when in fact, a simple mousemove generates a call stack of more than 100 calls.

**I would assume that the iDoc would have the same memory address as the iWindow.document, but apparently they don’t