Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2015-12-30 12:15:55 +01:00
commit 3d60bbd26f
180 changed files with 4510 additions and 3210 deletions

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
@ -139,7 +139,7 @@
<project name="init_sh" path="external/init_sh" remote="b2g" revision="feb58d2b397e45ead9b904d5c4d9255df408db56"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="3e85c4683c121530c1c3a48c696a569bf5f587e2"/>
<project name="platform_external_bluetooth_bluedroid" path="external/bluetooth/bluedroid" remote="b2g" revision="70f536bd97d901b96b94669ae1aa2fd0fb54b258"/>
<project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="b2g" revision="2d017f975f4542c6d23b226ec172b9b30383c31c"/>
<project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="b2g" revision="2a52bd77d2ca0cefbf02acc6863492d16b6ccfec"/>
<project name="platform_external_libnfc-pn547" path="external/libnfc-pn547" remote="b2g" revision="5bb999b84b8adc14f6bea004d523ba258dea8188"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="5b71e40213f650459e95d35b6f14af7e88d8ab62"/>
<project name="platform_frameworks_av" path="frameworks/av" remote="b2g" revision="5d5bcc83d6c32874701f0df78ed1119e006bd10a"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23",
"git_revision": "1899109c9fd9b9e2244155c4b9e966c0a48368fc",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "9cfeee1568995b5cf0f58db8924baff387871876",
"revision": "cfb223aa835d5bf17ec0fd03f873b6788a149edb",
"repo_path": "integration/gaia-central"
}

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -21,7 +21,7 @@
<!--
B2G repositories for all targets
-->
<project name="gaia" path="gaia" remote="mozillaorg" revision="63c3a57ad9935b9c61057a29ee27a1c6ed6a9e23"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1899109c9fd9b9e2244155c4b9e966c0a48368fc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>

View File

@ -648,9 +648,9 @@
@RESPATH@/components/Push.js
@RESPATH@/components/Push.manifest
#ifdef MOZ_SIMPLEPUSH
@RESPATH@/components/PushComponents.js
#else
@RESPATH@/components/PushServiceLauncher.js
#else
@RESPATH@/components/PushComponents.js
#endif
@RESPATH@/components/InterAppComm.manifest

View File

@ -1611,13 +1611,6 @@ pref("reader.parse-node-limit", 0);
// 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);

View File

@ -79,10 +79,6 @@
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/>
@ -270,10 +266,6 @@
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/>

View File

@ -413,7 +413,6 @@
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">
@ -422,12 +421,6 @@
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"

View File

@ -1554,12 +1554,6 @@ var BookmarkingUI = {
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;
@ -1681,7 +1675,6 @@ var BookmarkingUI = {
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");

View File

@ -1348,9 +1348,8 @@ SocialMarks = {
// 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() {

View File

@ -53,37 +53,6 @@ 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');
@ -7097,6 +7066,9 @@ var gIdentityHandler = {
// Fallback for special protocols.
if (!host) {
host = this._uri.specIgnoringRef;
// Special URIs without a host (eg, about:) should crop the end so
// the protocol can be seen.
crop = "end";
}
// Fill in the CA name if we have a valid TLS certificate.

View File

@ -620,9 +620,9 @@
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"
@ -798,7 +798,6 @@
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"
@ -815,11 +814,6 @@
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"

View File

@ -11,10 +11,6 @@ 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");
@ -216,25 +212,6 @@ nsContextMenu.prototype = {
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() {
@ -1721,14 +1698,6 @@ nsContextMenu.prototype = {
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);
},

View File

@ -12,7 +12,7 @@ var manifest2 = { // used for testing install
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",
@ -20,7 +20,7 @@ var manifestUpgrade = { // used for testing install
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() {

View File

@ -48,7 +48,6 @@ function test() {
CustomizableUI.removeWidgetFromArea("social-share-button", CustomizableUI.AREA_NAVBAR)
shareButton.remove();
}
ok(CustomizableUI.inDefaultState, "Should start in default state.");
next();
});
}

View File

@ -13,7 +13,7 @@ var manifest = { // used for testing install
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() {

View File

@ -13,25 +13,20 @@ var manifest2 = { // used for testing install
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 = {

View File

@ -8,18 +8,14 @@ function makeMarkProvider(origin) {
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 = {

View File

@ -17,14 +17,14 @@ var manifest2 = { // used for testing install
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"
};
@ -45,7 +45,6 @@ function test() {
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();
});

View File

@ -22,7 +22,7 @@ var data = {
"author": "Shane Caraveo, Mozilla",
// optional
"version": 1
"version": "1.0"
}
function activate(node) {

View File

@ -20,7 +20,7 @@ var data = {
"author": "Shane Caraveo, Mozilla",
// optional
"version": 1
"version": "1.0"
}
function activate(node) {

View File

@ -126,7 +126,7 @@ onconnect = function(e) {
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});

View File

@ -126,18 +126,6 @@ static RedirEntry kRedirMap[] = {
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);

View File

@ -117,8 +117,6 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ 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 },

View File

@ -56,7 +56,7 @@ const kSubviewEvents = [
* 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
@ -64,7 +64,8 @@ var kVersion = 5;
* 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
};
/**
@ -222,15 +223,6 @@ var CustomizableUIInternal = {
"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");
}
@ -3473,8 +3465,8 @@ this.CustomizableUI = {
*
* 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.

View File

@ -18,18 +18,12 @@ 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");
@ -1225,68 +1219,6 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
});
}
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

View File

@ -191,10 +191,6 @@
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;"
@ -310,12 +306,6 @@
</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. -->

View File

@ -15,7 +15,6 @@ DIRS += [
'migration',
'newtab',
'places',
'pocket',
'preferences',
'privatebrowsing',
'search',

View File

@ -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)

View File

@ -9,25 +9,7 @@ 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);

View File

@ -62,7 +62,7 @@ function checkPanelIsHidden(aPanel) {
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.

View File

@ -7,5 +7,6 @@
DIRS += [
'loop',
'pdfjs',
'pocket',
'shumway',
]

View File

@ -1,3 +1,3 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.3.110
Current extension version is: 1.3.142

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -264,3 +264,4 @@ var NetworkManager = (function NetworkManagerClosure() {
return NetworkManager;
})();

View File

@ -81,44 +81,7 @@
position: absolute;
}
.annotationLayer .annotLink > a:hover {
opacity: 0.2;
background: #ff0;
box-shadow: 0px 2px 10px #ff0;
}
.annotationLayer .annotText > img {
position: absolute;
cursor: pointer;
}
.annotationLayer .annotTextContentWrapper {
position: absolute;
width: 20em;
}
.annotationLayer .annotTextContent {
z-index: 200;
float: left;
max-width: 20em;
background-color: #FFFF99;
box-shadow: 0px 2px 5px #333;
border-radius: 2px;
padding: 0.6em;
cursor: pointer;
}
.annotationLayer .annotTextContent > h1 {
font-size: 1em;
border-bottom: 1px solid #000000;
padding-bottom: 0.2em;
}
.annotationLayer .annotTextContent > p {
padding-top: 0.2em;
}
.annotationLayer .annotLink > a {
.annotationLayer .linkAnnotation > a {
position: absolute;
font-size: 1em;
top: 0;
@ -127,6 +90,49 @@
height: 100%;
}
.annotationLayer .linkAnnotation > a:hover {
opacity: 0.2;
background: #ff0;
box-shadow: 0px 2px 10px #ff0;
}
.annotationLayer .textAnnotation img {
position: absolute;
cursor: pointer;
}
.annotationLayer .popupWrapper {
position: absolute;
width: 20em;
}
.annotationLayer .popup {
position: absolute;
z-index: 200;
max-width: 20em;
background-color: #FFFF99;
box-shadow: 0px 2px 5px #333;
border-radius: 2px;
padding: 0.6em;
margin-left: 5px;
cursor: pointer;
word-wrap: break-word;
}
.annotationLayer .popup h1 {
font-size: 1em;
border-bottom: 1px solid #000000;
padding-bottom: 0.2em;
}
.annotationLayer .popup p {
padding-top: 0.2em;
}
.annotationLayer .underlineAnnotation {
cursor: pointer;
}
.pdfViewer .canvasWrapper {
overflow: hidden;
}

View File

@ -34,10 +34,12 @@ var SCALE_SELECT_PADDING = 22;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
PDFJS.imageResourcesPath = './images/';
function configure(PDFJS) {
PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '../build/pdf.worker.js';
PDFJS.cMapUrl = '../web/cmaps/';
PDFJS.cMapPacked = true;
}
var mozL10n = document.mozL10n || document.webL10n;
@ -3439,7 +3441,7 @@ var TEXT_LAYER_RENDER_DELAY = 200; // ms
* @property {PageViewport} defaultViewport - The page viewport.
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
* @property {IPDFTextLayerFactory} textLayerFactory
* @property {IPDFAnnotationsLayerFactory} annotationsLayerFactory
* @property {IPDFAnnotationLayerFactory} annotationLayerFactory
*/
/**
@ -3447,8 +3449,6 @@ var TEXT_LAYER_RENDER_DELAY = 200; // ms
* @implements {IRenderableView}
*/
var PDFPageView = (function PDFPageViewClosure() {
var CustomStyle = PDFJS.CustomStyle;
/**
* @constructs PDFPageView
* @param {PDFPageViewOptions} options
@ -3460,7 +3460,7 @@ var PDFPageView = (function PDFPageViewClosure() {
var defaultViewport = options.defaultViewport;
var renderingQueue = options.renderingQueue;
var textLayerFactory = options.textLayerFactory;
var annotationsLayerFactory = options.annotationsLayerFactory;
var annotationLayerFactory = options.annotationLayerFactory;
this.id = id;
this.renderingId = 'page' + id;
@ -3473,7 +3473,7 @@ var PDFPageView = (function PDFPageViewClosure() {
this.renderingQueue = renderingQueue;
this.textLayerFactory = textLayerFactory;
this.annotationsLayerFactory = annotationsLayerFactory;
this.annotationLayerFactory = annotationLayerFactory;
this.renderingState = RenderingStates.INITIAL;
this.resume = null;
@ -3622,6 +3622,8 @@ var PDFPageView = (function PDFPageViewClosure() {
},
cssTransform: function PDFPageView_transform(canvas, redrawAnnotations) {
var CustomStyle = PDFJS.CustomStyle;
// Scale canvas, canvas wrapper, and page container.
var width = this.viewport.width;
var height = this.viewport.height;
@ -3902,10 +3904,10 @@ var PDFPageView = (function PDFPageViewClosure() {
}
);
if (this.annotationsLayerFactory) {
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationsLayerFactory.
createAnnotationsLayerBuilder(div, this.pdfPage);
this.annotationLayer = this.annotationLayerFactory.
createAnnotationLayerBuilder(div, this.pdfPage);
}
this.annotationLayer.render(this.viewport, 'display');
}
@ -3918,6 +3920,7 @@ var PDFPageView = (function PDFPageViewClosure() {
},
beforePrint: function PDFPageView_beforePrint() {
var CustomStyle = PDFJS.CustomStyle;
var pdfPage = this.pdfPage;
var viewport = pdfPage.getViewport(1);
@ -4296,7 +4299,7 @@ DefaultTextLayerFactory.prototype = {
/**
* @typedef {Object} AnnotationsLayerBuilderOptions
* @typedef {Object} AnnotationLayerBuilderOptions
* @property {HTMLDivElement} pageDiv
* @property {PDFPage} pdfPage
* @property {IPDFLinkService} linkService
@ -4305,12 +4308,12 @@ DefaultTextLayerFactory.prototype = {
/**
* @class
*/
var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
/**
* @param {AnnotationsLayerBuilderOptions} options
* @constructs AnnotationsLayerBuilder
* @param {AnnotationLayerBuilderOptions} options
* @constructs AnnotationLayerBuilder
*/
function AnnotationsLayerBuilder(options) {
function AnnotationLayerBuilder(options) {
this.pageDiv = options.pageDiv;
this.pdfPage = options.pdfPage;
this.linkService = options.linkService;
@ -4318,14 +4321,14 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
this.div = null;
}
AnnotationsLayerBuilder.prototype =
/** @lends AnnotationsLayerBuilder.prototype */ {
AnnotationLayerBuilder.prototype =
/** @lends AnnotationLayerBuilder.prototype */ {
/**
* @param {PageViewport} viewport
* @param {string} intent (default value is 'display')
*/
render: function AnnotationsLayerBuilder_render(viewport, intent) {
render: function AnnotationLayerBuilder_render(viewport, intent) {
var self = this;
var parameters = {
intent: (intent === undefined ? 'display' : intent),
@ -4333,11 +4336,18 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
this.pdfPage.getAnnotations(parameters).then(function (annotations) {
viewport = viewport.clone({ dontFlip: true });
parameters = {
viewport: viewport,
div: self.div,
annotations: annotations,
page: self.pdfPage,
linkService: self.linkService
};
if (self.div) {
// If an annotationLayer already exists, refresh its children's
// transformation matrices.
PDFJS.AnnotationLayer.update(viewport, self.div, annotations);
PDFJS.AnnotationLayer.update(parameters);
} else {
// Create an annotation layer div and render the annotations
// if there is at least one annotation.
@ -4348,9 +4358,9 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
self.div = document.createElement('div');
self.div.className = 'annotationLayer';
self.pageDiv.appendChild(self.div);
parameters.div = self.div;
PDFJS.AnnotationLayer.render(viewport, self.div, annotations,
self.pdfPage, self.linkService);
PDFJS.AnnotationLayer.render(parameters);
if (typeof mozL10n !== 'undefined') {
mozL10n.translate(self.div);
}
@ -4358,7 +4368,7 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
});
},
hide: function AnnotationsLayerBuilder_hide() {
hide: function AnnotationLayerBuilder_hide() {
if (!this.div) {
return;
}
@ -4366,22 +4376,22 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
}
};
return AnnotationsLayerBuilder;
return AnnotationLayerBuilder;
})();
/**
* @constructor
* @implements IPDFAnnotationsLayerFactory
* @implements IPDFAnnotationLayerFactory
*/
function DefaultAnnotationsLayerFactory() {}
DefaultAnnotationsLayerFactory.prototype = {
function DefaultAnnotationLayerFactory() {}
DefaultAnnotationLayerFactory.prototype = {
/**
* @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage
* @returns {AnnotationsLayerBuilder}
* @returns {AnnotationLayerBuilder}
*/
createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationsLayerBuilder({
createAnnotationLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
linkService: new SimpleLinkService(),
@ -4649,7 +4659,7 @@ var PDFViewer = (function pdfViewer() {
defaultViewport: viewport.clone(),
renderingQueue: this.renderingQueue,
textLayerFactory: textLayerFactory,
annotationsLayerFactory: this
annotationLayerFactory: this
});
bindOnAfterAndBeforeDraw(pageView);
this._pages.push(pageView);
@ -5106,10 +5116,10 @@ var PDFViewer = (function pdfViewer() {
/**
* @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage
* @returns {AnnotationsLayerBuilder}
* @returns {AnnotationLayerBuilder}
*/
createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationsLayerBuilder({
createAnnotationLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
linkService: this.linkService
@ -7090,7 +7100,8 @@ var PDFViewerApplication = {
function webViewerLoad(evt) {
PDFViewerApplication.initialize().then(webViewerInitialized);
configure(PDFJS);
PDFViewerApplication.initialize().then(webViewerInitialized);
}
function webViewerInitialized() {

502
browser/extensions/pocket/bootstrap.js vendored Normal file
View File

@ -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() {
}

View File

@ -16,7 +16,7 @@ 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"; },
/**
@ -37,7 +37,7 @@ var Pocket = {
if (urlToSave) {
window.pktUI.tryToSaveUrl(urlToSave, titleToSave);
} else {
window.pktUI.pocketButtonOnCommand();
window.pktUI.tryToSaveCurrentPage();
}
if (iframe.contentDocument &&

View File

@ -15,10 +15,10 @@
* 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
@ -46,6 +46,8 @@ 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() {
@ -61,125 +63,31 @@ var pktUI = (function() {
// 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');
}
@ -192,73 +100,6 @@ var pktUI = (function() {
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 -- //
/**
@ -267,7 +108,7 @@ var pktUI = (function() {
function tryToSaveCurrentPage() {
tryToSaveUrl(getCurrentUrl(), getCurrentTitle());
}
function tryToSaveUrl(url, title) {
// If the user is logged in, go ahead and save the current page
@ -292,8 +133,8 @@ var pktUI = (function() {
var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0';
var startheight = 490;
var inOverflowMenu = isInOverflowMenu();
if (inOverflowMenu)
if (inOverflowMenu)
{
startheight = overflowMenuHeight;
}
@ -321,7 +162,7 @@ var pktUI = (function() {
{
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,
@ -349,7 +190,7 @@ var pktUI = (function() {
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';
@ -479,7 +320,7 @@ var pktUI = (function() {
* Called when the signup and saved panel was hidden
*/
function panelDidHide() {
}
/**
@ -615,7 +456,7 @@ var pktUI = (function() {
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);
@ -725,7 +566,7 @@ var pktUI = (function() {
callback();
});
}
function getUILocale() {
var locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry).
@ -733,112 +574,19 @@ var pktUI = (function() {
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
};
}());
@ -857,7 +605,7 @@ var pktUIMessaging = (function() {
* 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;

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View File

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View File

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 635 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 287 B

View File

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 508 B

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View File

@ -2,7 +2,7 @@
<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">

View File

@ -2,7 +2,7 @@
<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">

View File

@ -42,6 +42,13 @@
* 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() {
/**
@ -49,20 +56,20 @@ var pktApi = (function() {
*/
// 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

View File

@ -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>

View File

@ -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/*)

View File

@ -29,3 +29,13 @@ 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

View File

@ -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@/ (%*)

View File

@ -1,7 +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']
EXTRA_JS_MODULES += ['Pocket.jsm']

Some files were not shown because too many files have changed in this diff Show More