:: Forum >>

Safari v5 crashes on AW.Formats.Date

Hi
We make extensive use of your Grid in our product, and thus AW.Formats.Date when setting cell formats. Unfortunately Safari v5 crashes when it reaches a line that has:
var dateAndTime = new AW.Formats.Date;

I took your example Grid and just added the above line to get Safari to die, and I caught the following in the console:
SyntaxError: Invalid regular expression: missing ) aw.js line 35

This was with AW v2.5.5.

Is this fixed in the up and coming v2.5.6?


thanks
Chris
Chris Pollard
Thursday, July 1, 2010
Not really sure, but could be a typo, cause replacing the sentence:
var re=new RegExp(match.replace("|","(")+")","gi");
with:
var re=new RegExp(match.replace("|","("+")"),"gi");
seems to work.
C+
Thursday, July 1, 2010
Sorry, the original RegExp sentence is correct, so seems that Safari 5 has a bug treating javascript parenthesis.
Friday, July 2, 2010
Okay, another bug with Safari v5 then :(
Do you know if this is tracked in the WebKit Bugzilla?

I've already fallen fowl of another Safari v5 bug with it not handling the right shift operator as expected, as has been noted here:
http://www.mail-archive.com/google-web-toolkit@googlegroups.com/msg43645.html

thanks
Chris
Chris Pollard
Friday, July 2, 2010
ok, this is definitely a bug in Safari. Here is a simplified testcase -

<html>
<body>
<script>

    var tokens = {
        "hh" : "x",
        "h" : "x",
        ":mm" : "x",
        "mm:" : "x",
        "ss" : "x",
        "tt" : "x",
        "dddd" : "x",
        "ddd" : "x",
        "dd" : "x",
        "d" : "x",
        "mmmm" : "x"
    };

    var i, match = "";

    for(i in tokens){
        match += "|" + i;
    }

    document.write('<textarea cols="60">' + match.replace("|", "(") + '</textarea>');

</script>
</body>
</html>

Alex (ActiveWidgets)
Monday, July 5, 2010
Here is a possible fix -

replace

var re = new RegExp(match.replace("|", "(")+")", "gi");

with

var re = new RegExp("(" + match.substr(1)+")", "gi");

either in /source/lib/formats/date.js, line 74

or directly in /runtime/lib/aw.js line 30, char 1693
Alex (ActiveWidgets)
Monday, July 5, 2010
Yes, it works very well for me (Safari 4.1, had the same problem). Thank you.
Tom
Sunday, July 11, 2010

This topic is archived.


Back to support forum

Forum search