Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Ext JS Premium Member
    Join Date
    Jul 2008
    Posts
    14
    Vote Rating
    0
    docjah is on a distinguished road

      0  

    Default Production build causes JS Error in microloader block - number is not a function

    Production build causes JS Error in microloader block - number is not a function


    HI,





    Just upgraded to 2.1.


    When I do a production build , I get an error in the JS console.


    Uncaught TypeError: number is not a function




    <script type="text/javascript">(function(i){function s(a){function b(a,j){var c=a.length,b,g;for(b=0;b<c;b++){g=a[b];var e=a,K=b,d=void 0;"string"==typeof g&&(g={path:g});g.shared?(g.version=g.shared,d=g.shared+g.path)A.href=g.path,d=A.href);g.uri=d;g.key=h+"-"+d;f[d]=g;e[K]=g;g.type=j;g.index=b;g.collection=a;g.ready=!1;g.evaluated=!1}return a}var c;"string"==typeof a?(c=a,a=B(c)):c=JSON.stringify(a);var h=a.id,e=h+"-"+C+o,f={};this.key=e;this.css=b(a.css,"css");this.js=b(a.js,"js");this.assets=this.css.concat(this.js);this.getAsset=
    function(a){return f[a]};this.store=function(){t(e,c)}}function v(a,b){k.write('<meta name="'+a+'" content="'+b+'">')}function p(a,b,c){var h=new XMLHttpRequest,c=c||D,a=a+(-1==a.indexOf("?")?"?":"&")+Date.now();try{h.open("GET",a,!0),h.onreadystatechange=function(){if(4==h.readyState){var a=h.status,d=h.responseText;200<=a&&300>a||304==a||0==a&&0<d.length?b(d):c()}},h.send(null)}catch(d){c()}}function L(a,b){var c=k.createElement("iframe");m.push({iframe:c,callback:b});c.src=a+".html";c.style.cssText=
    "width:0;height:0;border:0;position:absolute;z-index:-999;visibility:hidden";k.body.appendChild(c)}function E(a,b,c){var d=!!a.shared;if(a.remote)b("");else{if(!d)var e=b,f=a.version,l,b=function(j){l=j.substring(0,f.length+4);l!=="/*"+f+"*/"?confirm("Requested: '"+a.uri+"' with checksum: "+f+" but received: "+l.substring(2,f.length)+"instead. Attempt to refresh the application?")&&M():e(j)};(d?L:p)(a.uri,b,c)}}function F(a){var b=a.data,a=a.source.window,c,d,e,f;c=0;for(d=m.length;c<d;c++)if(e=m[c],
    f=e.iframe,f.contentWindow===a){e.callback(b);k.body.removeChild(f);m.splice(c,1);break}}function G(a){"undefined"!=typeof console&&(console.error||console.log).call(console,a)}function t(a,b){try{n.setItem(a,b)}catch(c){if(c.code==c.QUOTA_EXCEEDED_ERR&&q){var d=q.assets.map(function(a){return a.key}),e=0,f=n.length,l=!1,j;for(d.push(q.key);e<=f-1j=n.key(e),-1==d.indexOf(j)?(n.removeItem(j),l=!0,f--):e++;l&&t(a,b)}}}function u(a){try{return n.getItem(a)}catch(d){return null}}function M(){H||(H=
    !0,p(o,function(a){(new s(a)).store();i.location.reload()}))}function w(a){function b(a,d){var b=a.collection,g=a.index,f=b.length,e;a.ready=!0;a.content=d;for(e=g-1;0<=e;e--)if(a=b[e],!a.ready||!a.evaluated)return;for(e=g;e<f;e++)if(a=b[e],a.ready)a.evaluated||c(a);else break}function c(a){a.evaluated=!0;if("js"==a.type)try{eval(a.content)}catch(b){G("Error evaluating "+a.uri+" with message: "+b)}else{var d=k.createElement("style"),c;d.type="text/css";d.textContent=a.content;"id"in a&&(d.id=a.id);
    "disabled"in a&&(d.disabled=a.disabled);c=document.createElement("base");c.href=a.path.replace(/\/[^\/]*$/,"/");x.appendChild(c);x.appendChild(d);x.removeChild(c)}delete a.content;0==--f&&h()}function h(){function b(){k&&c()}function c(){var a=r.onUpdated||D;if("onSetup"in r)r.onSetup(a);else a()}function e(){l.store();h.forEach(function(a){t(a.key,a.content)});c()}function g(a,b){a.content=b;0==--m&&(d.status==d.IDLE?e():i=e)}function f(){I("online",f,!1);p(o,function(c){q=l=new s(c);var e;l.assets.forEach(function(b){e=
    a.getAsset(b.uri);(!e||b.version!==e.version)&&h.push(b)});m=h.length;0==m?d.status==d.IDLE?b():i=b:h.forEach(function(b){function d(){E(b,function(a){g(b,a)})}var c=a.getAsset(b.uri),e=b.path,f=b.update;!c||!f||null===u(b.key)||"delta"!=f?d():p("deltas/"+e+"/"+c.version+".json",function(a){try{var d=b,c;var e=u(b.key),f=B(a),a=[],h,j,i;if(0===f.length)c=e;else{j=0;for(i=f.length;j<i;j++)h=f[j],"number"===typeof h?a.push(e.substring(h,h+f[++j])):a.push(h);c=a.join("")}g(d,c)}catch(k){G("Malformed delta content received for "+
    b.uri)}},d)})})}var h=[],k=!1,i=function(){},n=function(){d.swapCache();k=!0;i()},m;I("message",F,!1);if(d.status==d.UPDATEREADY)n();else if(d.status==d.CHECKING||d.status==d.DOWNLOADING)d.onupdateready=n,d.onnoupdate=d.onobsolete=function(){i()};!1!==navigator.onLine?f():y("online",f,!1)}var e=a.assets,f=e.length,l;q=a;y("message",F,!1);0==f?h():e.forEach(function(a){var c=u(a.key);null===c?E(a,function(c){a.remote||t(a.key,c);b(a,c)},function(){b(a,"")}):b(a,c)})}function J(a){null!==k.readyState.match(/interactive|complete|loaded/)?
    w(a):y("DOMContentLoaded",function(){navigator.standalone?setTimeout(function(){setTimeout(function(){w(a)},1)},1):w(a)},!1)}var D=function(){},m=[],k=i.document,x=k.head,y=i.addEventListener,I=i.removeEventListener,n=i.localStorage,d=i.applicationCache,B=JSON.parse,A=k.createElement("a"),z=k.location,C=z.origin+z.pathname+z.search,o="app.json",H=!1,q;if("undefined"===typeof r)var r=i.Ext={};r.blink=function(a){var b=u(a.id+"-"+C+o);v("viewport","width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no");
    v("apple-mobile-web-app-capable","yes");v("apple-touch-fullscreen","yes");b?(a=new s(b),J(a)):p(o,function(b){a=new s(b);a.store();J(a)})}})(this);;Ext.blink({"id":"e9081360-97de-11e1-a0d0-a5a3552e8c83"})</script>




    OK so that's my loader. Problem appears to be caused by these two snippets:


    var h=a.id


    This comes first.


    Then..


    0==--f&&h()


    so it looks as if h is being set to a number then being used as a function.


    Interestingly this comes next:


    function h(){function b(){k&&c()}


    The app does work , just throws a JS error.


    Any insight here?


    Thanks,


    Dave

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Can I have a test case?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Jul 2008
    Posts
    14
    Vote Rating
    0
    docjah is on a distinguished road

      0  

    Default


    Sure , how do I get it to you , what do you want , the whole project?

    Dave

Thread Participants: 1