Bug 1215694 move pocket to a system addon, r=Gijs, r=glandium
authorShane Caraveo <scaraveo@mozilla.com>
Tue, 29 Dec 2015 15:40:52 -0800
changeset 277877 3ba655f6bc67660a2dcfc4c2a5b3d0d17714f53d
parent 277876 0c12d4229be0068eb1b9beb5064b800f12143f20
child 277878 6cfbca1410850a9892a3ec2686b52b6f8713e2fd
push id69628
push usercbook@mozilla.com
push dateWed, 30 Dec 2015 11:16:09 +0000
treeherdermozilla-inbound@b493cf33851f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, glandium
bugs1215694
milestone46.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 1215694 move pocket to a system addon, r=Gijs, r=glandium part 1: reorganize file locations, r=Gijs part 2: remove built-in pocket code, r=Gijs part 3: l10n support, r=glandium part 4: move code/functionality from part 2 into the addon, r=Gijs part 5: remove dead code, r=Gijs part 6: create a simple api for addons to add to reader mode, r=Gijs part 7: various test fixes related to cui behaviour and pocket, r=me
browser/app/profile/firefox.js
browser/base/content/browser-context.inc
browser/base/content/browser-menubar.inc
browser/base/content/browser-places.js
browser/base/content/browser-social.js
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/nsContextMenu.js
browser/base/content/test/social/browser_addons.js
browser/base/content/test/social/browser_share.js
browser/base/content/test/social/browser_social_contextmenu.js
browser/base/content/test/social/browser_social_marks.js
browser/base/content/test/social/browser_social_marks_context.js
browser/base/content/test/social/browser_social_status.js
browser/base/content/test/social/social_activate.html
browser/base/content/test/social/social_activate_basic.html
browser/base/content/test/social/social_worker.js
browser/components/about/AboutRedirector.cpp
browser/components/build/nsModule.cpp
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/customizableui/content/panelUI.inc.xul
browser/components/moz.build
browser/components/pocket/Pocket.jsm
browser/components/pocket/jar.mn
browser/components/pocket/main.js
browser/components/pocket/moz.build
browser/components/pocket/panels/css/firasans.css
browser/components/pocket/panels/css/normalize.css
browser/components/pocket/panels/css/saved.css
browser/components/pocket/panels/css/signup.css
browser/components/pocket/panels/fonts/FiraSans-Regular.woff
browser/components/pocket/panels/img/pocketerror@1x.png
browser/components/pocket/panels/img/pocketerror@2x.png
browser/components/pocket/panels/img/pocketlogo@1x.png
browser/components/pocket/panels/img/pocketlogo@2x.png
browser/components/pocket/panels/img/pocketlogosolo@1x.png
browser/components/pocket/panels/img/pocketlogosolo@2x.png
browser/components/pocket/panels/img/pocketmenuitem16.png
browser/components/pocket/panels/img/pocketmenuitem16@2x.png
browser/components/pocket/panels/img/pocketsignup_button@1x.png
browser/components/pocket/panels/img/pocketsignup_button@2x.png
browser/components/pocket/panels/img/pocketsignup_devices@1x.png
browser/components/pocket/panels/img/pocketsignup_devices@2x.png
browser/components/pocket/panels/img/pocketsignup_hero@1x.png
browser/components/pocket/panels/img/pocketsignup_hero@2x.png
browser/components/pocket/panels/img/signup_firefoxlogo@1x.png
browser/components/pocket/panels/img/signup_firefoxlogo@2x.png
browser/components/pocket/panels/img/signup_help@1x.png
browser/components/pocket/panels/img/signup_help@2x.png
browser/components/pocket/panels/img/signup_or@1x.png
browser/components/pocket/panels/img/signup_or@2x.png
browser/components/pocket/panels/img/tag_close@1x.png
browser/components/pocket/panels/img/tag_close@2x.png
browser/components/pocket/panels/img/tag_closeactive@1x.png
browser/components/pocket/panels/img/tag_closeactive@2x.png
browser/components/pocket/panels/js/messages.js
browser/components/pocket/panels/js/saved.js
browser/components/pocket/panels/js/signup.js
browser/components/pocket/panels/js/tmpl.js
browser/components/pocket/panels/js/vendor/handlebars.runtime.js
browser/components/pocket/panels/js/vendor/jquery-2.1.1.min.js
browser/components/pocket/panels/js/vendor/jquery.tokeninput.min.js
browser/components/pocket/panels/license.txt
browser/components/pocket/panels/saved.html
browser/components/pocket/panels/signup.html
browser/components/pocket/panels/tmpl/saved_premiumextras.handlebars
browser/components/pocket/panels/tmpl/saved_premiumshell.handlebars
browser/components/pocket/panels/tmpl/saved_shell.handlebars
browser/components/pocket/panels/tmpl/signup_shell.handlebars
browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars
browser/components/pocket/pktApi.js
browser/components/uitour/test/browser_UITour_availableTargets.js
browser/components/uitour/test/browser_UITour_pocket.js
browser/extensions/moz.build
browser/extensions/pocket/bootstrap.js
browser/extensions/pocket/content/Pocket.jsm
browser/extensions/pocket/content/main.js
browser/extensions/pocket/content/panels/css/firasans.css
browser/extensions/pocket/content/panels/css/normalize.css
browser/extensions/pocket/content/panels/css/saved.css
browser/extensions/pocket/content/panels/css/signup.css
browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff
browser/extensions/pocket/content/panels/img/pocket.svg
browser/extensions/pocket/content/panels/img/pocketerror@1x.png
browser/extensions/pocket/content/panels/img/pocketerror@2x.png
browser/extensions/pocket/content/panels/img/pocketlogo@1x.png
browser/extensions/pocket/content/panels/img/pocketlogo@2x.png
browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png
browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png
browser/extensions/pocket/content/panels/img/pocketmenuitem16.png
browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png
browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png
browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png
browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png
browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png
browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png
browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png
browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png
browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png
browser/extensions/pocket/content/panels/img/signup_help@1x.png
browser/extensions/pocket/content/panels/img/signup_help@2x.png
browser/extensions/pocket/content/panels/img/signup_or@1x.png
browser/extensions/pocket/content/panels/img/signup_or@2x.png
browser/extensions/pocket/content/panels/img/tag_close@1x.png
browser/extensions/pocket/content/panels/img/tag_close@2x.png
browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png
browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png
browser/extensions/pocket/content/panels/js/messages.js
browser/extensions/pocket/content/panels/js/saved.js
browser/extensions/pocket/content/panels/js/signup.js
browser/extensions/pocket/content/panels/js/tmpl.js
browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js
browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js
browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
browser/extensions/pocket/content/panels/license.txt
browser/extensions/pocket/content/panels/saved.html
browser/extensions/pocket/content/panels/signup.html
browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars
browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars
browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars
browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars
browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars
browser/extensions/pocket/content/pktApi.jsm
browser/extensions/pocket/install.rdf.in
browser/extensions/pocket/jar.mn
browser/extensions/pocket/locales/en-US/pocket.properties
browser/extensions/pocket/locales/jar.mn
browser/extensions/pocket/locales/moz.build
browser/extensions/pocket/moz.build
browser/extensions/pocket/skin/linux/pocket.css
browser/extensions/pocket/skin/osx/pocket.css
browser/extensions/pocket/skin/shared/pocket.css
browser/extensions/pocket/skin/windows/pocket.css
browser/locales/Makefile.in
browser/locales/en-US/chrome/browser/browser-pocket.properties
browser/locales/en-US/chrome/browser/browser.dtd
browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties
browser/locales/filter.py
browser/locales/jar.mn
browser/locales/l10n.ini
browser/modules/ReaderParent.jsm
browser/themes/linux/browser.css
browser/themes/osx/browser.css
browser/themes/shared/browser.inc
browser/themes/shared/customizableui/panelUIOverlay.inc.css
browser/themes/shared/menupanel.inc.css
browser/themes/shared/toolbarbuttons.inc.css
browser/themes/windows/browser.css
python/mozbuild/mozbuild/jar.py
testing/profiles/prefs_general.js
toolkit/components/reader/AboutReader.jsm
toolkit/components/reader/content/aboutReader.html
toolkit/themes/shared/aboutReaderControls.css
toolkit/themes/shared/jar.inc.mn
toolkit/themes/shared/reader/pocket.svg
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1606,23 +1606,16 @@ pref("dom.ipc.reportProcessHangs", true)
 pref("browser.reader.detectedFirstArticle", false);
 // Don't limit how many nodes we care about on desktop:
 pref("reader.parse-node-limit", 0);
 
 // On desktop, we want the URLs to be included here for ease of debugging,
 // and because (normally) these errors are not persisted anywhere.
 pref("reader.errors.includeURLs", true);
 
-pref("browser.pocket.enabled", true);
-pref("browser.pocket.api", "api.getpocket.com");
-pref("browser.pocket.site", "getpocket.com");
-pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
-pref("browser.pocket.useLocaleList", true);
-pref("browser.pocket.enabledLocales", "cs de en-GB en-US en-ZA es-ES es-MX fr hu it ja ja-JP-mac ko nl pl pt-BR pt-PT ru zh-CN zh-TW");
-
 pref("view_source.tab", true);
 
 pref("dom.serviceWorkers.enabled", true);
 pref("dom.serviceWorkers.interception.enabled", true);
 pref("dom.serviceWorkers.openWindow.enabled", true);
 
 #ifndef RELEASE_BUILD
 // Enable Push API.
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -74,20 +74,16 @@
       <menuitem id="context-sharelink"
                 label="&shareLink.label;"
                 accesskey="&shareLink.accesskey;"
                 oncommand="gContextMenu.shareLink();"/>
       <menuitem id="context-savelink"
                 label="&saveLinkCmd.label;"
                 accesskey="&saveLinkCmd.accesskey;"
                 oncommand="gContextMenu.saveLink();"/>
-      <menuitem id="context-savelinktopocket"
-                label="&saveLinkToPocketCmd.label;"
-                accesskey="&saveLinkToPocketCmd.accesskey;"
-                oncommand="gContextMenu.saveLinkToPocket();"/>
       <menu id="context-marklinkMenu" label="&social.marklinkMenu.label;"
             accesskey="&social.marklinkMenu.accesskey;">
         <menupopup/>
       </menu>
       <menuitem id="context-copyemail"
                 label="&copyEmailCmd.label;"
                 accesskey="&copyEmailCmd.accesskey;"
                 oncommand="gContextMenu.copyEmail();"/>
@@ -265,20 +261,16 @@
       <menuitem id="context-sharepage"
                 label="&sharePageCmd.label;"
                 accesskey="&sharePageCmd.accesskey;"
                 oncommand="SocialShare.sharePage();"/>
       <menuitem id="context-savepage"
                 label="&savePageCmd.label;"
                 accesskey="&savePageCmd.accesskey2;"
                 oncommand="gContextMenu.savePageAs();"/>
-      <menuitem id="context-pocket"
-                label="&saveToPocketCmd.label;"
-                accesskey="&saveToPocketCmd.accesskey;"
-                oncommand="gContextMenu.savePageToPocket();"/>
       <menu id="context-markpageMenu" label="&social.markpageMenu.label;"
             accesskey="&social.markpageMenu.accesskey;">
         <menupopup/>
       </menu>
       <menuseparator id="context-sep-viewbgimage"/>
       <menuitem id="context-viewbgimage"
                 label="&viewBGImageCmd.label;"
                 accesskey="&viewBGImageCmd.accesskey;"
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -408,31 +408,24 @@
 #ifndef XP_MACOSX
                placespopup="true"
 #endif
                context="placesContext"
                openInTabs="children"
                oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
                onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
                onpopupshowing="BookmarkingUI.onMainMenuPopupShowing(event);
-                               BookmarkingUI.updatePocketItemVisibility('menu_');
                                if (!this.parentNode._placesView)
                                  new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
                tooltip="bhTooltip" popupsinherittooltip="true">
       <menuitem id="bookmarksShowAll"
                 label="&showAllBookmarks2.label;"
                 command="Browser:ShowAllBookmarks"
                 key="manBookmarkKb"/>
       <menuseparator id="organizeBookmarksSeparator"/>
-      <menuitem id="menu_pocket" label="&pocketMenuitem.label;"
-#ifndef XP_MACOSX
-                class="menuitem-iconic"
-#endif
-                oncommand="openUILink(Pocket.listURL, event);"/>
-      <menuseparator id="menu_pocketSeparator"/>
       <menuitem id="menu_bookmarkThisPage"
                 command="Browser:AddBookmarkAs"
                 observes="bookmarkThisPageBroadcaster"
                 key="addBookmarkAsKb"/>
       <menuitem id="subscribeToPageMenuitem"
 #ifndef XP_MACOSX
                 class="menuitem-iconic"
 #endif
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -1549,22 +1549,16 @@ var BookmarkingUI = {
     }
   },
 
   onMainMenuPopupShowing: function BUI_onMainMenuPopupShowing(event) {
     this._updateBookmarkPageMenuItem();
     PlacesCommandHook.updateBookmarkAllTabsCommand();
   },
 
-  updatePocketItemVisibility: function BUI_updatePocketItemVisibility(prefix) {
-    let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button");
-    document.getElementById(prefix + "pocket").hidden = hidden;
-    document.getElementById(prefix + "pocketSeparator").hidden = hidden;
-  },
-
   _showBookmarkedNotification: function BUI_showBookmarkedNotification() {
     function getCenteringTransformForRects(rectToPosition, referenceRect) {
       let topDiff = referenceRect.top - rectToPosition.top;
       let leftDiff = referenceRect.left - rectToPosition.left;
       let heightDiff = referenceRect.height - rectToPosition.height;
       let widthDiff = referenceRect.width - rectToPosition.width;
       return [(leftDiff + .5 * widthDiff) + "px", (topDiff + .5 * heightDiff) + "px"];
     }
@@ -1676,17 +1670,16 @@ var BookmarkingUI = {
       case "ViewHiding":
         this.onPanelMenuViewHiding(aEvent);
         break;
     }
   },
 
   onPanelMenuViewShowing: function BUI_onViewShowing(aEvent) {
     this._updateBookmarkPageMenuItem();
-    this.updatePocketItemVisibility("panelMenu_");
     // Update checked status of the toolbar toggle.
     let viewToolbar = document.getElementById("panelMenu_viewBookmarksToolbar");
     let personalToolbar = document.getElementById("PersonalToolbar");
     if (personalToolbar.collapsed)
       viewToolbar.removeAttribute("checked");
     else
       viewToolbar.setAttribute("checked", "true");
     // Get all statically placed buttons to supply them with keyboard shortcuts.
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -1343,19 +1343,18 @@ SocialMarks = {
     }
   },
 
   getProviders: function() {
     // only rely on providers that the user has placed in the UI somewhere. This
     // also means that populateToolbarPalette must be called prior to using this
     // method, otherwise you get a big fat zero. For our use case with context
     // menu's, this is ok.
-    let tbh = this._toolbarHelper;
     return [p for (p of Social.providers) if (p.markURL &&
-                                              document.getElementById(tbh.idFromOrigin(p.origin)))];
+                                              document.getElementById(this._toolbarHelper.idFromOrigin(p.origin)))];
   },
 
   populateContextMenu: function() {
     // only show a selection if enabled and there is more than one
     let providers = this.getProviders();
 
     // remove all previous entries by class
     let menus = [m for (m of document.getElementsByClassName("context-socialmarks"))];
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -48,47 +48,16 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "mozIAsyncFavicons");
 XPCOMUtils.defineLazyServiceGetter(this, "gDNSService",
                                    "@mozilla.org/network/dns-service;1",
                                    "nsIDNSService");
 XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
                                    "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
                                   "resource://gre/modules/LightweightThemeManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
-                                  "resource:///modules/Pocket.jsm");
-
-// Can't use XPCOMUtils for these because the scripts try to define the variables
-// on window, and so the defineProperty inside defineLazyGetter fails.
-Object.defineProperty(window, "pktApi", {
-  get: function() {
-    // Avoid this getter running again:
-    delete window.pktApi;
-    Services.scriptloader.loadSubScript("chrome://browser/content/pocket/pktApi.js", window);
-    return window.pktApi;
-  },
-  configurable: true,
-  enumerable: true
-});
-
-function pktUIGetter(prop) {
-  return {
-    get: function() {
-      // Avoid either of these getters running again:
-      delete window.pktUI;
-      delete window.pktUIMessaging;
-      Services.scriptloader.loadSubScript("chrome://browser/content/pocket/main.js", window);
-      return window[prop];
-    },
-    configurable: true,
-    enumerable: true
-  };
-}
-Object.defineProperty(window, "pktUI", pktUIGetter("pktUI"));
-Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging"));
 
 XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
   return Services.strings.createBundle('chrome://browser/locale/browser.properties');
 });
 
 const nsIWebNavigation = Ci.nsIWebNavigation;
 
 var gLastBrowserCharset = null;
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -615,19 +615,19 @@
            to the default placements of buttons in CustomizableUI.jsm, so the
            customization code doesn't get confused.
       -->
     <toolbar id="nav-bar"
              aria-label="&navbarCmd.label;"
              fullscreentoolbar="true" mode="icons" customizable="true"
              iconsize="small"
 #ifdef MOZ_DEV_EDITION
-             defaultset="urlbar-container,search-container,developer-button,bookmarks-menu-button,pocket-button,downloads-button,home-button,loop-button"
+             defaultset="urlbar-container,search-container,developer-button,bookmarks-menu-button,downloads-button,home-button,loop-button"
 #else
-             defaultset="urlbar-container,search-container,bookmarks-menu-button,pocket-button,downloads-button,home-button,loop-button"
+             defaultset="urlbar-container,search-container,bookmarks-menu-button,downloads-button,home-button,loop-button"
 #endif
              customizationtarget="nav-bar-customization-target"
              overflowable="true"
              overflowbutton="nav-bar-overflow-button"
              overflowtarget="widget-overflow-list"
              overflowpanel="widget-overflow"
              context="toolbar-context-menu">
 
@@ -793,38 +793,32 @@
           <menupopup id="BMB_bookmarksPopup"
                      class="cui-widget-panel cui-widget-panelview cui-widget-panelWithFooter PanelUI-subView"
                      placespopup="true"
                      context="placesContext"
                      openInTabs="children"
                      oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
                      onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
                      onpopupshowing="BookmarkingUI.onPopupShowing(event);
-                                     BookmarkingUI.updatePocketItemVisibility('BMB_');
                                      BookmarkingUI.attachPlacesView(event, this);"
                      tooltip="bhTooltip" popupsinherittooltip="true">
             <menuitem id="BMB_viewBookmarksSidebar"
                       class="subviewbutton"
                       label="&viewBookmarksSidebar2.label;"
                       type="checkbox"
                       oncommand="SidebarUI.toggle('viewBookmarksSidebar');">
               <observes element="viewBookmarksSidebar" attribute="checked"/>
             </menuitem>
             <!-- NB: temporary solution for bug 985024, this should go away soon. -->
             <menuitem id="BMB_bookmarksShowAllTop"
                       class="menuitem-iconic subviewbutton"
                       label="&showAllBookmarks2.label;"
                       command="Browser:ShowAllBookmarks"
                       key="manBookmarkKb"/>
             <menuseparator/>
-            <menuitem id="BMB_pocket"
-                      class="menuitem-iconic bookmark-item subviewbutton"
-                      label="&pocketMenuitem.label;"
-                      oncommand="openUILink(Pocket.listURL, event);"/>
-            <menuseparator id="BMB_pocketSeparator"/>
             <menuitem id="BMB_subscribeToPageMenuitem"
 #ifndef XP_MACOSX
                       class="menuitem-iconic subviewbutton"
 #else
                       class="subviewbutton"
 #endif
                       label="&subscribeToPageMenuitem.label;"
                       oncommand="return FeedHandler.subscribeToFeed(null, event);"
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -6,20 +6,16 @@
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
 Components.utils.import("resource://gre/modules/LoginManagerContextMenu.jsm");
 Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
-  "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
-  "resource:///modules/Pocket.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
   "resource://gre/modules/LoginHelper.jsm");
 
 var gContextMenuContentData = null;
 
 function nsContextMenu(aXulMenu, aIsShift) {
   this.shouldDisplay = true;
   this.initMenu(aXulMenu, aIsShift);
@@ -211,35 +207,16 @@ nsContextMenu.prototype = {
     // SimpleServiceDiscovery.services), but SimpleServiceDiscovery is guaranteed
     // to be already loaded, since we load it on startup in nsBrowserGlue,
     // and CastingApps isn't, so check SimpleServiceDiscovery.services first
     // to avoid needing to load CastingApps.jsm if we don't need to.
     shouldShowCast = shouldShowCast && this.mediaURL &&
                      SimpleServiceDiscovery.services.length > 0 &&
                      CastingApps.getServicesForVideo(this.target).length > 0;
     this.setItemAttr("context-castvideo", "disabled", !shouldShowCast);
-
-    this.initPocketItems();
-  },
-
-  initPocketItems: function CM_initPocketItems() {
-    var showSaveCurrentPageToPocket = !(this.onTextInput || this.onLink ||
-                                        this.isContentSelected || this.onImage ||
-                                        this.onCanvas || this.onVideo || this.onAudio);
-    let targetURI = (this.onSaveableLink || this.onPlainTextLink) ? this.linkURI : this.browser.currentURI;
-    let canPocket = CustomizableUI.getPlacementOfWidget("pocket-button") &&
-                    window.pktApi && window.pktApi.isUserLoggedIn();
-    canPocket = canPocket && (targetURI.schemeIs("http") || targetURI.schemeIs("https") ||
-                              (targetURI.schemeIs("about") && ReaderMode.getOriginalUrl(targetURI.spec)));
-    canPocket = canPocket && window.gBrowser && this.browser.getTabBrowser() == window.gBrowser;
-
-    this.showItem("context-pocket", canPocket && showSaveCurrentPageToPocket);
-    let showSaveLinkToPocket = canPocket && !showSaveCurrentPageToPocket &&
-                               (this.onSaveableLink || this.onPlainTextLink);
-    this.showItem("context-savelinktopocket", showSaveLinkToPocket);
   },
 
   initViewItems: function CM_initViewItems() {
     // View source is always OK, unless in directory listing.
     this.showItem("context-viewpartialsource-selection",
                   this.isContentSelected);
     this.showItem("context-viewpartialsource-mathml",
                   this.onMathML && !this.isContentSelected);
@@ -1716,24 +1693,16 @@ nsContextMenu.prototype = {
   shareSelect: function CM_shareSelect() {
     SocialShare.sharePage(null, { url: this.browser.currentURI.spec, text: this.textSelected }, this.target);
   },
 
   savePageAs: function CM_savePageAs() {
     saveBrowser(this.browser);
   },
 
-  saveLinkToPocket: function CM_saveLinkToPocket() {
-    Pocket.savePage(this.browser, this.linkURL);
-  },
-
-  savePageToPocket: function CM_saveToPocket() {
-    Pocket.savePage(this.browser, this.browser.currentURI.spec, this.browser.contentTitle);
-  },
-
   printFrame: function CM_printFrame() {
     PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
   },
 
   switchPageDirection: function CM_switchPageDirection() {
     this.browser.messageManager.sendAsyncMessage("SwitchDocumentDirection");
   },
 
--- a/browser/base/content/test/social/browser_addons.js
+++ b/browser/base/content/test/social/browser_addons.js
@@ -7,25 +7,25 @@ var manifest = {
   sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",
   iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
 };
 var manifest2 = { // used for testing install
   name: "provider 2",
   origin: "https://test1.example.com",
   sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",
   iconURL: "https://test1.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 var manifestUpgrade = { // used for testing install
   name: "provider 3",
   origin: "https://test2.example.com",
   sidebarURL: "https://test2.example.com/browser/browser/base/content/test/social/social_sidebar.html",
   workerURL: "https://test2.example.com/browser/browser/base/content/test/social/social_worker.js",
   iconURL: "https://test2.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 
 function test() {
   waitForExplicitFinish();
 
   let prefname = getManifestPrefname(manifest);
   // ensure that manifest2 is NOT showing as builtin
   is(SocialService.getOriginActivationType(manifest.origin), "foreign", "manifest is foreign");
--- a/browser/base/content/test/social/browser_share.js
+++ b/browser/base/content/test/social/browser_share.js
@@ -43,17 +43,16 @@ function test() {
     Services.prefs.clearUserPref("social.share.activationPanelEnabled");
   });
   runSocialTests(tests, undefined, function(next) {
     let shareButton = SocialShare.shareButton;
     if (shareButton) {
       CustomizableUI.removeWidgetFromArea("social-share-button", CustomizableUI.AREA_NAVBAR)
       shareButton.remove();
     }
-    ok(CustomizableUI.inDefaultState, "Should start in default state.");
     next();
   });
 }
 
 var corpus = [
   {
     url: baseURL+"opengraph/opengraph.html",
     options: {
--- a/browser/base/content/test/social/browser_social_contextmenu.js
+++ b/browser/base/content/test/social/browser_social_contextmenu.js
@@ -8,17 +8,17 @@ var manifest = { // used for testing ins
   name: "provider test1",
   origin: "https://test1.example.com",
   workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
   markURL: "https://test1.example.com/browser/browser/base/content/test/social/social_mark.html?url=%{url}",
   markedIcon: "https://test1.example.com/browser/browser/base/content/test/social/unchecked.jpg",
   unmarkedIcon: "https://test1.example.com/browser/browser/base/content/test/social/checked.jpg",
 
   iconURL: "https://test1.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 
 function test() {
   waitForExplicitFinish();
 
   runSocialTestWithProvider(manifest, function (finishcb) {
     runSocialTests(tests, undefined, undefined, function () {
       finishcb();
--- a/browser/base/content/test/social/browser_social_marks.js
+++ b/browser/base/content/test/social/browser_social_marks.js
@@ -8,35 +8,30 @@ var manifest2 = { // used for testing in
   name: "provider test1",
   origin: "https://test1.example.com",
   workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
   markURL: "https://test1.example.com/browser/browser/base/content/test/social/social_mark.html?url=%{url}",
   markedIcon: "https://test1.example.com/browser/browser/base/content/test/social/unchecked.jpg",
   unmarkedIcon: "https://test1.example.com/browser/browser/base/content/test/social/checked.jpg",
 
   iconURL: "https://test1.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 var manifest3 = { // used for testing install
   name: "provider test2",
   origin: "https://test2.example.com",
   sidebarURL: "https://test2.example.com/browser/browser/base/content/test/social/social_sidebar.html",
   iconURL: "https://test2.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 
 function test() {
   waitForExplicitFinish();
 
-  runSocialTests(tests, undefined, undefined, function () {
-    // Bug 1232207 - something breaks this on aurora on most platforms
-    // ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
-    CustomizableUI.reset();
-    finish();
-  });
+  runSocialTests(tests, undefined, undefined, finish);
 }
 
 var tests = {
   testButtonDisabledOnActivate: function(next) {
     // starting on about:blank page, share should be visible but disabled when
     // adding provider
     is(gBrowser.selectedBrowser.currentURI.spec, "about:blank");
     SocialService.addProvider(manifest2, function(provider) {
--- a/browser/base/content/test/social/browser_social_marks_context.js
+++ b/browser/base/content/test/social/browser_social_marks_context.js
@@ -3,28 +3,24 @@ var SocialService = Cu.import("resource:
 function makeMarkProvider(origin) {
   return { // used for testing install
     name: "mark provider " + origin,
     origin: "https://" + origin + ".example.com",
     markURL: "https://" + origin + ".example.com/browser/browser/base/content/test/social/social_mark.html?url=%{url}",
     markedIcon: "https://" + origin + ".example.com/browser/browser/base/content/test/social/unchecked.jpg",
     unmarkedIcon: "https://" + origin + ".example.com/browser/browser/base/content/test/social/checked.jpg",
     iconURL: "https://" + origin + ".example.com/browser/browser/base/content/test/general/moz.png",
-    version: 1
+    version: "1.0"
   }
 }
 
 function test() {
   waitForExplicitFinish();
 
-  runSocialTests(tests, undefined, undefined, function () {
-    ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
-    CustomizableUI.reset();
-    finish();
-  });
+  runSocialTests(tests, undefined, undefined, finish);
 }
 
 var tests = {
   testContextSubmenu: function(next) {
     // install 4 providers to test that the menu's are added as submenus
     let manifests = [
       makeMarkProvider("sub1.test1"),
       makeMarkProvider("sub2.test1"),
--- a/browser/base/content/test/social/browser_social_status.js
+++ b/browser/base/content/test/social/browser_social_status.js
@@ -12,24 +12,24 @@ var manifest = { // builtin provider
   iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
 };
 var manifest2 = { // used for testing install
   name: "provider test1",
   origin: "https://test1.example.com",
   workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
   statusURL: "https://test1.example.com/browser/browser/base/content/test/social/social_panel.html",
   iconURL: "https://test1.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 var manifest3 = { // used for testing install
   name: "provider test2",
   origin: "https://test2.example.com",
   sidebarURL: "https://test2.example.com/browser/browser/base/content/test/social/social_sidebar.html",
   iconURL: "https://test2.example.com/browser/browser/base/content/test/general/moz.png",
-  version: 1
+  version: "1.0"
 };
 
 
 function openWindowAndWaitForInit(callback) {
   let topic = "browser-delayed-startup-finished";
   let w = OpenBrowserWindow();
   Services.obs.addObserver(function providerSet(subject, topic, data) {
     Services.obs.removeObserver(providerSet, topic);
@@ -40,17 +40,16 @@ function openWindowAndWaitForInit(callba
 function test() {
   waitForExplicitFinish();
 
   runSocialTestWithProvider(manifest, function (finishcb) {
     runSocialTests(tests, undefined, undefined, function () {
       Services.prefs.clearUserPref("social.remote-install.enabled");
       // just in case the tests failed, clear these here as well
       Services.prefs.clearUserPref("social.whitelist");
-      ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
       CustomizableUI.reset();
       finishcb();
     });
   });
 }
 
 var tests = {
   testNoButtonOnEnable: function(next) {
--- a/browser/base/content/test/social/social_activate.html
+++ b/browser/base/content/test/social/social_activate.html
@@ -17,17 +17,17 @@ var data = {
   "statusURL": "/browser/browser/base/content/test/social/social_panel.html",
   "postActivationURL": "/browser/browser/base/content/test/social/social_postActivation.html",
 
   // should be available for display purposes
   "description": "A short paragraph about this provider",
   "author": "Shane Caraveo, Mozilla",
 
   // optional
-  "version": 1
+  "version": "1.0"
 }
 
 function activate(node) {
   node.setAttribute("data-service", JSON.stringify(data));
   var event = new CustomEvent("ActivateSocialFeature");
   node.dispatchEvent(event);
 }
 
--- a/browser/base/content/test/social/social_activate_basic.html
+++ b/browser/base/content/test/social/social_activate_basic.html
@@ -15,17 +15,17 @@ var data = {
   "sidebarURL": "/browser/browser/base/content/test/social/social_sidebar_empty.html",
   "postActivationURL": "/browser/browser/base/content/test/social/social_postActivation.html",
 
   // should be available for display purposes
   "description": "A short paragraph about this provider",
   "author": "Shane Caraveo, Mozilla",
 
   // optional
-  "version": 1
+  "version": "1.0"
 }
 
 function activate(node) {
   node.setAttribute("data-service", JSON.stringify(data));
   var event = new CustomEvent("ActivateSocialFeature");
   node.dispatchEvent(event);
 }
 
--- a/browser/base/content/test/social/social_worker.js
+++ b/browser/base/content/test/social/social_worker.js
@@ -121,17 +121,17 @@ onconnect = function(e) {
         break;
       case "worker.update":
         updatingManifest = true;
         apiPort.postMessage({topic: 'social.manifest-get'});
         break;
       case "social.manifest":
         if (updatingManifest) {
           updatingManifest = false;
-          event.data.data.version = 2;
+          event.data.data.version = "2.0";
           apiPort.postMessage({topic: 'social.manifest-set', data: event.data.data});
         } else if (testPort) {
           testPort.postMessage({topic:"social.manifest", data: event.data.data});
         }
         break;
     }
   }
 }
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -121,28 +121,16 @@ static RedirEntry kRedirMap[] = {
     // Shares an IndexedDB origin with about:loopconversation.
     "loopconversation" },
   { "reader", "chrome://global/content/reader/aboutReader.html",
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
     nsIAboutModule::ALLOW_SCRIPT |
     nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
     nsIAboutModule::MAKE_UNLINKABLE |
     nsIAboutModule::HIDE_FROM_ABOUTABOUT },
-  {
-    "pocket-saved", "chrome://browser/content/pocket/panels/saved.html",
-    nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
-    nsIAboutModule::ALLOW_SCRIPT |
-    nsIAboutModule::HIDE_FROM_ABOUTABOUT |
-    nsIAboutModule::MAKE_UNLINKABLE },
-  {
-    "pocket-signup", "chrome://browser/content/pocket/panels/signup.html",
-    nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
-    nsIAboutModule::ALLOW_SCRIPT |
-    nsIAboutModule::HIDE_FROM_ABOUTABOUT |
-    nsIAboutModule::MAKE_UNLINKABLE },
 };
 static const int kRedirTotal = ArrayLength(kRedirMap);
 
 static nsAutoCString
 GetAboutModuleName(nsIURI *aURI)
 {
   nsAutoCString path;
   aURI->GetPath(path);
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -112,18 +112,16 @@ static const mozilla::Module::ContractID
 #ifdef MOZ_SERVICES_HEALTHREPORT
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "healthreport", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
 #endif
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "customizing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "debugging", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "looppanel", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "loopconversation", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "reader", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
-    { NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-saved", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
-    { NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-signup", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
 #if defined(XP_WIN)
     { NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
     { NS_EDGEREADINGLISTEXTRACTOR_CONTRACTID, &kNS_EDGEREADINGLISTEXTRACTOR_CID },
 #elif defined(XP_MACOSX)
     { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
 #endif
     { nullptr }
 };
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -51,25 +51,26 @@ const kSubviewEvents = [
   "ViewShowing",
   "ViewHiding"
 ];
 
 /**
  * The current version. We can use this to auto-add new default widgets as necessary.
  * (would be const but isn't because of testing purposes)
  */
-var kVersion = 5;
+var kVersion = 6;
 
 /**
  * Buttons removed from built-ins by version they were removed. kVersion must be
  * bumped any time a new id is added to this. Use the button id as key, and
  * version the button is removed in as the value.  e.g. "pocket-button": 5
  */
 var ObsoleteBuiltinButtons = {
-  "loop-button": 5
+  "loop-button": 5,
+  "pocket-button": 6
 };
 
 /**
  * gPalette is a map of every widget that CustomizableUI.jsm knows about, keyed
  * on their IDs.
  */
 var gPalette = new Map();
 
@@ -217,25 +218,16 @@ var CustomizableUIInternal = {
       "developer-button",
 #endif
       "bookmarks-menu-button",
       "downloads-button",
       "home-button",
       "loop-button",
     ];
 
-    // Insert the Pocket button after the bookmarks button if it's present.
-    for (let widgetDefinition of CustomizableWidgets) {
-      if (widgetDefinition.id == "pocket-button") {
-        let idx = navbarPlacements.indexOf("bookmarks-menu-button") + 1;
-        navbarPlacements.splice(idx, 0, widgetDefinition.id);
-        break;
-      }
-    }
-
     if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) {
       navbarPlacements.push("webide-button");
     }
 
     this.registerArea(CustomizableUI.AREA_NAVBAR, {
       legacy: true,
       type: CustomizableUI.TYPE_TOOLBAR,
       overflowable: true,
@@ -3468,18 +3460,18 @@ this.CustomizableUI = {
    *     position: 42 // the index in the placements array corresponding to
    *                  // your widget.
    *   }
    *
    *   OR
    *
    *   null // if the widget is not placed anywhere (ie in the palette)
    */
-  getPlacementOfWidget: function(aWidgetId) {
-    return CustomizableUIInternal.getPlacementOfWidget(aWidgetId, true);
+  getPlacementOfWidget: function(aWidgetId, aOnlyRegistered=true, aDeadAreas=false) {
+    return CustomizableUIInternal.getPlacementOfWidget(aWidgetId, aOnlyRegistered, aDeadAreas);
   },
   /**
    * Check if a widget can be removed from the area it's in.
    *
    * Note that if you're wanting to move the widget somewhere, you should
    * generally be checking canWidgetMoveToArea, because that will return
    * true if the widget is already in the area where you want to move it (!).
    *
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -13,28 +13,22 @@ Cu.import("resource://gre/modules/XPCOMU
 XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
   "resource:///modules/BrowserUITelemetry.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
   "resource://gre/modules/PlacesUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUIUtils",
   "resource:///modules/PlacesUIUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "RecentlyClosedTabsAndWindowsMenuUtils",
   "resource:///modules/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
-  "resource:///modules/Pocket.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
   "resource://gre/modules/ShortcutUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
   "resource://gre/modules/CharsetMenu.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
-  "resource://gre/modules/AddonManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
-  "resource://gre/modules/SocialService.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "SyncedTabs",
   "resource://services-sync/SyncedTabs.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "CharsetBundle", function() {
   const kCharsetBundle = "chrome://global/locale/charsetMenu.properties";
   return Services.strings.createBundle(kCharsetBundle);
 });
 XPCOMUtils.defineLazyGetter(this, "BrandBundle", function() {
@@ -1220,78 +1214,16 @@ if (Services.prefs.getBoolPref("privacy.
     },
     onViewHiding: function(aEvent) {
       let forgetButton = aEvent.target.querySelector("#PanelUI-panic-view-button");
       forgetButton.removeEventListener("command", this);
     },
   });
 }
 
-if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
-  let isEnabledForLocale = true;
-  if (Services.prefs.getBoolPref("browser.pocket.useLocaleList")) {
-    let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                           .getService(Ci.nsIXULChromeRegistry);
-    let browserLocale = chromeRegistry.getSelectedLocale("browser");
-    let enabledLocales = [];
-    try {
-      enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' ');
-    } catch (ex) {
-      Cu.reportError(ex);
-    }
-    isEnabledForLocale = enabledLocales.indexOf(browserLocale) != -1;
-  }
-
-  if (isEnabledForLocale) {
-    let pocketButton = {
-      id: "pocket-button",
-      defaultArea: CustomizableUI.AREA_NAVBAR,
-      introducedInVersion: "pref",
-      type: "view",
-      viewId: "PanelUI-pocketView",
-      // Use forwarding functions here to avoid loading Pocket.jsm on startup:
-      onViewShowing: function() {
-        return Pocket.onPanelViewShowing.apply(this, arguments);
-      },
-      onViewHiding: function() {
-        return Pocket.onPanelViewHiding.apply(this, arguments);
-      },
-
-      // If the user has the "classic" Pocket add-on installed, use that instead
-      // and destroy the widget.
-      conditionalDestroyPromise: new Promise(resolve => {
-        AddonManager.getAddonByID("isreaditlater@ideashower.com", addon => {
-          resolve(addon && addon.isActive);
-        });
-      }),
-    };
-
-    CustomizableWidgets.push(pocketButton);
-    CustomizableUI.addListener(pocketButton);
-
-    // Uninstall the Pocket social provider if it exists, but only if we haven't
-    // already uninstalled it in this manner.  That way the user can reinstall
-    // it if they prefer it without its being uninstalled every time they start
-    // the browser.
-    let origin = "https://getpocket.com";
-    SocialService.getProvider(origin, provider => {
-      if (provider) {
-        let pref = "social.backup.getpocket-com";
-        if (!Services.prefs.prefHasUserValue(pref)) {
-          let str = Cc["@mozilla.org/supports-string;1"].
-                    createInstance(Ci.nsISupportsString);
-          str.data = JSON.stringify(provider.manifest);
-          Services.prefs.setComplexValue(pref, Ci.nsISupportsString, str);
-          SocialService.uninstallProvider(origin, () => {});
-        }
-      }
-    });
-  }
-}
-
 #ifdef E10S_TESTING_ONLY
 var e10sDisabled = false;
 #ifdef XP_MACOSX
 // On OS X, "Disable Hardware Acceleration" also disables OMTC and forces
 // a fallback to Basic Layers. This is incompatible with e10s.
 e10sDisabled |= Services.prefs.getBoolPref("layers.acceleration.disabled");
 #endif
 
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -186,20 +186,16 @@
     <panelview id="PanelUI-bookmarks" flex="1" class="PanelUI-subView">
       <label value="&bookmarksMenu.label;" class="panel-subview-header"/>
       <vbox class="panel-subview-body">
         <toolbarbutton id="panelMenuBookmarkThisPage"
                        class="subviewbutton"
                        observes="bookmarkThisPageBroadcaster"
                        command="Browser:AddBookmarkAs"
                        onclick="PanelUI.hide();"/>
-        <toolbarseparator id="panelMenu_pocketSeparator"/>
-        <toolbarbutton id="panelMenu_pocket" label="&pocketMenuitem.label;"
-                       class="subviewbutton cui-withicon"
-                       oncommand="openUILink(Pocket.listURL, event);"/>
         <toolbarseparator/>
         <toolbarbutton id="panelMenu_viewBookmarksSidebar"
                        label="&viewBookmarksSidebar2.label;"
                        class="subviewbutton"
                        key="viewBookmarksSidebarKb"
                        oncommand="SidebarUI.toggle('viewBookmarksSidebar'); PanelUI.hide();">
           <observes element="viewBookmarksSidebar" attribute="checked"/>
         </toolbarbutton>
@@ -305,22 +301,16 @@
 
           <label id="PanelUI-panic-warning">&panicButton.view.undoWarning;</label>
         </vbox>
         <button id="PanelUI-panic-view-button"
                 label="&panicButton.view.forgetButton;"/>
       </vbox>
     </panelview>
 
-    <panelview id="PanelUI-pocketView" flex="1">
-      <vbox class="panel-subview-body">
-      </vbox>
-    </panelview>
-
-
   </panelmultiview>
   <!-- These menupopups are located here to prevent flickering,
        see bug 492960 comment 20. -->
   <menupopup id="customizationPanelItemContextMenu">
     <menuitem oncommand="gCustomizeMode.addToToolbar(document.popupNode)"
               closemenu="single"
               class="customize-context-moveToToolbar"
               accesskey="&customizeMenu.moveToToolbar.accesskey;"
--- a/browser/components/moz.build
+++ b/browser/components/moz.build
@@ -10,17 +10,16 @@ DIRS += [
     'customizableui',
     'dirprovider',
     'downloads',
     'extensions',
     'feeds',
     'migration',
     'newtab',
     'places',
-    'pocket',
     'preferences',
     'privatebrowsing',
     'search',
     'sessionstore',
     'shell',
     'selfsupport',
     'uitour',
     'translation',
deleted file mode 100644
--- a/browser/components/pocket/jar.mn
+++ /dev/null
@@ -1,48 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-browser.jar:
-  content/browser/pocket/main.js
-  content/browser/pocket/pktApi.js
-  content/browser/pocket/panels/saved.html       (panels/saved.html)
-  content/browser/pocket/panels/signup.html      (panels/signup.html)
-  content/browser/pocket/panels/css/normalize.css       (panels/css/normalize.css)
-  content/browser/pocket/panels/css/firasans.css        (panels/css/firasans.css)
-  content/browser/pocket/panels/css/saved.css           (panels/css/saved.css)
-  content/browser/pocket/panels/css/signup.css           (panels/css/signup.css)
-  content/browser/pocket/panels/fonts/FiraSans-Regular.woff (panels/fonts/FiraSans-Regular.woff)
-  content/browser/pocket/panels/img/pocketerror@1x.png             (panels/img/pocketerror@1x.png)
-  content/browser/pocket/panels/img/pocketerror@2x.png             (panels/img/pocketerror@2x.png)
-  content/browser/pocket/panels/img/pocketlogo@1x.png              (panels/img/pocketlogo@1x.png)
-  content/browser/pocket/panels/img/pocketlogo@2x.png              (panels/img/pocketlogo@2x.png)
-  content/browser/pocket/panels/img/pocketlogosolo@1x.png          (panels/img/pocketlogosolo@1x.png)
-  content/browser/pocket/panels/img/pocketlogosolo@2x.png          (panels/img/pocketlogosolo@2x.png)
-  content/browser/pocket/panels/img/pocketmenuitem16.png           (panels/img/pocketmenuitem16.png)
-  content/browser/pocket/panels/img/pocketmenuitem16@2x.png        (panels/img/pocketmenuitem16@2x.png)
-  content/browser/pocket/panels/img/pocketsignup_button@1x.png     (panels/img/pocketsignup_button@1x.png)
-  content/browser/pocket/panels/img/pocketsignup_button@2x.png     (panels/img/pocketsignup_button@2x.png)
-  content/browser/pocket/panels/img/pocketsignup_devices@1x.png    (panels/img/pocketsignup_devices@1x.png)
-  content/browser/pocket/panels/img/pocketsignup_devices@2x.png    (panels/img/pocketsignup_devices@2x.png)
-  content/browser/pocket/panels/img/pocketsignup_hero@1x.png       (panels/img/pocketsignup_hero@1x.png)
-  content/browser/pocket/panels/img/pocketsignup_hero@2x.png       (panels/img/pocketsignup_hero@2x.png)
-  content/browser/pocket/panels/img/signup_firefoxlogo@1x.png      (panels/img/signup_firefoxlogo@1x.png)
-  content/browser/pocket/panels/img/signup_firefoxlogo@2x.png      (panels/img/signup_firefoxlogo@2x.png)
-  content/browser/pocket/panels/img/signup_help@1x.png             (panels/img/signup_help@1x.png)
-  content/browser/pocket/panels/img/signup_help@2x.png             (panels/img/signup_help@2x.png)
-  content/browser/pocket/panels/img/tag_close@1x.png               (panels/img/tag_close@1x.png)
-  content/browser/pocket/panels/img/tag_close@2x.png               (panels/img/tag_close@2x.png)
-  content/browser/pocket/panels/img/tag_closeactive@1x.png         (panels/img/tag_closeactive@1x.png)
-  content/browser/pocket/panels/img/tag_closeactive@2x.png         (panels/img/tag_closeactive@2x.png)
-  content/browser/pocket/panels/js/messages.js                     (panels/js/messages.js)
-  content/browser/pocket/panels/js/saved.js                        (panels/js/saved.js)
-  content/browser/pocket/panels/js/signup.js                       (panels/js/signup.js)
-  content/browser/pocket/panels/js/tmpl.js                         (panels/js/tmpl.js)
-  content/browser/pocket/panels/js/vendor/jquery-2.1.1.min.js      (panels/js/vendor/jquery-2.1.1.min.js)
-  content/browser/pocket/panels/js/vendor/handlebars.runtime.js    (panels/js/vendor/handlebars.runtime.js)
-  content/browser/pocket/panels/js/vendor/jquery.tokeninput.min.js (panels/js/vendor/jquery.tokeninput.min.js)
-  content/browser/pocket/panels/tmpl/saved_premiumextras.handlebars (panels/tmpl/saved_premiumextras.handlebars)
-  content/browser/pocket/panels/tmpl/saved_premiumshell.handlebars (panels/tmpl/saved_premiumshell.handlebars)
-  content/browser/pocket/panels/tmpl/saved_shell.handlebars        (panels/tmpl/saved_shell.handlebars)
-  content/browser/pocket/panels/tmpl/signup_shell.handlebars       (panels/tmpl/signup_shell.handlebars)
-  content/browser/pocket/panels/tmpl/signupstoryboard_shell.handlebars (panels/tmpl/signupstoryboard_shell.handlebars)
deleted file mode 100644
--- a/browser/components/pocket/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-JAR_MANIFESTS += ['jar.mn']
-
-EXTRA_JS_MODULES += ['Pocket.jsm']
--- a/browser/components/uitour/test/browser_UITour_availableTargets.js
+++ b/browser/components/uitour/test/browser_UITour_availableTargets.js
@@ -4,35 +4,17 @@
 "use strict";
 
 var gTestTab;
 var gContentAPI;
 var gContentWindow;
 
 var hasWebIDE = Services.prefs.getBoolPref("devtools.webide.widget.enabled");
 
-var hasPocket = false;
-if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
-  let isEnabledForLocale = true;
-  if (Services.prefs.getBoolPref("browser.pocket.useLocaleList")) {
-    let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
-                           .getService(Ci.nsIXULChromeRegistry);
-    let browserLocale = chromeRegistry.getSelectedLocale("browser");
-    let enabledLocales = [];
-    try {
-      enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' ');
-    } catch (ex) {
-      Cu.reportError(ex);
-    }
-    isEnabledForLocale = enabledLocales.indexOf(browserLocale) != -1;
-  }
-  if (isEnabledForLocale) {
-    hasPocket = true;
-  }
-}
+var hasPocket = Services.prefs.getBoolPref("extensions.pocket.enabled");
 
 function test() {
   requestLongerTimeout(2);
   UITourTest();
 }
 
 var tests = [
   function test_availableTargets(done) {
--- a/browser/components/uitour/test/browser_UITour_pocket.js
+++ b/browser/components/uitour/test/browser_UITour_pocket.js
@@ -57,17 +57,17 @@ function checkPanelIsHidden(aPanel) {
   if (aPanel.parentElement) {
     is_hidden(aPanel);
   } else {
     ok(!aPanel.parentElement, "Widget panel should have been removed");
   }
   is(button.hasAttribute("open"), false, "Pocket button should know that the panel is closed");
 }
 
-if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
+if (Services.prefs.getBoolPref("extensions.pocket.enabled")) {
   let placement = CustomizableUI.getPlacementOfWidget("pocket-button");
 
   // Add the button to the nav-bar by default.
   if (!placement || placement.area != CustomizableUI.AREA_NAVBAR) {
     CustomizableUI.addWidgetToArea("pocket-button", CustomizableUI.AREA_NAVBAR);
   }
   registerCleanupFunction(() => {
     CustomizableUI.reset();
--- a/browser/extensions/moz.build
+++ b/browser/extensions/moz.build
@@ -2,10 +2,11 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += [
     'loop',
     'pdfjs',
+    'pocket',
     'shumway',
 ]
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/bootstrap.js
@@ -0,0 +1,502 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://services-common/utils.js");
+Cu.import("resource://gre/modules/Preferences.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Services",
+                                  "resource://gre/modules/Services.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
+                                  "resource:///modules/RecentWindow.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
+                                  "resource:///modules/CustomizableUI.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "SocialService",
+                                  "resource://gre/modules/SocialService.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
+                                  "resource://gre/modules/AddonManager.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
+                                  "resource://gre/modules/ReaderMode.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
+                                  "chrome://pocket/content/Pocket.jsm");
+XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
+  return Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
+});
+
+
+const PREF_BRANCH = "extensions.pocket.";
+const PREFS = {
+  enabled: true, // bug 1229937, figure out ui tour support
+  api: "api.getpocket.com",
+  site: "getpocket.com",
+  oAuthConsumerKey: "40249-e88c401e1b1f2242d9e441c4"
+};
+
+function setDefaultPrefs() {
+  let branch = Services.prefs.getDefaultBranch(PREF_BRANCH);
+  for (let [key, val] in Iterator(PREFS)) {
+    switch (typeof val) {
+      case "boolean":
+        branch.setBoolPref(key, val);
+        break;
+      case "number":
+        branch.setIntPref(key, val);
+        break;
+      case "string":
+        branch.setCharPref(key, val);
+        break;
+    }
+  }
+}
+
+function* allBrowserWindows() {
+  var winEnum = Services.wm.getEnumerator("navigator:browser");
+  while (winEnum.hasMoreElements()) {
+    let win = winEnum.getNext();
+    // skip closed windows
+    if (win.closed)
+      continue;
+    yield win;
+  }
+}
+
+function createElementWithAttrs(document, type, attrs) {
+  let element = document.createElement(type);
+  Object.keys(attrs).forEach(function (attr) {
+    element.setAttribute(attr, attrs[attr]);
+  })
+  return element;
+}
+
+function CreatePocketWidget(reason) {
+  let id = "pocket-button"
+  let widget = CustomizableUI.getWidget(id);
+  // The widget is only null if we've created then destroyed the widget.
+  // Once we've actually called createWidget the provider will be set to
+  // PROVIDER_API.
+  if (widget && widget.provider == CustomizableUI.PROVIDER_API)
+    return;
+  // if upgrading from builtin version and the button was placed in ui,
+  // seenWidget will not be null
+  let seenWidget = CustomizableUI.getPlacementOfWidget("pocket-button", false, true);
+  let pocketButton = {
+    id: "pocket-button",
+    defaultArea: CustomizableUI.AREA_NAVBAR,
+    introducedInVersion: "pref",
+    type: "view",
+    viewId: "PanelUI-pocketView",
+    label: gPocketBundle.GetStringFromName("pocket-button.label"),
+    tooltiptext: gPocketBundle.GetStringFromName("pocket-button.tooltiptext"),
+    // Use forwarding functions here to avoid loading Pocket.jsm on startup:
+    onViewShowing: function() {
+      return Pocket.onPanelViewShowing.apply(this, arguments);
+    },
+    onViewHiding: function() {
+      return Pocket.onPanelViewHiding.apply(this, arguments);
+    },
+    onBeforeCreated: function(doc) {
+      // Bug 1223127,CUI should make this easier to do.
+      if (doc.getElementById("PanelUI-pocketView"))
+        return;
+      let view = doc.createElement("panelview");
+      view.id = "PanelUI-pocketView";
+      let panel = doc.createElement("vbox");
+      panel.setAttribute("class", "panel-subview-body");
+      view.appendChild(panel);
+      doc.getElementById("PanelUI-multiView").appendChild(view);
+    }
+  };
+
+  CustomizableUI.createWidget(pocketButton);
+  CustomizableUI.addListener(pocketButton);
+  // placed is null if location is palette
+  let placed = CustomizableUI.getPlacementOfWidget("pocket-button");
+
+  // a first time install will always have placed the button somewhere, and will
+  // not have a placement prior to creating the widget. Thus, !seenWidget &&
+  // placed.
+  if (reason == ADDON_ENABLE && !seenWidget && placed) {
+    // initially place the button after the bookmarks button if it is in the UI
+    let widgets = CustomizableUI.getWidgetIdsInArea(CustomizableUI.AREA_NAVBAR);
+    let bmbtn = widgets.indexOf("bookmarks-menu-button");
+    if (bmbtn > -1) {
+      CustomizableUI.moveWidgetWithinArea("pocket-button", bmbtn + 1);
+    }
+  }
+
+  // Uninstall the Pocket social provider if it exists, but only if we haven't
+  // already uninstalled it in this manner.  That way the user can reinstall
+  // it if they prefer it without its being uninstalled every time they start
+  // the browser.
+  let origin = "https://getpocket.com";
+  SocialService.getProvider(origin, provider => {
+    if (provider) {
+      let pref = "social.backup.getpocket-com";
+      if (!Services.prefs.prefHasUserValue(pref)) {
+        let str = Cc["@mozilla.org/supports-string;1"].
+                  createInstance(Ci.nsISupportsString);
+        str.data = JSON.stringify(provider.manifest);
+        Services.prefs.setComplexValue(pref, Ci.nsISupportsString, str);
+        SocialService.uninstallProvider(origin, () => {});
+      }
+    }
+  });
+
+};
+
+// PocketContextMenu
+// When the context menu is opened check if we need to build and enable pocket UI.
+var PocketContextMenu = {
+  init: function() {
+    Services.obs.addObserver(this, "on-build-contextmenu", false);
+  },
+  shutdown: function() {
+    Services.obs.removeObserver(this, "on-build-contextmenu");
+    // loop through windows and remove context menus
+    // iterate through all windows and add pocket to them
+    for (let win of allBrowserWindows()) {
+      let document = win.document;
+      for (let id in ["context-pocket", "context-savelinktopocket"]) {
+        let element = document.getElementById(id);
+        if (element)
+          element.remove();
+      }
+    }
+  },
+  observe: function(aSubject, aTopic, aData) {
+    let subject = aSubject.wrappedJSObject;;
+    let document = subject.menu.ownerDocument;
+    let window = document.defaultView;
+    let pocketEnabled = CustomizableUI.getPlacementOfWidget("pocket-button");
+
+    let showSaveCurrentPageToPocket = !(subject.onTextInput || subject.onLink ||
+                                        subject.isContentSelected || subject.onImage ||
+                                        subject.onCanvas || subject.onVideo || subject.onAudio);
+    let targetUrl = subject.onLink ? subject.linkUrl : subject.pageUrl;
+    let targetURI = Services.io.newURI(targetUrl, null, null);
+    let canPocket = pocketEnabled && (targetURI.schemeIs("http") || targetURI.schemeIs("https") ||
+                    (targetURI.schemeIs("about") && ReaderMode.getOriginalUrl(targetUrl)));
+
+    let showSaveLinkToPocket = canPocket && !showSaveCurrentPageToPocket && subject.onLink;
+
+    // create menu entries if necessary
+    let menu = document.getElementById("context-pocket");
+    if (!menu) {
+      menu = createElementWithAttrs(document, "menuitem", {
+        "id": "context-pocket",
+        "label": gPocketBundle.GetStringFromName("saveToPocketCmd.label"),
+        "accesskey": gPocketBundle.GetStringFromName("saveToPocketCmd.accesskey"),
+        "oncommand": "Pocket.savePage(gContextMenu.browser, gContextMenu.browser.currentURI.spec, gContextMenu.browser.contentTitle);"
+      });
+      let sibling = document.getElementById("context-savepage");
+      if (sibling.nextSibling) {
+        sibling.parentNode.insertBefore(menu, sibling.nextSibling);
+      } else {
+        sibling.parentNode.appendChild(menu);
+      }
+    }
+    menu.hidden = !(canPocket && showSaveCurrentPageToPocket);
+
+    menu = document.getElementById("context-savelinktopocket");
+    if (!menu) {
+      menu = createElementWithAttrs(document, "menuitem", {
+        "id": "context-savelinktopocket",
+        "label": gPocketBundle.GetStringFromName("saveLinkToPocketCmd.label"),
+        "accesskey": gPocketBundle.GetStringFromName("saveLinkToPocketCmd.accesskey"),
+        "oncommand": "Pocket.savePage(gContextMenu.browser, gContextMenu.linkURL);"
+      });
+      sibling = document.getElementById("context-savelink");
+      if (sibling.nextSibling) {
+        sibling.parentNode.insertBefore(menu, sibling.nextSibling);
+      } else {
+        sibling.parentNode.appendChild(menu);
+      }
+    }
+    menu.hidden = !showSaveLinkToPocket;
+  }
+}
+
+// PocketReader
+// Listen for reader mode setup and add our button to the reader toolbar
+var PocketReader = {
+  startup: function() {
+    let mm = Services.mm;
+    mm.addMessageListener("Reader:OnSetup", this);
+    mm.addMessageListener("Reader:Clicked-pocket-button", this);
+    mm.broadcastAsyncMessage("Reader:AddButton",
+                             { id: "pocket-button",
+                               title: gPocketBundle.GetStringFromName("pocket-button.tooltiptext"),
+                               image: "chrome://pocket/content/panels/img/pocket.svg#pocket-mark" });
+  },
+  shutdown: function() {
+    let mm = Services.mm;
+    mm.removeMessageListener("Reader:OnSetup", this);
+    mm.removeMessageListener("Reader:Clicked-pocket-button", this);
+    mm.broadcastAsyncMessage("Reader:RemoveButton", { id: "pocket-button" });
+  },
+  receiveMessage: function(message) {
+    switch (message.name) {
+      case "Reader:OnSetup": {
+        // tell the reader about our button.  A chrome url here doesn't work, but
+        // we can use the resoure url.
+        message.target.messageManager.
+          sendAsyncMessage("Reader:AddButton", { id: "pocket-button",
+                                                 title: gPocketBundle.GetStringFromName("pocket-button.tooltiptext"),
+                                                 image: "chrome://pocket/content/panels/img/pocket.svg#pocket-mark"});
+        break;
+      }
+      case "Reader:Clicked-pocket-button": {
+        let doc = message.target.ownerDocument;
+        let pocketWidget = doc.getElementById("pocket-button");
+        let placement = CustomizableUI.getPlacementOfWidget("pocket-button");
+        if (placement) {
+          if (placement.area == CustomizableUI.AREA_PANEL) {
+            doc.defaultView.PanelUI.show().then(function() {
+              // The DOM node might not exist yet if the panel wasn't opened before.
+              pocketWidget = doc.getElementById("pocket-button");
+              pocketWidget.doCommand();
+            });
+          } else {
+            pocketWidget.doCommand();
+          }
+        }
+        break;
+      }
+    }
+  }
+}
+
+
+function pktUIGetter(prop, window) {
+  return {
+    get: function() {
+      // delete any getters for properties loaded from main.js so we only load main.js once
+      delete window.pktUI;
+      delete window.pktUIMessaging;
+      Services.scriptloader.loadSubScript("chrome://pocket/content/main.js", window);
+      return window[prop];
+    },
+    configurable: true,
+    enumerable: true
+  };
+}
+
+var PocketOverlay = {
+  startup: function(reason) {
+    this.registerStylesheet();
+    CreatePocketWidget(reason);
+    Services.obs.addObserver(this,
+                             "browser-delayed-startup-finished",
+                             false);
+    CustomizableUI.addListener(this);
+    PocketContextMenu.init();
+    PocketReader.startup();
+
+    if (reason == ADDON_ENABLE) {
+      for (let win of allBrowserWindows()) {
+        this.setWindowScripts(win);
+        this.updateWindow(win);
+      }
+    }
+  },
+  shutdown: function(reason) {
+    CustomizableUI.removeListener(this);
+    for (let window of allBrowserWindows()) {
+      for (let id of ["panelMenu_pocket", "menu_pocket", "BMB_pocket",
+                      "panelMenu_pocketSeparator", "menu_pocketSeparator",
+                      "BMB_pocketSeparator"]) {
+        let element = window.document.getElementById(id);
+        if (element)
+          element.remove();
+      }
+      // remove script getters/objects
+      delete window.Pocket;
+      delete window.pktUI;
+      delete window.pktUIMessaging;
+    }
+    CustomizableUI.destroyWidget("pocket-button");
+    PocketContextMenu.shutdown();
+    PocketReader.shutdown();
+    this.unregisterStylesheet();
+  },
+  observe: function(aSubject, aTopic, aData) {
+    // new browser window, initialize the "overlay"
+    let window = aSubject;
+    this.setWindowScripts(window);
+    this.updateWindow(window);
+  },
+  setWindowScripts: function(window) {
+    XPCOMUtils.defineLazyModuleGetter(window, "Pocket",
+                                      "chrome://pocket/content/Pocket.jsm");
+    // Can't use XPCOMUtils for these because the scripts try to define the variables
+    // on window, and so the defineProperty inside defineLazyGetter fails.
+    Object.defineProperty(window, "pktUI", pktUIGetter("pktUI", window));
+    Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging", window));
+  },
+  // called for each window as it is opened
+  updateWindow: function(window) {
+    // insert our three menu items
+    let document = window.document;
+
+    // add to bookmarksMenu
+    let sib = document.getElementById("menu_bookmarkThisPage");
+    if (sib && !document.getElementById("menu_pocket")) {
+      let menu = createElementWithAttrs(document, "menuitem", {
+        "id": "menu_pocket",
+        "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
+        "class": "menuitem-iconic", // OSX only
+        "oncommand": "openUILink(Pocket.listURL, event);"
+      });
+      let sep = createElementWithAttrs(document, "menuseparator", {
+        "id": "menu_pocketSeparator"
+      });
+      sib.parentNode.insertBefore(menu, sib);
+      sib.parentNode.insertBefore(sep, sib);
+    }
+
+    // add to bookmarks-menu-button
+    sib = document.getElementById("BMB_subscribeToPageMenuitem");
+    if (sib && !document.getElementById("BMB_pocket")) {
+      let menu = createElementWithAttrs(document, "menuitem", {
+        "id": "BMB_pocket",
+        "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
+        "class": "menuitem-iconic bookmark-item subviewbutton",
+        "oncommand": "openUILink(Pocket.listURL, event);"
+      });
+      let sep = createElementWithAttrs(document, "menuseparator", {
+        "id": "BMB_pocketSeparator"
+      });
+      sib.parentNode.insertBefore(menu, sib);
+      sib.parentNode.insertBefore(sep, sib);
+    }
+
+    // add to PanelUI-bookmarks
+    sib = document.getElementById("panelMenuBookmarkThisPage");
+    if (sib && !document.getElementById("panelMenu_pocket")) {
+      let menu = createElementWithAttrs(document, "toolbarbutton", {
+        "id": "panelMenu_pocket",
+        "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
+        "class": "subviewbutton cui-withicon",
+        "oncommand": "openUILink(Pocket.listURL, event);"
+      });
+      let sep = createElementWithAttrs(document, "toolbarseparator", {
+        "id": "panelMenu_pocketSeparator"
+      });
+      // nextSibling is no-id toolbarseparator
+      // insert separator first then button
+      sib = sib.nextSibling;
+      sib.parentNode.insertBefore(sep, sib);
+      sib.parentNode.insertBefore(menu, sib);
+    }
+
+    this.updatePocketItemVisibility(document);
+  },
+  onWidgetAdded: function(aWidgetId, aArea, aPosition) {
+    for (let win of allBrowserWindows()) {
+      this.updatePocketItemVisibility(win.document);
+    }
+  },
+  onWidgetRemoved: function(aWidgetId, aArea, aPosition) {
+    for (let win of allBrowserWindows()) {
+      this.updatePocketItemVisibility(win.document);
+    }
+  },
+  onWidgetReset: function(aNode, aContainer) {
+    // CUI was reset and doesn't respect default area for API widgets, place our
+    // widget back to the default area
+    // initially place the button after the bookmarks button if it is in the UI
+    let widgets = CustomizableUI.getWidgetIdsInArea(CustomizableUI.AREA_NAVBAR);
+    let bmbtn = widgets.indexOf("bookmarks-menu-button");
+    if (bmbtn > -1) {
+      CustomizableUI.addWidgetToArea("pocket-button", CustomizableUI.AREA_NAVBAR, bmbtn + 1);
+    } else {
+      CustomizableUI.addWidgetToArea("pocket-button", CustomizableUI.AREA_NAVBAR);
+    }
+  },
+  updatePocketItemVisibility: function(doc) {
+    let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button");
+    for (let prefix of ["panelMenu_", "menu_", "BMB_"]) {
+      let element = doc.getElementById(prefix + "pocket");
+      if (element) {
+        element.hidden = hidden;
+        doc.getElementById(prefix + "pocketSeparator").hidden = hidden;
+      }
+    }
+    // enable or disable reader button
+    if (hidden) {
+      PocketReader.shutdown();
+    } else {
+      PocketReader.startup();
+    }
+  },
+
+  registerStylesheet: function() {
+    let styleSheetService= Components.classes["@mozilla.org/content/style-sheet-service;1"]
+                                     .getService(Components.interfaces.nsIStyleSheetService);
+    let styleSheetURI = Services.io.newURI("chrome://pocket/skin/pocket.css", null, null);
+    styleSheetService.loadAndRegisterSheet(styleSheetURI, styleSheetService.AUTHOR_SHEET);
+    styleSheetURI = Services.io.newURI("chrome://pocket-shared/skin/pocket.css", null, null);
+    styleSheetService.loadAndRegisterSheet(styleSheetURI, styleSheetService.AUTHOR_SHEET);
+  },
+
+  unregisterStylesheet: function() {
+    let styleSheetService = Components.classes["@mozilla.org/content/style-sheet-service;1"]
+                                      .getService(Components.interfaces.nsIStyleSheetService);
+    let styleSheetURI = Services.io.newURI("chrome://pocket/skin/pocket.css", null, null);
+    if (styleSheetService.sheetRegistered(styleSheetURI, styleSheetService.AUTHOR_SHEET)) {
+      styleSheetService.unregisterSheet(styleSheetURI, styleSheetService.AUTHOR_SHEET);
+    }
+    styleSheetURI = Services.io.newURI("chrome://pocket-shared/skin/pocket.css", null, null);
+    if (styleSheetService.sheetRegistered(styleSheetURI, styleSheetService.AUTHOR_SHEET)) {
+      styleSheetService.unregisterSheet(styleSheetURI, styleSheetService.AUTHOR_SHEET);
+    }
+  }
+
+}
+
+// use enabled pref as a way for tests (e.g. test_contextmenu.html) to disable
+// the addon when running.
+function prefObserver(aSubject, aTopic, aData) {
+  let enabled = Services.prefs.getBoolPref("extensions.pocket.enabled");
+  if (enabled)
+    PocketOverlay.startup(ADDON_ENABLE);
+  else
+    PocketOverlay.shutdown(ADDON_DISABLE);
+}
+
+function startup(data, reason) {
+  AddonManager.getAddonByID("isreaditlater@ideashower.com", addon => {
+    if (addon && addon.isActive)
+      return;
+    setDefaultPrefs();
+    // migrate enabled pref
+    if (Services.prefs.prefHasUserValue("browser.pocket.enabled")) {
+      Services.prefs.setBoolPref("extensions.pocket.enabled", Services.prefs.getBoolPref("browser.pocket.enabled"));
+      Services.prefs.clearUserPref("browser.pocket.enabled");
+    }
+    // watch pref change and enable/disable if necessary
+    Services.prefs.addObserver("extensions.pocket.enabled", prefObserver, false);
+    if (Services.prefs.prefHasUserValue("extensions.pocket.enabled") &&
+        !Services.prefs.getBoolPref("extensions.pocket.enabled"))
+      return;
+    PocketOverlay.startup(reason);
+  });
+}
+
+function shutdown(data, reason) {
+  // For speed sake, we should only do a shutdown if we're being disabled.
+  // On an app shutdown, just let it fade away...
+  if (reason == ADDON_DISABLE) {
+    Services.prefs.removeObserver("extensions.pocket.enabled", prefObserver);
+    PocketOverlay.shutdown(reason);
+  }
+}
+
+function install() {
+}
+
+function uninstall() {
+}
rename from browser/components/pocket/Pocket.jsm
rename to browser/extensions/pocket/content/Pocket.jsm
--- a/browser/components/pocket/Pocket.jsm
+++ b/browser/extensions/pocket/content/Pocket.jsm
@@ -11,17 +11,17 @@ Cu.import("resource://gre/modules/XPCOMU
 Cu.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
   "resource:///modules/CustomizableUI.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
   "resource://gre/modules/ReaderMode.jsm");
 
 var Pocket = {
-  get site() { return Services.prefs.getCharPref("browser.pocket.site"); },
+  get site() { return Services.prefs.getCharPref("extensions.pocket.site"); },
   get listURL() { return "https://" + Pocket.site + "/?src=ff_ext"; },
 
   /**
    * Functions related to the Pocket panel UI.
    */
   onPanelViewShowing(event) {
     let document = event.target.ownerDocument;
     let window = document.defaultView;
@@ -32,17 +32,17 @@ var Pocket = {
     Pocket._urlToSave = null;
     Pocket._titleToSave = null;
     // ViewShowing fires immediately before it creates the contents,
     // in lieu of an AfterViewShowing event, just spin the event loop.
     window.setTimeout(function() {
       if (urlToSave) {
         window.pktUI.tryToSaveUrl(urlToSave, titleToSave);
       } else {
-        window.pktUI.pocketButtonOnCommand();
+        window.pktUI.tryToSaveCurrentPage();
       }
 
       if (iframe.contentDocument &&
           iframe.contentDocument.readyState == "complete") {
         window.pktUI.pocketPanelDidShow();
       } else {
         // iframe didn't load yet. This seems to always be the case when in
         // the toolbar panel, but never the case for a subview.
rename from browser/components/pocket/main.js
rename to browser/extensions/pocket/content/main.js
--- a/browser/components/pocket/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -10,20 +10,20 @@
  * SOFTWARE
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
@@ -41,238 +41,79 @@
 // 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)
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
   "resource://gre/modules/ReaderMode.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "pktApi",
+  "chrome://pocket/content/pktApi.jsm");
 
 var pktUI = (function() {
 
 	// -- Initialization (on startup and new windows) -- //
 	var inited = false;
 	var _currentPanelDidShow;
     var _currentPanelDidHide;
 	var _isHidden = false;
 	var _notificationTimeout;
 
     // Init panel id at 0. The first actual panel id will have the number 1 so
     // in case at some point any panel has the id 0 we know there is something
     // wrong
     var _panelId = 0;
 
-	var prefBranch = Services.prefs.getBranch("browser.pocket.settings.");
+	var prefBranch = Services.prefs.getBranch("extensions.pocket.settings.");
 
 	var overflowMenuWidth = 230;
 	var overflowMenuHeight = 475;
 	var savePanelWidth = 350;
 	var savePanelHeights = {collapsed: 153, expanded: 272};
 
-	/**
-     * Initalizes Pocket UI and panels
-     */
-	function onLoad() {
-		
-		if (inited)
-			return;
-		
-		// Install the button (Only on first run, if a user removes the button, you do not want to restore it)
-		// TODO, only do this if in a certain language
-		// TODO - Ask Mozilla what the best way is to have this update when a user restores browser defaults
-		// TODO - this needs to run only on a main window - if the first run happens on a window without the toolbar, then it will never try to run it again
-		if (!prefBranch.prefHasUserValue('installed')) {
-		
-			// If user has social add-on installed, uninstall it
-			if (Social.getManifestByOrigin("https://getpocket.com")) {
-				Social.uninstallProvider("https://getpocket.com", function(){ /* callback */ });
-			}
-			
-			// if user has legacy pkt add-on installed, flag it so we can handle it correctly
-			prefBranch.setBoolPref('hasLegacyExtension', hasLegacyExtension());
-		
-			var id = "pocket-menu-button";
-	        var toolbar = document.getElementById("nav-bar");
-			
-	        var before = null;
-			// Is the bookmarks button in the toolbar?
-			if (toolbar.currentSet.match("bookmarks-menu-button")) {
-	            var elem = document.getElementById("bookmarks-menu-button");
-	            if (elem)
-					before = elem.nextElementSibling;
-			}
-			// Otherwise, just add it to the end of the toolbar (because before is null)
-			
-        	toolbar.insertItem(id, before);
-	
-	        toolbar.setAttribute("currentset", toolbar.currentSet);
-	        document.persist(toolbar.id, "currentset");
-	        
-	        prefBranch.setBoolPref('installed', true);
-		}
-		
-		// Context Menu Event
-		document.getElementById('contentAreaContextMenu').addEventListener("popupshowing", contextOnPopupShowing, false);
-		
-		// Hide the extension based on certain criteria
-		hideIntegrationIfNeeded();
-		
-		inited = true;
-	}
-	
-	/**
-	 * Mark all Pocket integration chrome elements as hidden if certain criteria apply (ex: legacy Pocket extension users or unsupported languages)
-	 */
-	function hideIntegrationIfNeeded() {
-		
-		var hideIntegration = false;
-		
-		// Check if the user had the legacy extension the last time we looked
-		if (prefBranch.getBoolPref('hasLegacyExtension')) {
-			if (hasLegacyExtension()) {
-				hideIntegration = true; // they still have it, hide new native integration
-			}
-			else {
-				// if they originally had it, but no longer do, then we should remove the pref so we no longer have to check
-				prefBranch.setBoolPref('hasLegacyExtension', false);
-			}
-		}
-		
-		// TODO
-		// If language other than launch languages (en-US currently) {
-		//	hideIntegration = true;
-		//}
-		
-		// Hide the integration if needed
-		if (hideIntegration) {
-			// Note, we don't hide the context menus here, that's handled in contextOnPopupShowing
-			var elements = ['pocket-menu-button', 'BMB_openPocketWebapp'];
-			for(var i=0; i<elements.length; i++) {
-				document.getElementById(elements[i]).setAttribute('hidden', true);
-			}
-			
-			_isHidden = true;
-		}
-		else
-			_isHidden = false
-	}
-	
-	
 	// -- Event Handling -- //
-    
+
     /**
      * Event handler when Pocket toolbar button is pressed
      */
-    function pocketButtonOnCommand(event) {
-    
-    	tryToSaveCurrentPage();
-    
-    }
-    
+
     function pocketPanelDidShow(event) {
     	if (_currentPanelDidShow) {
     		_currentPanelDidShow(event);
         }
-    	
+
     }
-    
+
     function pocketPanelDidHide(event) {
     	if (_currentPanelDidHide) {
     		_currentPanelDidHide(event);
         }
-        
+
         // clear the panel
         getPanelFrame().setAttribute('src', 'about:blank');
     }
 
 
     /**
      * Event handler when Pocket bookmark bar entry is pressed
      */
      function pocketBookmarkBarOpenPocketCommand(event) {
         openTabWithUrl('https://getpocket.com/a/', true);
      }
 
-    /**
-     * Event handler when Pocket context menu button is presed
-     */
-
-	// Determine which context menus to show before it's shown
-	function contextOnPopupShowing() {
-
-		var saveLinkId = "PKT_context_saveLink";
-		var savePageId = "PKT_context_savePage";
-
-		if (isHidden()) {
-			gContextMenu.showItem(saveLinkId, false);
-			gContextMenu.showItem(savePageId, false);
-	    } else if ( (gContextMenu.onSaveableLink || ( gContextMenu.inDirList && gContextMenu.onLink )) ) {
-			gContextMenu.showItem(saveLinkId, true);
-			gContextMenu.showItem(savePageId, false);
-	    } else if (gContextMenu.isTextSelected) {
-			gContextMenu.showItem(saveLinkId, false);
-			gContextMenu.showItem(savePageId, false);
-	    } else if (!gContextMenu.onTextInput) {
-			gContextMenu.showItem(saveLinkId, false);
-			gContextMenu.showItem(savePageId, true);
-	    } else {
-			gContextMenu.showItem(saveLinkId, false);
-			gContextMenu.showItem(savePageId, false);
-	    }
-	}
-
-    function pocketContextSaveLinkOnCommand(event) {
-    	// TODO : Unsafe CPOW Usage when saving with Page context menu (Ask Mozilla for help with this one)
-        var linkNode = gContextMenu.target || document.popupNode;
-
-        // Get parent node in case of text nodes (old safari versions)
-        if (linkNode.nodeType == Node.TEXT_NODE) {
-            linkNode = linkNode.parentNode;
-        }
-
-        // If for some reason, it's not an element node, abort
-        if (linkNode.nodeType != Node.ELEMENT_NODE) {
-            return;
-        }
-
-        // Try to get a link element in the parent chain as we can be in the
-        // last child element
-        var currentElement = linkNode;
-        while (currentElement !== null) {
-            if (currentElement.nodeType == Node.ELEMENT_NODE &&
-                currentElement.nodeName.toLowerCase() == 'a')
-            {
-                // We have a link element try to save it
-                linkNode = currentElement;
-                break;
-            }
-            currentElement = currentElement.parentNode;
-        }
-
-        var link = linkNode.href;
-        tryToSaveUrl(link);
-
-        event.stopPropagation();
-    }
-
-    function pocketContextSavePageOnCommand(event) {
-        tryToSaveCurrentPage();
-    }
-
-
     // -- Communication to API -- //
 
     /**
      * Either save or attempt to log the user in
      */
 	function tryToSaveCurrentPage() {
 		tryToSaveUrl(getCurrentUrl(), getCurrentTitle());
 	}
-     
+
     function tryToSaveUrl(url, title) {
 
     	// If the user is logged in, go ahead and save the current page
     	if (pktApi.isUserLoggedIn()) {
     		saveAndShowConfirmation(url, title);
             return;
     	}
 
@@ -287,18 +128,18 @@ var pktUI = (function() {
      * Show the sign-up panel
      */
     function showSignUp() {
         getFirefoxAccountSignedInUser(function(userdata)
         {
             var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0';
             var startheight = 490;
             var inOverflowMenu = isInOverflowMenu();
-            
-            if (inOverflowMenu) 
+
+            if (inOverflowMenu)
             {
             	startheight = overflowMenuHeight;
             }
             else if (pktApi.getSignupAB().indexOf('storyboard') > -1)
             {
                 startheight = 460;
                 if (fxasignedin == '1')
                 {
@@ -316,17 +157,17 @@ var pktUI = (function() {
             if (inOverflowMenu)
             {
                 variant = 'overflow';
             }
             else
             {
                 variant = pktApi.getSignupAB();
             }
-            var panelId = showPanel("about:pocket-signup?pockethost=" + Services.prefs.getCharPref("browser.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
+            var panelId = showPanel("chrome://pocket/content/panels/signup.html?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
             		onShow: function() {
                     },
         			onHide: panelDidHide,
             		width: inOverflowMenu ? overflowMenuWidth : 300,
             		height: startheight
             	});
             });
     }
@@ -344,17 +185,17 @@ var pktUI = (function() {
         var isValidURL = (typeof url !== 'undefined' && (url.startsWith("http") || url.startsWith('https')));
 
         var inOverflowMenu = isInOverflowMenu();
         var startheight = pktApi.isPremiumUser() && isValidURL ? savePanelHeights.expanded : savePanelHeights.collapsed;
         if (inOverflowMenu) {
         	startheight = overflowMenuHeight;
         }
 
-    	var panelId = showPanel("about:pocket-saved?pockethost=" + Services.prefs.getCharPref("browser.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
+    	var panelId = showPanel("chrome://pocket/content/panels/saved.html?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
     		onShow: function() {
                 var saveLinkMessageId = 'saveLink';
 
                 // Send error message for invalid url
                 if (!isValidURL) {
                     // TODO: Pass key for localized error in error object
                     var error = {
                         message: 'Only links can be saved',
@@ -474,17 +315,17 @@ var pktUI = (function() {
           iframe.style.height = options.height + "px";
         }
     }
 
     /**
      * Called when the signup and saved panel was hidden
      */
     function panelDidHide() {
-        
+
     }
 
     /**
      * Register all of the messages needed for the panels
      */
     function registerEventMessages() {
     	var iframe = getPanelFrame();
 
@@ -610,17 +451,17 @@ var pktUI = (function() {
 				    pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _deleteItemMessageId, error);
 				}
 			})
 		});
 
         var _initL10NMessageId = "initL10N";
         pktUIMessaging.addMessageListener(_initL10NMessageId, function(panelId, data) {
             var strings = {};
-            var bundle = Services.strings.createBundle("chrome://browser/locale/browser-pocket.properties");
+            var bundle = Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
             var e = bundle.getSimpleEnumeration();
             while(e.hasMoreElements()) {
                 var str = e.getNext().QueryInterface(Components.interfaces.nsIPropertyElement);
                 strings[str.key] = str.value;
             }
             pktUIMessaging.sendResponseMessageToPanel(panelId, _initL10NMessageId, { strings: strings });
         });
 
@@ -720,130 +561,37 @@ var pktUI = (function() {
 
     function getFirefoxAccountSignedInUser(callback) {
 	    fxAccounts.getSignedInUser().then(userData => {
     		callback(userData);
     	}).then(null, error => {
       		callback();
 	    });
     }
-    
+
     function getUILocale() {
     	var locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
              getService(Ci.nsIXULChromeRegistry).
              getSelectedLocale("browser");
         return locale;
     }
 
-    /**
-     * Toolbar animations
-     */
-    
-    function showPocketAnimation() {
-    	
-    	// Borrowed from bookmark star animation:
-    	// https://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser-places.js#1568
-    	
-    	// TODO : Clean-up : Probably don't need all of this since the css animation does most of the heavy lifting
-    	// TODO : Do not show when saving from context menu -- or get really fancy and launch the icon from the link that was saved into the bookmark menu
-    
-    	function getCenteringTransformForRects(rectToPosition, referenceRect) {
-	      let topDiff = referenceRect.top - rectToPosition.top;
-	      let leftDiff = referenceRect.left - rectToPosition.left;
-	      let heightDiff = referenceRect.height - rectToPosition.height;
-	      let widthDiff = referenceRect.width - rectToPosition.width;
-	      return [(leftDiff + .5 * widthDiff) + "px", (topDiff + .5 * heightDiff) + "px"];
-	    }
-	
-	    if (_notificationTimeout) {
-	      clearTimeout(this._notificationTimeout);
-	   	}
-	
-		var button = document.getElementById('pocket-menu-button');
-		var bookmarksButton = document.getElementById('bookmarks-menu-button');
-		var notifier = document.getElementById("pocketed-notification-anchor");
-		var dropmarkerNotifier = document.getElementById("bookmarked-notification-dropmarker-anchor");
-	
-		
-    	// If the Pocket button is not immediately after the bookmark button, then do not do the animation 
-    	//	(because it's hard-coded for the positions right now)
-    	// TODO - double check this in small and large toolbar button sizes
-    	if (bookmarksButton.nextElementSibling != button)
-    		return;
-	
-	    if (notifier.style.transform == '') {
-	      // Get all the relevant nodes and computed style objects
-	      let dropmarker = document.getAnonymousElementByAttribute(bookmarksButton, "anonid", "dropmarker");
-	      let dropmarkerIcon = document.getAnonymousElementByAttribute(dropmarker, "class", "dropmarker-icon");
-	      let dropmarkerStyle = getComputedStyle(dropmarkerIcon);
-	      
-	      // Check for RTL and get bounds
-	      let isRTL = getComputedStyle(button).direction == "rtl"; // need this?
-	      let buttonRect = button.getBoundingClientRect();
-	      let notifierRect = notifier.getBoundingClientRect();
-	      let dropmarkerRect = dropmarkerIcon.getBoundingClientRect();
-	      let dropmarkerNotifierRect = dropmarkerNotifier.getBoundingClientRect();
-	
-	      // Compute, but do not set, transform for pocket icon
-	      let [translateX, translateY] = getCenteringTransformForRects(notifierRect, buttonRect);
-	      let starIconTransform = "translate(" +  (translateX) + ", " + translateY + ")";
-	      if (isRTL) {
-	        starIconTransform += " scaleX(-1)";
-	      }
-	
-	      // Compute, but do not set, transform for dropmarker
-	      [translateX, translateY] = getCenteringTransformForRects(dropmarkerNotifierRect, dropmarkerRect);
-	      let dropmarkerTransform = "translate(" + translateX + ", " + translateY + ")";
-	
-	      // Do all layout invalidation in one go:
-	      notifier.style.transform = starIconTransform;
-	      dropmarkerNotifier.style.transform = dropmarkerTransform;
-	
-	      let dropmarkerAnimationNode = dropmarkerNotifier.firstChild;
-	      dropmarkerAnimationNode.style.MozImageRegion = dropmarkerStyle.MozImageRegion;
-	      dropmarkerAnimationNode.style.listStyleImage = dropmarkerStyle.listStyleImage;
-	    }
-	
-	    let isInOverflowMenu = button.getAttribute("overflowedItem") == "true";
-	    if (!isInOverflowMenu) {
-	      notifier.setAttribute("notification", "finish");
-	      button.setAttribute("notification", "finish");
-	      dropmarkerNotifier.setAttribute("notification", "finish");
-	    }
-	
-	    _notificationTimeout = setTimeout( () => {
-	      notifier.removeAttribute("notification");
-	      dropmarkerNotifier.removeAttribute("notification");
-	      button.removeAttribute("notification");
-	
-	      dropmarkerNotifier.style.transform = '';
-	      notifier.style.transform = '';
-	    }, 1000);
-    }
-    
-    
 	/**
      * Public functions
      */
     return {
-    	onLoad: onLoad,
     	getPanelFrame: getPanelFrame,
 
         openTabWithUrl: openTabWithUrl,
 
-    	pocketButtonOnCommand: pocketButtonOnCommand,
     	pocketPanelDidShow: pocketPanelDidShow,
     	pocketPanelDidHide: pocketPanelDidHide,
 
-        pocketContextSaveLinkOnCommand,
-        pocketContextSavePageOnCommand,
-
-        pocketBookmarkBarOpenPocketCommand,
-
-    	tryToSaveUrl: tryToSaveUrl
+    	tryToSaveUrl: tryToSaveUrl,
+    	tryToSaveCurrentPage: tryToSaveCurrentPage
     };
 }());
 
 // -- Communication to Background -- //
 // https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Interaction_between_privileged_and_non-privileged_pages
 var pktUIMessaging = (function() {
 
     /**
@@ -852,17 +600,17 @@ var pktUIMessaging = (function() {
     function prefixedMessageId(messageId) {
         return 'PKT_' + messageId;
     }
 
     /**
      * Register a listener and callback for a specific messageId
      */
     function addMessageListener(messageId, callback) {
-        document.addEventListener(prefixedMessageId(messageId), function(e) { 
+        document.addEventListener(prefixedMessageId(messageId), function(e) {
             // ignore to ensure we do not pick up other events in the browser
             if (e.target.tagName !== 'PKTMESSAGEFROMPANELELEMENT') {
                 return;
             }
 
             // Pass in information to callback
             var payload = JSON.parse(e.target.getAttribute("payload"))[0];
             var panelId = payload.panelId;
rename from browser/components/pocket/panels/css/firasans.css
rename to browser/extensions/pocket/content/panels/css/firasans.css
rename from browser/components/pocket/panels/css/normalize.css
rename to browser/extensions/pocket/content/panels/css/normalize.css
rename from browser/components/pocket/panels/css/saved.css
rename to browser/extensions/pocket/content/panels/css/saved.css
rename from browser/components/pocket/panels/css/signup.css
rename to browser/extensions/pocket/content/panels/css/signup.css
rename from browser/components/pocket/panels/fonts/FiraSans-Regular.woff
rename to browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff
rename from toolkit/themes/shared/reader/pocket.svg
rename to browser/extensions/pocket/content/panels/img/pocket.svg
rename from browser/components/pocket/panels/img/pocketerror@1x.png
rename to browser/extensions/pocket/content/panels/img/pocketerror@1x.png
rename from browser/components/pocket/panels/img/pocketerror@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketerror@2x.png
rename from browser/components/pocket/panels/img/pocketlogo@1x.png
rename to browser/extensions/pocket/content/panels/img/pocketlogo@1x.png
rename from browser/components/pocket/panels/img/pocketlogo@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketlogo@2x.png
rename from browser/components/pocket/panels/img/pocketlogosolo@1x.png
rename to browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png
rename from browser/components/pocket/panels/img/pocketlogosolo@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png
rename from browser/components/pocket/panels/img/pocketmenuitem16.png
rename to browser/extensions/pocket/content/panels/img/pocketmenuitem16.png
rename from browser/components/pocket/panels/img/pocketmenuitem16@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png
rename from browser/components/pocket/panels/img/pocketsignup_button@1x.png
rename to browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png
rename from browser/components/pocket/panels/img/pocketsignup_button@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png
rename from browser/components/pocket/panels/img/pocketsignup_devices@1x.png
rename to browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png
rename from browser/components/pocket/panels/img/pocketsignup_devices@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png
rename from browser/components/pocket/panels/img/pocketsignup_hero@1x.png
rename to browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png
rename from browser/components/pocket/panels/img/pocketsignup_hero@2x.png
rename to browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png
rename from browser/components/pocket/panels/img/signup_firefoxlogo@1x.png
rename to browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png
rename from browser/components/pocket/panels/img/signup_firefoxlogo@2x.png
rename to browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png
rename from browser/components/pocket/panels/img/signup_help@1x.png
rename to browser/extensions/pocket/content/panels/img/signup_help@1x.png
rename from browser/components/pocket/panels/img/signup_help@2x.png
rename to browser/extensions/pocket/content/panels/img/signup_help@2x.png
rename from browser/components/pocket/panels/img/signup_or@1x.png
rename to browser/extensions/pocket/content/panels/img/signup_or@1x.png
rename from browser/components/pocket/panels/img/signup_or@2x.png
rename to browser/extensions/pocket/content/panels/img/signup_or@2x.png
rename from browser/components/pocket/panels/img/tag_close@1x.png
rename to browser/extensions/pocket/content/panels/img/tag_close@1x.png
rename from browser/components/pocket/panels/img/tag_close@2x.png
rename to browser/extensions/pocket/content/panels/img/tag_close@2x.png
rename from browser/components/pocket/panels/img/tag_closeactive@1x.png
rename to browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png
rename from browser/components/pocket/panels/img/tag_closeactive@2x.png
rename to browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png
rename from browser/components/pocket/panels/js/messages.js
rename to browser/extensions/pocket/content/panels/js/messages.js
rename from browser/components/pocket/panels/js/saved.js
rename to browser/extensions/pocket/content/panels/js/saved.js
rename from browser/components/pocket/panels/js/signup.js
rename to browser/extensions/pocket/content/panels/js/signup.js
rename from browser/components/pocket/panels/js/tmpl.js
rename to browser/extensions/pocket/content/panels/js/tmpl.js
rename from browser/components/pocket/panels/js/vendor/handlebars.runtime.js
rename to browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js
rename from browser/components/pocket/panels/js/vendor/jquery-2.1.1.min.js
rename to browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js
rename from browser/components/pocket/panels/js/vendor/jquery.tokeninput.min.js
rename to browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
rename from browser/components/pocket/panels/license.txt
rename to browser/extensions/pocket/content/panels/license.txt
rename from browser/components/pocket/panels/saved.html
rename to browser/extensions/pocket/content/panels/saved.html
--- a/browser/components/pocket/panels/saved.html
+++ b/browser/extensions/pocket/content/panels/saved.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html>
     <head>
         <meta charset="utf-8">
-        <base href="chrome://browser/content/pocket/panels/">
+        <base href="chrome://pocket/content/panels/">
         <title>Pocket: Page Saved</title>
         <link rel="stylesheet" href="css/normalize.css">
         <link rel="stylesheet" href="css/firasans.css">
         <link rel="stylesheet" href="css/saved.css">
     </head>
     <body class="pkt_ext_containersaved" aria-live="polite">
         <script type="text/javascript" src="js/vendor/jquery-2.1.1.min.js"></script>
         <script type="text/javascript" src="js/vendor/handlebars.runtime.js"></script>
rename from browser/components/pocket/panels/signup.html
rename to browser/extensions/pocket/content/panels/signup.html
--- a/browser/components/pocket/panels/signup.html
+++ b/browser/extensions/pocket/content/panels/signup.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html>
     <head>
         <meta charset="utf-8">
-        <base href="chrome://browser/content/pocket/panels/">
+        <base href="chrome://pocket/content/panels/">
         <title>Pocket: Sign Up</title>
         <link rel="stylesheet" href="css/normalize.css">
         <link rel="stylesheet" href="css/firasans.css">
         <link rel="stylesheet" href="css/signup.css">
     </head>
     <body class="pkt_ext_containersignup" aria-live="polite">
         <script type="text/javascript" src="js/vendor/jquery-2.1.1.min.js"></script>
         <script type="text/javascript" src="js/vendor/handlebars.runtime.js"></script>
rename from browser/components/pocket/panels/tmpl/saved_premiumextras.handlebars
rename to browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars
rename from browser/components/pocket/panels/tmpl/saved_premiumshell.handlebars
rename to browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars
rename from browser/components/pocket/panels/tmpl/saved_shell.handlebars
rename to browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars
rename from browser/components/pocket/panels/tmpl/signup_shell.handlebars
rename to browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars
rename from browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars
rename to browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars
rename from browser/components/pocket/pktApi.js
rename to browser/extensions/pocket/content/pktApi.jsm
--- a/browser/components/pocket/pktApi.js
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -37,37 +37,44 @@
  * Definition of keys stored in preferences to preserve user state:
  *      premium_status:   Current premium status for logged in user if available
  *                        Can be 0 for no premium and 1 for premium
  *      latestSince:      Last timestamp a save happened
  *      tags:             All tags for logged in user
  *      usedTags:         All used tags from within the extension sorted by recency
  */
 
+const {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components;
+this.EXPORTED_SYMBOLS = ["pktApi"];
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+
+
 var pktApi = (function() {
 
     /**
      * Configuration
      */
 
     // Base url for all api calls
-    var pocketAPIhost = Services.prefs.getCharPref("browser.pocket.api"); 	// api.getpocket.com
-    var pocketSiteHost = Services.prefs.getCharPref("browser.pocket.site"); // getpocket.com
+    var pocketAPIhost = Services.prefs.getCharPref("extensions.pocket.api"); 	// api.getpocket.com
+    var pocketSiteHost = Services.prefs.getCharPref("extensions.pocket.site"); // getpocket.com
     var baseAPIUrl = "https://" + pocketAPIhost + "/v3";
 
 
     /**
      * Auth keys for the API requests
      */
-    var oAuthConsumerKey = Services.prefs.getCharPref("browser.pocket.oAuthConsumerKey");
+    var oAuthConsumerKey = Services.prefs.getCharPref("extensions.pocket.oAuthConsumerKey");
 
 	/**
 	 *
 	 */
-	var prefBranch = Services.prefs.getBranch("browser.pocket.settings.");
+	var prefBranch = Services.prefs.getBranch("extensions.pocket.settings.");
 
     /**
      * Helper
      */
 
     var extend = function(out) {
         out = out || {};
 
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/install.rdf.in
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+#filter substitution
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <Description about="urn:mozilla:install-manifest">
+    <em:id>firefox@getpocket.com</em:id>
+    <em:version>@FIREFOX_VERSION@</em:version>
+    <em:type>2</em:type>
+    <em:bootstrap>true</em:bootstrap>
+
+    <!-- Target Application this theme can install into,
+        with minimum and maximum supported versions. -->
+    <em:targetApplication>
+      <Description>
+        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+        <em:minVersion>@FIREFOX_VERSION@</em:minVersion>
+        <em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
+      </Description>
+    </em:targetApplication>
+
+    <!-- Front End MetaData -->
+    <em:name>Pocket</em:name>
+    <em:description>When you find something you want to view later, put it in Pocket.</em:description>
+  </Description>
+</RDF>
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/jar.mn
@@ -0,0 +1,12 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+[features/firefox@getpocket.com] chrome.jar:
+% content pocket %content/ contentaccessible=yes
+% skin pocket classic/1.0 %skin/linux/ os=Linux
+% skin pocket classic/1.0 %skin/osx/ os=Darwin
+% skin pocket classic/1.0 %skin/windows/ os=WINNT
+% skin pocket-shared classic/1.0 %skin/shared/
+  content/  (content/*)
+  skin/  (skin/*)
rename from browser/locales/en-US/chrome/browser/browser-pocket.properties
rename to browser/extensions/pocket/locales/en-US/pocket.properties
--- a/browser/locales/en-US/chrome/browser/browser-pocket.properties
+++ b/browser/extensions/pocket/locales/en-US/pocket.properties
@@ -24,8 +24,18 @@ signuptosave = Sign up for Pocket. It’s free.
 suggestedtags = Suggested Tags
 tagline = Save articles and videos from Firefox to view in Pocket on any device, any time.
 taglinestory_one = Click the Pocket Button to save any article, video or page from Firefox.
 taglinestory_two = View in Pocket on any device, any time.
 tagssaved = Tags Added
 signinfirefox = Sign in with Firefox
 signupfirefox = Sign up with Firefox
 viewlist = View List
+
+# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
+# "Pocket" is a brand name.
+pocket-button.label = Pocket
+pocket-button.tooltiptext = Save to Pocket
+saveToPocketCmd.label = Save Page to Pocket
+saveToPocketCmd.accesskey = k
+saveLinkToPocketCmd.label = Save Link to Pocket
+saveLinkToPocketCmd.accesskey = o
+pocketMenuitem.label = View Pocket List
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/locales/jar.mn
@@ -0,0 +1,8 @@
+#filter substitution
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+[features/firefox@getpocket.com] @AB_CD@.jar:
+%   locale pocket @AB_CD@ %locale/@AB_CD@/
+    locale/@AB_CD@/ (%*)
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/locales/moz.build
@@ -0,0 +1,7 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+JAR_MANIFESTS += ['jar.mn']
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/moz.build
@@ -0,0 +1,17 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += ['locales']
+
+FINAL_TARGET_FILES.features['firefox@getpocket.com'] += [
+  'bootstrap.js'
+]
+
+FINAL_TARGET_PP_FILES.features['firefox@getpocket.com'] += [
+  'install.rdf.in'
+]
+
+JAR_MANIFESTS += ['jar.mn']
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/skin/osx/pocket.css
@@ -0,0 +1,38 @@
+#pocket-button[cui-areatype="toolbar"][open] {
+  -moz-image-region: rect(36px, 774px, 54px, 756px);
+}
+
+@media (min-resolution: 1.1dppx) {
+
+  #pocket-button[cui-areatype="toolbar"] {
+    -moz-image-region: rect(0, 1548px, 36px, 1512px);
+  }
+
+  #pocket-button[cui-areatype="toolbar"][open] {
+    -moz-image-region: rect(72px, 1548px, 108px, 1512px);
+  }
+}
+
+@media (min-resolution: 2dppx) {
+  #panelMenu_pocket,
+  #menu_pocket,
+  #BMB_pocket {
+    list-style-image: url("chrome://pocket/content/panels/img/pocketmenuitem16@2x.png");
+  }
+
+  #panelMenu_pocket > .toolbarbutton-icon {
+    width: 16px;
+  }
+}
+
+@media not all and (min-resolution: 1.1dppx) {
+  #pocket-button:hover:active:not([disabled="true"]):not([cui-areatype="menu-panel"]) {
+    -moz-image-region: rect(18px, 774px, 36px, 756px);
+  }
+}
+
+@media (min-resolution: 1.1dppx) {
+  #pocket-button:hover:active:not([disabled="true"]):not([cui-areatype="menu-panel"]) {
+    -moz-image-region: rect(36px, 1548px, 72px, 1512px);
+  }
+}
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/skin/shared/pocket.css
@@ -0,0 +1,68 @@
+/* Bug 1164419 - increase Pocket panel size to accomidate wider Russian text. */
+panelmultiview[mainViewId=PanelUI-pocketView] > .panel-viewcontainer > .panel-viewstack > .panel-mainview:not([panelid="PanelUI-popup"]) {
+  max-width: 33em; /* standaloneSubviewWidth + 3 */
+}
+
+.cui-widget-panel[viewId="PanelUI-pocketView"] > .panel-arrowcontainer > .panel-arrowcontent {
+  padding-top: 0;
+  padding-bottom: 0;
+}
+
+#PanelUI-pocketView > .panel-subview-body,
+#PanelUI-pocketView {
+  overflow: visible;
+}
+
+#pocket-button {
+  list-style-image: url("chrome://browser/skin/Toolbar.png");
+}
+
+toolbar[brighttext] #pocket-button {
+  list-style-image: url(chrome://browser/skin/Toolbar-inverted.png);
+}
+
+@media not all and (min-resolution: 1.1dppx) {
+  #pocket-button[cui-areatype="menu-panel"],
+  toolbarpaletteitem[place="palette"] > #pocket-button {
+    list-style-image: var(--menupanel-list-style-image);
+    -moz-image-region: rect(0px, 992px, 32px, 960px);
+  }
+
+  #pocket-button[cui-areatype="menu-panel"][panel-multiview-anchor=true] {
+    -moz-image-region: rect(32px, 992px, 64px, 960px);
+  }
+}
+
+@media (min-resolution: 1.1dppx) {
+  #pocket-button {
+    list-style-image: url("chrome://browser/skin/Toolbar@2x.png");
+  }
+
+  toolbar[brighttext] #pocket-button {
+    list-style-image: url("chrome://browser/skin/Toolbar-inverted@2x.png");
+  }
+
+  #pocket-button[cui-areatype="menu-panel"],
+  toolbarpaletteitem[place="palette"] > #pocket-button {
+    list-style-image: var(--menupanel-list-style-image-2x);
+    -moz-image-region: rect(0px, 1984px, 64px, 1920px);
+  }
+
+  #pocket-button[cui-areatype="menu-panel"][panel-multiview-anchor=true] {
+    -moz-image-region: rect(64px, 1984px, 128px, 1920px);
+  }
+}
+
+#pocket-button[cui-areatype="toolbar"] {
+  -moz-image-region: rect(0, 774px, 18px, 756px);
+}
+
+#pocket-button[cui-areatype="toolbar"][open] {
+  -moz-image-region: rect(18px, 774px, 36px, 756px);
+}
+
+#panelMenu_pocket,
+#menu_pocket,
+#BMB_pocket {
+  list-style-image: url("chrome://pocket/content/panels/img/pocketmenuitem16.png");
+}
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/skin/windows/pocket.css
@@ -0,0 +1,9 @@
+@media (min-resolution: 1.1dppx) {
+  #pocket-button[cui-areatype="toolbar"] {
+    -moz-image-region: rect(0, 1548px, 36px, 1512px);
+  }
+
+  #pocket-button[cui-areatype="toolbar"][open] {
+    -moz-image-region: rect(36px, 1548px, 72px, 1512px);
+  }
+}
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -128,16 +128,17 @@ libs:: $(call MERGE_FILES,$(addprefix pr
 libs-%:
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
 ifdef MOZ_WEBAPP_RUNTIME
 	@$(MAKE) -C ../../webapprt/locales AB_CD=$* XPI_NAME=locale-$*
 endif
 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
+	@$(MAKE) -C ../extensions/pocket/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../devtools/client/locales AB_CD=$* XPI_NAME=locale-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
 	@$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR)
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
 
 repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
 repackage-win32-installer: $(call ESCAPE_WILDCARD,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -929,15 +929,8 @@ you can use these alternative items. Oth
 <!ENTITY panicButton.thankyou.buttonlabel         "Thanks!">
 
 <!ENTITY emeLearnMoreContextMenu.label            "Learn more about DRM…">
 <!ENTITY emeLearnMoreContextMenu.accesskey        "D">
 <!ENTITY emeNotificationsNotNow.label             "Not now">
 <!ENTITY emeNotificationsNotNow.accesskey         "N">
 <!ENTITY emeNotificationsDontAskAgain.label       "Don't ask me again">
 <!ENTITY emeNotificationsDontAskAgain.accesskey   "D">
-
-<!-- LOCALIZATION NOTE (saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label): Pocket is a brand name -->
-<!ENTITY saveToPocketCmd.label     "Save Page to Pocket">
-<!ENTITY saveToPocketCmd.accesskey "k">
-<!ENTITY saveLinkToPocketCmd.label     "Save Link to Pocket">
-<!ENTITY saveLinkToPocketCmd.accesskey "o">
-<!ENTITY pocketMenuitem.label      "View Pocket List">
--- a/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties
+++ b/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties
@@ -119,15 +119,10 @@ web-apps-button.label = Apps
 web-apps-button.tooltiptext = Discover Apps
 
 # LOCALIZATION NOTE(devtools-webide-button.label, devtools-webide-button.tooltiptext):
 # widget is only visible after WebIDE has been started once (Tools > Web Developers > WebIDE)
 # %S is the keyboard shortcut
 devtools-webide-button2.label = WebIDE
 devtools-webide-button2.tooltiptext = Open WebIDE (%S)
 
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext): "Pocket"
-# is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Save to Pocket
-
 e10s-button.label = New Non-e10s Window
 e10s-button.tooltiptext = Open a new Non-e10s Window
--- a/browser/locales/filter.py
+++ b/browser/locales/filter.py
@@ -6,17 +6,18 @@ def test(mod, path, entity = None):
   import re
   # ignore anything but Firefox
   if mod not in ("netwerk", "dom", "toolkit", "security/manager",
                  "devtools/client", "devtools/shared",
                  "browser", "webapprt",
                  "extensions/reporter", "extensions/spellcheck",
                  "other-licenses/branding/firefox",
                  "browser/branding/official",
-                 "services/sync"):
+                 "services/sync",
+                 "browser/extensions/pocket"):
     return "ignore"
   if mod not in ("browser", "extensions/spellcheck"):
     # we only have exceptions for browser and extensions/spellcheck
     return "error"
   if not entity:
     # the only files to ignore are spell checkers and search
     if mod == "extensions/spellcheck":
       return "ignore"
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -19,17 +19,16 @@
 #endif
     locale/browser/aboutSessionRestore.dtd         (%chrome/browser/aboutSessionRestore.dtd)
     locale/browser/aboutTabCrashed.dtd             (%chrome/browser/aboutTabCrashed.dtd)
     locale/browser/syncCustomize.dtd               (%chrome/browser/syncCustomize.dtd)
     locale/browser/aboutSyncTabs.dtd               (%chrome/browser/aboutSyncTabs.dtd)
     locale/browser/browser.dtd                     (%chrome/browser/browser.dtd)
     locale/browser/baseMenuOverlay.dtd             (%chrome/browser/baseMenuOverlay.dtd)
     locale/browser/browser.properties              (%chrome/browser/browser.properties)
-    locale/browser/browser-pocket.properties       (%chrome/browser/browser-pocket.properties)
     locale/browser/customizableui/customizableWidgets.properties (%chrome/browser/customizableui/customizableWidgets.properties)
     locale/browser/lightweightThemes.properties    (%chrome/browser/lightweightThemes.properties)
     locale/browser/loop/loop.properties            (%chrome/browser/loop/loop.properties)
     locale/browser/newTab.dtd                      (%chrome/browser/newTab.dtd)
     locale/browser/newTab.properties               (%chrome/browser/newTab.properties)
     locale/browser/pageInfo.dtd                    (%chrome/browser/pageInfo.dtd)
     locale/browser/pageInfo.properties             (%chrome/browser/pageInfo.properties)
     locale/browser/quitDialog.properties           (%chrome/browser/quitDialog.properties)
--- a/browser/locales/l10n.ini
+++ b/browser/locales/l10n.ini
@@ -7,16 +7,17 @@ depth = ../..
 all = browser/locales/all-locales
 
 [compare]
 dirs = browser
      extensions/reporter
      other-licenses/branding/firefox
      browser/branding/official
      devtools/client
+     browser/extensions/pocket
 
 [includes]
 # non-central apps might want to use %(topsrcdir)s here, or other vars
 # RFE: that needs to be supported by compare-locales, too, though
 toolkit = toolkit/locales/l10n.ini
 services_sync = services/sync/locales/l10n.ini
 webapprt = webapprt/locales/l10n.ini
 
--- a/browser/modules/ReaderParent.jsm
+++ b/browser/modules/ReaderParent.jsm
@@ -8,33 +8,30 @@
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 this.EXPORTED_SYMBOLS = [ "ReaderParent" ];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils","resource://gre/modules/PlacesUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "UITour", "resource:///modules/UITour.jsm");
 
 const gStringBundle = Services.strings.createBundle("chrome://global/locale/aboutReader.properties");
 
 var ReaderParent = {
   _readerModeInfoPanelOpen: false,
 
   MESSAGES: [
     "Reader:AddToList",
-    "Reader:AddToPocket",
     "Reader:ArticleGet",
     "Reader:FaviconRequest",
     "Reader:ListStatusRequest",
-    "Reader:PocketEnabledGet",
     "Reader:RemoveFromList",
     "Reader:Share",
     "Reader:SystemUIVisibility",
     "Reader:UpdateReaderButton",
     "Reader:SetIntPref",
     "Reader:SetCharPref",
   ],
 
@@ -42,54 +39,29 @@ var ReaderParent = {
     let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
     for (let msg of this.MESSAGES) {
       mm.addMessageListener(msg, this);
     }
   },
 
   receiveMessage: function(message) {
     switch (message.name) {
-      case "Reader:AddToPocket": {
-        let doc = message.target.ownerDocument;
-        let pocketWidget = doc.getElementById("pocket-button");
-        let placement = CustomizableUI.getPlacementOfWidget("pocket-button");
-        if (placement) {
-          if (placement.area == CustomizableUI.AREA_PANEL) {
-            doc.defaultView.PanelUI.show().then(function() {
-              // The DOM node might not exist yet if the panel wasn't opened before.
-              pocketWidget = doc.getElementById("pocket-button");
-              pocketWidget.doCommand();
-            });
-          } else {
-            pocketWidget.doCommand();
-          }
-        }
-        break;
-      }
-
       case "Reader:ArticleGet":
         this._getArticle(message.data.url, message.target).then((article) => {
           // Make sure the target browser is still alive before trying to send data back.
           if (message.target.messageManager) {
             message.target.messageManager.sendAsyncMessage("Reader:ArticleData", { article: article });
           }
         }, e => {
           if (e && e.newURL) {
             message.target.loadURI("about:reader?url=" + encodeURIComponent(e.newURL));
           }
         });
         break;
 
-      case "Reader:PocketEnabledGet": {
-        let pocketPlacement = CustomizableUI.getPlacementOfWidget("pocket-button");
-        let isPocketEnabled = pocketPlacement && pocketPlacement.area;
-        message.target.messageManager.sendAsyncMessage("Reader:PocketEnabledData", { enabled: !!isPocketEnabled});
-        break;
-      }
-
       case "Reader:FaviconRequest": {
         if (message.target.messageManager) {
           let faviconUrl = PlacesUtils.promiseFaviconLinkUrl(message.data.url);
           faviconUrl.then(function onResolution(favicon) {
             message.target.messageManager.sendAsyncMessage("Reader:FaviconReturn", {
               url: message.data.url,
               faviconUrl: favicon.path.replace(/^favicon:/, "")
             })
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -519,22 +519,16 @@ menuitem:not([type]):not(.menuitem-toolt
   list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
 }
 
 #BMB_unsortedBookmarks,
 #panelMenu_unsortedBookmarks {
   list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
 }
 
-#panelMenu_pocket,
-#menu_pocket,
-#BMB_pocket {
-  list-style-image: url("chrome://browser/content/pocket/panels/img/pocketmenuitem16.png");
-}
-
 #menu_openDownloads {
   list-style-image: url("chrome://browser/skin/Toolbar-small.png");
   -moz-image-region: rect(0px 16px 16px 0px);
 }
 
 #menu_openAddons {
   list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.png");
 }
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -588,34 +588,16 @@ toolbarpaletteitem[place="palette"] > #p
     list-style-image: url("chrome://browser/skin/places/bookmarksToolbar@2x.png");
   }
 
   #BMB_unsortedBookmarks {
     list-style-image: url("chrome://browser/skin/places/unfiledBookmarks@2x.png");
   }
 }
 
-#panelMenu_pocket,
-#menu_pocket,
-#BMB_pocket {
-  list-style-image: url("chrome://browser/content/pocket/panels/img/pocketmenuitem16.png");
-}
-
-@media (min-resolution: 2dppx) {
-  #panelMenu_pocket,
-  #menu_pocket,
-  #BMB_pocket {
-    list-style-image: url("chrome://browser/content/pocket/panels/img/pocketmenuitem16@2x.png");
-  }
-
-  #panelMenu_pocket > .toolbarbutton-icon {
-    width: 16px;
-  }
-}
-
 /* ----- PRIMARY TOOLBAR BUTTONS ----- */
 
 :-moz-any(toolbar, .widget-overflow-list) .toolbarbutton-1 > .toolbarbutton-icon,
 :-moz-any(toolbar, .widget-overflow-list) .toolbarbutton-1 > :-moz-any(.toolbarbutton-menubutton-button, .toolbarbutton-badge-stack) > .toolbarbutton-icon {
   max-width: 16px;
   margin: 1px;
 }
 
@@ -834,20 +816,16 @@ toolbar .toolbarbutton-1 > .toolbarbutto
   #e10s-button@toolbarButtonPressed@ {
     -moz-image-region: rect(18px, 342px, 36px, 324px);
   }
 
   #webide-button@toolbarButtonPressed@ {
     -moz-image-region: rect(18px, 738px, 36px, 720px);
   }
 
-  #pocket-button@toolbarButtonPressed@ {
-    -moz-image-region: rect(18px, 774px, 36px, 756px);
-  }
-
   #new-tab-button@toolbarButtonPressed@ {
     -moz-image-region: rect(18px, 360px, 36px, 342px);
   }
 
   #privatebrowsing-button@toolbarButtonPressed@ {
     -moz-image-region: rect(18px, 378px, 36px, 360px);
   }
 
@@ -1001,20 +979,16 @@ toolbar .toolbarbutton-1 > .toolbarbutto
   #e10s-button > .toolbarbutton-icon {
     transform: scaleY(-1);
   }
 
   #webide-button@toolbarButtonPressed@ {
     -moz-image-region: rect(36px, 1476px, 72px, 1440px);
   }
 
-  #pocket-button@toolbarButtonPressed@ {
-    -moz-image-region: rect(36px, 1548px, 72px, 1512px);
-  }
-
   #new-tab-button@toolbarButtonPressed@ {
     -moz-image-region: rect(36px, 720px, 72px, 684px);
   }
 
   #privatebrowsing-button@toolbarButtonPressed@ {
     -moz-image-region: rect(36px, 756px, 72px, 720px);
   }
 
--- a/browser/themes/shared/browser.inc
+++ b/browser/themes/shared/browser.inc
@@ -1,13 +1,13 @@
 %filter substitution
 
 % Note that zoom-reset-button is a bit different since it doesn't use an image and thus has the image with display: none.
 %define nestedButtons #zoom-out-button, #zoom-reset-button, #zoom-in-button, #cut-button, #copy-button, #paste-button
-%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #fullscreen-button, #sync-button, #feed-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button, #sidebar-button, @nestedButtons@, #e10s-button, #panic-button, #web-apps-button, #webide-button, #pocket-button
+%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #fullscreen-button, #sync-button, #feed-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button, #sidebar-button, @nestedButtons@, #e10s-button, #panic-button, #web-apps-button, #webide-button
 
 %ifdef XP_MACOSX
 % Prior to 10.7 there wasn't a native fullscreen button so we use #restore-button to exit fullscreen
 % and want it to behave like other toolbar buttons.
 %define primaryToolbarButtons @primaryToolbarButtons@, #restore-button
 %endif
 
 %define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true])
--- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css
+++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css
@@ -245,36 +245,26 @@ panelmultiview[nosubviews=true] > .panel
   max-width: @menuPanelWidth@;
 }
 
 #BMB_bookmarksPopup,
 .panel-mainview:not([panelid="PanelUI-popup"]) {
   max-width: @standaloneSubviewWidth@;
 }
 
-/* Bug 1164419 - increase Pocket panel size to accomidate wider Russian text. */
-panelmultiview[mainViewId=PanelUI-pocketView] > .panel-viewcontainer > .panel-viewstack > .panel-mainview:not([panelid="PanelUI-popup"]) {
-  max-width: 33em; /* standaloneSubviewWidth + 3 */
-}
-
 panelview:not([mainview]) .toolbarbutton-text,
 .cui-widget-panel toolbarbutton > .toolbarbutton-text {
   text-align: start;
   display: -moz-box;
 }
 
 .cui-widget-panel > .panel-arrowcontainer > .panel-arrowcontent {
   padding: 4px 0;
 }
 
-.cui-widget-panel[viewId="PanelUI-pocketView"] > .panel-arrowcontainer > .panel-arrowcontent {
-  padding-top: 0;
-  padding-bottom: 0;
-}
-
 .cui-widget-panel.cui-widget-panelWithFooter > .panel-arrowcontainer > .panel-arrowcontent {
   padding-bottom: 0;
 }
 
 #PanelUI-contents {
   display: block;
   flex: 1 0 auto;
   margin-left: auto;
@@ -1400,19 +1390,17 @@ toolbaritem[overflowedItem=true],
 menuitem[checked="true"].subviewbutton > .menu-iconic-left {
   visibility: hidden;
 }
 
 .panel-mainview[panelid=customizationui-widget-panel],
 #customizationui-widget-multiview > .panel-viewcontainer,
 #customizationui-widget-multiview > .panel-viewcontainer > .panel-viewstack,
 #PanelUI-panicView > .panel-subview-body,
-#PanelUI-panicView,
-#PanelUI-pocketView > .panel-subview-body,
-#PanelUI-pocketView {
+#PanelUI-panicView {
   overflow: visible;
 }
 
 #PanelUI-panicView.cui-widget-panelview {
   min-width: 280px;
 }
 
 #PanelUI-panic-timeframe {
--- a/browser/themes/shared/menupanel.inc.css
+++ b/browser/themes/shared/menupanel.inc.css
@@ -163,25 +163,16 @@
     -moz-image-region: rect(0, 928px, 32px, 896px);
   }
 
   #webide-button[cui-areatype="menu-panel"],
   toolbarpaletteitem[place="palette"] > #webide-button {
     -moz-image-region: rect(0px, 960px, 32px, 928px);
   }
 
-  #pocket-button[cui-areatype="menu-panel"],
-  toolbarpaletteitem[place="palette"] > #pocket-button {
-    -moz-image-region: rect(0px, 992px, 32px, 960px);
-  }
-
-  #pocket-button[cui-areatype="menu-panel"][panel-multiview-anchor=true] {
-    -moz-image-region: rect(32px, 992px, 64px, 960px);
-  }
-
   toolbaritem[sdkstylewidget="true"] > toolbarbutton {
     -moz-image-region: rect(0, 832px, 32px, 800px);
   }
 
   /* Wide panel control icons */
 
   #edit-controls@inAnyPanel@ > toolbarbutton,
   #zoom-controls@inAnyPanel@ > toolbarbutton,
@@ -310,25 +301,16 @@
     -moz-image-region: rect(0px, 1024px, 64px, 960px);
   }
 
   #webide-button[cui-areatype="menu-panel"],
   toolbarpaletteitem[place="palette"] > #webide-button {
     -moz-image-region: rect(0px, 1920px, 64px, 1856px);
   }
 
-  #pocket-button[cui-areatype="menu-panel"],
-  toolbarpaletteitem[place="palette"] > #pocket-button {
-    -moz-image-region: rect(0px, 1984px, 64px, 1920px);
-  }
-
-  #pocket-button[cui-areatype="menu-panel"][panel-multiview-anchor=true] {
-    -moz-image-region: rect(64px, 1984px, 128px, 1920px);
-  }
-
   #new-tab-button[cui-areatype="menu-panel"],
   toolbarpaletteitem[place="palette"] > #new-tab-button {
     -moz-image-region: rect(0px, 1088px, 64px, 1024px);
   }
 
   #privatebrowsing-button[cui-areatype="menu-panel"],
   toolbarpaletteitem[place="palette"] > #privatebrowsing-button {
     -moz-image-region: rect(0px, 1152px, 64px, 1088px);
--- a/browser/themes/shared/toolbarbuttons.inc.css
+++ b/browser/themes/shared/toolbarbuttons.inc.css
@@ -170,28 +170,16 @@ toolbar[brighttext] #bookmarks-menu-butt
 #web-apps-button[cui-areatype="toolbar"] {
   -moz-image-region: rect(0, 720px, 18px, 702px);
 }
 
 #webide-button[cui-areatype="toolbar"] {
   -moz-image-region: rect(0, 738px, 18px, 720px);
 }
 
-#pocket-button[cui-areatype="toolbar"] {
-  -moz-image-region: rect(0, 774px, 18px, 756px);
-}
-
-#pocket-button[cui-areatype="toolbar"][open] {
-%ifdef XP_MACOSX
-  -moz-image-region: rect(36px, 774px, 54px, 756px);
-%else
-  -moz-image-region: rect(18px, 774px, 36px, 756px);
-%endif
-}
-
 %if defined(XP_WIN) || defined(XP_MACOSX)
 @media (min-resolution: 1.1dppx) {
   :-moz-any(@primaryToolbarButtons@),
   #bookmarks-menu-button > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
     list-style-image: url("chrome://browser/skin/Toolbar@2x.png");
   }
 
   toolbar[brighttext] :-moz-any(@primaryToolbarButtons@),
@@ -352,22 +340,10 @@ toolbar[brighttext] #bookmarks-menu-butt
 
   #web-apps-button[cui-areatype="toolbar"] {
     -moz-image-region: rect(0, 1440px, 36px, 1404px);
   }
 
   #webide-button[cui-areatype="toolbar"] {
     -moz-image-region: rect(0, 1476px, 36px, 1440px);
   }
-
-  #pocket-button[cui-areatype="toolbar"] {
-    -moz-image-region: rect(0, 1548px, 36px, 1512px);
-  }
-
-  #pocket-button[cui-areatype="toolbar"][open] {
-%ifdef XP_MACOSX
-    -moz-image-region: rect(72px, 1548px, 108px, 1512px);
-%else
-    -moz-image-region: rect(36px, 1548px, 72px, 1512px);
-%endif
-  }
 }
 %endif
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -2299,22 +2299,16 @@ notification[value="translation"] {
 }
 
 #BMB_unsortedBookmarks,
 #panelMenu_unsortedBookmarks {
   list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
   -moz-image-region: auto;
 }
 
-#panelMenu_pocket,
-#menu_pocket,
-#BMB_pocket {
-  list-style-image: url("chrome://browser/content/pocket/panels/img/pocketmenuitem16.png");
-}
-
 /* ::::: Keyboard UI Panel ::::: */
 
 .KUI-panel {
   -moz-appearance: none;
   background: rgba(27%,27%,27%,.9) url(KUI-background.png) repeat-x;
   color: white;
   border-style: none;
   border-radius: 20px;
--- a/python/mozbuild/mozbuild/jar.py
+++ b/python/mozbuild/mozbuild/jar.py
@@ -92,17 +92,17 @@ class JarInfo(object):
         self.entries = []
 
 
 class JarManifestParser(object):
 
     ignore = re.compile('\s*(\#.*)?$')
     jarline = re.compile('''
         (?:
-            (?:\[(?P<base>[\w\d.\-\_\\\/{}]+)\]\s*)? # optional [base/path]
+            (?:\[(?P<base>[\w\d.\-\_\\\/{}@]+)\]\s*)? # optional [base/path]
             (?P<jarfile>[\w\d.\-\_\\\/{}]+).jar\:    # filename.jar:
         |
             (?:\s*(\#.*)?)                           # comment
         )\s*$                                        # whitespaces
         ''', re.VERBOSE)
     relsrcline = re.compile('relativesrcdir\s+(?P<relativesrcdir>.+?):')
     regline = re.compile('\%\s+(.*)$')
     entryre = '(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+'
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -92,16 +92,18 @@ user_pref("privacy.trackingprotection.in
 // Point update checks to the local testing server for fast failures
 user_pref("extensions.update.url", "http://%(server)s/extensions-dummy/updateURL");
 user_pref("extensions.update.background.url", "http://%(server)s/extensions-dummy/updateBackgroundURL");
 user_pref("extensions.blocklist.url", "http://%(server)s/extensions-dummy/blocklistURL");
 user_pref("extensions.hotfix.url", "http://%(server)s/extensions-dummy/hotfixURL");
 user_pref("extensions.systemAddon.update.url", "http://%(server)s/dummy-system-addons.xml");
 // Turn off extension updates so they don't bother tests
 user_pref("extensions.update.enabled", false);
+// Bug 1235627 Turn off pocket add-on so it doesn't bother tests
+user_pref("extensions.pocket.enabled", false);
 // Make sure opening about:addons won't hit the network
 user_pref("extensions.webservice.discoverURL", "http://%(server)s/extensions-dummy/discoveryURL");
 // Make sure AddonRepository won't hit the network
 user_pref("extensions.getAddons.maxResults", 0);
 user_pref("extensions.getAddons.get.url", "http://%(server)s/extensions-dummy/repositoryGetURL");
 user_pref("extensions.getAddons.getWithPerformance.url", "http://%(server)s/extensions-dummy/repositoryGetWithPerformanceURL");
 user_pref("extensions.getAddons.search.browseURL", "http://%(server)s/extensions-dummy/repositoryBrowseURL");
 user_pref("extensions.getAddons.search.url", "http://%(server)s/extensions-dummy/repositorySearchURL");
--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -34,16 +34,18 @@ var AboutReader = function(mm, win, arti
   let doc = win.document;
 
   this._mm = mm;
   this._mm.addMessageListener("Reader:Added", this);
   this._mm.addMessageListener("Reader:Removed", this);
   this._mm.addMessageListener("Sidebar:VisibilityChange", this);
   this._mm.addMessageListener("ReadingList:VisibilityStatus", this);
   this._mm.addMessageListener("Reader:CloseDropdown", this);
+  this._mm.addMessageListener("Reader:AddButton", this);
+  this._mm.addMessageListener("Reader:RemoveButton", this);
 
   this._docRef = Cu.getWeakReference(doc);
   this._winRef = Cu.getWeakReference(win);
 
   this._article = null;
 
   if (articlePromise) {
     this._articlePromise = articlePromise;
@@ -80,19 +82,18 @@ var AboutReader = function(mm, win, arti
       this._doc.getElementById("reader-footer").setAttribute('readinglist-enabled', "true");
     }
   } catch (e) {
     // Pref doesn't exist.
   }
 
   const gIsFirefoxDesktop = Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
   if (gIsFirefoxDesktop) {
-    this._setupPocketButton();
-  } else {
-    this._doc.getElementById("pocket-button").hidden = true;
+    // we're ready for any external setup, send a signal for that.
+    this._mm.sendAsyncMessage("Reader:OnSetup");
   }
 
   let colorSchemeValues = JSON.parse(Services.prefs.getCharPref("reader.color_scheme.values"));
   let colorSchemeOptions = colorSchemeValues.map((value) => {
     return { name: gStrings.GetStringFromName("aboutReader.colorScheme." + value),
              value: value,
              itemClass: value + "-button" };
   });
@@ -212,16 +213,41 @@ AboutReader.prototype = {
         if (message.data.url == this._article.url) {
           if (this._isReadingListItem != 0) {
             this._isReadingListItem = 0;
             this._updateToggleButton();
           }
         }
         break;
       }
+      case "Reader:AddButton": {
+        if (message.data.id && message.data.image) {
+          let btn = this._doc.createElement("button");
+          btn.setAttribute("class", "button");
+          btn.setAttribute("style", "background-image: url('" + message.data.image + "')");
+          btn.setAttribute("id", message.data.id);
+          if (message.data.title)
+            btn.setAttribute("title", message.data.title);
+          if (message.data.text)
+            btn.textContent = message.data.text;
+          let tb = this._doc.getElementById("reader-toolbar");
+          tb.appendChild(btn);
+          this._setupButton(message.data.id, button => {
+            this._mm.sendAsyncMessage("Reader:Clicked-" + button.getAttribute("id"), { article: this._article });
+          });
+        }
+        break;
+      }
+      case "Reader:RemoveButton": {
+        if (message.data.id) {
+          let btn = this._doc.getElementById(message.data.id);
+          btn.remove();
+        }
+        break;
+      }
 
       // Notifys us of Sidebar updates, user clicks X to close,
       // checks View -> Sidebar -> (Bookmarks, Histroy, Readinglist, etc).
       case "Sidebar:VisibilityChange": {
         let data = message.data;
         this._updateListButtonStyle(data.isOpen && data.commandID === READINGLIST_COMMAND_ID);
         break;
       }
@@ -267,16 +293,18 @@ AboutReader.prototype = {
         // Close the Banners Font-dropdown, cleanup Android BackPressListener.
         this._closeDropdown();
 
         this._mm.removeMessageListener("Reader:Added", this);
         this._mm.removeMessageListener("Reader:Removed", this);
         this._mm.removeMessageListener("Sidebar:VisibilityChange", this);
         this._mm.removeMessageListener("ReadingList:VisibilityStatus", this);
         this._mm.removeMessageListener("Reader:CloseDropdown", this);
+        this._mm.removeMessageListener("Reader:AddButton", this);
+        this._mm.removeMessageListener("Reader:RemoveButton", this);
         this._windowUnloaded = true;
         break;
     }
   },
 
   _updateToggleButton: function() {
     let button = this._doc.getElementById("toggle-button");
 
@@ -330,24 +358,16 @@ AboutReader.prototype = {
       this._mm.sendAsyncMessage("Reader:AddToList", { article: this._article });
       UITelemetry.addEvent("save.1", aMethod, null, "reading_list");
     } else {
       this._mm.sendAsyncMessage("Reader:RemoveFromList", { url: this._article.url });
       UITelemetry.addEvent("unsave.1", aMethod, null, "reading_list");
     }
   },
 
-  _onPocketToggle: function(aMethod) {
-    if (!this._article)
-      return;
-
-    this._mm.sendAsyncMessage("Reader:AddToPocket", { article: this._article });
-    UITelemetry.addEvent("pocket.1", aMethod, null, "reader");
-  },
-
   _onShare: function() {
     if (!this._article)
       return;
 
     this._mm.sendAsyncMessage("Reader:Share", {
       url: this._article.url,
       title: this._article.title
     });
@@ -628,34 +648,16 @@ AboutReader.prototype = {
   _toggleToolbarVisibility: function() {
     this._setToolbarVisibility(!this._getToolbarVisibility());
   },
 
   _setSystemUIVisibility: function(visible) {
     this._mm.sendAsyncMessage("Reader:SystemUIVisibility", { visible: visible });
   },
 
-  _setupPocketButton: Task.async(function* () {
-    let pocketEnabledPromise = new Promise((resolve, reject) => {
-      let listener = (message) => {
-        this._mm.removeMessageListener("Reader:PocketEnabledData", listener);
-        resolve(message.data.enabled);
-      };
-      this._mm.addMessageListener("Reader:PocketEnabledData", listener);
-      this._mm.sendAsyncMessage("Reader:PocketEnabledGet");
-    });
-
-    let isPocketEnabled = yield pocketEnabledPromise;
-    if (isPocketEnabled) {
-      this._setupButton("pocket-button", this._onPocketToggle.bind(this, "button"));
-    } else {
-      this._doc.getElementById("pocket-button").hidden = true;
-    }
-  }),
-
   _loadArticle: Task.async(function* () {
     let url = this._getOriginalUrl();
     this._showProgressDelayed();
 
     let article;
     if (this._articlePromise) {
       article = yield this._articlePromise;
     } else {
@@ -910,17 +912,18 @@ AboutReader.prototype = {
       button.textContent = gStrings.GetStringFromName(textEntity);
     }
     button.removeAttribute("hidden");
     button.addEventListener("click", function(aEvent) {
       if (!aEvent.isTrusted)
         return;
 
       aEvent.stopPropagation();
-      callback();
+      let btn = aEvent.target;
+      callback(btn);
     }, true);
   },
 
   /**
    * Sets a toolTip for a button. Performed at initial button setup
    * and dynamically as button state changes.
    * @param   Localizable string providing UI element usage tip.
    */
--- a/toolkit/components/reader/content/aboutReader.html
+++ b/toolkit/components/reader/content/aboutReader.html
@@ -62,14 +62,13 @@
         </div>
         <hr></hr>
         <div id="color-scheme-buttons"></div>
         <div class="dropdown-arrow"/>
       </li>
     </ul>
     <li><button id="toggle-button" class="button toggle-button" hidden="true"/></li>
     <li><button id="list-button" class="button list-button" hidden="true"/></li>
-    <li><button id="pocket-button" class="button" hidden="true"/></li>
   </ul>
 
 </body>
 
 </html>
--- a/toolkit/themes/shared/aboutReaderControls.css
+++ b/toolkit/themes/shared/aboutReaderControls.css
@@ -374,24 +374,16 @@
 .minus-button {
   background-image: url("chrome://global/skin/reader/RM-Minus-24x24.svg");
 }
 
 .plus-button {
   background-image: url("chrome://global/skin/reader/RM-Plus-24x24.svg");
 }
 
-#pocket-button {
-  background-image: url("chrome://global/skin/reader/pocket.svg#pocket-mark");
-}
-
-#pocket-button:hover:active {
-  background-image: url("chrome://global/skin/reader/pocket.svg#pocket-mark-added");
-}
-
 @media print {
   .toolbar {
     display: none !important;
   }
   .footer {
     display: none !important;
   }
 }
--- a/toolkit/themes/shared/jar.inc.mn
+++ b/toolkit/themes/shared/jar.inc.mn
@@ -31,17 +31,16 @@ toolkit.jar:
   skin/classic/global/menu/shared-menu-check-active.svg    (../../shared/menu-check-active.svg)
   skin/classic/global/menu/shared-menu-check-black.svg     (../../shared/menu-check-black.svg)
   skin/classic/global/menu/shared-menu-check-hover.svg     (../../shared/menu-check-hover.svg)
   skin/classic/global/in-content/check.svg                 (../../shared/in-content/check.svg)
   skin/classic/global/in-content/check-partial.svg         (../../shared/in-content/check-partial.svg)
   skin/classic/global/in-content/dropdown.svg              (../../shared/in-content/dropdown.svg)
   skin/classic/global/in-content/help-glyph.svg            (../../shared/in-content/help-glyph.svg)
   skin/classic/global/in-content/radio.svg                 (../../shared/in-content/radio.svg)
-  skin/classic/global/reader/pocket.svg                    (../../shared/reader/pocket.svg)
   skin/classic/global/reader/RM-Add-24x24.svg              (../../shared/reader/RM-Add-24x24.svg)
   skin/classic/global/reader/RM-Close-24x24.svg            (../../shared/reader/RM-Close-24x24.svg)
   skin/classic/global/reader/RM-Delete-24x24.svg           (../../shared/reader/RM-Delete-24x24.svg)
   skin/classic/global/reader/RM-Minus-24x24.svg            (../../shared/reader/RM-Minus-24x24.svg)
   skin/classic/global/reader/RM-Plus-24x24.svg             (../../shared/reader/RM-Plus-24x24.svg)
   skin/classic/global/reader/RM-Reading-List-24x24.svg     (../../shared/reader/RM-Reading-List-24x24.svg)
   skin/classic/global/reader/RM-Type-Controls-24x24.svg    (../../shared/reader/RM-Type-Controls-24x24.svg)
   skin/classic/global/reader/RM-Type-Controls-Arrow.svg    (../../shared/reader/RM-Type-Controls-Arrow.svg)