fix open_tab() not returning false on failure
This commit is contained in:
22
ext/bg.js
22
ext/bg.js
@@ -241,11 +241,25 @@ function attach_ws_events(ws){
|
||||
break;
|
||||
|
||||
case "tab_open":
|
||||
var tab =
|
||||
await browser.tabs.create({
|
||||
url: msg.url,
|
||||
...(typeof msg.container == "string" && { cookieStoreId: msg.container })
|
||||
|
||||
// sometimes opening tabs like about:blank with a
|
||||
// container will fail.
|
||||
var tab = null;
|
||||
|
||||
try{
|
||||
tab =
|
||||
await browser.tabs.create({
|
||||
url: msg.url,
|
||||
...(typeof msg.container == "string" && { cookieStoreId: msg.container })
|
||||
});
|
||||
}catch(err){
|
||||
|
||||
// send error: we attempted to open tab
|
||||
send(ws, seqid, {
|
||||
data: false
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
// immediately return even if its not loaded yet
|
||||
send(ws, seqid, {
|
||||
|
||||
Reference in New Issue
Block a user