Bug 1167756 - Switch to openUILink for the Pocket menubar item to avoid using and leaking AppConstants. r=jaws a=bustage
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Fri, 22 May 2015 14:15:15 -0700
changeset 267553 d13593be924c4b6e8a55521e5706140b7fab607e
parent 267552 499952b6cf5705475d1e5f39d25288c294272a8b
child 267554 a080d9c9e1a9d7e74c80c231c96eb11e58dfb960
child 267555 8298b32e2b92fc1ee41900dccc40ac3c7e4025b8
child 267557 c790fa665dff7bb8ece78a31626c162a3c87132f
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, bustage
Bug 1167756 - Switch to openUILink for the Pocket menubar item to avoid using and leaking AppConstants. r=jaws a=bustage
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -408,17 +408,17 @@
       <menuseparator id="organizeBookmarksSeparator"/>
       <menuitem id="menu_pocket" label="&pocketMenuitem.label;"
 #ifndef XP_MACOSX
-                oncommand="window.pktUI.openTabWithUrl(Pocket.listURL);"/>
+                oncommand="openUILink(Pocket.listURL, event);"/>
       <menuseparator id="menu_pocketSeparator"/>
       <menuitem id="menu_bookmarkThisPage"
       <menuitem id="subscribeToPageMenuitem"
 #ifndef XP_MACOSX
--- a/browser/components/pocket/main.js
+++ b/browser/components/pocket/main.js
@@ -37,18 +37,16 @@
 // TODO : Get the toolbar icons from Firefox's build (Nikki needs to give us a red saved icon)
 // TODO : [needs clarificaiton from Fx] Firefox's plan was to hide Pocket from context menus until the user logs in. Now that it's an extension I'm wondering if we still need to do this.
 // TODO : [needs clarificaiton from Fx] Reader mode (might be a something they need to do since it's in html, need to investigate their code)
 // TODO : [needs clarificaiton from Fx] Move prefs within pktApi.s to sqlite or a local file so it's not editable (and is safer)
 // TODO : [nice to have] - Immediately save, buffer the actions in a local queue and send (so it works offline, works like our native extensions)
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
-  "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
 var pktUI = (function() {
 	// -- Initialization (on startup and new windows) -- //
@@ -619,22 +617,17 @@ var pktUI = (function() {
      * Open a new tab with a given url and notify the iframe panel that it was opened
 	function openTabWithUrl(url) {
         let recentWindow = Services.wm.getMostRecentWindow("navigator:browser");
         if (!recentWindow) {
-          if (this.AppConstants.platform == "macosx") {
-            let hiddenWindow = Services.appShell.hiddenDOMWindow;
-            // If there are no open browser windows, open a new one.
-            hiddenWindow.openDialog("chrome://browser/content/", "_blank",
-                                    "chrome,all,dialog=no", url);
-          }
+          Cu.reportError("Pocket: No open browser windows to openTabWithUrl");
         // If the user is in permanent private browsing than this is not an issue,
         // since the current window will always share the same cookie jar as the other
         // windows.
         if (!PrivateBrowsingUtils.isWindowPrivate(recentWindow) ||
             PrivateBrowsingUtils.permanentPrivateBrowsing) {