[Webkit-unassigned] [Bug 69249] [GTK][WEBKIT2] Add webkit_web_view_load_html_string and webkit_web_view_load_plain_text APIs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 4 23:28:29 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=69249





--- Comment #17 from Carlos Garcia Campos <cgarcia at igalia.com>  2011-10-04 23:28:29 PST ---
(In reply to comment #16)
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:286
> > +    WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
> > +    WKStringRef htmlStringRef = WKStringCreateWithUTF8CString(htmlString);
> > +    WKURLRef baseUriRef = WKURLCreateWithUTF8CString(baseUri);
> > +    WKPageLoadHTMLString(toAPI(page), htmlStringRef, baseUriRef);
> > +    WKRelease(htmlStringRef);
> > +    WKRelease(baseUriRef);
> 
> Is there no smart pointer for WK types? If there is we need to use it.

Yes, there's WKRetainPtr, I realized yesterday, I'm already using it in the bf list patch:

https://bugs.webkit.org/show_bug.cgi?id=69343

> > Source/WebKit2/UIProcess/API/gtk/tests/testloading.c:249
> > +static void htmlStringLoadingNotifyTitleCb(WebKitWebView *webView, GParamSpec *pSpec, WebLoadingFixture *fixture)
> > +{
> > +    g_assert(!fixture->hasBeenFinished);
> > +
> > +    const gchar *title = webkit_web_view_get_title(webView);
> > +    g_assert_cmpstr(title, ==, HTML_TITLE);
> > +}
> > +
> > +static void htmlStringLoadingFixtureSetup(WebLoadingFixture *fixture, gconstpointer data)
> > +{
> > +    fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
> > +    fixture->loop = g_main_loop_new(NULL, TRUE);
> > +    g_object_ref_sink(fixture->webView);
> > +    fixture->hasBeenFinished = FALSE;
> > +    g_signal_connect(fixture->webView, "notify::title", G_CALLBACK(htmlStringLoadingNotifyTitleCb), fixture);
> > +}
> > +
> > +static gboolean htmlStringLoadStatusLoadFinished(WebKitWebLoaderClient *client, WebLoadingFixture *fixture)
> > +{
> > +    g_assert(!fixture->hasBeenFinished);
> > +    fixture->hasBeenFinished = TRUE;
> > +
> > +    g_main_loop_quit(fixture->loop);
> 
> I guess it's okay to structure the test like this for now, but when we add an API to get the WebView contents, we should restructure this test to simply load the page and assert that the contents are equal. These tests should be in the webkittests file since they are unit tests for the WebView.

No, we don't need a new fiture for every test, we can just use the loading one, see the load_alternate_html() patch:

https://bugs.webkit.org/show_bug.cgi?id=69254

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list