diff options
author | Christian Dywan <christian@twotoasts.de> | 2018-08-27 18:25:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-27 18:25:23 +0200 |
commit | 0c592f5ab4eec1af5aff8d4cc6f8aa03073881b1 (patch) | |
tree | d8f1d655576e74bb771d37fa368afe1b5e3de11f | |
parent | d435849aec6c0ffa0e49b93f516502a86efd8dd4 (diff) | |
download | midori-git-0c592f5ab4eec1af5aff8d4cc6f8aa03073881b1.tar.gz |
Apply the unholy trinity of errors (#20)
The **unholy trinity** of errors concerns plugins, redirects and downloads. Most typically it surfaces like so:
- The address typed in the urlbar leads to a downloaded file, and the tab shows an error.
- A loading web page is cancelled via Esc or the toolbar button.
-rw-r--r-- | core/tab.vala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/tab.vala b/core/tab.vala index 1592e719..b7ffa088 100644 --- a/core/tab.vala +++ b/core/tab.vala @@ -126,6 +126,20 @@ namespace Midori { } public override bool load_failed (WebKit.LoadEvent load_event, string uri, Error load_error) { + // The unholy trinity; also ignored in Webkit's default error handler: + // A plugin will take over. That's expected, it's not fatal. + if (load_error is WebKit.PluginError.WILL_HANDLE_LOAD) { + return false; + } + // Mostly initiated by JS redirects. + if (load_error is WebKit.NetworkError.CANCELLED) { + return false; + } + // A frame load is cancelled because of a download. + if (load_error is WebKit.PolicyError.FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE) { + return false; + } + var monitor = NetworkMonitor.get_default (); string hostname = new Soup.URI (uri).host; string? title = null; |