bug 883346 permissions support for standalone chat window, r=felipe

This commit is contained in:
Shane Caraveo 2013-06-21 19:17:34 -07:00
parent 969230ff7c
commit b0289891cb
5 changed files with 135 additions and 109 deletions

View File

@ -287,59 +287,6 @@
<menupopup id="placesContext"/>
<panel id="notification-popup"
type="arrow"
footertype="promobox"
position="after_start"
hidden="true"
orient="vertical"
role="alert"/>
<!-- Popup for site identity information -->
<panel id="identity-popup"
type="arrow"
hidden="true"
noautofocus="true"
consumeoutsideclicks="true"
onpopupshown="gIdentityHandler.onPopupShown(event);"
level="top">
<hbox id="identity-popup-container" align="top">
<image id="identity-popup-icon"/>
<vbox id="identity-popup-content-box">
<label id="identity-popup-connectedToLabel"
class="identity-popup-label"
value="&identity.connectedTo;"/>
<label id="identity-popup-connectedToLabel2"
class="identity-popup-label"
value="&identity.unverifiedsite2;"/>
<description id="identity-popup-content-host"
class="identity-popup-description"/>
<label id="identity-popup-runByLabel"
class="identity-popup-label"
value="&identity.runBy;"/>
<description id="identity-popup-content-owner"
class="identity-popup-description"/>
<description id="identity-popup-content-supplemental"
class="identity-popup-description"/>
<description id="identity-popup-content-verifier"
class="identity-popup-description"/>
<hbox id="identity-popup-encryption" flex="1">
<vbox>
<image id="identity-popup-encryption-icon"/>
</vbox>
<description id="identity-popup-encryption-label" flex="1"
class="identity-popup-description"/>
</hbox>
<!-- Footer button to open security page info -->
<hbox id="identity-popup-button-container" pack="end">
<button id="identity-popup-more-info-button"
label="&identity.moreInfoLinkText;"
onblur="gIdentityHandler.hideIdentityPopup();"
oncommand="gIdentityHandler.handleMoreInfoClick(event);"/>
</hbox>
</vbox>
</hbox>
</panel>
<panel id="ctrlTab-panel" class="KUI-panel" hidden="true" norestorefocus="true" level="top">
<hbox>
@ -382,57 +329,7 @@
#endif
</tooltip>
<popupnotification id="webRTC-shareDevices-notification" hidden="true">
<popupnotificationcontent id="webRTC-selectCamera" orient="vertical">
<separator class="thin"/>
<label value="&getUserMedia.selectCamera.label;"
accesskey="&getUserMedia.selectCamera.accesskey;"
control="webRTC-selectCamera-menulist"/>
<menulist id="webRTC-selectCamera-menulist">
<menupopup id="webRTC-selectCamera-menupopup"/>
</menulist>
</popupnotificationcontent>
<popupnotificationcontent id="webRTC-selectMicrophone" orient="vertical">
<separator class="thin"/>
<label value="&getUserMedia.selectMicrophone.label;"
accesskey="&getUserMedia.selectMicrophone.accesskey;"
control="webRTC-selectMicrophone-menulist"/>
<menulist id="webRTC-selectMicrophone-menulist">
<menupopup id="webRTC-selectMicrophone-menupopup"/>
</menulist>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="geolocation-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>
<label id="geolocation-learnmore-link" class="text-link"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="servicesInstall-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>
<label id="servicesInstall-learnmore-link" class="text-link"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="pointerLock-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>
<label id="pointerLock-cancel" value="&pointerLock.notification.message;"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="mixed-content-blocked-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator/>
<description id="mixed-content-blocked-moreinfo">&mixedContentBlocked.moreinfo;</description>
<separator/>
<label id="mixed-content-blocked-helplink" class="text-link"
value="&mixedContentBlocked.helplink;"/>
</popupnotificationcontent>
</popupnotification>
#include popup-notifications.inc
</popupset>

View File

@ -61,6 +61,21 @@ var gChatWindow = {
}
}
// define a popupnotifications handler for this window. we don't use
// an iconbox here, and only support the browser frame for chat.
XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
let tmp = {};
Cu.import("resource://gre/modules/PopupNotifications.jsm", tmp);
try {
return new tmp.PopupNotifications(document.getElementById("chatter").content,
document.getElementById("notification-popup"),
null);
} catch (ex) {
console.error(ex);
return null;
}
});
</script>
#include browser-sets.inc
@ -82,6 +97,9 @@ var gChatWindow = {
gContextMenu = null;">
#include browser-context.inc
</menupopup>
#include popup-notifications.inc
</popupset>
<commandset id="editMenuCommands"/>

View File

@ -0,0 +1,108 @@
# to be included inside a popupset element
<panel id="notification-popup"
type="arrow"
footertype="promobox"
position="after_start"
hidden="true"
orient="vertical"
role="alert"/>
<!-- Popup for site identity information -->
<panel id="identity-popup"
type="arrow"
hidden="true"
noautofocus="true"
consumeoutsideclicks="true"
onpopupshown="gIdentityHandler.onPopupShown(event);"
level="top">
<hbox id="identity-popup-container" align="top">
<image id="identity-popup-icon"/>
<vbox id="identity-popup-content-box">
<label id="identity-popup-connectedToLabel"
class="identity-popup-label"
value="&identity.connectedTo;"/>
<label id="identity-popup-connectedToLabel2"
class="identity-popup-label"
value="&identity.unverifiedsite2;"/>
<description id="identity-popup-content-host"
class="identity-popup-description"/>
<label id="identity-popup-runByLabel"
class="identity-popup-label"
value="&identity.runBy;"/>
<description id="identity-popup-content-owner"
class="identity-popup-description"/>
<description id="identity-popup-content-supplemental"
class="identity-popup-description"/>
<description id="identity-popup-content-verifier"
class="identity-popup-description"/>
<hbox id="identity-popup-encryption" flex="1">
<vbox>
<image id="identity-popup-encryption-icon"/>
</vbox>
<description id="identity-popup-encryption-label" flex="1"
class="identity-popup-description"/>
</hbox>
<!-- Footer button to open security page info -->
<hbox id="identity-popup-button-container" pack="end">
<button id="identity-popup-more-info-button"
label="&identity.moreInfoLinkText;"
onblur="gIdentityHandler.hideIdentityPopup();"
oncommand="gIdentityHandler.handleMoreInfoClick(event);"/>
</hbox>
</vbox>
</hbox>
</panel>
<popupnotification id="webRTC-shareDevices-notification" hidden="true">
<popupnotificationcontent id="webRTC-selectCamera" orient="vertical">
<separator class="thin"/>
<label value="&getUserMedia.selectCamera.label;"
accesskey="&getUserMedia.selectCamera.accesskey;"
control="webRTC-selectCamera-menulist"/>
<menulist id="webRTC-selectCamera-menulist">
<menupopup id="webRTC-selectCamera-menupopup"/>
</menulist>
</popupnotificationcontent>
<popupnotificationcontent id="webRTC-selectMicrophone" orient="vertical">
<separator class="thin"/>
<label value="&getUserMedia.selectMicrophone.label;"
accesskey="&getUserMedia.selectMicrophone.accesskey;"
control="webRTC-selectMicrophone-menulist"/>
<menulist id="webRTC-selectMicrophone-menulist">
<menupopup id="webRTC-selectMicrophone-menupopup"/>
</menulist>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="geolocation-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>
<label id="geolocation-learnmore-link" class="text-link"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="servicesInstall-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>
<label id="servicesInstall-learnmore-link" class="text-link"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="pointerLock-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>
<label id="pointerLock-cancel" value="&pointerLock.notification.message;"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="mixed-content-blocked-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator/>
<description id="mixed-content-blocked-moreinfo">&mixedContentBlocked.moreinfo;</description>
<separator/>
<label id="mixed-content-blocked-helplink" class="text-link"
value="&mixedContentBlocked.helplink;"/>
</popupnotificationcontent>
</popupnotification>

View File

@ -144,6 +144,7 @@
<body><![CDATA[
aTarget.setAttribute('label', this.contentDocument.title);
aTarget.content.setAttribute("origin", this.content.getAttribute("origin"));
aTarget.content.popupnotificationanchor.className = this.content.popupnotificationanchor.className;
this.content.socialErrorListener.remove();
this.content.swapDocShells(aTarget.content);
Social.setErrorListener(this.content, function(aBrowser) {

View File

@ -59,8 +59,6 @@ Notification.prototype = {
get anchorElement() {
let iconBox = this.owner.iconBox;
if (!iconBox)
return null;
let anchorElement = null;
let anchor = this.browser.getAttribute("popupnotificationanchor") ||
@ -69,10 +67,13 @@ Notification.prototype = {
if (anchor instanceof Ci.nsIDOMXULElement) {
anchorElement = anchor;
} else {
anchorElement = iconBox.ownerDocument.getElementById(anchor);
anchorElement = this.browser.ownerDocument.getElementById(anchor);
}
}
if (!iconBox)
return anchorElement;
if (!anchorElement && this.anchorID)
anchorElement = iconBox.querySelector("#"+this.anchorID);
@ -123,7 +124,8 @@ this.PopupNotifications = function PopupNotifications(tabbrowser, panel, iconBox
this.panel.addEventListener("popuphidden", this, true);
this.window.addEventListener("activate", this, true);
this.tabbrowser.tabContainer.addEventListener("TabSelect", this, true);
if (this.tabbrowser.tabContainer)
this.tabbrowser.tabContainer.addEventListener("TabSelect", this, true);
}
PopupNotifications.prototype = {
@ -392,7 +394,7 @@ PopupNotifications.prototype = {
* Gets notifications for the currently selected browser.
*/
get _currentNotifications() {
return this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser);
return this.tabbrowser.selectedBrowser ? this._getNotificationsForBrowser(this.tabbrowser.selectedBrowser) : [];
},
_remove: function PopupNotifications_removeHelper(notification) {