Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    layout = XMLTools.selectString fails in Firefox 14

    I just upgraded to Firefox 14 and the following code now returns null rather than a string:
    layout = XMLTools.selectString(data, "//profile/@layout");

    This works fine in Firefox 13.

    Windows7 PC
    SmartClient Version: v8.2p_2012-04-30/LGPL Development Only (built 2012-04-30)

    #2
    Can you show how this can be reproduced (data file, etc)?

    Comment


      #3
      XMLTools.selectString for attributes is failing on Firefox14

      Even I am facing the same issue with Firefox14.

      sample code:
      String value = XMLTools.selectString("<?xml version=\"1.0\" encoding=\"UTF-8\"?><element attributeValue=\"hello\"/>", "/element/@attributeValue");

      My understanding is that the xpath to select attribute values are failing.

      In IE9 and FF13 above line of code returns 'hello'. in Firefox14 it return null.

      Comment


        #4
        In the code below, if the data are in attributes, neither the selectString works or the setValueXPath expressions work. If you change the data to elements and remove the valuexpaths, the code will work.

        SmartClient Version: v8.2p_2012-04-30/LGPL Development Only (built 2012-04-30)

        FireFox 14. Code worked in previous versions of Firefox.

        Code:
                RestDataSource countryDS = new RestDataSource() {
                    @Override
                    protected Object transformRequest(DSRequest dsRequest) {
                        return super.transformRequest(dsRequest);
                    }
                    @Override
                    protected void transformResponse(DSResponse response, DSRequest request, Object data) {
                		String status = XMLTools.selectString(data,"//country/@id");
                		SC.say(status);
                    	super.transformResponse(response, request, data);
                    }
                };
                DataSourceField id = new DataSourceTextField("id");
                DataSourceField name = new DataSourceTextField("name");
                id.setValueXPath("@id");
                name.setValueXPath("@name");
                countryDS.setFetchDataURL("data/country.xml");
                countryDS.setFields(id,name);
                countryDS.setRecordXPath("//country");
                countryDS.fetchData(null,new DSCallback() {
        			@Override
        			public void execute(DSResponse response, Object rawData,
        					DSRequest request) {
        				Record r = response.getData()[0];
        				SC.logWarn(r.getAttribute("id"));
        				SC.logWarn(r.getAttribute("name"));
        			}
                });
        Code:
        <response>
        	<status>0</status>
            <data>
            	<country id="1" name="USA"/>
           </data>
        </response>

        Comment


          #5
          Fixed for tomorrow's nightlies in 3.1d and 3.0p.

          Looks like Firefox changed the format of their XML attribute elements in such a way as to disagree with all other browsers.

          Comment


            #6
            Also fixed for 2.5p.

            Comment


              #7
              Hi,

              I also ran into this issue. I currently have 8.2p (SmartClient_v82p_2012-05-04) in production and experience this problem.

              When I updated to the latest 8.2p (SmartClient_v82p_2012-07-24), the problem goes away. Great!

              But ... Would it be possible to prepare a patch containing only this fix? We can't risk upgrading the entire framework at
              this point, as last time we did this, it took us weeks to have everything nailed down.

              Thank you,

              Comment


                #8
                You had trouble upgrading from 8.0 to 8.2 if we recall. Going from your current 8.2 to the latest 8.2p is just going to pick up a small number of bugfixes, not new features.

                Comment


                  #9
                  That is correct. 8.0 to 8.2 was major but we also ran into issues within 8.2 releases.

                  I can ask my management to see if we can try going to the latest 8.2p release ...

                  I'll get back to you. Tx!

                  Comment


                    #10
                    Hi,

                    Since this is a production issue we're having, we, ourselves are going to issue a patch for
                    this. It will not be possible for us to go thru a regression testing cycle therefore we'd like
                    to have a patch delivered with only that issue fixed ...

                    In our trunk/ codebase, we'll upgrade to 8.2p latest release, though. That version is scheduled
                    for delivery in early September so we'll be able to regression test it by then.

                    Thanks for your understanding,

                    Comment


                      #11
                      Hi guys,

                      Have you been able to prepare and post an 8.2p patch for this issue ? If so, what's the URL where it can be downloaded ?

                      Thanks,

                      Comment


                        #12
                        In your last post you said you planned to prepare your own patch. By that did you actually mean you want us to do it?

                        Comment


                          #13
                          Yes. We'd like you to prepare a JS patch that we'll bundle inside our patched WAR that we'll prepare.

                          Thanks,

                          Comment


                            #14
                            Hello,

                            Is it planned to port this bug fix to SmartClient 7.0rc2 ? It seems to have same problem with FF14

                            Comment


                              #15
                              Here is some code that patches the relevant method:
                              Code:
                              if (window.isc != null) {
                                  if (isc.XMLTools != null) {
                                      isc.XMLTools.addClassMethods({
                                          getElementText : function xmltools_getElementText (element) {
                                              if (this.elementIsNil(element)) return null;
                                              if (!element) return null;
                                              var child = element.firstChild;
                                              if (!child) {
                                                  // from Firefox 13 to Firefox 14 XML nodes representing attributes were changed to no
                                                  // longer have a #text child.
                                                  if (isc.Browser.isMoz && element.nodeType == 2) return element.value;
                                                  return isc.emptyString; // empty element, but not marked nil
                                              }
                                              var text = child.data;
                                              if (isc.Browser.isMoz && text != null && text.length > 4000) return element.textContent;
                                              return text;
                                          }
                                      });
                                  }
                              }
                              Regards
                              Isomorphic Software

                              Comment

                              Working...
                              X