Bug 34689 - Loading javascript files
Summary: Loading javascript files
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 420+
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL: http://www.lulabytes.com
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-06 23:44 PST by Juan
Modified: 2010-02-09 00:09 PST (History)
0 users

See Also:


Attachments
Capture (61.16 KB, image/jpeg)
2010-02-08 09:37 PST, Juan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juan 2010-02-06 23:44:42 PST
Chrome launch error "uncaught syntax error" when in others browsers never happen.
Looking the download code, you can see that a part of the code in the bottom another time.
It's correct the error, but it's not correct the way that Chrome mount or download the javascript file.
In my web page I have some javascript files, but it happens in some of them.

Example:


function _fiTs(aa, ab){var ac="";var ad=""+aa;if(ad.length < ab){var i=0;for(i=0;i <(ab-ad.length );i++){ac=ac.concat("0");}ac=ac.concat(ad);}else{ac=ad;}i=null;ad=null;return ac;}
 
function _sT(aa, ab){var ac=document.getElementById(aa);ac.innerHTML=ab;ac=null;}
 
function _gF(ac){
var aa=new Date();var d,m,y;d=aa.getDate();m=aa.getMonth()+1;y=aa.getFullYear();
var ab='';var i=0;
for(i=0;i < ac.length;i++){switch(ac.charAt(i)){case'y':if(((i+1)<ac.length)&&(ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}
ab=ab.concat(_fiTs(y,4));break;case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
 
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
 
&&(ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}

Uncaught SyntaxError: Unexpected token &&

ab=ab.concat(_fiTs(y,4));break;case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
 
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
Comment 1 Alexey Proskuryakov 2010-02-07 14:34:28 PST
Does this only happen in Chrome, and not in Safari?
Comment 2 Juan 2010-02-07 23:29:17 PST
(In reply to comment #1)
> Does this only happen in Chrome, and not in Safari?

In Safari too.
Comment 3 Alexey Proskuryakov 2010-02-08 08:42:10 PST
I don't see any syntax errors in Safari console (although there are other JavaScript errors reported).

What exactly is the bug here? I take it that to reproduce it, one needs to open http://www.lulabytes.com. What are the actual and expected results?
Comment 4 Juan 2010-02-08 09:20:42 PST
(In reply to comment #3)
> I don't see any syntax errors in Safari console (although there are other
> JavaScript errors reported).
> 
> What exactly is the bug here? I take it that to reproduce it, one needs to open
> http://www.lulabytes.com. What are the actual and expected results?

For example there is another uncaught syntax error:

function _fiTs(aa, ab){var ac="";var ad=""+aa;if(ad.length < ab){var i=0;for(i=0;i <(ab-ad.length );i++){ac=ac.concat("0");}ac=ac.concat(ad);}else{ac=ad;}i=null;ad=null;return ac;}
function _sT(aa, ab){var ac=document.getElementById(aa);ac.innerHTML=ab;ac=null;}
function _gF(ac){var aa=new Date();var d,m,y;d=aa.getDate();m=aa.getMonth()+1;y=aa.getFullYear();var ab='';var i=0;
for(i=0;i < ac.length;i++)
{switch(ac.charAt(i))
{case'y':if(((i+1)<ac.length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;

Uncaught SyntaxError: Unexpected token )
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}



The problem is that the page doesn't load correctly, you can not see the menu, and the text...
As there are some errors in Javascript, the loading data stops.
I can not see this problem in Firefox or IExplorer.
Comment 5 Juan 2010-02-08 09:33:27 PST
(In reply to comment #4)
> (In reply to comment #3)
> > I don't see any syntax errors in Safari console (although there are other
> > JavaScript errors reported).
> > 
> > What exactly is the bug here? I take it that to reproduce it, one needs to open
> > http://www.lulabytes.com. What are the actual and expected results?
> 
> For example there is another uncaught syntax error:
> 
> function _fiTs(aa, ab){var ac="";var ad=""+aa;if(ad.length < ab){var
> i=0;for(i=0;i <(ab-ad.length
> );i++){ac=ac.concat("0");}ac=ac.concat(ad);}else{ac=ad;}i=null;ad=null;return
> ac;}
> function _sT(aa, ab){var
> ac=document.getElementById(aa);ac.innerHTML=ab;ac=null;}
> function _gF(ac){var aa=new Date();var
> d,m,y;d=aa.getDate();m=aa.getMonth()+1;y=aa.getFullYear();var ab='';var i=0;
> for(i=0;i < ac.length;i++)
> {switch(ac.charAt(i))
> {case'y':if(((i+1)<ac.length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)<
> ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
> case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)<
> ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
> case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return
> ab;}
> function _gH(){var aa=null;var ab=new Date();var
> h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return
> _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
> length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&&
> (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
> 
> Uncaught SyntaxError: Unexpected token )
> case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)<
> ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
> case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return
> ab;}
> function _gH(){var aa=null;var ab=new Date();var
> h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return
> _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
> 
> 
> 
> The problem is that the page doesn't load correctly, you can not see the menu,
> and the text...
> As there are some errors in Javascript, the loading data stops.
> I can not see this problem in Firefox or IExplorer.



What I like to understand  is the reason why I get javascript errors with chrome, but the javascript sintax is correct. I also find when the internet conexion is not good enought .
Comment 6 Alexey Proskuryakov 2010-02-08 09:34:05 PST
I do see the menu in Safari 4.0.4. The site looks exactly like it looks in Firefox (only fonts are different).
Comment 7 Juan 2010-02-08 09:37:59 PST
Created attachment 48339 [details]
Capture

The result to load with Chrome
Comment 8 Juan 2010-02-08 09:38:31 PST
The Capture of the page.
Comment 9 Juan 2010-02-08 09:56:52 PST
(In reply to comment #8)
> The Capture of the page.

Another uncaught syntax error from utils.js:
It's seems that the navigator do not package well the donwloaded file. We can see one part of the dowloaded file added at the bottom of the page.
  


function _fiTs(aa, ab){var ac="";var ad=""+aa;if(ad.length < ab){var i=0;for(i=0;i <(ab-ad.length );i++){ac=ac.concat("0");}ac=ac.concat(ad);}else{ac=ad;}i=null;ad=null;return ac;}
function _sT(aa, ab){var ac=document.getElementById(aa);ac.innerHTML=ab;ac=null;}
function _gF(ac){var aa=new Date();var d,m,y;d=aa.getDate();m=aa.getMonth()+1;y=aa.getFullYear();var ab='';var i=0;
for(i=0;i < ac.length;i++)
{switch(ac.charAt(i))
{case'y':if(((i+1)<ac.length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;


Uncaught SyntaxError: Unexpected token )
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
Comment 10 Alexey Proskuryakov 2010-02-08 10:00:49 PST
Please don't paste obfuscated code here. It is most obviously broken, there is no need for anyone to look into it.

As already mentioned, this site looks fine for me in Safari.
Comment 11 Juan 2010-02-08 10:13:40 PST
(In reply to comment #10)
> Please don't paste obfuscated code here. It is most obviously broken, there is
> no need for anyone to look into it.
> 
> As already mentioned, this site looks fine for me in Safari.

Sorry for the obfuscated code, but is what I use, for this reason I has paste it, I prefer you to see the real code.
The problem is not the javascript code, is the package of the frames received. 
I think that, as you have a very good connection in internet, you are not able to see the problem as I do, but the problem exists, and the probe is the capture sent. 
I remember you that I get the same problem wiht the safari browser, so it not just a chrome problem and it is not a problem with the server, because with other browser as internet explorer, this problem doesn't exist.

Please try to make an effort to understand me. Your help it would be gratefull. Thanks for your kind help and understanding.
Comment 12 Juan 2010-02-09 00:09:25 PST
(In reply to comment #11)
> (In reply to comment #10)
> > Please don't paste obfuscated code here. It is most obviously broken, there is
> > no need for anyone to look into it.
> > 
> > As already mentioned, this site looks fine for me in Safari.
> 
> Sorry for the obfuscated code, but is what I use, for this reason I has paste
> it, I prefer you to see the real code.
> The problem is not the javascript code, is the package of the frames received. 
> I think that, as you have a very good connection in internet, you are not able
> to see the problem as I do, but the problem exists, and the probe is the
> capture sent. 
> I remember you that I get the same problem wiht the safari browser, so it not
> just a chrome problem and it is not a problem with the server, because with
> other browser as internet explorer, this problem doesn't exist.
> 
> Please try to make an effort to understand me. Your help it would be gratefull.
> Thanks for your kind help and understanding.


This is the best example, to see what is wrong.
It's not the code, it's how is downloading the file...

http://88.2.242.162/lulahome/js/utils.js

Firefox/IExplorer (Correct):

function _fiTs(aa, ab){var ac="";var ad=""+aa;if(ad.length < ab){var i=0;for(i=0;i <(ab-ad.length );i++){ac=ac.concat("0");}ac=ac.concat(ad);}else{ac=ad;}i=null;ad=null;return ac;}
function _sT(aa, ab){var ac=document.getElementById(aa);ac.innerHTML=ab;ac=null;}
function _gF(ac){var aa=new Date();var d,m,y;d=aa.getDate();m=aa.getMonth()+1;y=aa.getFullYear();var ab='';var i=0;
for(i=0;i < ac.length;i++)
{switch(ac.charAt(i))
{case'y':if(((i+1)<ac.length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}


Chrome/Safari:
function _fiTs(aa, ab){var ac="";var ad=""+aa;if(ad.length < ab){var i=0;for(i=0;i <(ab-ad.length );i++){ac=ac.concat("0");}ac=ac.concat(ad);}else{ac=ad;}i=null;ad=null;return ac;}
function _sT(aa, ab){var ac=document.getElementById(aa);ac.innerHTML=ab;ac=null;}
function _gF(ac){var aa=new Date();var d,m,y;d=aa.getDate();m=aa.getMonth()+1;y=aa.getFullYear();var ab='';var i=0;
for(i=0;i < ac.length;i++)
{switch(ac.charAt(i))
{case'y':if(((i+1)<ac.length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}
length)&& (ac.charAt(i+1)=='+')){y=y+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){y=y-1;}ab=ab.concat(_fiTs(y,4));break;
case'm':if(((i+1)< ac.length)&& (ac.charAt(i+1)=='+')){m=m+1;}if(((i+1)< ac.length)&& (ac.charAt(i+1)=='-')){m=m-1;}ab=ab.concat(_fiTs(m,2));break;
case'd':ab=ab.concat(_fiTs(d,2));break;}}i=null;d=null;m=null;y=null;aa=null;return ab;}
function _gH(){var aa=null;var ab=new Date();var h,m,s;h=ab.getHours();m=ab.getMinutes();s=ab.getSeconds();return _fiTs(h,2)+_fiTs(m,2)+_fiTs(s,2);}


If you can compare the two files, you can see that in the Chrome file there are  repeated parts in the code. 
Thanks in advance.