Prevent bmark from guessing title for manually specified URLs

This commit is contained in:
Oliver Blanthorn 2019-05-27 14:47:47 +01:00
parent 6a15b99c2e
commit afbf4e2e50
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -4066,6 +4066,7 @@ export async function perfhistogram(...filters: string[]) {
*/
//#background
export async function bmark(url?: string, ...titlearr: string[]) {
const auto_url = (url == undefined)
url = url === undefined ? (await activeTab()).url : url
let title = titlearr.join(" ")
// if titlearr is given and we have duplicates, we probably want to give an error here.
@ -4076,7 +4077,7 @@ export async function bmark(url?: string, ...titlearr: string[]) {
// if title is blank, get it from the current page.
// technically could race condition if someone switched tabs REALLY quick after
// bookmarking, but too unlikely to bother with for now
if (title == "") {
if (title == "" && auto_url) {
//retrieve title from current tab
title = (await activeTab()).title
}
@ -4097,7 +4098,7 @@ export async function bmark(url?: string, ...titlearr: string[]) {
if (pathobj === undefined) pathobj = validpaths.find(p => p.path.includes(path))
//technically an initial title string like `Firefox/` can give us a blank title
//once we remove the path, so let's fix that
if (title == "") {
if (title == "" && auto_url) {
//retrieve title from current tab
const currTitle = (await activeTab()).title
title = currTitle