Title: [93617] trunk/Source/WebKit/efl
Revision
93617
Author
[email protected]
Date
2011-08-23 11:27:51 -0700 (Tue, 23 Aug 2011)

Log Message

[EFL] Do not treat valid cases in ewk_frame_child_add() as failures.
https://bugs.webkit.org/show_bug.cgi?id=66692

Patch by Raphael Kubo da Costa <[email protected]> on 2011-08-23
Rubber-stamped by Kenneth Rohde Christiansen.

Frame::page() and FrameTree::parent() returning 0 were being considered
failure cases, however it is possible for them to return 0 when some
arbitrary _javascript_ is run.

The function's return type has been changed to make it easier to convey
these cases to the caller (which is only ewk_view_frame_create).

This should make tests like
fast/dom/null-page-show-modal-dialog-crash.html stop outputting
erroneous messages to stderr.

* ewk/ewk_frame.cpp:
(ewk_frame_child_add):
* ewk/ewk_private.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (93616 => 93617)


--- trunk/Source/WebKit/efl/ChangeLog	2011-08-23 18:11:44 UTC (rev 93616)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-08-23 18:27:51 UTC (rev 93617)
@@ -1,3 +1,25 @@
+2011-08-23  Raphael Kubo da Costa  <[email protected]>
+
+        [EFL] Do not treat valid cases in ewk_frame_child_add() as failures.
+        https://bugs.webkit.org/show_bug.cgi?id=66692
+
+        Rubber-stamped by Kenneth Rohde Christiansen.
+
+        Frame::page() and FrameTree::parent() returning 0 were being considered
+        failure cases, however it is possible for them to return 0 when some
+        arbitrary _javascript_ is run.
+
+        The function's return type has been changed to make it easier to convey
+        these cases to the caller (which is only ewk_view_frame_create).
+
+        This should make tests like
+        fast/dom/null-page-show-modal-dialog-crash.html stop outputting
+        erroneous messages to stderr.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_child_add):
+        * ewk/ewk_private.h:
+
 2011-08-23  Leandro Pereira  <[email protected]>
 
         Unreviewed build fix after r66685.

Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.cpp (93616 => 93617)


--- trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2011-08-23 18:11:44 UTC (rev 93616)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2011-08-23 18:27:51 UTC (rev 93617)
@@ -1131,7 +1131,7 @@
  *
  * Adds child to the frame.
  */
-Evas_Object *ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame> child, const WTF::String &name, const WebCore::KURL &url, const WTF::String &referrer)
+Eina_Bool ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame> child, const WTF::String &name, const WebCore::KURL &url, const WTF::String &referrer)
 {
     EWK_FRAME_SD_GET_OR_RETURN(o, sd, 0);
     char buf[256];
@@ -1141,7 +1141,7 @@
     frame = ewk_frame_add(sd->base.evas);
     if (!frame) {
         ERR("Could not create ewk_frame object.");
-        return 0;
+        return EINA_FALSE;
     }
 
     cf = child.get();
@@ -1153,29 +1153,30 @@
 
     if (!ewk_frame_init(frame, sd->view, cf)) {
         evas_object_del(frame);
-        return 0;
+        return EINA_FALSE;
     }
     snprintf(buf, sizeof(buf), "EWK_Frame:child/%s", name.utf8().data());
     evas_object_name_set(frame, buf);
     evas_object_smart_member_add(frame, o);
     evas_object_show(frame);
 
-    if (!cf->page())
-        goto died;
+    // The creation of the frame may have run arbitrary _javascript_ that removed it from the page already.
+    if (!cf->page()) {
+        evas_object_del(frame);
+        return EINA_TRUE;
+    }
 
     sd->frame->loader()->loadURLIntoChildFrame(url, referrer, cf);
-    if (!cf->tree()->parent())
-        goto died;
 
+    // The frame's onload handler may have removed it from the document.
+    // See fast/dom/null-page-show-modal-dialog-crash.html for an example.
+    if (!cf->tree()->parent()) {
+        evas_object_del(frame);
+        return EINA_TRUE;
+    }
+
     // TODO: announce frame was created?
-    return frame;
-
-died:
-    CRITICAL("does this work: BEGIN");
-    ewk_frame_core_gone(frame); // CONFIRM
-    evas_object_del(frame); // CONFIRM
-    CRITICAL("does this work: END");
-    return 0;
+    return EINA_TRUE;
 }
 
 /**

Modified: trunk/Source/WebKit/efl/ewk/ewk_private.h (93616 => 93617)


--- trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-08-23 18:11:44 UTC (rev 93616)
+++ trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-08-23 18:27:51 UTC (rev 93617)
@@ -157,7 +157,7 @@
 
 Evas_Object *ewk_frame_add(Evas *e);
 Eina_Bool ewk_frame_init(Evas_Object *o, Evas_Object *view, WebCore::Frame *frame);
-Evas_Object *ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame> child, const WTF::String &name, const WebCore::KURL &url, const WTF::String &referrer);
+Eina_Bool ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame> child, const WTF::String &name, const WebCore::KURL &url, const WTF::String &referrer);
 
 WebCore::Frame *ewk_frame_core_get(const Evas_Object *o);
 void ewk_frame_core_gone(Evas_Object *o);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to