Bug 136992

Summary: Konqueror does not render "http://www.bbc.co.uk/weather/ukweather/" pages
Product: [Applications] konqueror Reporter: Derek Huskisson <derek>
Component: kjsAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: maksim
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch

Description Derek Huskisson 2006-11-07 09:19:17 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc version 4.1.1 (Gentoo 4.1.1)
 
OS:                Linux

On "http://www.bbc.co.uk/weather/ukweather/" javascript (I assume) can give a slideshow of the next few days weather. The initial page does not display correctly and neither do the choices below (except for text summary of course). When debugging is allowed several errors appear at http://www.bbc.co.uk/weather/jsglobal/mappresenter/slideshowdatauk.js?11 line 419

This used to work in kde 3.5.3 and kde 3.5.2 but not in kde 3.5.4.
Seamonkey works O/K on these pages.
Comment 1 Maksim Orlovich 2006-11-07 15:10:28 UTC
Testcase:

g_now = new Date();
g_now.setTime(NaN);
g_now.setTime(Date.parse("November 7, 2006 14:00:00"));

Somehow the second setTime doesn't go through after the first one...
Comment 2 Maksim Orlovich 2006-11-07 15:29:58 UTC
Created attachment 18457 [details]
patch

This should fix it --- setTime doesn't rely on the internal value, so no reason
to disallow it if the internal value is NaN.
Comment 3 Maksim Orlovich 2006-11-08 17:33:33 UTC
SVN commit 603353 by orlovich:

Regression test for #136992, and the bug the fix for which introduced this bug...

CCBUG:136992


 M  +6 -0      Date.js  


--- trunk/tests/khtmltests/regression/tests/js/Date.js #603352:603353
@@ -317,4 +317,10 @@
 shouldBe("new Date('00/00/2006').toString()", "new Date('Nov 30 2005').toString()");
 shouldBe("new Date('01/452/2006').toString()", "new Date('Mar 28 2007').toString()");
 
+// Not crashing when trying set* ops on NaNs
+shouldBeTrue("isNaN(new Date(NaN).setFullYear(1900))");
+
+//... but should permit doing setTime on NaN (#136992)
+shouldBe("new Date(NaN).setTime(1162939650000)", "1162939650000"); 
+
 debug("End Of Test");
Comment 4 Maksim Orlovich 2006-11-08 17:41:35 UTC
SVN commit 603351 by orlovich:

Permit changing the internal value of invalid dates. Fixes the BBC UK Weather page..


BUG:136992


 M  +6 -6      date_object.cpp  


--- branches/KDE/3.5/kdelibs/kjs/date_object.cpp #603350:603351
@@ -417,7 +417,6 @@
     case GetSeconds:
     case GetMilliSeconds:
     case GetTimezoneOffset:
-    case SetTime:
     case SetMilliSeconds:
     case SetSeconds:
     case SetMinutes:
@@ -429,6 +428,12 @@
     }
   }
 
+  if (id == SetTime) {
+    result = Number(roundValue(exec,args[0]));
+    thisObj.setInternalValue(result);
+    return result;
+  }
+
   // check whether time value is outside time_t's usual range
   // make the necessary transformations if necessary
   int realYearOffset = 0;
@@ -538,11 +543,6 @@
   case GetTimezoneOffset:
     result = Number(timeZoneOffset(t));
     break;
-  case SetTime:
-    milli = roundValue(exec,args[0]);
-    result = Number(milli);
-    thisObj.setInternalValue(result);
-    break;
   case SetMilliSeconds:
     fillStructuresUsingTimeArgs(exec, args, 1, &ms, t);
     break;