Another very clear example.  Thanks.  I made some elaborations and added
comments here:  https://jsfiddle.net/dlaliberte/kw7weduj/7/

I believe the 'breaking' change introduced with 45.2 is merely the use of
ES6.  This has the effect of ensuring that the 'values' property is defined
on all arrays, as specified here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values
This 'values' property is a function that returns an iterator over the
array values.

And when the 'values' property is defined on arrays, then the valid
expression:
  with (someArray) { return values }
will return that property, which happens to be a function, and hence,
length of that function is 0.

So this is actually valid and correct, though bizarre and confusing, and a
very good reason to entirely avoid use of JavaScript 'with'.  I believe
this also means that Firefox and other browsers are actually wrong, and
need to be fixed to behave the same as Chrome.  They should all aim to be
consistent in any event.

This is a problem with ES6, to some extent, because it introduced this new
property ('values') on Array prototype, which could affect any program that
was trying to use this same property for a different purpose, or doesn't
expect it to be there at all.  It is also a problem with JS 'with' because
it can result in these kinds of surprises, but that is actually incidental
here, and only one of the ways in which this problem can be exposed.

Short of upgrading your ExtJS, maybe there is a patch you could apply to
work around the problem, which is in Ext.XTemplate,  tpl.compiled. See h
ttp://docs.sencha.com/extjs/4.0.7/source/XTemplate.html  You'll have to
replace this function with one that avoids accidental use of this values
property.  Or maybe the problem is really in the WITHVALUES definition:

  WITHVALUES = 'with(values){ ',

and every place it is used.  E.g.

  Ext.functionFactory(VALUES, PARENT, 'try{' + WITHVALUES + RETURN + name +
';}}catch(e){return;}');

Ya, that looks like the problem described in the previous link, better
formatted here:
https://www.sencha.com/forum/showthread.php?273538-ExtJS-4-0-7-Chrome-30-0-1599-69-Ext-view-View-fails-to-render-(Ext-XTemplate-fails)

Also note in a later comment: "As far as filing a bug, the code segment you
referenced is not in the next version of the code (4.1.0) let alone the
current one, and Chrome 30 didn't exist when 4.0.7 released in 2011."

So maybe it will be enough for you to upgrade to ExtJS 4.1.0.


On Fri, Jul 7, 2017 at 4:46 PM, Ariel Falduto <[email protected]> wrote:

> Hi Daniel, forget about the ExtJS loader exceptions, they are not related
> in any way to the issue, they are fiddle related exceptions.
> I think a breaking change was introduced in the latest version (45.2).
> I prepared a new js fiddle example with no ExtJS loader code at all,
> please try it:
>
> https://jsfiddle.net/outaTiME/kw7weduj/
>
> Also note above example is failing in chrome but not in firefox or safari.
> May be there is a problem with the ES6 transpiler?
> Unfortunately I can’t upgrade to a newer version of ExtJS in the short or
> mid term.
> Thanks
>
> El viernes, 7 de julio de 2017, 0:45:47 (UTC-3), Daniel LaLiberte escribió:
>>
>> Thanks Ariel.  Nice clear example!  Here is what I am seeing.
>>
>> Loading 45.2, I get only two errors both saying:
>>
>> ?_dc=1499395990479:2 Uncaught TypeError: Ext.Loader.setPath is not a
>> function
>> at ?_dc=1499395990479:2
>>
>> If I add a big timeout around the Ext.onReady() callback function, or
>> rearrange to do the Ext.onReady first, I get more errors:
>>
>> VM28 extensions::extension:10 Uncaught Natives disabled
>> Uncaught (in promise) TypeError: l.fireFn.apply is not a function at
>> EXTUTIL.Event.fire (VM123 ext-all-debug.js:329) at Object.onDocumentReady
>> [as onReady] (VM123 ext-all-debug.js:5420) at VM289 app.js:9 at <anonymous>
>>
>> This suggests to me that there is a problem loading the ExtJS code this
>> way, regardless whether it works or not, and maybe this loading problem was
>> only exposed sufficiently with the new Google Charts loader to cause
>> failures.
>>
>> If I load version 44, I still see the same errors as above, but it
>> proceeds to run the XTemplate as desired.
>>
>> So it seems that loading is not happening as intended (there should be no
>> errors), but even if things manage to get loaded, they don't behave
>> properly if Google Charts 45.2 is loaded.
>>
>> I am suspecting that ExtJS 4.07 (and maybe some other versions from that
>> era) is interfering with the Object and Array prototype methods in a way
>> that is not compatible with more recent code, and the browser native
>> support.
>>
>> This message looks spot on:
>> https://www.sencha.com/forum/archive/index.php/t-273538.html
>> "EDIT : It's a bug. It is caused by ECMAScript 6 support
>> (Array.prototype has function values)
>>
>> If you call f([1,2,3], obj) in an ECMAScript 5 environment, then the
>> values reference inside the with statement will resolve to obj. However,
>> ECMAScript 6 introduces a values property on Array.prototype (
>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Ref
>> erence/Global_Objects/Array/prototype) (so that it will be available on
>> every array). So, in a JavaScript environment that supports ECMAScript 6,
>> the values reference inside the with statement will resolve to
>> [1,2,3].values. [...]"
>>
>> Newer versions of ExtJS have fixed this problem, apparently.
>> The new loader does use some ES6 features, in particular, the Promise
>> mechanism.  Moreover, version 45.2 uses some more ES6, and perhaps that is
>> enough to trigger the problems with XTemplate.
>>
>> So, I don't see a workaround.  I'm not inclined to back out any of the
>> changes I have made in 45.2, and it is difficult to know at this point what
>> changes triggered this old problem in ExtJS 4.07.  You'll probably have to
>> stick with versions 44, 45, or 45.1 (if they still work for you) until you
>> can upgrade your ExtJS.
>>
>>
>> On Thu, Jul 6, 2017 at 10:04 PM, Ariel Falduto <[email protected]> wrote:
>>
>>> Hi Daniel, please see the following example to reproduce the issue with
>>> ‘current’ version:
>>> https://fiddle.sencha.com/#fiddle/22on
>>>
>>> Also you can see that works fine with ’45.1’
>>>
>>> El jueves, 6 de julio de 2017, 17:10:07 (UTC-3), Daniel LaLiberte
>>> escribió:
>>>>
>>>> Ariel and Katia, if you could point me at an example page using ExtJS
>>>> with Google Charts that shows this problem, I'd be happy to look into it.
>>>> Otherwise, I don't have much of a clue about what could be going wrong.  I
>>>> thought I read somewhere that newer versions of ExtJS might also resolve
>>>> the conflict.
>>>>
>>>> On Thu, Jul 6, 2017 at 3:19 PM, Ariel Falduto <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Katia, I have the same problem here with ExtJS and is very weird
>>>>> ... for example the Ext.XTemplate object for some reason instead of
>>>>> returning an array is returning an object from
>>>>> jsapi_compiled_format_module, my workaround was to set charts version to
>>>>> 45.1. Also I’m having this problem only in chrome.
>>>>>
>>>>>
>>>>> El viernes, 16 de junio de 2017, 7:05:18 (UTC-3), Katia Caprarelli
>>>>> escribió:
>>>>>>
>>>>>> Since this morning 16 of june 2017 my application displayed a bug
>>>>>> with the combobox using Chrome or IE
>>>>>> After a long debug we realized there should be a conflict between the
>>>>>> two libraries : ExtJs 4.07 and Google Chart upcoming release .
>>>>>> changing the google loader in : google.charts.load('44',
>>>>>> {............}) //last stable release it start working again
>>>>>>
>>>>>> I hope it will be fixed asap
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Il giorno giovedì 15 giugno 2017 21:09:38 UTC+2, Daniel LaLiberte ha
>>>>>> scritto:
>>>>>>>
>>>>>>> You can now load Google Charts version '45.2' by loading
>>>>>>> 'upcoming'.  Please test this version and let us know if you experience 
>>>>>>> any
>>>>>>> new problems.
>>>>>>>
>>>>>>>
>>>>>>> At this time, 'current' is still '45.1'.  You can continue to load
>>>>>>> version '45' or '45.1' by specifying one of those versions.
>>>>>>>
>>>>>>> Anticipated production release date: June 28
>>>>>>>   On this date, loading 'current' or 'upcoming' will load '45.2'.
>>>>>>>
>>>>>>> This version includes a few bug fixes and many changes that involve
>>>>>>> internal refactoring, particularly in how options are processed, but 
>>>>>>> there
>>>>>>> should be no visible changes.
>>>>>>>
>>>>>>>
>>>>>>> Summary of changes for v45.2:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>    -
>>>>>>>
>>>>>>>    Corecharts
>>>>>>>    -
>>>>>>>
>>>>>>>       Added tooltip.boxStyle options: e.g.
>>>>>>>
>>>>>>>  'tooltip': {
>>>>>>>
>>>>>>>    'boxStyle': {
>>>>>>>
>>>>>>>        'stroke': '#b2b2b2',  'strokeOpacity': 1,  'strokeWidth': 1.5,
>>>>>>>
>>>>>>>        'fill': 'white',  'fillOpacity': 1,
>>>>>>>
>>>>>>>        'shadow': {  'radius': 1, 'opacity': 0.2,  'xOffset': 0,
>>>>>>>  'yOffset': 2 }
>>>>>>>
>>>>>>>    }}
>>>>>>>
>>>>>>>    -
>>>>>>>
>>>>>>>       Fix AreaChart legend items to use areaOpacity option.
>>>>>>>       -
>>>>>>>
>>>>>>>       Fix infinite loop when formatted domain values are
>>>>>>>       (incorrectly) numeric.
>>>>>>>
>>>>>>>
>>>>>>>    -
>>>>>>>
>>>>>>>    Table
>>>>>>>    -
>>>>>>>
>>>>>>>       Fix paging buttons.
>>>>>>>       -
>>>>>>>
>>>>>>>       Add column type to header cell classlist.
>>>>>>>       -
>>>>>>>
>>>>>>>       Respect column property.
>>>>>>>       -
>>>>>>>
>>>>>>>       Fix accessibility labels when sorting is enabled.
>>>>>>>       -
>>>>>>>
>>>>>>>    Gantt
>>>>>>>    -
>>>>>>>
>>>>>>>       Fix selection object to include row index.
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Daniel LaLiberte
>>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>>>>> [email protected]   5CC, Cambridge MA
>>>>>>>
>>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google Visualization API" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at https://groups.google.com/grou
>>>>> p/google-visualization-api.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/google-visualization-api/
>>>>> bb57a7a4-6f11-4c39-8877-1ddc555720d2%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/google-visualization-api/bb57a7a4-6f11-4c39-8877-1ddc555720d2%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Daniel LaLiberte
>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>> [email protected]   5CC, Cambridge MA
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Visualization API" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/grou
>>> p/google-visualization-api.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/google-visualization-api/cbae6416-d668-4f12-9861-bf2a8f
>>> 17916c%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/cbae6416-d668-4f12-9861-bf2a8f17916c%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>> [email protected]   5CC, Cambridge MA
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to google-visualization-api@
> googlegroups.com.
> Visit this group at https://groups.google.com/
> group/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-visualization-api/d5e113f9-7236-45f3-9fd0-
> 39e36c4cce49%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/d5e113f9-7236-45f3-9fd0-39e36c4cce49%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJNt8kgVNzUWM5k_ma101QqhwzOr-kOb07pnBy6o420DSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to