bug 871931 support non-tab browsers in usermedia/camera toolbarbutton, r=dao

This commit is contained in:
Shane Caraveo 2013-06-05 10:15:14 -07:00
parent 4e9196b791
commit 6575602183
2 changed files with 15 additions and 15 deletions

View File

@ -44,9 +44,12 @@ let WebrtcIndicator = {
if (!streamData)
return;
let tab = streamData.tab;
let browserWindow = tab.ownerDocument.defaultView;
browserWindow.gBrowser.selectedTab = tab;
let browserWindow = streamData.browser.ownerDocument.defaultView;
if (streamData.tab) {
browserWindow.gBrowser.selectedTab = streamData.tab;
} else {
streamData.browser.focus();
}
browserWindow.focus();
}
}

View File

@ -39,19 +39,16 @@ this.webrtcUI = {
let activeStreams = [];
for (let i = 0; i < count; i++) {
let contentWindow = contentWindowSupportsArray.GetElementAt(i);
let browserWindow = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
let browser = getBrowserForWindow(contentWindow);
let browserWindow = browser.ownerDocument.defaultView;
let tab = browserWindow.gBrowser &&
browserWindow.gBrowser._getTabForContentWindow(contentWindow.top);
if (tab) {
activeStreams.push({
uri: contentWindow.location.href,
tab: tab
tab: tab,
browser: browser
});
}
}
return activeStreams;
}
}
@ -212,8 +209,8 @@ function updateIndicators() {
while (e.hasMoreElements())
e.getNext().WebrtcIndicator.updateButton();
for (let {tab: tab} of webrtcUI.activeStreams)
showBrowserSpecificIndicator(tab.linkedBrowser);
for (let {browser: browser} of webrtcUI.activeStreams)
showBrowserSpecificIndicator(browser);
}
function showBrowserSpecificIndicator(aBrowser) {