From 68764ab0240bd4d5b7f95b4473427eaea82d515c Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 1 Oct 2024 14:53:28 +0300 Subject: [PATCH] reorder action steps, add comments --- src/browser/main/tab/page.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/browser/main/tab/page.rs b/src/browser/main/tab/page.rs index 04b4f790..a6ba9d91 100644 --- a/src/browser/main/tab/page.rs +++ b/src/browser/main/tab/page.rs @@ -84,26 +84,28 @@ impl Page { action_page_open.connect_activate({ let navigation = navigation.clone(); move |_, request| { - let uri = request - .expect("Parameter required for `page.open` action") - .get::() - .expect("Parameter does not match `String`"); - - let request = GString::from(uri); - - navigation.set_request_text( - &request, true, // activate (page reload) + // Convert to GString + let request = GString::from( + request + .expect("Parameter required for `page.open` action") + .get::() + .expect("Parameter does not match `String`"), ); // Add new history record on request change match navigation.history_current() { Some(current) => { if current != request { - navigation.history_add(request); + navigation.history_add(request.clone()); } } - None => navigation.history_add(request), + None => navigation.history_add(request.clone()), } + + // Update + navigation.set_request_text( + &request, true, // activate (page reload) + ); } });