Set cookie for both gwt and polygerrit UI
Change-Id: I33927d817ca46cce053a44d5759476faca1815ac
diff --git a/background.js b/background.js
index 0f8cfdf..6744618 100644
--- a/background.js
+++ b/background.js
@@ -204,9 +204,17 @@
url: tab.url,
};
chrome.cookies.get(cookieID, function(cookie) {
- if (cookie) {
+ if (cookie && cookie.value === 'polygerrit') {
ga('send', 'event', 'Page Action', 'Switch to Gerrit');
- chrome.cookies.remove(cookieID, function() {
+ chrome.cookies.set({
+ expirationDate: twoYearsFromNow,
+ url: tab.url,
+ name: 'GERRIT_UI',
+ value: 'gwt',
+ httpOnly: true,
+ path: '/',
+ secure: true,
+ }, function() {
// The GWT UI does not handle PolyGerrit URL redirection.
chrome.tabs.update(tab.id, {
url: getGWTRedirectURL(new URL(tab.url)),
diff --git a/manifest.json b/manifest.json
index 2a6aa49..772df9a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Gerrit UI Switcher",
"description": "Easily switch between the current Gerrit UI and the new PolyGerrit UI",
- "version": "0.5.4",
+ "version": "0.6.0",
"background": {
"scripts": [
"background.js"