diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/html.cc | 10 | ||||
-rw-r--r-- | test/html/manual/title-dup.html | 10 | ||||
-rw-r--r-- | test/html/manual/title-empty.html | 9 | ||||
-rw-r--r-- | test/html/manual/title-missing.html | 8 |
5 files changed, 36 insertions, 3 deletions
@@ -10,6 +10,8 @@ dillo-3.2.0 [Not released yet] +- Add new_tab_page option to open a custom new tab page. Patches: Alex, Rodrigo Arias Mallo ++- Ignore empty page title for tab labels. + Patches: Rodrigo Arias Mallo dillo-3.1.1 [Jun 8, 2024] diff --git a/src/html.cc b/src/html.cc index c6aa5b5e..5e1f6ba7 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1706,10 +1706,14 @@ static void Html_tag_open_title(DilloHtml *html, const char *tag, int tagsize) */ static void Html_tag_close_title(DilloHtml *html) { + /* title is only valid inside HEAD */ if (html->InFlags & IN_HEAD && html->Num_TITLE == 1) { - /* title is only valid inside HEAD */ - a_UIcmd_set_page_title(html->bw, html->Stash->str); - a_History_set_title_by_url(html->page_url, html->Stash->str); + /* Ignore empty titles: <title></title> */ + char *title = html->Stash->str; + if (!title || title[0] == '\0') + return; + a_UIcmd_set_page_title(html->bw, title); + a_History_set_title_by_url(html->page_url, title); } } diff --git a/test/html/manual/title-dup.html b/test/html/manual/title-dup.html new file mode 100644 index 00000000..eaae117c --- /dev/null +++ b/test/html/manual/title-dup.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <head> + <title>one</title> + <title>two</title> + </head> + <body> + <p>Duplicated title</p> + </body> +</html> diff --git a/test/html/manual/title-empty.html b/test/html/manual/title-empty.html new file mode 100644 index 00000000..7251307b --- /dev/null +++ b/test/html/manual/title-empty.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <head> + <title></title> + </head> + <body> + <p>Empty title</p> + </body> +</html> diff --git a/test/html/manual/title-missing.html b/test/html/manual/title-missing.html new file mode 100644 index 00000000..9227ec15 --- /dev/null +++ b/test/html/manual/title-missing.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<html> + <head> + </head> + <body> + <p>Missing title</p> + </body> +</html> |