From 35c2af014344060d826d31502958b0e88bebb0c0 Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Tue, 17 Sep 2019 18:51:10 -0400 Subject: [PATCH] Don't close Load from URL if URL invalid --- src/functions.js | 10 +++++----- src/sessions.js | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/functions.js b/src/functions.js index b2bd580..e0ac0ea 100644 --- a/src/functions.js +++ b/src/functions.js @@ -203,13 +203,13 @@ function file_load_from_url(){ $w.$main.html(""); var $input = $w.$main.find(".url-input"); $w.$Button("Load", function(){ - $w.close(); - // TODO: retry loading if same URL entered - // actually, make it change the hash only after loading successfully - // (but still load from the hash when necessary) - // make sure it doesn't overwrite the old session before switching var uris = get_URIs($input.val()); if (uris.length > 0) { + // TODO: retry loading if same URL entered + // actually, make it change the hash only after loading successfully + // (but still load from the hash when necessary) + // make sure it doesn't overwrite the old session before switching + $w.close(); location.hash = "load:" + encodeURIComponent(uris[0]); } else { show_error_message("Invalid URL. It must include a protocol (https:// or http://)"); diff --git a/src/sessions.js b/src/sessions.js index b686f58..35b0d75 100644 --- a/src/sessions.js +++ b/src/sessions.js @@ -425,6 +425,7 @@ } end_current_session(); + // TODO: fix loading duplicately, from popstate and hashchange open_from_URI(url, function(err){ if(err){ show_resource_load_error_message();