PDA

View Full Version : [2.1] Bug when loading ext-all.js or ext-all-debug.js



deanna
24 Apr 2008, 7:59 PM
In ie7 I get an error loading the ext-all library. With the ext-all-debug.js library the message is
Line: 6680
Char: 9
Error: Syntax error

I get the same error when using FF with firebug. But the error appears to be upstream a bit from the line number. I started matching braces and when I get to line 6593 the braces don't match up anymore. The code at this line is

if (/["\\\x00-\x1f]/.test(s)) {

and is the first line of Ext.util.JSON.encodeString() function.

I tried to back down to ext2.0.2 and the bug was present there also.

evant
24 Apr 2008, 8:48 PM
This is almost definitely not a bug. It's probable that you have a corrupted version of the scripts, or your web server is not serving them up correctly.

deanna
24 Apr 2008, 9:18 PM
I downloaded the file from your site again ext2.1. Did a diff on the files and no difference. I get the same errors on the same lines with a new install. The ext files are being loaded as the very first javascript files as


<!-- EXT -->
<link rel='stylesheet' type='text/css' href='js/ext/resources/css/ext-all.css' />
<script type='text/javascript' src='js/ext/adapter/ext/ext-base.js'></script>
<script type='text/javascript' src='js/ext/ext-all.js' ></script>

I have unpacked them on both my PC, and the linux system that is the websever. I see the file as described above on both systems with 2 different downloads from your site.

evant
24 Apr 2008, 9:25 PM
Look at the response in firebug. Check the size of the downloaded files.

deanna
24 Apr 2008, 9:52 PM
Error I get in firebug with debug version is

invalid flag after regular expression
http://site.guildcircle.com/js/ext/ext-all-debug.js
Line 6680

These are the sizes on the linux server
-rw-r--r-- 1 root root 942534 Apr 21 04:04 ext-all-debug.js
-rw-r--r-- 1 root root 523229 Apr 21 04:05 ext-all.js
-rw-r--r-- 1 root root 160730 Apr 21 04:04 ext-core-debug.js
-rw-r--r-- 1 root root 86260 Apr 21 04:04 ext-core.js

firebug says ext-all-debug is 928kb

You can look directly at the site with http://site.guildcircle.com

evant
25 Apr 2008, 12:11 AM
I went to your demo site and everything loads correctly.

Try clearing your cache?

deanna
25 Apr 2008, 6:26 AM
I cleared my cache and I when I reload I still get the error. It doesn't stop the page from loading, but you see it when firebug is enabled. In safari it doesn't report the error. In ie7 I run with the IE web developer toolbar and it reports the error. My friend on the other side of the US gets its also. So I know it isn't anything particular about my machines/browsers or ISP. But I really don't understand how you got a clean version of the file. The error doesn't stop the site from working but I do get the parse error none the less.

Maybe there is something really stupid I'm doing. But I can load a fresh download of ext2.1 from the extjs site. I go to the line number 6680 that I'm getting the error on. It is at the closing of the Ext.util.JSON class. spket doesn't show a parse error there, but if you look at the closing brace of the class it doesn't match with the head of the class. Then match the braces on each function they get off kilter on line 6593 on the encodeString function.

This is the code there


var encodeString = function(s){
if (/["\\\x00-\x1f]/.test(s)) {
return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if(c){
return c;
}
c = b.charCodeAt();
return "\\u00" +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + '"';
}
return '"' + s + '"';
};

deanna
25 Apr 2008, 6:49 AM
I just loaded the file into vi and its syntax coloring also doesn't like that line. Are you sure that this regular expression is right?

if (/["\\\x00-\x1f]/.test(s))

deanna
25 Apr 2008, 8:28 AM
More info.

I did some working with it. And although that RE doesn't parse right in spket or vi, it doesn't cause the but I am seeing. The bug is actually not a parse error of the javascript, but runtime when it parses a php warning that comes back instead of the expected JSON. I don't mean it returns an error but is a javascript error on the php generated warning. The warning I can fix - but I wouldn't think bad data would cause the function to crash, just return an error.

This is the warning that crashed the JSON.decode


<br />

<b>Warning</b>: main(./classes/user/User.php) [<a href='function.main'>function.main</a>]: failed to

open stream: No such file or directory in <b>/usr/www/GuildDesktop/classes/Site.php</b> on line <b>26

</b><br />

<br />

<b>Fatal error</b>: main() [<a href='function.require'>function.require</a>]: Failed opening required

'./classes/user/User.php' (include_path='.:/usr/share/pear') in <b>/usr/www/GuildDesktop/classes/Site

.php</b> on line <b>26</b><br />

Eric Suen
25 Apr 2008, 5:49 PM
The regular expression is right, Spket has two part, one is for syntax highlighting, which is design for speed, and other is for syntax error report, code assist, which is using javascript parser. The brace not match is the bug of syntax highlighting...

ExtJsTest
1 Jul 2009, 6:02 AM
I'm having a really similar problem. did you guys manage to fix this?!

Thanks!!