Exception in chatting application in Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kpranjan1
    New Member
    • Jun 2007
    • 6

    Exception in chatting application in Firefox

    i am getting exception like this---
    1.
    [Exception... "Component returned failure code: 0x804b000f [nsIXMLHttpReque st.setRequestHe ader]" nsresult: "0x804b000f (<unknown>)" location: "JS frame :: http://localhost:8080/supportnow/jsLibrary/Ajax.js :: getChatText :: line 149" data: no]
    [Break on this error] receiveReq.setR equestHeader('C ontent-Type','applicat ion/x-www-form-urlencoded')..
    .

    my application is working fine in IE 6.0 but fails in FF2.0.

    sometimes Firefox browser abnormally teminated, so i have to restart my pc.

    my application is used for chatting
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Please remember to provide a meaningful Title for any threads started (Please Use Appropriate Titles for New Threads!).

    This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

    MODERATOR.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by kpranjan1
      i am getting exception like this---
      1.
      [Exception... "Component returned failure code: 0x804b000f [nsIXMLHttpReque st.setRequestHe ader]" nsresult: "0x804b000f (<unknown>)" location: "JS frame :: http://localhost:8080/supportnow/jsLibrary/Ajax.js :: getChatText :: line 149" data: no]
      [Break on this error] receiveReq.setR equestHeader('C ontent-Type','applicat ion/x-www-form-urlencoded')..
      .

      my application is working fine in IE 6.0 but fails in FF2.0.

      sometimes Firefox browser abnormally teminated, so i have to restart my pc.

      my application is used for chatting
      Welcome to TSDN!

      Can you post some of your code (using code tags please).

      Comment

      • kpranjan1
        New Member
        • Jun 2007
        • 6

        #4
        These are some lines of code-

        function getChatText() {
        receiveReq.open ("POST", getUrl ,true);
        receiveReq.setR equestHeader('C ontent-Type','applicat ion/x-www-form-urlencoded');
        receiveReq.onre adystatechange = handleGetChat;
        var queryString=Ope ratorDept.getPa rameterString() ;
        var queryParmaSt=qu eryString+"&opt yping="+opTypin g+"&messageReci ver="+escape(me ssageReciver);
        receiveReq.send (queryParmaSt);
        }
        //Function for handling the return of chat text
        function handleGetChat() {
        try{
        if (receiveReq.rea dyState == 4) {
        if ((receiveReq.st atus == 200)||(receiveR eq.status == 0)) {
        var chat_div = document.getEle mentById("div_c hat");
        var lastMessage;
        var chat_typing=doc ument.getElemen tById("div_typi ng");
        var oroot = receiveReq.resp onseXML.getElem entsByTagName(" root");
        var messageObj = receiveReq.resp onseXML.getElem entsByTagName(" message");
        var sessionOut = receiveReq.resp onseXML.getElem entsByTagName(" sessionexpired" );
        //this will return an object specify that whether a party is typing or not
        var typingStatus= receiveReq.resp onseXML.getElem entsByTagName(" typing");
        //alert(sessionOu t.length);
        //redirecting the page if the session is out
        if(sessionOut.l ength>0){
        //alert(sessionOu t.length);
        alert("inside ajax.js ");
        location.href=" SessionExp.htm" ;
        }

        //execute the typing status
        chat_typing.inn erHTML="";
        if(typingStatus .length!=0){
        for(var j=0;j< typingStatus.le ngth;j++){
        var oppTyping=typin gStatus[j].childNodes[0].firstChild.nod eValue;
        if(oppTyping==m essageReciver){
        var oppName=chatUse rList.getUserNi ckName(oppTypin g);
        chat_typing.inn erHTML="<img src='Images/typing.gif' >"+oppName+" is typing a message";
        }//end if
        }//end for
        }//end if typing status.length
        var n_messages = messageObj.leng th;
        msgString="";
        if(n_messages!= 0){
        for (var i = 0; i < n_messages; i++) {
        var messageID=messa geObj[i].childNodes[0].firstChild.nod eValue;
        var msgChatRoom=mes sageObj[i].childNodes[8].firstChild.nod eValue;
        OperatorDept.se tDeptMessageID( msgChatRoom,mes sageID);
        var postedTime=mess ageObj[i].childNodes[1].firstChild.nod eValue;
        var sender=messageO bj[i].childNodes[2].firstChild.nod eValue;
        var senderName=mess ageObj[i].childNodes[3].firstChild.nod eValue;
        var reciver=message Obj[i].childNodes[4].firstChild.nod eValue;
        var recName=message Obj[i].childNodes[5].firstChild.nod eValue;
        //alert(reciverNa me);
        var msgText=decodeU RIComponent(mes sageObj[i].childNodes[6].firstChild.nod eValue);
        //alert(msgText);
        var msgtype=message Obj[i].childNodes[7].firstChild.nod eValue;

        //Let this function to handle, store and display each message
        chatMessageHand ler(messageID,s ender,senderNam e,reciver,recNa me,msgText,msgt ype,msgChatRoom );
        //alert(messageID +sender+reciver +msgText+msgtyp e+msgChatRoom);
        }//End for loop
        chat_div.innerH TML+=msgString;
        chat_div.scroll Top = 1000000;
        }//End if(n_messages

        }
        mTimer = setTimeout('get ChatText();',20 00);

        }
        }catch(e){
        alert(e);

        }
        }

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          See an example of a POST request. Are you sure the response is valid XML?

          Comment

          • kpranjan1
            New Member
            • Jun 2007
            • 6

            #6
            Originally posted by acoder
            See an example of a POST request. Are you sure the response is valid XML?


            Yeah my response is valid XML. it is working fine on Opera , IE 7 as well as Safari browser.

            <?xml version=\"1.0\" ?> this is the first line of dynamic generated XML.

            is it ok ? .

            actually i am new to developement field. and currently i am working on Maintenance project.


            thanks

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Try adding the following:
              [CODE=javascript]if (receiveReq.ove rrideMimeType) {
              receiveReq.over rideMimeType('t ext/xml');
              }[/CODE]

              Comment

              • kpranjan1
                New Member
                • Jun 2007
                • 6

                #8
                Originally posted by acoder
                Try adding the following:
                [CODE=javascript]if (receiveReq.ove rrideMimeType) {
                receiveReq.over rideMimeType('t ext/xml');
                }[/CODE]
                Sorry for late reply, but i was on leave.
                I have already tryed above line but getting same error.

                Comment

                Working...