summaryrefslogtreecommitdiffstats
path: root/browser/extensions/pocket/content/pocket-content-process.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/extensions/pocket/content/pocket-content-process.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/extensions/pocket/content/pocket-content-process.js')
-rw-r--r--browser/extensions/pocket/content/pocket-content-process.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/browser/extensions/pocket/content/pocket-content-process.js b/browser/extensions/pocket/content/pocket-content-process.js
new file mode 100644
index 000000000..9b158a0ed
--- /dev/null
+++ b/browser/extensions/pocket/content/pocket-content-process.js
@@ -0,0 +1,54 @@
+/* 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/. */
+"use strict";
+
+// This file is loaded as a process script, it will be loaded in the parent
+// process as well as all content processes.
+
+const { utils: Cu } = Components;
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("chrome://pocket/content/AboutPocket.jsm");
+
+function AboutPocketChildListener() {
+}
+AboutPocketChildListener.prototype = {
+ onStartup: function onStartup() {
+
+ // Only do this in content processes since, as the broadcaster of this
+ // message, the parent process doesn't also receive it. We handlers
+ // the shutting down separately.
+ if (Services.appinfo.processType ==
+ Services.appinfo.PROCESS_TYPE_CONTENT) {
+
+ Services.cpmm.addMessageListener("PocketShuttingDown", this, true);
+ }
+
+ AboutPocket.aboutSaved.register();
+ AboutPocket.aboutSignup.register();
+ },
+
+ onShutdown: function onShutdown() {
+ AboutPocket.aboutSignup.unregister();
+ AboutPocket.aboutSaved.unregister();
+
+ Services.cpmm.removeMessageListener("PocketShuttingDown", this);
+ Cu.unload("chrome://pocket/content/AboutPocket.jsm");
+ },
+
+ receiveMessage: function receiveMessage(message) {
+ switch (message.name) {
+ case "PocketShuttingDown":
+ this.onShutdown();
+ break;
+ default:
+ break;
+ }
+
+ return;
+ }
+};
+
+const listener = new AboutPocketChildListener();
+listener.onStartup();