Announcement

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

    SmartGWT and 3rd party vendor javascript libraries

    IE 11
    SmartGWT 4.0p

    We are using a third party library yfiles for html with SmartGWT for some graphical display in our UI. The graphical display works perfectly fine in Chrome and Firefox but in IE 11 it throws a javascript exception in one of their functions. The third party vendor has a set of javascript libraries that are loaded at runtime. It seems that some of the code in those libraries is clashing with code in the SmartGWT javascript libraries. After reporting the issue to them below is a summary of their response:

    ***** BEGIN ******
    The "root" cause seems to be the combination of IE, GWT, SmartGWT, and yFiles - each seem to run fine on their own, but as soon as they come together, the code behavior becomes unpredictable and undeterministic. My suspicion is SmartGWT is to blame, but I have not proof for that. It's the only tool we are not familiar with and the first third party component that causes problems if used in conjunction with yFiles.

    . We have never before seen issues like this before and as soon as you take out SmartGWT everything works correctly. This and the fact that SmartGWT heavily pollutes the Javascript public API makes us *think* it's SmartGWT, but it can as well be IE itself
    *******END******

    I can provide a standalone program that reproduces the issue if needed. Do you have any comments to the assessment made by the 3rd party vendor? Has anyone reported anything similar to what is being described above?

    Thanks,

    Tony



    #2
    Two JavaScript libraries that both augment core JavaScript objects (like Array) can clobber each other, we've seen that before.

    However, attributing "undeterministic" behavior to SmartGWT doesn't make a lot of sense, and that's classically a hallmark of IE. In fact, we recently worked around an IE11 bug where adding lines of code that does nothing corrected a impossible JavaScript error later in the code, due to a bug in IE11's JavaScript VM.

    Your first step should be to update to at least 5.1 and preferably 6.0, as 4.0 pre-dates IE11 and doesn't support it. Then, if the issue still occurs, we'd need a minimal, standalone test case to investigate further.

    As far as the test case, unfortunately, we cannot accept a test case that consists of some yFiles-based application that isn't working (there could be a lot of causes for that) - you will need to narrow it down further, to a test case that doesn't include yFiles. Or, you can use our Consulting services if you prefer to have us analyze third-party code to try to find the problem.

    Comment


      #3
      Actually, Array is one of the javascript objects where they have mentioned it has some strange behavior probably because it is being clobbered. Here are the two examples they provided me where they saw some strange behavior:

      ****** BEGIN *****
      if (Array.isArray(h)) h.length // (failure because h.length does not work because h is undefined - but Array.isArray(h) returns false - so we should not be in that branch at all)

      $super = Object
      if (a.hasOwnProperty("$extends")) $super = a["$extends"]; $super.prototype // throwing because $super is undefined, *although* a.hasOwnProperty("$extends") is actually *false* and thus $super should still be Object, but it's undefined because a["$extends"] is undefined
      ********END*****

      Do you know if there is any way to work around this issue? I have tried SmartGWT 5.0 and 6.0 and they both still had the issue.

      Comment


        #4
        The code is only partial, but you seem to be saying that Array.isArray(), which is a native method that we do not change, sometimes returns true when passed undefined.

        This is not something SmartGWT controls, in fact, there should be no way for any framework to influence this behavior other than replacing Array.isArray, and we don't do that.

        Also, it's not reproducible if you just try to run such code in the midst of the Showcase application.

        However, as we mentioned, we did see a somewhat similar behavior from IE11 where, as with the above code samples, something impossible happened, and it was related to Arrays (it happened inside a method that had been attached to an Array instance, and had to do with the value of Array slots).

        So it appears we're both being hit with an IE11 bug that occurs at pseudo-random times with no particular known cause. We say no particular known cause because lots of frameworks add utility methods to Array as SmartGWT does, and also because there's at least one report of a problem similar to what we are seeing, with really trivial code.

        Two things you can try:

        1. make sure you've got the latest patched build of 5.1 or 6.0 (and please report the exact version when posting, every time), since the change to work around this IE11 bug was very recent.

        2. if the weird failures you're seeing are happening inside methods added to Array.prototype, try assigning and "delete"ing a random property on the current Array instance. This was one of several "magic" code changes that could correct the issue for us

        Comment

        Working...
        X