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;
|
break;
|
||||||
|
|
||||||
case "tab_open":
|
case "tab_open":
|
||||||
var tab =
|
|
||||||
await browser.tabs.create({
|
// sometimes opening tabs like about:blank with a
|
||||||
url: msg.url,
|
// container will fail.
|
||||||
...(typeof msg.container == "string" && { cookieStoreId: msg.container })
|
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
|
// immediately return even if its not loaded yet
|
||||||
send(ws, seqid, {
|
send(ws, seqid, {
|
||||||
|
|||||||
Reference in New Issue
Block a user