Dubious cast from HTMLCollection to HTMLAllCollection
authortsepez@chromium.org <tsepez@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 08:52:01 +0000 (08:52 +0000)
committertsepez@chromium.org <tsepez@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 08:52:01 +0000 (08:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108538

Reviewed by Adam Barth.

Patch is tested by enabling V8 binding integrity on HTMLAllCollection and
running the existing tests without introducing new crashes.

* dom/Document.cpp:
(WebCore::Document::all):
Pass correct type to template.

* html/HTMLAllCollection.cpp:
(WebCore::HTMLAllCollection::create):
(WebCore::HTMLAllCollection::HTMLAllCollection):
* html/HTMLAllCollection.h:
(HTMLAllCollection):
Make create() method arguments compatible with template above.

* html/HTMLAllCollection.idl:
Enable binding integrity.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141556 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLAllCollection.cpp
Source/WebCore/html/HTMLAllCollection.h
Source/WebCore/html/HTMLAllCollection.idl

index 16cf61b..b4cfff3 100644 (file)
@@ -1,3 +1,27 @@
+2013-02-01  Tom Sepez  <tsepez@chromium.org>
+
+        Dubious cast from HTMLCollection to HTMLAllCollection
+        https://bugs.webkit.org/show_bug.cgi?id=108538
+
+        Reviewed by Adam Barth.
+
+        Patch is tested by enabling V8 binding integrity on HTMLAllCollection and
+        running the existing tests without introducing new crashes.
+
+        * dom/Document.cpp:
+        (WebCore::Document::all):
+        Pass correct type to template.
+        
+        * html/HTMLAllCollection.cpp:
+        (WebCore::HTMLAllCollection::create):
+        (WebCore::HTMLAllCollection::HTMLAllCollection):
+        * html/HTMLAllCollection.h:
+        (HTMLAllCollection):
+        Make create() method arguments compatible with template above.
+
+        * html/HTMLAllCollection.idl:
+        Enable binding integrity.
+
 2013-02-01  Ken Kania  <kkania@chromium.org>
 
         Web Inspector: Add support for handling modal dialogs
index 0e925f0..79e2409 100644 (file)
@@ -4369,7 +4369,7 @@ PassRefPtr<HTMLCollection> Document::anchors()
 
 PassRefPtr<HTMLCollection> Document::all()
 {
-    return ensureCachedCollection(DocAll);
+    return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLAllCollection>(this, DocAll);
 }
 
 PassRefPtr<HTMLCollection> Document::windowNamedItems(const AtomicString& name)
index 1dd5c15..465fa1c 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document)
+PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Node* node, CollectionType type)
 {
-    return adoptRef(new HTMLAllCollection(document));
+    return adoptRef(new HTMLAllCollection(node, type));
 }
 
-HTMLAllCollection::HTMLAllCollection(Document* document)
-    : HTMLCollection(document, DocAll, DoesNotOverrideItemAfter)
+HTMLAllCollection::HTMLAllCollection(Node* node, CollectionType type)
+    : HTMLCollection(node, type, DoesNotOverrideItemAfter)
 {
 }
 
index ae97a53..62e2641 100644 (file)
@@ -32,13 +32,13 @@ namespace WebCore {
 
 class HTMLAllCollection : public HTMLCollection {
 public:
-    static PassRefPtr<HTMLAllCollection> create(Document*);
+    static PassRefPtr<HTMLAllCollection> create(Node*, CollectionType);
     virtual ~HTMLAllCollection();
 
     Node* namedItemWithIndex(const AtomicString& name, unsigned index) const;
 
 private:
-    HTMLAllCollection(Document*);
+    HTMLAllCollection(Node*, CollectionType);
 };
 
 } // namespace WebCore
index 8a8840e..fff6335 100644 (file)
@@ -30,7 +30,6 @@
     MasqueradesAsUndefined,
     GenerateIsReachable=ImplOwnerNodeRoot,
     V8DependentLifetime,
-    V8SkipVTableValidation
 ] interface HTMLAllCollection {
     readonly attribute unsigned long length;
     [Custom] Node item(in [Optional=DefaultIsUndefined] unsigned long index);