gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.51k stars 373 forks source link

DOMImplMozilla.isOrHasChild throws NS_ERROR_DOM_NOT_SUPPORTED_ERR #3978

Closed dankurka closed 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 3977

Found in GWT Release: 
1.5, trunk

Encountered on: 
WinXP with FF3.5

Detailed description:

The native statement parent.compareDocumentPosition(child) used by
DOMImplMozilla.isOrHasChild sometimes causes Mozilla errors.  My hunch is
that this happens when either the parent or child is not attached.

I can't describe an easy way to reproduce this, but I spent two days
debugging this issue in my app, so please just take my word for it:
element.compareDocumentPosition in Firefox 3.5 is buggy.

If anyone here understands Mozilla stacktraces (I don't), see if this tells
you anything:

com.google.gwt.core.client.JavaScriptException:
(NS_ERROR_DOM_NOT_SUPPORTED_ERR): Operation is not supported code: 9
INDEX_SIZE_ERR: 1 DOMSTRING_SIZE_ERR: 2 HIERARCHY_REQUEST_ERR: 3
WRONG_DOCUMENT_ERR: 4 INVALID_CHARACTER_ERR: 5 NO_DATA_ALLOWED_ERR: 6
NO_MODIFICATION_ALLOWED_ERR: 7 NOT_FOUND_ERR: 8 NOT_SUPPORTED_ERR: 9
INUSE_ATTRIBUTE_ERR: 10 INVALID_STATE_ERR: 11 SYNTAX_ERR: 12
INVALID_MODIFICATION_ERR: 13 NAMESPACE_ERR: 14 INVALID_ACCESS_ERR: 15
VALIDATION_ERR: 16 TYPE_MISMATCH_ERR: 17 result: 2152923145

Workaround if you have one:

Use the attached file, adding the following lines to your module .gwt.xml:

  <replace-with class="com.google.gwt.dom.client.DOMImplMozillaFix">
    <when-type-is class="com.google.gwt.dom.client.DOMImpl"/>
    <when-property-is name="user.agent" value="gecko1_8"/>
  </replace-with>

To summarize, the patch falls back to the old implementation of
isOrHasChild from GWT 1.4 when it encounters an exception.

Reported by alexander.epshteyn on 2009-08-21 22:53:26


dankurka commented 9 years ago
Alex, I'll send this Joel's way in case it rings any bells, but if you could provide
a 
repro code snippet, that would be tremendously helpful in figuring out why the code
in 
the DomImplMozilla.isOrHasChild is buggy.

Reported by sumitchandel+legacy@google.com on 2009-08-26 22:14:46

dankurka commented 9 years ago
I think it's the underlying Mozilla implementation of that Javascript method that's
buggy.  I can't provide a code snippet, unfortunately, because it's a result of a
complex interaction in a complex UI, and I don't know exactly how to trigger it.  

All I can say is it arises from MouseListenerCollection:95 call to
DOM.isOrHasChild(senderElem, to) which translates to the Javascript 
!(senderElem.compareDocumentPosition(to) & 16))

My hunch is that you can repro it when either senderElem or to is unattached.  Either
way, it's a Mozilla bug and I don't think there's anything better you can do in GWT
than to trap the Mozilla exception and ignore it.  That's what the attached patch
does and I'm successfully using in my app now.

Reported by alexander.epshteyn on 2009-08-27 03:24:01

dankurka commented 9 years ago
is it still reproducible in gwt 1.7?

Reported by epishkin on 2009-09-11 09:11:19

dankurka commented 9 years ago
Alexander, thanks for your workaround!

It fixed that issue in our application (gwt 1.5 & gxt 1.2.4). In our application this

error happens in com.extjs.gxt.ui.client.widget.form.DualListField when user moves

cursor to the vertical scrollbar of any list field of DualListField

Reported by epishkin on 2009-09-11 10:30:36

dankurka commented 9 years ago
I'm using gwt 1.5 & gxt 1.2.4 too and I fixed it with your workaround. Thanks! I hope
it was fixed in gwt 1.7.1.

Reported by lunarjchav on 2009-10-21 07:54:30

dankurka commented 9 years ago
I encountered this problem using gwt 1.7.1 (I do not use gxt).  The problem seems to
occur when I cursor over a vertical scrollbar.  Applying your workaround fixed the
problem for me.  Thanks.

Reported by jimcampsw on 2009-12-08 17:24:53

dankurka commented 9 years ago

Reported by kurka.daniel on 2012-12-16 10:48:35