Skip to content
Permalink
Browse files
[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 <kubo@profusion.mobi> 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:

Canonical link: https://commits.webkit.org/82594@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Raphael Kubo da Costa authored and webkit-commit-queue committed Aug 23, 2011
1 parent 30d7fdb commit 1c3cc6ffe1b6ea9e686b80c08eebb94dbf9cab8e
Showing 3 changed files with 39 additions and 16 deletions.
@@ -1,3 +1,25 @@
2011-08-23 Raphael Kubo da Costa <kubo@profusion.mobi>

[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 <leandro@profusion.mobi>

Unreviewed build fix after r66685.
@@ -1131,7 +1131,7 @@ Eina_Bool ewk_frame_init(Evas_Object *o, Evas_Object *view, WebCore::Frame *fram
*
* 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 @@ Evas_Object *ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame>
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 @@ Evas_Object *ewk_frame_child_add(Evas_Object *o, WTF::PassRefPtr<WebCore::Frame>

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;

// TODO: announce frame was created?
return frame;
// 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;
}

died:
CRITICAL("does this work: BEGIN");
ewk_frame_core_gone(frame); // CONFIRM
evas_object_del(frame); // CONFIRM
CRITICAL("does this work: END");
return 0;
// TODO: announce frame was created?
return EINA_TRUE;
}

/**
@@ -157,7 +157,7 @@ Ewk_Window_Features *ewk_window_features_new_from_core(const WebCore::WindowFeat

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);

0 comments on commit 1c3cc6f

Please sign in to comment.