Announcement

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

    isA.Array implementation fails when used from an iframe

    Hi,
    I am encountering an issue with the isA.Array implementation in Smartclient (8.3 recent build).

    Some background: we have code in an iframe which calls its parent/top. We load the SC libraries in the parent html page. So the iframe does not load the sc libraries directly. We use this to load a google map in an iframe without having all sc code to load in the iframe (we want to have access to the global context from the iframe).

    This scenario the isA.Array works incorrectly. The isA.Array implementation checks some native things it seems. This works fine in case of the main window but not if run from an iframe. The reason is that the array is created in the iframe and the array type in the iframe is not augmented by Smartclient (see the example pages attached). So therefore Smartclient does not detect/see the array as an array.

    If I compare the isA.Array implementation to implementations by other solutions ([1] see below) then this is different from what others do. For me this 'other' implementation would work fine and seems to be more like 'the common' approach.

    I have attached an example test cases, it needs to be run in web server and the paths to the ISC libraries have to be repaired, but you will see this fail in the console.

    Note this fails in chrome 18 but not in other browsers.

    gr. Martin

    [1]

    jQuery:
    https://github.com/jquery/jquery/blo...c/core.js#L487

    YUI3:
    https://github.com/yui/yui3/blob/mas...ui-lang.js#L28

    Enyo:
    https://github.com/enyojs/enyo/blob/...el/lang.js#L90
    Attached Files
    Last edited by martintaal; 15 May 2012, 04:47.

    #2
    The last time we looked at this, implementations in other frameworks were missing several corners cases where our behavior is correct. Looks like this is some new problem in Chrome, we'll take a look.

    Comment


      #3
      Hi,

      Just as a comment, this failed Array detection triggers a wrong serialization using isc.JSON.encode():

      Code:
      isc.JSON.encode({lines: ['one', 'two']});
      Produces in the main window:
      Code:
      {
          "lines":[
              "one", 
              "two"
          ]
      }
      And in the iframe:
      Code:
      {
          "lines":{
              "0":"one", 
              "1":"two"
          }
      }
      Which is a major problem.

      Thanks,

      Comment

      Working...
      X