From abbaaa2ff22b6a6f1f78a7554c2628ecf26dfec9 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 14 Apr 2020 17:38:31 +0000 Subject: [PATCH] fix browser crash and rare bug with redirects git-svn-id: svn://kolibrios.org@7791 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/WebView.c | 55 +++++++++++++++++----------------- programs/cmm/browser/tabs.h | 2 +- programs/cmm/browser/texts.h | 2 +- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 8fcc751c84..dbf241ca4d 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -36,6 +36,31 @@ bool debug_mode = false; +enum { + NEW_TAB=600, + ENCODINGS=700, + BACK_BUTTON=800, + FORWARD_BUTTON, + REFRESH_BUTTON, + GOTOURL_BUTTON, + CHANGE_ENCODING, + SANDWICH_BUTTON, + VIEW_SOURCE, + EDIT_SOURCE, + OPEN_FILE, + NEW_WINDOW, + VIEW_HISTORY, + DOWNLOAD_MANAGER, + CLEAR_CACHE, + UPDATE_BROWSER, + IN_NEW_TAB, + IN_NEW_WINDOW, + COPY_LINK_URL, + DOWNLOAD_LINK_CONTENTS, + TAB_ID, + TAB_CLOSE_ID = 900 +}; + #include "..\TWB\TWB.c" //HTML Parser, a core component TWebBrowser WB1; @@ -63,31 +88,6 @@ proc_info Form; int menu_id=NULL; -enum { - NEW_TAB=600, - ENCODINGS=700, - BACK_BUTTON=800, - FORWARD_BUTTON, - REFRESH_BUTTON, - GOTOURL_BUTTON, - CHANGE_ENCODING, - SANDWICH_BUTTON, - VIEW_SOURCE, - EDIT_SOURCE, - OPEN_FILE, - NEW_WINDOW, - VIEW_HISTORY, - DOWNLOAD_MANAGER, - CLEAR_CACHE, - UPDATE_BROWSER, - IN_NEW_TAB, - IN_NEW_WINDOW, - COPY_LINK_URL, - DOWNLOAD_LINK_CONTENTS, - TAB_ID, - TAB_CLOSE_ID = 900 -}; - #include "tabs.h" char default_dir[] = "/rd/1"; @@ -235,6 +235,7 @@ void main() } else { notify("'Too many redirects.' -E"); StopLoading(); + redirect_count = 0; } } else { // Loading the page is complete, free resources @@ -430,12 +431,12 @@ void ProcessEvent(dword id__) return; case IN_NEW_TAB: open_new_tab = true; - EventOpenNewTab(PageLinks.GetURL(PageLinks.active)); + EventClickLink(PageLinks.GetURL(PageLinks.active)); open_new_tab = false; return; case IN_NEW_WINDOW: open_new_tab = true; - RunProgram(#program_path, PageLinks.GetURL(PageLinks.active)); + EventClickLink(PageLinks.GetURL(PageLinks.active)); open_new_tab = false; return; case COPY_LINK_URL: diff --git a/programs/cmm/browser/tabs.h b/programs/cmm/browser/tabs.h index fe152cf546..946a07f7b0 100644 --- a/programs/cmm/browser/tabs.h +++ b/programs/cmm/browser/tabs.h @@ -35,7 +35,7 @@ bool TAB::close(int _tab_number) { int i; if (count==1) return false; - for (i=_tab_number; i<=TABS_MAX; i++) { + for (i=_tab_number; i