Show
Ignore:
Timestamp:
07/18/06 13:22:45 (2 years ago)
Author:
brmorris
Message:

2006-07-17 Bradley <bradley.morrison@nokia.com>

Reviewed by Sachin/Zalan.

Various fixes - see ChangeLogs for details.
Part 1 of 4.

Location:
S60/trunk/JavaScriptCore
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • S60/trunk/JavaScriptCore/ChangeLog

    r15432 r15507  
     12006-07-18  brmorris  <bradley.morrison> 
     2 
     3        Reviewed by Zalan/Sachin. 
     4 
     5        * kjs/date_object.cpp: support for utc 
     6        (formatDate): 
     7        (formatDateUTCVariant): 
     8        (formatTime): 
     9        (DateProtoFuncImp::call): 
     10        (DateObjectImp::call): 
     11        * kjs/nodes.cpp: 
     12        (BlockNode::~BlockNode): Implemented. 
     13        * kjs/nodes.h: ~BlockNode 
     14        * kjs/object.h: KJS_MAX_STACK set to 80 on hw 
     15        * kjs/shared_ptr.h:  
     16        (kxmlcore::SharedPtr::setNull): wrapped in NOKIA_CHANGES 
     17 
    1182006-06-06  Bradley  <bradley.morrison@nokia.com> 
    219 
  • S60/trunk/JavaScriptCore/kjs/date_object.cpp

    r14549 r15507  
    9191#define ctime(x) NotAllowedToCallThis() 
    9292#define strftime(a, b, c, d) NotAllowedToCallThis() 
    93  
     93#endif 
     94 
     95#if APPLE_CHANGES 
    9496static const char * const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; 
    9597static const char * const monthName[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 
     98#endif 
     99 
     100 
     101#if APPLE_CHANGES && !NOKIA_CHANGES 
    96102     
    97103static struct tm *tmUsingCF(time_t clock, CFTimeZoneRef timeZone) 
     
    264270    CFDateFormatterStyle retVal = defaultStyle; 
    265271    if (string == "short") 
    266         retVal = kCFDateFormatterShortStyle; 
     272  retVal = kCFDateFormatterShortStyle; 
    267273    else if (string == "medium") 
    268         retVal = kCFDateFormatterMediumStyle; 
     274  retVal = kCFDateFormatterMediumStyle; 
    269275    else if (string == "long") 
    270         retVal = kCFDateFormatterLongStyle; 
     276  retVal = kCFDateFormatterLongStyle; 
    271277    else if (string == "full") 
    272         retVal = kCFDateFormatterFullStyle; 
     278  retVal = kCFDateFormatterFullStyle; 
    273279    return retVal; 
    274280} 
     
    282288    CFDateFormatterStyle    timeStyle = (includeTime ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle); 
    283289 
    284     UString     arg0String; 
    285     UString     arg1String; 
    286     bool        useCustomFormat = false; 
    287     UString     customFormatString; 
     290    UString arg0String; 
     291    UString arg1String; 
     292    bool  useCustomFormat = false; 
     293    UString customFormatString; 
    288294    arg0String = args[0].toString(exec); 
    289295    if ((arg0String == "custom") && (argCount >= 2)) { 
    290         useCustomFormat = true; 
    291         customFormatString = args[1].toString(exec); 
     296  useCustomFormat = true; 
     297  customFormatString = args[1].toString(exec); 
    292298    } else if (includeDate && includeTime && (argCount >= 2)) { 
    293         arg1String = args[1].toString(exec); 
    294         dateStyle = styleFromArgString(arg0String,dateStyle); 
    295         timeStyle = styleFromArgString(arg1String,timeStyle); 
     299  arg1String = args[1].toString(exec); 
     300  dateStyle = styleFromArgString(arg0String,dateStyle); 
     301  timeStyle = styleFromArgString(arg1String,timeStyle); 
    296302    } else if (includeDate && (argCount >= 1)) { 
    297         dateStyle = styleFromArgString(arg0String,dateStyle); 
     303  dateStyle = styleFromArgString(arg0String,dateStyle); 
    298304    } else if (includeTime && (argCount >= 1)) { 
    299         timeStyle = styleFromArgString(arg0String,timeStyle); 
     305  timeStyle = styleFromArgString(arg0String,timeStyle); 
    300306    } 
    301307    CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, dateStyle, timeStyle); 
    302308    if (useCustomFormat) { 
    303         CFStringRef     customFormatCFString = CFStringCreateWithCharacters(NULL,(UniChar*)customFormatString.data(),customFormatString.size()); 
    304         CFDateFormatterSetFormat(formatter,customFormatCFString); 
    305         CFRelease(customFormatCFString); 
     309  CFStringRef customFormatCFString = CFStringCreateWithCharacters(NULL,(UniChar*)customFormatString.data(),customFormatString.size()); 
     310  CFDateFormatterSetFormat(formatter,customFormatCFString); 
     311  CFRelease(customFormatCFString); 
    306312    } 
    307313    CFStringRef string = CFDateFormatterCreateStringWithAbsoluteTime(NULL, formatter, time - kCFAbsoluteTimeIntervalSince1970); 
     
    341347 
    342348 
    343  
    344  
    345349static time_t timegm(tm* t) 
    346350{ 
    347         // timegm use GMT time zone 
    348         return mktime(t) - User::UTCOffset().Int(); 
    349 } 
    350  
    351  
    352 static UString formatDate(tm &t) 
    353 { 
    354         TBuf<64> buf; 
    355         TTime tt( TDateTime(t.tm_year + 1900, TMonth(t.tm_mon), t.tm_mday-1, 
    356                                  t.tm_hour, t.tm_min, t.tm_sec, 0) ); 
    357         tt.FormatL( buf, KDateFormat ); 
    358         const UChar *p = (const UChar*)buf.Ptr(); 
    359         return UString( p, buf.Length() ); 
    360 } 
    361  
    362 static UString formatDateUTCVariant(tm &t) 
    363 { 
    364         TBuf<64> buf; 
    365         TTime tt( TDateTime(t.tm_year + 1900, TMonth(t.tm_mon), t.tm_mday-1, 
    366                                  t.tm_hour, t.tm_min, t.tm_sec, 0) ); 
    367         tt.FormatL( buf, KDateUTCVariant ); 
    368         const UChar *p = (const UChar*)buf.Ptr(); 
    369         return UString( p, buf.Length() ); 
    370 } 
    371  
    372 static UString formatTime(tm &t) 
    373 { 
    374         TBuf<64> buf; 
    375         TTime tt( TDateTime(t.tm_year + 1900, TMonth(t.tm_mon), t.tm_mday-1, 
    376                                  t.tm_hour, t.tm_min, t.tm_sec, 0) ); 
    377         tt.FormatL( buf, KTimeFormat ); 
    378         const UChar *p = (const UChar*)buf.Ptr(); 
    379         return UString( p, buf.Length() ); 
     351  // timegm use GMT time zone 
     352  return mktime(t) - User::UTCOffset().Int(); 
     353} 
     354 
     355 
     356static UString formatDate(struct tm &tm) 
     357{ 
     358    char buffer[100]; 
     359    sprintf(buffer, "%s %s %02d %04d", 
     360        weekdayName[(tm.tm_wday + 6) % 7], 
     361        monthName[tm.tm_mon], tm.tm_mday, tm.tm_year + 1900); 
     362    return buffer; 
     363} 
     364 
     365 
     366static UString formatDateUTCVariant(struct tm &tm) 
     367{ 
     368    char buffer[100]; 
     369    sprintf(buffer, "%s, %02d %s %04d", 
     370        weekdayName[(tm.tm_wday + 6) % 7], 
     371        tm.tm_mday, monthName[tm.tm_mon], tm.tm_year + 1900); 
     372    return buffer; 
     373} 
     374 
     375 
     376static UString formatTime(struct tm &tm, bool utc) 
     377{ 
     378    char buffer[100]; 
     379    TLocale locale; 
     380  TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset()); 
     381  // add one hour daylight offset, if any 
     382  if( locale.QueryHomeHasDaylightSavingOn() ) 
     383    universalTimeOffset = universalTimeOffset.Int() - (60 * 60) ; 
     384 
     385    if (utc) { 
     386        sprintf(buffer, "%02d:%02d:%02d GMT", tm.tm_hour, tm.tm_min, tm.tm_sec); 
     387    } else { 
     388        int offset = universalTimeOffset.Int(); 
     389        if (offset < 0) { 
     390            offset = -offset; 
     391        } 
     392        sprintf(buffer, "%02d:%02d:%02d GMT%c%02d%02d", 
     393            tm.tm_hour, tm.tm_min, tm.tm_sec, 
     394            universalTimeOffset.Int() < 0 ? '-' : '+', offset / (60 * 60), (offset / 60) % 60); 
     395    } 
     396    return UString(buffer); 
    380397} 
    381398 
     
    383400static UString formatLocaleDate(KJS::ExecState *exec, time_t t_, bool includeDate, bool includeTime, const KJS::List &args) 
    384401{ 
    385         TBuf<256> buf; 
    386         struct tm* t = localtime( &t_ ); 
    387         TTime tt( TDateTime(t->tm_year + 1900, TMonth(t->tm_mon), t->tm_mday-1, 
    388                                 t->tm_hour, t->tm_min, t->tm_sec, 0) ); 
    389  
    390         if( includeDate && includeTime ) 
    391                 tt.FormatL( buf, KLocaleDateTime ); 
    392         else if( includeDate ) 
    393                 tt.FormatL( buf, KLocaleDate ); 
    394         else if( includeTime ) 
    395                 tt.FormatL( buf, KLocaleTime ); 
    396  
    397         const UChar *p = (const UChar*)buf.Ptr(); 
    398         return UString( p, buf.Length() ); 
     402  TBuf<256> buf; 
     403  struct tm* t = localtime( &t_ ); 
     404  TTime tt( TDateTime(t->tm_year + 1900, TMonth(t->tm_mon), t->tm_mday-1, 
     405        t->tm_hour, t->tm_min, t->tm_sec, 0) ); 
     406 
     407  if( includeDate && includeTime ) 
     408    tt.FormatL( buf, KLocaleDateTime ); 
     409  else if( includeDate ) 
     410    tt.FormatL( buf, KLocaleDate ); 
     411  else if( includeTime ) 
     412    tt.FormatL( buf, KLocaleTime ); 
     413 
     414  const UChar *p = (const UChar*)buf.Ptr(); 
     415  return UString( p, buf.Length() ); 
    399416} 
    400417 
     
    501518   We use a negative ID to denote the "UTC" variant. 
    502519@begin dateTable 61 
    503   toString              DateProtoFuncImp::ToString              DontEnum|Function       0 
    504   toUTCString           -DateProtoFuncImp::ToUTCString          DontEnum|Function       0 
    505   toDateString          DateProtoFuncImp::ToDateString          DontEnum|Function       0 
    506   toTimeString          DateProtoFuncImp::ToTimeString          DontEnum|Function       0 
    507   toLocaleString        DateProtoFuncImp::ToLocaleString        DontEnum|Function       0 
    508   toLocaleDateString    DateProtoFuncImp::ToLocaleDateString    DontEnum|Function       0 
    509   toLocaleTimeString    DateProtoFuncImp::ToLocaleTimeString    DontEnum|Function       0 
    510   valueOf               DateProtoFuncImp::ValueOf               DontEnum|Function       0 
    511   getTime               DateProtoFuncImp::GetTime               DontEnum|Function       0 
    512   getFullYear           DateProtoFuncImp::GetFullYear           DontEnum|Function       0 
    513   getUTCFullYear        -DateProtoFuncImp::GetFullYear          DontEnum|Function       0 
    514   toGMTString           -DateProtoFuncImp::ToGMTString          DontEnum|Function       0 
    515   getMonth              DateProtoFuncImp::GetMonth              DontEnum|Function       0 
    516   getUTCMonth           -DateProtoFuncImp::GetMonth             DontEnum|Function       0 
    517   getDate               DateProtoFuncImp::GetDate               DontEnum|Function       0 
    518   getUTCDate            -DateProtoFuncImp::GetDate              DontEnum|Function       0 
    519   getDay                DateProtoFuncImp::GetDay                DontEnum|Function       0 
    520   getUTCDay             -DateProtoFuncImp::GetDay               DontEnum|Function       0 
    521   getHours              DateProtoFuncImp::GetHours              DontEnum|Function       0 
    522   getUTCHours           -DateProtoFuncImp::GetHours             DontEnum|Function       0 
    523   getMinutes            DateProtoFuncImp::GetMinutes            DontEnum|Function       0 
    524   getUTCMinutes         -DateProtoFuncImp::GetMinutes           DontEnum|Function       0 
    525   getSeconds            DateProtoFuncImp::GetSeconds            DontEnum|Function       0 
    526   getUTCSeconds         -DateProtoFuncImp::GetSeconds           DontEnum|Function       0 
    527   getMilliseconds       DateProtoFuncImp::GetMilliSeconds       DontEnum|Function       0 
    528   getUTCMilliseconds    -DateProtoFuncImp::GetMilliSeconds      DontEnum|Function       0 
    529   getTimezoneOffset     DateProtoFuncImp::GetTimezoneOffset     DontEnum|Function       0 
    530   setTime               DateProtoFuncImp::SetTime               DontEnum|Function       1 
    531   setMilliseconds       DateProtoFuncImp::SetMilliSeconds       DontEnum|Function       1 
    532   setUTCMilliseconds    -DateProtoFuncImp::SetMilliSeconds      DontEnum|Function       1 
    533   setSeconds            DateProtoFuncImp::SetSeconds            DontEnum|Function       2 
    534   setUTCSeconds         -DateProtoFuncImp::SetSeconds           DontEnum|Function       2 
    535   setMinutes            DateProtoFuncImp::SetMinutes            DontEnum|Function       3 
    536   setUTCMinutes         -DateProtoFuncImp::SetMinutes           DontEnum|Function       3 
    537   setHours              DateProtoFuncImp::SetHours              DontEnum|Function       4 
    538   setUTCHours           -DateProtoFuncImp::SetHours             DontEnum|Function       4 
    539   setDate               DateProtoFuncImp::SetDate               DontEnum|Function       1 
    540   setUTCDate            -DateProtoFuncImp::SetDate              DontEnum|Function       1 
    541   setMonth              DateProtoFuncImp::SetMonth              DontEnum|Function       2 
    542   setUTCMonth           -DateProtoFuncImp::SetMonth             DontEnum|Function       2 
    543   setFullYear           DateProtoFuncImp::SetFullYear           DontEnum|Function       3 
    544   setUTCFullYear        -DateProtoFuncImp::SetFullYear          DontEnum|Function       3 
    545   setYear               DateProtoFuncImp::SetYear               DontEnum|Function       1 
    546   getYear               DateProtoFuncImp::GetYear               DontEnum|Function       0 
     520  toString    DateProtoFuncImp::ToString    DontEnum|Function 0 
     521  toUTCString   -DateProtoFuncImp::ToUTCString    DontEnum|Function 0 
     522  toDateString    DateProtoFuncImp::ToDateString    DontEnum|Function 0 
     523  toTimeString    DateProtoFuncImp::ToTimeString    DontEnum|Function 0 
     524  toLocaleString  DateProtoFuncImp::ToLocaleString  DontEnum|Function 0 
     525  toLocaleDateString  DateProtoFuncImp::ToLocaleDateString  DontEnum|Function 0 
     526  toLocaleTimeString  DateProtoFuncImp::ToLocaleTimeString  DontEnum|Function 0 
     527  valueOf   DateProtoFuncImp::ValueOf   DontEnum|Function 0 
     528  getTime   DateProtoFuncImp::GetTime   DontEnum|Function 0 
     529  getFullYear   DateProtoFuncImp::GetFullYear   DontEnum|Function 0 
     530  getUTCFullYear  -DateProtoFuncImp::GetFullYear    DontEnum|Function 0 
     531  toGMTString   -DateProtoFuncImp::ToGMTString    DontEnum|Function 0 
     532  getMonth    DateProtoFuncImp::GetMonth    DontEnum|Function 0 
     533  getUTCMonth   -DateProtoFuncImp::GetMonth   DontEnum|Function 0 
     534  getDate   DateProtoFuncImp::GetDate   DontEnum|Function 0 
     535  getUTCDate    -DateProtoFuncImp::GetDate    DontEnum|Function 0 
     536  getDay    DateProtoFuncImp::GetDay    DontEnum|Function 0 
     537  getUTCDay   -DateProtoFuncImp::GetDay   DontEnum|Function 0 
     538  getHours    DateProtoFuncImp::GetHours    DontEnum|Function 0 
     539  getUTCHours   -DateProtoFuncImp::GetHours   DontEnum|Function 0 
     540  getMinutes    DateProtoFuncImp::GetMinutes    DontEnum|Function 0 
     541  getUTCMinutes   -DateProtoFuncImp::GetMinutes   DontEnum|Function 0 
     542  getSeconds    DateProtoFuncImp::GetSeconds    DontEnum|Function 0 
     543  getUTCSeconds   -DateProtoFuncImp::GetSeconds   DontEnum|Function 0 
     544  getMilliseconds DateProtoFuncImp::GetMilliSeconds DontEnum|Function 0 
     545  getUTCMilliseconds  -DateProtoFuncImp::GetMilliSeconds  DontEnum|Function 0 
     546  getTimezoneOffset DateProtoFuncImp::GetTimezoneOffset DontEnum|Function 0 
     547  setTime   DateProtoFuncImp::SetTime   DontEnum|Function 1 
     548  setMilliseconds DateProtoFuncImp::SetMilliSeconds DontEnum|Function 1 
     549  setUTCMilliseconds  -DateProtoFuncImp::SetMilliSeconds  DontEnum|Function 1 
     550  setSeconds    DateProtoFuncImp::SetSeconds    DontEnum|Function 2 
     551  setUTCSeconds   -DateProtoFuncImp::SetSeconds   DontEnum|Function 2 
     552  setMinutes    DateProtoFuncImp::SetMinutes    DontEnum|Function 3 
     553  setUTCMinutes   -DateProtoFuncImp::SetMinutes   DontEnum|Function 3 
     554  setHours    DateProtoFuncImp::SetHours    DontEnum|Function 4 
     555  setUTCHours   -DateProtoFuncImp::SetHours   DontEnum|Function 4 
     556  setDate   DateProtoFuncImp::SetDate   DontEnum|Function 1 
     557  setUTCDate    -DateProtoFuncImp::SetDate    DontEnum|Function 1 
     558  setMonth    DateProtoFuncImp::SetMonth    DontEnum|Function 2 
     559  setUTCMonth   -DateProtoFuncImp::SetMonth   DontEnum|Function 2 
     560  setFullYear   DateProtoFuncImp::SetFullYear   DontEnum|Function 3 
     561  setUTCFullYear  -DateProtoFuncImp::SetFullYear    DontEnum|Function 3 
     562  setYear   DateProtoFuncImp::SetYear   DontEnum|Function 1 
     563  getYear   DateProtoFuncImp::GetYear   DontEnum|Function 0 
    547564@end 
    548565*/ 
     
    671688#if APPLE_CHANGES 
    672689  case ToString: 
    673     result = String(formatDate(*t) + " " + formatTime(*t)); 
     690    result = String(formatDate(*t) + " " + formatTime(*t, utc)); 
    674691    break; 
    675692  case ToDateString: 
     
    677694    break; 
    678695  case ToTimeString: 
    679     result = String(formatTime(*t)); 
     696    result = String(formatTime(*t, utc)); 
    680697    break; 
    681698  case ToGMTString: 
    682699  case ToUTCString: 
    683     result = String(formatDateUTCVariant(*t) + " " + formatTime(*t)); 
     700    result = String(formatDateUTCVariant(*t) + " " + formatTime(*t, utc)); 
    684701    break; 
    685702  case ToLocaleString: 
     
    771788    result = Number(_timezone / 60 - (_daylight ? 60 : 0)); 
    772789#elif NOKIA_CHANGES 
    773         { 
    774                 TLocale locale; 
    775                 TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset()); 
    776                 int offset = universalTimeOffset.Int()/60;  // in minutes 
    777                 // add one hour daylight offset, if any 
    778                 if( locale.QueryHomeHasDaylightSavingOn() ) offset -= 60; 
    779  
    780                 // The getTimezoneOffset method returns an integer value representing the  
    781                 // number of minutes between the time on the current machine and UTC.  
    782                 // This number will be positive if you are behind UTC and  
    783                 // negative if you are ahead of UTC. 
    784                 // But TLocale UniversalTimeOffset() returns the Offset in seconds from  
    785                 // universal time, and Time zones east of universal time have positive  
    786                 // offsets and Time zones west of universal time have negative offsets. 
    787                 result = Number( -offset ); 
    788         } 
     790  { 
     791    TLocale locale; 
     792    TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset()); 
     793    int offset = universalTimeOffset.Int()/60;  // in minutes 
     794    // add one hour daylight offset, if any 
     795    if( locale.QueryHomeHasDaylightSavingOn() ) offset -= 60; 
     796 
     797    // The getTimezoneOffset method returns an integer value representing the  
     798    // number of minutes between the time on the current machine and UTC.  
     799    // This number will be positive if you are behind UTC and  
     800    // negative if you are ahead of UTC. 
     801    // But TLocale UniversalTimeOffset() returns the Offset in seconds from  
     802    // universal time, and Time zones east of universal time have positive  
     803    // offsets and Time zones west of universal time have negative offsets. 
     804    result = Number( -offset ); 
     805  } 
    789806#  else 
    790807    // FIXME: Using the daylight value was wrong for BSD, maybe wrong here too. 
     
    969986#if APPLE_CHANGES 
    970987  struct tm *tm = localtime(&t); 
    971   return String(formatDate(*tm) + " " + formatTime(*tm)); 
     988  return String(formatDate(*tm) + " " + formatTime(*tm, false)); 
    972989#else 
    973990  UString s(ctime(&t)); 
     
    10991116#  else 
    11001117#ifdef NOKIA_CHANGES 
    1101                 // Get Universal time offset 
    1102             TLocale currentLocale; 
     1118    // Get Universal time offset 
     1119      TLocale currentLocale; 
    11031120        currentLocale.Refresh(); 
    11041121        TTimeIntervalSeconds timeOffset( currentLocale.UniversalTimeOffset() ); 
    1105             utcOffset = -timeOffset.Int(); 
     1122      utcOffset = -timeOffset.Int(); 
    11061123#else 
    11071124        utcOffset = -timezone; 
     
    11111128#endif 
    11121129    } else { 
    1113         utcOffset = 0; 
    1114         t->tm_isdst = -1; 
     1130  utcOffset = 0; 
     1131  t->tm_isdst = -1; 
    11151132    } 
    11161133 
     
    11881205     // Skip leading space 
    11891206     while(isspace(*dateString)) 
    1190         dateString++; 
     1207      dateString++; 
    11911208 
    11921209     const char *wordStart = dateString; 
     
    12111228 
    12121229     while(isspace(*dateString)) 
    1213         dateString++; 
     1230      dateString++; 
    12141231 
    12151232     if (!*dateString) 
    1216         return invalidDate; 
     1233      return invalidDate; 
    12171234 
    12181235     // ' 09-Nov-99 23:12:40 GMT' 
     
    12231240 
    12241241     if (!*dateString) 
    1225         return invalidDate; 
     1242      return invalidDate; 
    12261243 
    12271244     if (day < 1) 
     
    12481265       } 
    12491266     } else if (*dateString == '/' && day <= 12 && month == -1) { 
    1250         dateString++; 
     1267      dateString++; 
    12511268        // This looks like a MM/DD/YYYY date, not an RFC date..... 
    12521269        month = day - 1; // 0-based 
     
    13601377            dateString++; 
    13611378 
    1362           if (strncasecmp(dateString, "AM", 2) == 0) { 
    1363             if (hour > 12) 
    1364               return invalidDate; 
    1365             if (hour == 12) 
    1366               hour = 0; 
    1367             dateString += 2; 
    1368             while (isspace(*dateString)) 
    1369               dateString++; 
    1370           } else if (strncasecmp(dateString, "PM", 2) == 0) { 
    1371             if (hour > 12) 
    1372               return invalidDate; 
    1373             if (hour != 12) 
    1374               hour += 12; 
    1375             dateString += 2; 
    1376             while (isspace(*dateString)) 
    1377               dateString++; 
    1378           } 
     1379    if (strncasecmp(dateString, "AM", 2) == 0) { 
     1380      if (hour > 12) 
     1381        return invalidDate; 
     1382      if (hour == 12) 
     1383        hour = 0; 
     1384      dateString += 2; 
     1385      while (isspace(*dateString)) 
     1386        dateString++; 
     1387    } else if (strncasecmp(dateString, "PM", 2) == 0) { 
     1388      if (hour > 12) 
     1389        return invalidDate; 
     1390      if (hour != 12) 
     1391        hour += 12; 
     1392      dateString += 2; 
     1393      while (isspace(*dateString)) 
     1394        dateString++; 
     1395    } 
    13791396        } 
    13801397     } else { 
     
    13861403     if (*dateString) { 
    13871404       if (strncasecmp(dateString, "GMT", 3) == 0 || 
    1388            strncasecmp(dateString, "UTC", 3) == 0) { 
     1405     strncasecmp(dateString, "UTC", 3) == 0) { 
    13891406         dateString += 3; 
    13901407         have_tz = true; 
  • S60/trunk/JavaScriptCore/kjs/nodes.cpp

    r14719 r15507  
    11491149} 
    11501150 
     1151#ifdef NOKIA_CHANGES 
     1152BlockNode::~BlockNode() 
     1153{ 
     1154  if( SourceElementsNode *src = source.get() ) { 
     1155    SourceElementsNode *s = src->elements.get(); 
     1156    //Avoid using the smart pointers as it will make things complicated 
     1157    while(s) { 
     1158    SourceElementsNode *next = s->elements.get(); 
     1159    s->elements.setNull(); 
     1160    s->deref(); 
     1161    s = next; 
     1162    } 
     1163    src->elements.setNull(); 
     1164  } 
     1165} 
     1166#endif 
     1167 
    11511168// ECMA 12.1 
    11521169Completion BlockNode::execute(ExecState *exec) 
  • S60/trunk/JavaScriptCore/kjs/nodes.h

    r14549 r15507  
    5252 
    5353  enum Operator { OpEqual, 
    54                   OpEqEq, 
    55                   OpNotEq, 
    56                   OpStrEq, 
    57                   OpStrNEq, 
    58                   OpPlusEq, 
    59                   OpMinusEq, 
    60                   OpMultEq, 
    61                   OpDivEq, 
     54      OpEqEq, 
     55      OpNotEq, 
     56      OpStrEq, 
     57      OpStrNEq, 
     58      OpPlusEq, 
     59      OpMinusEq, 
     60      OpMultEq, 
     61      OpDivEq, 
    6262                  OpPlusPlus, 
    63                   OpMinusMinus, 
    64                   OpLess, 
    65                   OpLessEq, 
    66                   OpGreater, 
    67                   OpGreaterEq, 
    68                   OpAndEq, 
    69                   OpXOrEq, 
    70                   OpOrEq, 
    71                   OpModEq, 
     63      OpMinusMinus, 
     64      OpLess, 
     65      OpLessEq, 
     66      OpGreater, 
     67      OpGreaterEq, 
     68      OpAndEq, 
     69      OpXOrEq, 
     70      OpOrEq, 
     71      OpModEq, 
    7272                  OpAnd, 
    7373                  OpOr, 
    74                   OpBitAnd, 
    75                   OpBitXOr, 
    76                   OpBitOr, 
    77                   OpLShift, 
    78                   OpRShift, 
    79                   OpURShift, 
    80                   OpIn, 
    81                   OpInstanceOf 
     74      OpBitAnd, 
     75      OpBitXOr, 
     76      OpBitOr, 
     77      OpLShift, 
     78      OpRShift, 
     79      OpURShift, 
     80      OpIn, 
     81      OpInstanceOf 
    8282  }; 
    8383 
    8484  class Node { 
    85         OOM_NEW_DELETE 
     85  OOM_NEW_DELETE 
    8686  public: 
    8787    Node(); 
     
    615615  public: 
    616616    BlockNode(SourceElementsNode *s); 
     617#ifdef NOKIA_CHANGES 
     618  ~BlockNode(); 
     619#endif 
    617620    virtual Completion execute(ExecState *exec); 
    618621    virtual void processVarDecls(ExecState *exec); 
  • S60/trunk/JavaScriptCore/kjs/object.h

    r14549 r15507  
    3131// maximum global call stack size. Protects against accidental or 
    3232// malicious infinite recursions. Define to -1 if you want no limit. 
    33 #if APPLE_CHANGES 
     33#if NOKIA_CHANGES 
     34// Browser hangs or crashes in hardware since some websites runout of stack memory, 
     35// even before it hits the original KJS_MAX_STACK value of 100. So this value 
     36// is reduced to 80 as a workaround to fix this issue. But the real fix would be 
     37// to detect and prevent such infinite recursions and loops. 
     38#if __WINSCW__ 
     39#define KJS_MAX_STACK 100 
     40#else 
     41#define KJS_MAX_STACK 80 
     42#endif // __WINSCW__ 
     43#elif APPLE_CHANGES 
    3444// Given OS X stack sizes we run out of stack at about 350 levels. 
    3545// If we improve our stack usage, we can bump this number. 
     
    526536     */ 
    527537    IMPORT_C virtual bool hasProperty(ExecState *exec, 
    528                              const Identifier &propertyName) const; 
     538           const Identifier &propertyName) const; 
    529539    IMPORT_C virtual bool hasProperty(ExecState *exec, unsigned propertyName) const; 
    530540