From 1225f16d9ba764a690ade8c635a5b24138d05327 Mon Sep 17 00:00:00 2001
From: WangJie <i@i8e.net>
Date: Mon, 13 Aug 2018 11:35:47 +0800
Subject: [PATCH] 1.2.1: fix a serious problem

---
 .circleci/config.yml | 30 ++++++++++++++++++++++++++----
 src/background.js    |  4 ++--
 src/manifest.json    |  2 +-
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index e6e202b..c25f2a5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -27,9 +27,9 @@ jobs:
       - run: yarn build
       - save_cache:
           key: build-{{ .Environment.CIRCLE_SHA1 }}
-          paths: ~/ext/dist.zip
+          paths: ~/ext
 
-  publish:
+  publish_chrome:
     docker:
       - image: circleci/node:8.11.3-jessie
     working_directory: ~/ext
@@ -43,6 +43,20 @@ jobs:
             export PATH="$PATH:$HOME/.config/yarn/global/node_modules/.bin"
             webstore upload --source dist.zip --extension-id $EXTENSION_ID --auto-publish
 
+  publish_firefox:
+    docker:
+      - image: circleci/node:8.11.3-jessie
+    working_directory: ~/ext
+    steps:
+      - restore_cache:
+          key: build-{{ .Environment.CIRCLE_SHA1 }}
+      - run:
+          name: publish
+          command: |
+            yarn global add webext@1.9.1-with-submit.1
+            export PATH="$PATH:$HOME/.config/yarn/global/node_modules/.bin"
+            webext submit --api-key=${FF_API_KEY} --api-secret=${FF_API_SECRET} --id=${FF_ID} -s dist
+
   release:
     docker:
       - image: circleci/golang:1.9
@@ -77,7 +91,15 @@ workflows:
           filters:
             tags:
               only: /^v.*/
-      - publish:
+      - publish_chrome:
+          requires:
+            - build
+          filters:
+            tags:
+              only: /^v.*/
+            branches:
+              ignore: /.*/
+      - publish_firefox:
           requires:
             - build
           filters:
@@ -87,7 +109,7 @@ workflows:
               ignore: /.*/
       - release:
           requires:
-            - publish
+            - publish_chrome
           filters:
             tags:
               only: /^v.*/
diff --git a/src/background.js b/src/background.js
index bc280ff..28b3b23 100644
--- a/src/background.js
+++ b/src/background.js
@@ -83,7 +83,7 @@ const setupContextMenus = async pageContext => {
     }
   }
   createMenus(menus)
-  window.contextMenusClickedHandler = info => _.get(menus, info.menuItemId)
+  window.contextMenusClickedHandler = info => _.get(menus, info.menuItemId)()
 }
 
 const dynamicDisableMenu = async () => {
@@ -118,7 +118,7 @@ const init = async () => {
       if (changes.browserAction) updateBrowserAction(changes.browserAction)
       if ('pageContext' in changes) await setupContextMenus(changes.pageContext)
       await browser.runtime.sendMessage({optionsChangeHandledStatus: 'success'})
-      if (PRODUCTION) Object.keys(changes).map(key => ga('send', 'event', 'Options', key, changes[key]))
+      if (PRODUCTION) Object.keys(changes).map(key => ga('send', 'event', 'Options', key + ':' + changes[key]))
     }
     if (msg.restoreList) {
       const restoreList = msg.restoreList
diff --git a/src/manifest.json b/src/manifest.json
index 0f32a31..3775571 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,7 +1,7 @@
 {
   "manifest_version": 2,
   "name": "__MSG_ext_name__",
-  "version": "1.2.0",
+  "version": "1.2.1",
   "default_locale": "en",
   "description": "__MSG_ext_desc__",
   "author": "WangJie <doudou19758@gmail.com>",