Announcement

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

    SmartClient JavaScript not working with Google Maps API v3

    Hello everyone,

    My app uses google maps and since we updated to API v3 I've been having issues getting it to work and it seems SmartClient is causing the issue, because if I remove all SmartClient related <script> tags, it works. The change in behavior I see is: the side options (for zooming or changing between map and satellite views) are gone, the popups for location markers don't render properly, and zooming with the mouse wheel won't work.

    Looking at the call stack in the error log, it seems that maps' code tries to call something in SmartClient's code (maybe some unintended global?):

    Uncaught TypeError: undefined is not a function ISC_Core.js:428
    isc_Arra_map ISC_Core.js:428
    Uf.map.d main.js:25
    J4 VM10186:165
    A6 VM10186:253
    N.Sj VM10186:294
    (anonymous function) VM10167:31
    Zf main.js:26
    (anonymous function) VM10186:297
    xh.util VM10175:25
    (anonymous function) main.js:37
    (anonymous function) main.js:24
    (anonymous function) main.js:24
    (anonymous function) main.js:24
    Rf main.js:25
    Mf.(anonymous function).D main.js:24
    (anonymous function) VM10185 %7Bcontrols%7D.js:1

    Here, main.js belongs to Google Maps API, while ISC_Core.js is part of SmartClient.

    the SmartClient javascript file's we're importing are:

    /modules/ISC_Core.js
    /modules/ISC_Foundation.js
    /modules/ISC_Containers.js
    /modules/ISC_Grids.js
    /modules/ISC_DataBinding.js
    /skins/BlackOps/load_skin.js
    /locales/frameworkMessages_pt_BR.properties

    I'm using SmartClient Ajax RIA system Version v9.1p_2014-05-19/Pro Deployment (2014-05-19), currently testing on Google Chrome 38.0.2125.111 m (latest as of this post).

    The error happens regardless of whether I use a SmartClient component, but if I add one of the grids I use it works (the grid, not the map).

    Am I doing something wrong? Is this a known issue? Please let me know if you need any more info.

    Thanks in advance!

    #2
    Thanks for getting this deeply into this.

    The problem appears to be that SmartClient provides a custom implementation of Array.map, because we've had such an API since long before a "map" function was added to the ECMAScript standard.

    Our "map" implementation should be fully compatible with the native Array.map. Are you able to use the browser tools to see the arguments passed to our map function, and the specific line of code that's crashing?

    Comment


      #3
      It's been really hard to track down properly with all the minified files, but what I could gather is...

      main.js defines:

      Xf = function (a,b,c){return Uf.map[J](a,b,c)}

      where Uf is an array.

      J4 calls Xf with:

      Xf(this.j[Yb]("style"),function(a){return a[dF]})

      Can't really debug the call from J4, as it's not really a js file. Any thoughts on how to get the actual values passed in?

      Hope it helps.

      Comment


        #4
        Are you sure of that first line? It appears to access a property on the map Function itself. Typo in transcription perhaps?

        We're not sure what you mean about "J4" not being a JS file. It seems like if you're getting the error, just stopping on the error should allow you to look at the stack frames and get all the relevant values.

        If you're having trouble with that, another option would be a minimal, standalone test case that demonstrates the crash, so we can use debug tools directly.

        Comment


          #5
          Those lines are actually copied and pasted. Using 'Stop on Exceptions' did help: We could see that SC's map function "isc_Arra_map" is called with a single argument, a function:

          function (a){return a[dF]},

          And the error happens on the first "line" of isc_Arra_map, in "_9 = this.getLength()", because "this" is an array (apparently containing my <style> elements), but doesn't have "getLength", thus giving us a "Undefined is not a function" error.

          Comment


            #6
            Thanks, that helped track down the issue. Google Maps apparently takes the native Array.map function and assigns it to a non-Array, which is a surprising and risky thing to do (not a guaranteed valid behavior for Array.map per JavaScript spec, and wouldn't work before IE9..).

            Regardless, we've made a change that allows this usage to be supported by SmartClient's Array.map implementation. Download the next patched build to get the change.

            Comment


              #7
              We're not sure why, but we have intermittently started seeing this in production.

              Same error.

              Running 4.1-p20150218, when was it you fixed it?

              Comment

              Working...
              X