PDA

View Full Version : [FIXED] Ext.Loader.loadScript w/ disableCaching - Multiple Query Strings



rferri
13 Jan 2014, 2:26 PM
Ext version tested:

Ext 4.2.1
Browser versions tested against:

n/a
DOCTYPE tested against:

n/a
Description:

Using Ext.Loader.loadScript to dynamically load a script with a URL that contains a query string results in a request for a file with multiple query strings when the disableCaching config is true.
The implementation of loadScript should use Ext.String.urlAppend to append the cache-buster key-value pair to the URL.
https://fiddle.sencha.com/#fiddle/2kn
Steps to reproduce the problem:

Set the Ext.Loader config disableCaching to true
Call Ext.Loader.loadScript, passing a URL that contains a query string.
The result that was expected:

The URL requested should contain one query string with the additional cache-buster key-value pair appended.
The result that occurs instead:

The URL requested contains two query strings: the original and a query string that contains only the cache-buster kvp

Gary Schlosberg
13 Jan 2014, 5:14 PM
I think this is because you are calling the loader twice. If I comment lines 28-30 from your Fiddle example, it behaves as expected.

rferri
13 Jan 2014, 6:52 PM
I called it twice to illustrate the difference between calling loadScript when disableCaching is true and when it is false. Commenting lines 28-30 has no impact on the loadScript call initiated on line 38 (nor would I expect it to).

You should see that the URL passed to injectScriptElement remains

script.js?key=value?_dc=1389667417378

instead of the expected

script.js?key=value&_dc=1389667417378

Gary Schlosberg
13 Jan 2014, 10:34 PM
I see what you're saying now -- apologies for missing that. Thanks for the report! I have opened a bug in our bug tracker.

rferri
14 Jan 2014, 6:10 AM
No worries, thanks!