Bug 1199056 - Give the WebExtension's panels the same attributes as the other toolbar button's panels. ui-r=maritz, f=kmag, r=MarcoZ, r=billm, r=gijs
authorBlake Winton <bwinton@latte.ca>
Tue, 20 Oct 2015 11:18:11 -0400
changeset 304026 b6d4a3ec377603b0a651d6495c1af56a49e12d8a
parent 303881 f029ccdee154bdc2b49a1e0fcd5b0fa0397aa97b
child 304027 8c36f375d03b0fcd7a8b3f4c1d92a6b4e4f26e0e
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaritz, MarcoZ, billm, gijs
bugs1199056
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1199056 - Give the WebExtension's panels the same attributes as the other toolbar button's panels. ui-r=maritz, f=kmag, r=MarcoZ, r=billm, r=gijs
browser/components/extensions/ext-utils.js
--- a/browser/components/extensions/ext-utils.js
+++ b/browser/components/extensions/ext-utils.js
@@ -123,43 +123,48 @@ global.openPanel = (node, popupURL, exte
   Services.scriptSecurityManager.checkLoadURIWithPrincipal(
     extension.principal, popupURI,
     Services.scriptSecurityManager.DISALLOW_SCRIPT);
 
   let panel = document.createElement("panel");
   panel.setAttribute("id", makeWidgetId(extension.id) + "-panel");
   panel.setAttribute("class", "browser-extension-panel");
   panel.setAttribute("type", "arrow");
-  panel.setAttribute("flip", "slide");
+  panel.setAttribute("role", "group");
 
   let anchor;
   if (node.localName == "toolbarbutton") {
     // Toolbar buttons are a special case. The panel becomes a child of
     // the button, and is anchored to the button's icon.
     node.appendChild(panel);
     anchor = document.getAnonymousElementByAttribute(node, "class", "toolbarbutton-icon");
   } else {
     // In all other cases, the panel is anchored to the target node
     // itself, and is a child of a popupset node.
     document.getElementById("mainPopupSet").appendChild(panel);
     anchor = node;
   }
 
-  let context;
-  panel.addEventListener("popuphidden", () => {
-    context.unload();
-    panel.remove();
-  });
-
   const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
   let browser = document.createElementNS(XUL_NS, "browser");
   browser.setAttribute("type", "content");
   browser.setAttribute("disableglobalhistory", "true");
   panel.appendChild(browser);
 
+  let titleChangedListener = () => {
+    panel.setAttribute("aria-label", browser.contentTitle);
+  }
+
+  let context;
+  panel.addEventListener("popuphidden", () => {
+    browser.removeEventListener("DOMTitleChanged", titleChangedListener, true);
+    context.unload();
+    panel.remove();
+  });
+
   let loadListener = () => {
     panel.removeEventListener("load", loadListener);
 
     context = new ExtensionPage(extension, {
       type: "popup",
       contentWindow: browser.contentWindow,
       uri: popupURI,
       docShell: browser.docShell,
@@ -187,16 +192,18 @@ global.openPanel = (node, popupURL, exte
       height = Math.min(height, 800);
 
       browser.setAttribute("width", width);
       browser.setAttribute("height", height);
 
       panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, false);
     };
     browser.addEventListener("load", contentLoadListener, true);
+
+    browser.addEventListener("DOMTitleChanged", titleChangedListener, true);
   };
   panel.addEventListener("load", loadListener);
 
   return panel;
 }
 
 // Manages tab-specific context data, and dispatching tab select events
 // across all windows.