javascript - NS_ERROR_UNEXPECTED error in Firefox using Dojo - Stack Overflow

I'm having a strange issue that's being thrown in Firefox when using my Dojo (v.1.10.0) appli

I'm having a strange issue that's being thrown in Firefox when using my Dojo (v.1.10.0) application.

Here is the following error that I'm seeing in Firefox:

Exception 
    { message: "",
      result: 2147549183, 
      name: "NS_ERROR_UNEXPECTED", 
      filename: "http://localhost:8888/dojo/on.js", 
      lineNumber: 354, 
      columnNumber: 0, 
      inner: null, 
      data: null 
    } 
  ""

Unfortunately, I'm not sure where to go with this in my application. Can anyone point me in the right direction?

On line 354 of dojo/on, this is happening:

 if(has("dom-addeventlistener")){
    // emitter that works with native event handling
    on.emit = function(target, type, event){
        if(target.dispatchEvent && document.createEvent){
            // use the native event emitting mechanism if it is available on the target object
            // create a generic event               
            // we could create branch into the different types of event constructors, but 
            // that would be a lot of extra code, with little benefit that I can see, seems 
            // best to use the generic constructor and copy properties over, making it 
            // easy to have events look like the ones created with specific initializers
            var ownerDocument = target.ownerDocument || document;
            var nativeEvent = ownerDocument.createEvent("HTMLEvents");
            nativeEvent.initEvent(type, !!event.bubbles, !!event.cancelable);
            // and copy all our properties over
            for(var i in event){
                if(!(i in nativeEvent)){
                    nativeEvent[i] = event[i];
                }
            }
            return target.dispatchEvent(nativeEvent) && nativeEvent; // Line 354
        }
        return syntheticDispatch.apply(on, arguments); // emit for a non-node
    };
}

I'm having a strange issue that's being thrown in Firefox when using my Dojo (v.1.10.0) application.

Here is the following error that I'm seeing in Firefox:

Exception 
    { message: "",
      result: 2147549183, 
      name: "NS_ERROR_UNEXPECTED", 
      filename: "http://localhost:8888/dojo/on.js", 
      lineNumber: 354, 
      columnNumber: 0, 
      inner: null, 
      data: null 
    } 
  ""

Unfortunately, I'm not sure where to go with this in my application. Can anyone point me in the right direction?

On line 354 of dojo/on, this is happening:

 if(has("dom-addeventlistener")){
    // emitter that works with native event handling
    on.emit = function(target, type, event){
        if(target.dispatchEvent && document.createEvent){
            // use the native event emitting mechanism if it is available on the target object
            // create a generic event               
            // we could create branch into the different types of event constructors, but 
            // that would be a lot of extra code, with little benefit that I can see, seems 
            // best to use the generic constructor and copy properties over, making it 
            // easy to have events look like the ones created with specific initializers
            var ownerDocument = target.ownerDocument || document;
            var nativeEvent = ownerDocument.createEvent("HTMLEvents");
            nativeEvent.initEvent(type, !!event.bubbles, !!event.cancelable);
            // and copy all our properties over
            for(var i in event){
                if(!(i in nativeEvent)){
                    nativeEvent[i] = event[i];
                }
            }
            return target.dispatchEvent(nativeEvent) && nativeEvent; // Line 354
        }
        return syntheticDispatch.apply(on, arguments); // emit for a non-node
    };
}
Share Improve this question edited Sep 2, 2014 at 19:03 streetlight asked Sep 2, 2014 at 18:55 streetlightstreetlight 5,96813 gold badges66 silver badges102 bronze badges 1
  • 1 Just added to the ments. Thank you for the feedback @admdrew – streetlight Commented Sep 2, 2014 at 19:06
Add a ment  | 

3 Answers 3

Reset to default 3

This is a generic FF error message... it's usually triggered by a timing or race condition, which may explain why it's showing up via dojo/on. Maybe the target or event handler that you're trying to work with is acting on something that has been removed, etc. It's unclear without knowing what event is triggering it or without seeing your full code example.

For example, maybe you're trying to add event listeners before the DOM is available, but that's just a guess. Or maybe the target node doesn't exist.

You can use the debugger to see the values of the event parameters, or you can look at your various event registration mechanisms, etc.

We have a similar issue using intern 2.0 and unit tests creating native select boxes.

Some library code (verified that its not our own) triggers a dojo.emit() which causes the internal error.

We're trying to identify the problem in more detail. If you find something please let us know as well!

we were also getting same exception at exactly same point,

for us, we replaced our code
elementReference.destroy() // destroy is a dojo function with elementReference.domNode.remove() and it solved our problem.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742288136a4415694.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信