summaryrefslogtreecommitdiffstats
path: root/browser/modules
diff options
context:
space:
mode:
authorAscrod <32915892+Ascrod@users.noreply.github.com>2018-05-13 09:35:23 -0400
committerAscrod <32915892+Ascrod@users.noreply.github.com>2018-05-15 21:06:41 -0500
commit9ef464a5ac0a17135a0f7b4fef070bb4f7fbe44c (patch)
tree05dd6c130cbbb80e5512a5c199c010aa4b3516e5 /browser/modules
parentb70d884598e1e14b99190e1e5c349553ff59849b (diff)
downloadUXP-9ef464a5ac0a17135a0f7b4fef070bb4f7fbe44c.tar
UXP-9ef464a5ac0a17135a0f7b4fef070bb4f7fbe44c.tar.gz
UXP-9ef464a5ac0a17135a0f7b4fef070bb4f7fbe44c.tar.lz
UXP-9ef464a5ac0a17135a0f7b4fef070bb4f7fbe44c.tar.xz
UXP-9ef464a5ac0a17135a0f7b4fef070bb4f7fbe44c.zip
Change Reader API to use events, remove messaging.
Diffstat (limited to 'browser/modules')
-rw-r--r--browser/modules/ReaderParent.jsm53
1 files changed, 0 insertions, 53 deletions
diff --git a/browser/modules/ReaderParent.jsm b/browser/modules/ReaderParent.jsm
index fcc0cc92b..c81aa9905 100644
--- a/browser/modules/ReaderParent.jsm
+++ b/browser/modules/ReaderParent.jsm
@@ -19,8 +19,6 @@ const gStringBundle = Services.strings.createBundle("chrome://global/locale/abou
var ReaderParent = {
MESSAGES: [
- "Reader:ArticleGet",
- "Reader:FaviconRequest",
"Reader:UpdateReaderButton",
],
@@ -33,38 +31,6 @@ var ReaderParent = {
receiveMessage(message) {
switch (message.name) {
- 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) {
- // Make sure the target browser is still alive before trying to send data back.
- if (message.target.messageManager) {
- message.target.messageManager.sendAsyncMessage("Reader:ArticleData", { newURL: e.newURL });
- }
- }
- });
- 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:/, "")
- });
- },
- function onRejection(reason) {
- Cu.reportError("Error requesting favicon URL for about:reader content: " + reason);
- }).catch(Cu.reportError);
- }
- break;
- }
-
case "Reader:UpdateReaderButton": {
let browser = message.target;
if (message.data && message.data.isArticle !== undefined) {
@@ -132,24 +98,5 @@ var ReaderParent = {
let win = event.target.ownerGlobal;
let browser = win.gBrowser.selectedBrowser;
browser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode");
- },
-
- /**
- * Gets an article for a given URL. This method will download and parse a document.
- *
- * @param url The article URL.
- * @param browser The browser where the article is currently loaded.
- * @return {Promise}
- * @resolves JS object representing the article, or null if no article is found.
- */
- async _getArticle(url, browser) {
- return await ReaderMode.downloadAndParseDocument(url).catch(e => {
- if (e && e.newURL) {
- // Pass up the error so we can navigate the browser in question to the new URL:
- throw e;
- }
- Cu.reportError("Error downloading and parsing document: " + e);
- return null;
- });
}
};