LayoutTests:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 20:52:42 +0000 (20:52 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 20:52:42 +0000 (20:52 +0000)
        Reviewed by Mitz.

        <rdar://problem/5280532>
        REGRESSION: Can't access nested embed by document.name if object is not immediate parent

        * plugins/embed-inside-object-expected.txt: Added.
        * plugins/embed-inside-object.html: Added.

WebCore:

        Reviewed by Mitz.

        <rdar://problem/5280532>
        REGRESSION: Can't access nested embed by document.name if object is not immediate parent

        Traverse up the tree looking for an object element.

        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::getInstance):

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

LayoutTests/ChangeLog
LayoutTests/plugins/embed-inside-object-expected.txt [new file with mode: 0644]
LayoutTests/plugins/embed-inside-object.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLEmbedElement.cpp

index b075875..5f4d259 100644 (file)
@@ -1,3 +1,13 @@
+2007-07-06  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Mitz.
+
+        <rdar://problem/5280532>
+        REGRESSION: Can't access nested embed by document.name if object is not immediate parent
+        
+        * plugins/embed-inside-object-expected.txt: Added.
+        * plugins/embed-inside-object.html: Added.
+
 2007-07-06  Adam Roben  <aroben@apple.com>
 
         Add another Leopard failure
diff --git a/LayoutTests/plugins/embed-inside-object-expected.txt b/LayoutTests/plugins/embed-inside-object-expected.txt
new file mode 100644 (file)
index 0000000..93e31b3
--- /dev/null
@@ -0,0 +1,5 @@
+
+This tests that it's possible to control an embed that is nested inside an object with a span tag in between.
+plugin object is: [object HTMLEmbedElement]
+SUCCESS
+
diff --git a/LayoutTests/plugins/embed-inside-object.html b/LayoutTests/plugins/embed-inside-object.html
new file mode 100644 (file)
index 0000000..2d288fb
--- /dev/null
@@ -0,0 +1,37 @@
+<html>
+<script>
+    function debug(str) {
+        document.getElementById('console').innerHTML += str + "<br>";
+    }
+    
+    function pluginCallback() {
+        debug('SUCCESS');
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+    
+    function runTest() {
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText();
+            layoutTestController.waitUntilDone();
+        }
+        
+        var plugin = document.plugin;
+    
+        debug('plugin object is: ' + plugin);
+        plugin.getURL('javascript:pluginCallback()', '_self')
+    }
+</script>
+<body onload="runTest()">
+<object name="plugin" type="application/x-webkit-test-netscape">
+    <span>
+        <embed name="plugin" type="application/x-webkit-test-netscape"></embed>
+    </span>
+</object>
+<div>
+    This tests that it's possible to control an embed that is nested inside an object with a span tag in between.
+</div>
+<div id="console">
+</div>
+</body>
+</html>
index ef38619..c96e49d 100644 (file)
@@ -1,3 +1,15 @@
+2007-07-06  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Mitz.
+
+        <rdar://problem/5280532> 
+        REGRESSION: Can't access nested embed by document.name if object is not immediate parent
+        
+        Traverse up the tree looking for an object element.
+        
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::getInstance):
+
 2007-07-06  George Staikos  <staikos@kde.org>
 
         Qt build fix: Don't clobber qmake variables that are already set.
index 74c6a5f..89b11cf 100644 (file)
@@ -68,8 +68,15 @@ KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
     RenderObject *r = renderer();
     if (!r) {
         Node *p = parentNode();
-        if (p && p->hasTagName(objectTag))
-            r = p->renderer();
+        
+        while (p) {
+            if (p->hasTagName(objectTag)) {
+                r = p->renderer();
+                break;
+            }
+            
+            p = p->parentNode();
+        }
     }
 
     if (r && r->isWidget()) {