Skip to content

Commit 14c4745

Browse files
committed
Add LOAD_CANCELLED event
Split from the LOAD_ERROR event.
1 parent e787c42 commit 14c4745

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,9 @@ uzbl itself and will be emitted based on what is happening within uzbl-core.
12941294
request has been sent to the server.
12951295
* `LOAD_PROGRESS <PROGRESS>`
12961296
- Sent when the load percentage changes. The progress is in percentage.
1297+
* `LOAD_CANCELLED <URI>`
1298+
- Sent when the user has cancelled a load (e.g., by setting the URI in the
1299+
middle of another load).
12971300
* `LOAD_ERROR <URI> <CODE> <MESSAGE>`
12981301
- Sent when WebKit has failed to load a page.
12991302
* `LOAD_FINISH <URI>`

UPGRADING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ for these events. Also check the event manager for built-in handlers.
280280
- *Rationale*: The data is available and may be useful.
281281
- *Porting*: Expect a second argument in any `LINK_HOVER` event
282282
handlers.
283+
* `LOAD_ERROR`
284+
- *Change*: Cancelled loads are now `LOAD_CANCELLED`.
285+
- *Rationale*: Better diagnostics as to why things are happening.
286+
- *Porting*: Look for `LOAD_CANCELLED` for user-triggered cancellations.
283287
* `NEW_WINDOW`
284288
- *Change*: Renamed to `REQ_NEW_WINDOW`.
285289
- *Rationale*: Replaced with `REQ_NEW_WINDOW` for better interoperability

src/events.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
call (LOAD_REDIRECTED), \
1010
call (LOAD_COMMIT), \
1111
call (LOAD_FINISH), \
12+
call (LOAD_CANCELLED), \
1213
call (LOAD_ERROR), \
1314
call (REQUEST_QUEUED), \
1415
call (REQUEST_STARTING), \

src/gui.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,11 +1769,17 @@ send_load_status (WebKitLoadStatus status, const gchar *uri)
17691769
gboolean
17701770
send_load_error (const gchar *uri, GError *err)
17711771
{
1772-
uzbl_events_send (LOAD_ERROR, NULL,
1773-
TYPE_STR, uri,
1774-
TYPE_INT, err->code,
1775-
TYPE_STR, err->message,
1776-
NULL);
1772+
if (err->code == WEBKIT_NETWORK_ERROR_CANCELLED) {
1773+
uzbl_events_send (LOAD_CANCELLED, NULL,
1774+
TYPE_STR, uri,
1775+
NULL);
1776+
} else {
1777+
uzbl_events_send (LOAD_ERROR, NULL,
1778+
TYPE_STR, uri,
1779+
TYPE_INT, err->code,
1780+
TYPE_STR, err->message,
1781+
NULL);
1782+
}
17771783

17781784
return FALSE;
17791785
}

0 commit comments

Comments
 (0)