I'm trying to write a Firefox extension and came across a weird behavior that I found no information on:
When calling browser.windows.get()
(or some other browser.windows functions), the promise will never resolve but also the function won't throw any error. If I await the promise, the program is stuck and following lines won't be executed.
So I did console.log(browser.windows)
to check if the function exists at all and got this:
Object { onCreated: Getter & Setter, onRemoved: Getter & Setter, onFocusChanged: Getter & Setter, get: Getter & Setter, getLastFocused: Getter & Setter, getAll: Getter & Setter, create: Getter & Setter, update: Getter & Setter, remove: Getter & Setter, WINDOW_ID_CURRENT: Getter & Setter, … }
CreateType: TypeError: can't access dead object
GetInfo: TypeError: can't access dead object
WINDOW_ID_CURRENT: TypeError: can't access dead object
WINDOW_ID_NONE: TypeError: can't access dead object
Window: TypeError: can't access dead object
WindowState: Object { NORMAL: "normal", MINIMIZED: "minimized", MAXIMIZED: "maximized", … }
WindowType: TypeError: can't access dead object
create: TypeError: can't access dead object
get: TypeError: can't access dead object // unfolded
columnNumber: 0
fileName: ""
lineNumber: 0
message: "can't access dead object"
stack: ""
<prototype>: TypeError.prototype { stack: "", … }
getAll: TypeError: can't access dead object
getCurrent: function () // unfolded
length: 1
name: ""
<prototype>: function ()
getLastFocused: TypeError: can't access dead object
onCreated: TypeError: can't access dead object
onFocusChanged: TypeError: can't access dead object
onRemoved: TypeError: can't access dead object
remove: TypeError: can't access dead object
update: TypeError: can't access dead object // unfolded
columnNumber: 0
fileName: ""
lineNumber: 0
message: "can't access dead object"
stack: ""
<prototype>: TypeError.prototype { stack: "", … }
<get CreateType()>: function ()
<set CreateType()>: function ()
<get GetInfo()>: function ()
<set GetInfo()>: function ()
<get WINDOW_ID_CURRENT()>: function ()
<set WINDOW_ID_CURRENT()>: function ()
<get WINDOW_ID_NONE()>: function ()
<set WINDOW_ID_NONE()>: function ()
<get Window()>: function ()
<set Window()>: function ()
<get WindowType()>: function ()
<set WindowType()>: function ()
<get create()>: function ()
<set create()>: function ()
<get get()>: function ()
length: 0
name: ""
<prototype>: function ()
<set get()>: function ()
length: 1
name: ""
<prototype>: function ()
<get getAll()>: function ()
<set getAll()>: function ()
<get getLastFocused()>: function ()
<set getLastFocused()>: function ()
<get onCreated()>: function ()
<set onCreated()>: function ()
<get onFocusChanged()>: function ()
<set onFocusChanged()>: function ()
<get onRemoved()>: function ()
<set onRemoved()>: function ()
<get remove()>: function ()
<set remove()>: function ()
<get update()>: function ()
length: 0
name: ""
<prototype>: function ()
<set update()>: function ()
length: 1
name: ""
<prototype>: function ()
<prototype>: Object { … }
I marked some functions that I have unfolded in the console. So browser.windows.get()
exists, but it says "can't access dead object". A couple more say the same, while others are just empty somehow (with only length
and an empty string as name
).
The official docs on browser.windows
don't mention this behavior.
The only explanation I came up with is that some relevant API permission is missing, but I could't find any permission related to browser.windows
.
I'm testing with Firefox 94 on desktop (Ubuntu).
Does anyone know what this means and how to fix it?