Announcement

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

    Third-party incompatibility: it's changing __nativeType

    I've been having problems integrating a 3rd party tool with my Smartclient app, and I've finally boiled it down to something communicable via forum post.

    Smartclient includes this line in modules-debug/ISC_Core.js:
    Code:
    Boolean.__nativeType = 6;
    However, after my 3rd party tool builds its widget (as the result of user manipulation), I can verify that the values of several built-in classes have been reset:
    Code:
    var obs = [Date,String,Number,Boolean];
    for(var i=0; i<obs.length; i++){
       console.log(obs[i].name,obs[i].__nativeType);
    }
    Date 1
    String 1
    Number 1
    Boolean 1
    I'm also noticing that if I define my own variable:
    Code:
    Function.prototype.__nitroamos = 1;
    Boolean.__nitroamos = 6;
    so it appears that the widget I'm using is reverting __nativeType to Function.prototype.__nativeType.

    This is resulting in an infinite recursion in _serialize/_serializeObject. The widget I'm including uses jQuery and it includes JavaScript code produced by Java2Script. I haven't been able to find the place in their code where __nativeType is reset (I'm not sure what to search for).

    I can put a callback in the 3rd party library and reset the __nativeType values, but that would require me to "undo" the minification process in ISC_Core.js.

    Any suggested work-arounds?

    #2
    Our suggested workaround is to stop using any library that would do something like that. Kidding.. kinda.

    Any workaround for this is going to be pretty horrific - perhaps the least bad would be to carve out the part of ISC_Core.js that defines the isA functions and re-run that code after your third-party library runs.

    However, if this library is messing around with other frameworks' variables on JavaScript prototypes, who knows what other damage they might have done.. are you able to determine if there is any pattern to the variable they destroy, like perhaps it's everything with a leading double underscore?

    Also, in the interest of helping others figure this out, can you name the library that does this?

    Comment


      #3
      The library I'm using is JSmol (it seems to be the best choice for molecular visualization), but I doubt it's causing the problem directly. JSmol code bundled with java2script generated code, which might be causing the problems.

      Comment


        #4
        Thanks for filling us in, and please do keep us posted as you look into these other suggestions.

        Comment

        Working...
        X