Bug 1697800 - webrtcUI.getActiveStreams should not throw during tab closing, r=johannh.

Depends on D108011

Differential Revision: https://phabricator.services.mozilla.com/D108012
This commit is contained in:
Florian Quèze 2021-03-17 17:39:31 +00:00
Родитель fcd8134690
Коммит 2674c6abe4
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -176,10 +176,10 @@ var webrtcUI = {
window: state.window,
};
let browser = aStream.topBrowsingContext.embedderElement;
let browserWindow = browser.ownerGlobal;
let tab =
browserWindow.gBrowser &&
browserWindow.gBrowser.getTabForBrowser(browser);
// browser can be null when we are in the process of closing a tab
// and our stream list hasn't been updated yet.
// gBrowser will be null if a stream is used outside a tabbrowser window.
let tab = browser?.ownerGlobal.gBrowser?.getTabForBrowser(browser);
return {
uri: state.documentURI,
tab,