static void resourceGetDataCallback(GObject* object, GAsyncResult* result, gpointer userData) { size_t dataSize; GOwnPtr<GError> error; unsigned char* data = webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, &error.outPtr()); g_assert(data); WebViewTest* test = static_cast<WebViewTest*>(userData); test->m_resourceData.set(reinterpret_cast<char*>(data)); test->m_resourceDataSize = dataSize; g_main_loop_quit(test->m_mainLoop); }
static void html_finished(GObject *object, GAsyncResult *result, gpointer user_data) { WebKitWebResource *wr = WEBKIT_WEB_RESOURCE(object); GError *error = NULL; gsize length; guchar *h = webkit_web_resource_get_data_finish(wr, result, &length, &error); FILE *f = open_file(html_file, "w"); if (fwrite(h, length, 1, f) != 1) { errx(1, "error saving html"); } fclose(f); done(); }
void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader* loader, const ResourceRequest& request) { GOwnPtr<gchar> identifierString(toString(identifier)); WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0)); if (loader == loader->frameLoader()->provisionalDocumentLoader() && loader->frameLoader()->isLoadingMainFrame()) { webkit_web_view_add_main_resource(getViewFromFrame(m_frame), identifierString.get(), webResource); return; } webkit_web_view_add_resource(getViewFromFrame(m_frame), identifierString.get(), webResource); }
void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const ResourceRequest& request) { webkit_web_view_add_resource(getViewFromFrame(m_frame), toString(identifier), WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0))); }