[Cosmo-dev] Re: [commits-cosmo] (mde) [3543] Fix for bug 7917 -- Have Safari ignore test cases that its broken Date implementation can't handle.

Matthew Eernisse mde at osafoundation.org
Wed Jan 31 17:41:40 PST 2007


Yes, this is really the solution, in this case.

There is no workaround code, because Date is fundamentally broken in the 
current Safari. Any test that tries to exercise that part of the ECMA 
standard will break in Safari. The whole point of those particular tests 
is to ensure that wraparound works properly -- and that is what's broken 
in Safari.

Yes, it's something that could come up in the UI in Safari, as I noted 
in the bug report. It could come up anywhere we use Date.

Yes, it's fixed in the current WebKit, as I noted in the bug report. And 
if you'll take a moment to look at the diff, you'll see I took great 
pains to single out Safari 2. I'm not bothering to try to parse the 
version string into a number, because we only currently support Safari 
2, which fills the 41x string out completely to 419.3.

When the Safari version revs, the tests will run, and all will be well 
with the world.


Matthew


Mikeal Rogers wrote:
> I think this is fixed in the next release, so if you put in workaround 
> code you're just going to have to rip it all out again in a few months.
> 
> You can find out for sure by testing them against the latest webkit 
> nightly http://nightly.webkit.org/
> 
> -Mikeal
> 
> On Jan 31, 2007, at 5:33 PM, Bobby Rullo wrote:
> 
>> Is this really the solution? In other cases (UI stuff for example) we 
>> put in workaround code to handle differences in browsers, even if it 
>> makes us grumble.
>>
>> Is this something that could come up using the UI? If so, we might 
>> need a better fix than ignoring test cases.
>>
>> bobby
>>
>> On Jan 31, 2007, at 4:06 PM, svncheckin at osafoundation.org 
>> <mailto:svncheckin at osafoundation.org> wrote:
>>
>>> Revision
>>>     3543 <http://cvs.osafoundation.org/viewcvs.cgi?rev=3543&view=rev>
>>> Author
>>>     mde
>>> Date
>>>     2007-01-31 16:06:06 -0800 (Wed, 31 Jan 2007)
>>>
>>>
>>>       Log Message
>>>
>>> Fix for bug 7917 
>>> <http://bugzilla.osafoundation.org/show_bug.cgi?id=7917> -- Have 
>>> Safari ignore test cases that its broken Date implementation can't 
>>> handle.
>>>
>>>
>>>       Modified Paths
>>>
>>>     * cosmo/trunk/src/test/unit/js/cosmo/datetime/test_date.js
>>>       <#cosmotrunksrctestunitjscosmodatetimetest_datejs>
>>>
>>>
>>>       Diff
>>>
>>>
>>>         Modified:
>>>         cosmo/trunk/src/test/unit/js/cosmo/datetime/test_date.js
>>>         (3542 => 3543)
>>>
>>> --- cosmo/trunk/src/test/unit/js/cosmo/datetime/test_date.js	2007-01-31 23:27:03 UTC (rev 3542)
>>> +++ cosmo/trunk/src/test/unit/js/cosmo/datetime/test_date.js	2007-02-01 00:06:06 UTC (rev 3543)
>>> @@ -204,17 +204,23 @@
>>>      jum.assertEquals(2, dt.getMonth());
>>>      jum.assertEquals(1, dt.getDate());
>>>      
>>> -    dt = new D(2006, 9, 23, 22, 12, 55, 6);
>>> -    dt.setMonth(14);
>>> -    jum.assertEquals(2007, dt.getYear());
>>> -    jum.assertEquals(2, dt.getMonth());
>>> -    
>>> -    // Date wraparoud -- Set month to Feb with date of 31st
>>> -    // should wrap date to March 3rd
>>> -    dt = new D(2006, 0, 31);
>>> -    dt.setMonth(1);
>>> -    jum.assertEquals(2, dt.getMonth());
>>> -    jum.assertEquals(3, dt.getDate());
>>> +    // Wraparound broken in Safari 2, see WebKit bug 4892
>>> +    // http://bugs.webkit.org/show_bug.cgi?id=489
>>> +    // Safari 2 == Safari/412 to Safari/419.3
>>> +    // http://developer.apple.com/internet/safari/uamatrix.html
>>> +    if (navigator.userAgent.indexOf('Safari/41') == -1) {
>>> +        dt = new D(2006, 9, 23, 22, 12, 55, 6);
>>> +        dt.setMonth(14);
>>> +        jum.assertEquals(2007, dt.getYear());
>>> +        jum.assertEquals(2, dt.getMonth());
>>> +        
>>> +        // Date wraparoud -- Set month to Feb with date of 31st
>>> +        // should wrap date to March 3rd
>>> +        dt = new D(2006, 0, 31);
>>> +        dt.setMonth(1);
>>> +        jum.assertEquals(2, dt.getMonth());
>>> +        jum.assertEquals(3, dt.getDate());
>>> +    }
>>>  }
>>>  
>>>  function test_dateUTCSetters() {
>>> @@ -229,12 +235,18 @@
>>>      jum.assertEquals(6, dt.getUTCHours());
>>>      jum.assertEquals(6, dt.getHours());
>>>      
>>> -    dt = new D(2006, 9, 23, 22, 12, 55, 6, 'America/Chicago');
>>> -    dt.setUTCHours(54);
>>> -    // Should all be the same -- zero offset
>>> -    jum.assertEquals(25, dt.getUTCDate());
>>> -    jum.assertEquals(25, dt.getDate());
>>> -    jum.assertEquals(6, dt.getUTCHours());
>>> -    jum.assertEquals(11, dt.getHours());
>>> +    // Wraparound broken in Safari 2, see WebKit bug 4892
>>> +    // http://bugs.webkit.org/show_bug.cgi?id=489
>>> +    // Safari 2 == Safari/412 to Safari/419.3
>>> +    // http://developer.apple.com/internet/safari/uamatrix.html
>>> +    if (navigator.userAgent.indexOf('Safari/41') == -1) {
>>> +        dt = new D(2006, 9, 23, 22, 12, 55, 6, 'America/Chicago');
>>> +        dt.setUTCHours(54);
>>> +        // Should all be the same -- zero offset
>>> +        jum.assertEquals(25, dt.getUTCDate());
>>> +        jum.assertEquals(25, dt.getDate());
>>> +        jum.assertEquals(6, dt.getUTCHours());
>>> +        jum.assertEquals(11, dt.getHours());
>>> +    }
>>>  }
>>>  
>>>
>>> _______________________________________________
>>> Commits-Cosmo mailing list
>>> Commits-Cosmo at osafoundation.org <mailto:Commits-Cosmo at osafoundation.org>
>>> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo
>>
>> _______________________________________________
>> cosmo-dev mailing list
>> cosmo-dev at lists.osafoundation.org 
>> <mailto:cosmo-dev at lists.osafoundation.org>
>> http://lists.osafoundation.org/mailman/listinfo/cosmo-dev
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> cosmo-dev mailing list
> cosmo-dev at lists.osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/cosmo-dev



More information about the cosmo-dev mailing list