From 937e355d1698a3e08c85924657a2e93c01ab44e2 Mon Sep 17 00:00:00 2001 From: Antonio Gomes Date: Wed, 25 Mar 2009 11:20:37 -0400 Subject: [PATCH 1/1] WebKit/EFL: Fixed crash @setHtml when a invalid KURL is passed. --- WebKit/efl/Api/EWebFrame.h | 2 +- WebKit/efl/Api/EWebKit.h | 2 +- WebKit/efl/Api/ewebframe.cpp | 4 ++-- WebKit/efl/Api/ewebkit.cpp | 7 +++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/WebKit/efl/Api/EWebFrame.h b/WebKit/efl/Api/EWebFrame.h index a2e198f..6d9fbd9 100644 --- a/WebKit/efl/Api/EWebFrame.h +++ b/WebKit/efl/Api/EWebFrame.h @@ -103,7 +103,7 @@ public: WebCore::String url() const; WebCore::String originalUrl() const; - void setHtml(const WebCore::String&); + void setHtml(const WebCore::String&, const WebCore::String& url = WebCore::String("")); void scroll(int dx, int dy); diff --git a/WebKit/efl/Api/EWebKit.h b/WebKit/efl/Api/EWebKit.h index cf96276..52ab5ee 100644 --- a/WebKit/efl/Api/EWebKit.h +++ b/WebKit/efl/Api/EWebKit.h @@ -121,7 +121,7 @@ extern "C" { WEBKIT_EFL_EXPORT const char *ewk_webframe_object_title_get(Evas_Object *frame); WEBKIT_EFL_EXPORT const char *ewk_webframe_object_url_get(Evas_Object *frame); WEBKIT_EFL_EXPORT const char *ewk_webframe_object_original_url_get(Evas_Object *frame); - WEBKIT_EFL_EXPORT void ewk_webframe_object_html_set(Evas_Object *frame, const char *contents); + WEBKIT_EFL_EXPORT void ewk_webframe_object_html_set(Evas_Object *frame, const char *contents, const char *baseurl); WEBKIT_EFL_EXPORT void ewk_webframe_object_contents_size_get(Evas_Object *frame, int *w, int *h); WEBKIT_EFL_EXPORT void ewk_webframe_object_position_get(Evas_Object *frame, int *x, int *y); WEBKIT_EFL_EXPORT void ewk_webframe_object_scrollbar_value_get(Evas_Object *frame, int *x, int *y); diff --git a/WebKit/efl/Api/ewebframe.cpp b/WebKit/efl/Api/ewebframe.cpp index b813db7..933c187 100644 --- a/WebKit/efl/Api/ewebframe.cpp +++ b/WebKit/efl/Api/ewebframe.cpp @@ -144,9 +144,9 @@ String EWebFrame::originalUrl() const return d->frame->loader()->originalRequestURL().string(); } -void EWebFrame::setHtml(const String& html) +void EWebFrame::setHtml(const String& html, const String& baseUrl) { - KURL kurl = KURL(); + KURL kurl = KURL(baseUrl); ResourceRequest request(kurl); WTF::RefPtr data = SharedBuffer::create(html.utf8().data(), html.utf8().length()); SubstituteData substituteData(data, String("text/html"), String("utf-8"), kurl); diff --git a/WebKit/efl/Api/ewebkit.cpp b/WebKit/efl/Api/ewebkit.cpp index 681ae88..2ce3a11 100644 --- a/WebKit/efl/Api/ewebkit.cpp +++ b/WebKit/efl/Api/ewebkit.cpp @@ -293,10 +293,13 @@ const char* ewk_webframe_object_original_url_get(Evas_Object* obj) return 0; } -void ewk_webframe_object_html_set(Evas_Object* obj, const char *html) +void ewk_webframe_object_html_set(Evas_Object* obj, const char* html, const char* baseurl) { if (EWebFrame* webframe = eobject_cast(obj)) - webframe->setHtml(String(html)); + if(!baseurl) + webframe->setHtml(String(html)); + else + webframe->setHtml(String(html), String(baseurl)); } void ewk_webframe_object_contents_size_get(Evas_Object* obj, int* width, int* height) -- 1.5.6.3