Changeset 51649 in webkit


Ignore:
Timestamp:
Dec 3, 2009 11:34:46 AM (14 years ago)
Author:
oliver@apple.com
Message:

REGRESSION (r51627): 3 SVG tests are failing
https://bugs.webkit.org/show_bug.cgi?id=32117

Reviewed by Dan Bernstein.

Null checking Items in the SVGList is insufficient as items may
be floats, etc so add SVGListTraits::isNull and add appropriate
specializations.

Test: svg/dom/svglist-exception-on-out-bounds-error.html

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51645 r51649  
     12009-12-03  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        REGRESSION (r51627): 3 SVG tests are failing
     6        https://bugs.webkit.org/show_bug.cgi?id=32117
     7
     8        Improve testing of svglist.
     9
     10        * svg/dom/svglist-exception-on-out-bounds-error-expected.txt:
     11        * svg/dom/svglist-exception-on-out-bounds-error.html:
     12
    1132009-12-03  Enrica Casucci  <enrica@apple.com>
    214
  • trunk/LayoutTests/svg/dom/svglist-exception-on-out-bounds-error-expected.txt

    r43795 r51649  
    55
    66PASS svgList.getItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    7 PASS svgList.insertItemBefore(null, i) is null
     7PASS svgList.insertItemBefore(null, i) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     8PASS svgList.insertItemBefore(seg, i) is seg
     9PASS svgList.replaceItem(seg, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    810PASS svgList.replaceItem(null, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    911PASS svgList.removeItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1012PASS svgList.getItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    11 PASS svgList.insertItemBefore(null, i) is null
     13PASS svgList.insertItemBefore(null, i) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     14PASS svgList.insertItemBefore(seg, i) is seg
     15PASS svgList.replaceItem(seg, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1216PASS svgList.replaceItem(null, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1317PASS svgList.removeItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1418PASS svgList.getItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    15 PASS svgList.insertItemBefore(null, i) is null
     19PASS svgList.insertItemBefore(null, i) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     20PASS svgList.insertItemBefore(seg, i) is seg
     21PASS svgList.replaceItem(seg, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1622PASS svgList.replaceItem(null, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1723PASS svgList.removeItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    1824PASS svgList.getItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    19 PASS svgList.insertItemBefore(null, i) is null
     25PASS svgList.insertItemBefore(null, i) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     26PASS svgList.insertItemBefore(seg, i) is seg
     27PASS svgList.replaceItem(seg, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2028PASS svgList.replaceItem(null, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2129PASS svgList.removeItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2230PASS svgList.getItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    23 PASS svgList.insertItemBefore(null, i) is null
     31PASS svgList.insertItemBefore(null, i) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     32PASS svgList.insertItemBefore(seg, i) is seg
     33PASS svgList.replaceItem(seg, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2434PASS svgList.replaceItem(null, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2535PASS svgList.removeItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2636PASS svgList.getItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    27 PASS svgList.insertItemBefore(null, i) is null
     37PASS svgList.insertItemBefore(null, i) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     38PASS svgList.insertItemBefore(seg, i) is seg
     39PASS svgList.replaceItem(seg, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2840PASS svgList.replaceItem(null, i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
    2941PASS svgList.removeItem(i) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
  • trunk/LayoutTests/svg/dom/svglist-exception-on-out-bounds-error.html

    r43795 r51649  
    1515    for (var i = 0; i < indicesToTest.length; i++) {
    1616         shouldThrow("svgList.getItem(i)");
    17          shouldBeNull("svgList.insertItemBefore(null, i)");
     17         shouldThrow("svgList.insertItemBefore(null, i)");
     18         var seg = path.createSVGPathSegClosePath();
     19         shouldBe("svgList.insertItemBefore(seg, i)", "seg");
    1820         svgList.removeItem(0);
     21         shouldThrow("svgList.replaceItem(seg, i)");
    1922         shouldThrow("svgList.replaceItem(null, i)");
    2023         shouldThrow("svgList.removeItem(i)");
  • trunk/WebCore/ChangeLog

    r51648 r51649  
     12009-12-03  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        REGRESSION (r51627): 3 SVG tests are failing
     6        https://bugs.webkit.org/show_bug.cgi?id=32117
     7
     8        Null checking Items in the SVGList is insufficient as items may
     9        be floats, etc so add SVGListTraits::isNull and add appropriate
     10        specializations.
     11
     12        Test: svg/dom/svglist-exception-on-out-bounds-error.html
     13
     14        * svg/SVGList.h:
     15        (WebCore::SVGListTypeOperations::isNull):
     16        (WebCore::SVGList::initialize):
     17        (WebCore::SVGList::insertItemBefore):
     18        (WebCore::SVGList::replaceItem):
     19        (WebCore::SVGList::appendItem):
     20        * svg/SVGListTraits.h:
     21        (WebCore::):
     22
    1232009-12-03  Brady Eidson  <beidson@apple.com>
    224
  • trunk/WebCore/svg/SVGList.h

    r51627 r51649  
    4040            return SVGListTraits<UsesDefaultInitializer<Item>::value, Item>::nullItem();
    4141        }
     42        static bool isNull(const Item& it)
     43        {
     44            return SVGListTraits<UsesDefaultInitializer<Item>::value, Item>::isNull(it);
     45        }
    4246    };
    4347
     
    5761        Item initialize(Item newItem, ExceptionCode& ec)
    5862        {
    59             if (!newItem) {
     63            if (TypeOperations::isNull(newItem)) {
    6064                ec = TYPE_MISMATCH_ERR;
    6165                return TypeOperations::nullItem();
     
    99103        Item insertItemBefore(Item newItem, unsigned int index, ExceptionCode& ec)
    100104        {
    101             if (!newItem) {
     105            if (TypeOperations::isNull(newItem)) {
    102106                ec = TYPE_MISMATCH_ERR;
    103107                return TypeOperations::nullItem();
     
    119123            }
    120124   
    121             if (!newItem) {
     125            if (TypeOperations::isNull(newItem)) {
    122126                ec = TYPE_MISMATCH_ERR;
    123127                return TypeOperations::nullItem();
     
    142146        Item appendItem(Item newItem, ExceptionCode& ec)
    143147        {
    144             if (!newItem) {
     148            if (TypeOperations::isNull(newItem)) {
    145149                ec = TYPE_MISMATCH_ERR;
    146150                return TypeOperations::nullItem();
  • trunk/WebCore/svg/SVGListTraits.h

    r50583 r51649  
    2424#if ENABLE(SVG)
    2525
     26#include <wtf/RefPtr.h>
     27
    2628namespace WebCore {
    2729
    2830    template<typename Item> struct UsesDefaultInitializer { static const bool value = true; };
    2931    template<> struct UsesDefaultInitializer<double>      { static const bool value = false; };
     32    template<> struct UsesDefaultInitializer<float>       { static const bool value = false; };
    3033
    3134    template<bool usesDefaultInitializer, typename Item>
    3235    struct SVGListTraits { };
    3336
     37    template<typename ItemPtr>
     38    struct SVGListTraits<true, ItemPtr*> {
     39        static ItemPtr nullItem() { return 0; }
     40        static bool isNull(ItemPtr it) { return !it; }
     41    };
     42   
     43    template<typename ItemPtr>
     44    struct SVGListTraits<true, RefPtr<ItemPtr> > {
     45        static RefPtr<ItemPtr> nullItem() { return 0; }
     46        static bool isNull(RefPtr<ItemPtr> it) { return !it; }
     47    };
     48   
    3449    template<typename Item>
    3550    struct SVGListTraits<true, Item> {
    36         static Item nullItem() { return Item(); }
     51        static Item nullItem() { return Item(); }
     52        static bool isNull(Item it) { return !it; }
    3753    };
    3854
     
    4056    struct SVGListTraits<false, double> {
    4157        static double nullItem() { return 0.0; }
     58        static bool isNull(double) { return false; }
    4259    };
     60
     61    template<>
     62    struct SVGListTraits<false, float> {
     63        static double nullItem() { return 0.0; }
     64        static bool isNull(double) { return false; }
     65    };
     66
    4367
    4468} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.