LayoutTests:

        Reviewed by Oliver

        Fix for http://bugs.webkit.org/show_bug.cgi?id=13636 and <rdar://problem/5190816>

        When creating the applets collection, be sure to only count Objects if they contain
        a java applet

        * dom/html/level2/html/AppletsCollection-expected.txt: Added.
        * dom/html/level2/html/AppletsCollection.html: Added.

WebCore:

        Reviewed by Oliver

        Fix for http://bugs.webkit.org/show_bug.cgi?id=13636 and <rdar://problem/5190816>

        When creating the applets collection, be sure to only count Objects if they contain
        a java applet

        * html/HTMLCollection.cpp:
        (WebCore::HTMLCollection::traverseNextItem): Add the qualifier for Objects that 
          containsJavaApplet() must be true

        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::containsJavaApplet): Check this Object element and inner
          nodes for any Java applets
        * html/HTMLObjectElement.h: 



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp
index 53fb136..99db7d0 100644
--- a/WebCore/html/HTMLCollection.cpp
+++ b/WebCore/html/HTMLCollection.cpp
@@ -28,6 +28,7 @@
 #include "HTMLDocument.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
+#include "HTMLObjectElement.h"
 
 namespace WebCore {
 
@@ -148,8 +149,9 @@
                 if (e->hasLocalName(areaTag))
                     found = true;
                 break;
-            case DocApplets:   // all OBJECT and APPLET elements
-                if (e->hasLocalName(objectTag) || e->hasLocalName(appletTag))
+            case DocApplets:   // all APPLET elements and OBJECT elements that contain Java Applets
+                if (e->hasLocalName(appletTag) || 
+                    (e->hasLocalName(objectTag) && static_cast<HTMLObjectElement*>(e)->containsJavaApplet()))
                     found = true;
                 break;
             case DocEmbeds:   // all EMBED elements