[epiphany] snapshot-service: assert that web view has loaded at some point
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] snapshot-service: assert that web view has loaded at some point
- Date: Mon, 9 May 2016 13:40:35 +0000 (UTC)
commit 3c2fc9bc3c87c6a94ee767f974c0ce8cff6a94d6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Sat Apr 30 13:00:58 2016 -0500
snapshot-service: assert that web view has loaded at some point
We should never attempt to get a snapshot from a web view that has never
loaded anything ever. Instead of attempting to handle this case in a
nonsensical manner, just assert that it will never happen.
https://bugzilla.gnome.org/show_bug.cgi?id=765863
lib/ephy-snapshot-service.c | 29 ++++++++++++-----------------
1 files changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index aeaf8e7..b2f8a15 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -675,36 +675,31 @@ ephy_snapshot_service_get_snapshot_path_async (EphySnapshotService *service,
{
GTask *task;
const char *uri;
+ const char *path;
g_return_if_fail (EPHY_IS_SNAPSHOT_SERVICE (service));
g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
+ g_return_if_fail (webkit_web_view_get_uri (web_view));
task = g_task_new (service, cancellable, callback, user_data);
uri = webkit_web_view_get_uri (web_view);
- if (uri) {
- const char *path = ephy_snapshot_service_lookup_snapshot_path (service, uri);
+ path = ephy_snapshot_service_lookup_snapshot_path (service, uri);
- if (path) {
- g_task_return_pointer (task, g_strdup (path), g_free);
- g_object_unref (task);
- } else {
- g_task_set_task_data (task,
- snapshot_async_data_new (web_view, mtime),
- (GDestroyNotify)snapshot_async_data_free);
- ephy_snapshot_service_get_snapshot_path_for_url_async (service,
- uri, mtime, cancellable,
- (GAsyncReadyCallback)got_snapshot_path_for_url,
- task);
- }
-
- ensure_snapshot_freshness_for_web_view (service, web_view);
+ if (path) {
+ g_task_return_pointer (task, g_strdup (path), g_free);
+ g_object_unref (task);
} else {
g_task_set_task_data (task,
snapshot_async_data_new (web_view, mtime),
(GDestroyNotify)snapshot_async_data_free);
- g_idle_add ((GSourceFunc)ephy_snapshot_service_take_from_webview, task);
+ ephy_snapshot_service_get_snapshot_path_for_url_async (service,
+ uri, mtime, cancellable,
+ (GAsyncReadyCallback)got_snapshot_path_for_url,
+ task);
}
+
+ ensure_snapshot_freshness_for_web_view (service, web_view);
}
char *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]