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: https://svn.webkit.org/repository/webkit/trunk@21359
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-05-10 Brady Eidson <beidson@apple.com>
+
+ 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.
+
2007-05-09 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
--- /dev/null
+This test demonstrates a couple of object tags being added that do not contain Java applets. Previously these Object element would be included in the document.applets collection even though the spec says that collection should contain only Applet elements and Object elements that contain applets.
+
+As the document is parsed, javascript will output the size of the document.applets collection after each Object tag is inserted into the document. For this test the count should always be zero.
+
+Tragically we cannot have any actual Java Applets referenced here because when DRT loads the Java VM it hangs. If that bug is resolved this test should also be amended to add a dummy Applet using both the Applet tag and a few different uses of the Object tag.
+
+Applets length is currently 0
+
+
+Applets length is currently 0
+
+
+Applets length is currently 0
+
+
+Applets length is currently 0
+
+
--- /dev/null
+<html>
+<head>
+<title>Fix for 13636</title>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ }
+
+ function outputAppletsLength() {
+ document.write("<p>");
+ if (document.applets)
+ document.write("Applets length is currently " + document.applets.length);
+ else
+ document.write("There is no applets collection yet");
+ document.write("</p>");
+ }
+
+</script>
+</head>
+<body>
+<p>This test demonstrates a couple of object tags being added that do not contain Java applets. Previously these Object element would be included in the document.applets collection even though the spec says that collection should contain only Applet elements and Object elements that contain applets.</p>
+<p>As the document is parsed, javascript will output the size of the document.applets collection after each Object tag is inserted into the document. For this test the count should always be zero.</p>
+<p>Tragically we cannot have any actual Java Applets referenced here because when DRT loads the Java VM it hangs. If that bug is resolved this test should also be amended to add a dummy Applet using both the Applet tag and a few different uses of the Object tag.</p>
+
+<script>outputAppletsLength();</script>
+
+<object type="application/not-a-real-applet" width=500 height=50>
+<param name="code" value="ZOMG.class">
+<param name="text" value="ZOMG OBJECT JAVA APPLET (but not really!)">
+</object>
+
+<script>outputAppletsLength();</script>
+
+<object width=500 height=50>
+Nothing here!
+</object>
+
+<script>outputAppletsLength();</script>
+
+<object data="w3c_main.png" type="image/png">
+</object>
+
+<script>outputAppletsLength();</script>
+
+</body>
+</html>
+2007-05-10 Brady Eidson <beidson@apple.com>
+
+ 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:
+
2007-05-10 David Hyatt <hyatt@apple.com>
Fix for:
#include "HTMLDocument.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
+#include "HTMLObjectElement.h"
namespace WebCore {
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
setAttribute(vspaceAttr, String::number(value));
}
+bool HTMLObjectElement::containsJavaApplet() const
+{
+ if (type().lower() == "application/x-java-applet")
+ return true;
+
+ Node* child = firstChild();
+ while (child) {
+ if (child->isElementNode()) {
+ Element* e = static_cast<Element*>(child);
+ if (e->hasTagName(paramTag) &&
+ e->getAttribute(nameAttr).domString().lower() == "type" &&
+ e->getAttribute(valueAttr).domString().lower() == "application/x-java-applet")
+ return true;
+ else if (e->hasTagName(objectTag) && static_cast<HTMLObjectElement*>(e)->containsJavaApplet())
+ return true;
+ else if (e->hasTagName(appletTag))
+ return true;
+ }
+ child = child->nextSibling();
+ }
+
+ return false;
+}
+
#if ENABLE(SVG)
SVGDocument* HTMLObjectElement::getSVGDocument(ExceptionCode& ec) const
{
bool isDocNamedItem() const { return m_docNamedItem; }
+ bool containsJavaApplet() const;
+
#if ENABLE(SVG)
SVGDocument* getSVGDocument(ExceptionCode&) const;
#endif