[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

arv at chromium.org arv at chromium.org
Wed Dec 22 14:07:38 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2d518983591294f752c2d8d4d33aafe004e48221
Author: arv at chromium.org <arv at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 4 23:07:10 2010 +0000

    2010-10-04  Erik Arvidsson  <arv at chromium.org>
    
            Reviewed by James Robinson.
    
            https://bugs.webkit.org/show_bug.cgi?id=47122
            Crash in classList when class attribute is empty.
    
            * fast/dom/HTMLElement/class-list-expected.txt:
            * fast/dom/HTMLElement/class-list-quirks-expected.txt:
            * fast/dom/HTMLElement/script-tests/class-list.js:
    2010-10-04  Erik Arvidsson  <arv at chromium.org>
    
            Reviewed by James Robinson.
    
            https://bugs.webkit.org/show_bug.cgi?id=47122
            Crash in classList when class attribute is empty.
    
            Tests: fast/dom/HTMLElement/class-list.html
    
            * html/DOMTokenList.cpp:
            (WebCore::DOMTokenList::length):
            (WebCore::DOMTokenList::containsInternal):
            (WebCore::DOMTokenList::classNames):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69047 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7c0cc2b..f25da35 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-04  Erik Arvidsson  <arv at chromium.org>
+
+        Reviewed by James Robinson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47122
+        Crash in classList when class attribute is empty.
+
+        * fast/dom/HTMLElement/class-list-expected.txt:
+        * fast/dom/HTMLElement/class-list-quirks-expected.txt:
+        * fast/dom/HTMLElement/script-tests/class-list.js:
+
 2010-10-04  Justin Schuh  <jschuh at chromium.org>
 
         Reviewed by James Robinson.
diff --git a/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt b/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt
index bd0e8a4..fa90e6f 100644
--- a/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt
+++ b/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt
@@ -17,6 +17,11 @@ PASS element.className is ""
 PASS element.className is ""
 PASS element.className is " y y "
 PASS element.className is "y"
+Ensure that we can handle empty class name correctly
+PASS element.className is "x"
+PASS element.className is ""
+PASS element.classList.contains('x') is false
+PASS element.classList[1] is null
 Testing add in presence of trailing white spaces.
 PASS element.className is "x y"
 PASS element.className is "x	 y"
diff --git a/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt b/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt
index bd0e8a4..fa90e6f 100644
--- a/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt
+++ b/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt
@@ -17,6 +17,11 @@ PASS element.className is ""
 PASS element.className is ""
 PASS element.className is " y y "
 PASS element.className is "y"
+Ensure that we can handle empty class name correctly
+PASS element.className is "x"
+PASS element.className is ""
+PASS element.classList.contains('x') is false
+PASS element.classList[1] is null
 Testing add in presence of trailing white spaces.
 PASS element.className is "x y"
 PASS element.className is "x	 y"
diff --git a/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js b/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js
index 2a34dfa..8915130 100644
--- a/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js
+++ b/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js
@@ -77,6 +77,21 @@ createElement(' x y  x ');
 element.classList.remove('x');
 shouldBeEqualToString('element.className', 'y');
 
+
+debug('Ensure that we can handle empty class name correctly');
+element = document.createElement('span');
+element.classList.toggle('x');
+shouldBeEqualToString('element.className', 'x');
+element.classList.toggle('x');
+shouldBeEqualToString('element.className', '');
+
+element = document.createElement('span');
+shouldBeFalse('element.classList.contains(\'x\')');
+shouldBeNull('element.classList[1]');
+element.classList.remove('x');
+element.classList.add('x')
+
+
 debug('Testing add in presence of trailing white spaces.');
 
 createElement('x ');
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a6355ab..9e892c8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-04  Erik Arvidsson  <arv at chromium.org>
+
+        Reviewed by James Robinson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47122
+        Crash in classList when class attribute is empty.
+
+        Tests: fast/dom/HTMLElement/class-list.html
+
+        * html/DOMTokenList.cpp:
+        (WebCore::DOMTokenList::length):
+        (WebCore::DOMTokenList::containsInternal):
+        (WebCore::DOMTokenList::classNames):
+
 2010-10-04  Darin Adler  <darin at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/html/DOMTokenList.cpp b/WebCore/html/DOMTokenList.cpp
index d19875b..3383447 100644
--- a/WebCore/html/DOMTokenList.cpp
+++ b/WebCore/html/DOMTokenList.cpp
@@ -72,7 +72,7 @@ void DOMTokenList::deref()
 
 unsigned DOMTokenList::length() const
 {
-    return classNames().size();
+    return m_element->hasClass() ? classNames().size() : 0;
 }
 
 const AtomicString DOMTokenList::item(unsigned index) const
@@ -91,7 +91,7 @@ bool DOMTokenList::contains(const AtomicString& token, ExceptionCode& ec) const
 
 bool DOMTokenList::containsInternal(const AtomicString& token) const
 {
-    return classNames().contains(token);
+    return m_element->hasClass() && classNames().contains(token);
 }
 
 void DOMTokenList::add(const AtomicString& token, ExceptionCode& ec)
@@ -199,6 +199,7 @@ void DOMTokenList::reset(const String& newClassName)
 
 const SpaceSplitString& DOMTokenList::classNames() const
 {
+    ASSERT(m_element->hasClass());
     if (!m_classNamesForQuirksMode.isNull())
         return m_classNamesForQuirksMode;
     return m_element->attributeMap()->classNames();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list