Index: remoting/webapp/crd/js/remoting.js |
diff --git a/remoting/webapp/crd/js/remoting.js b/remoting/webapp/crd/js/remoting.js |
index f80d9f064944d4708090450e080084fbdf45b037..b8acbd6bf7eb7260c65f16a244e0a27c4bb23bd8 100644 |
--- a/remoting/webapp/crd/js/remoting.js |
+++ b/remoting/webapp/crd/js/remoting.js |
@@ -21,8 +21,6 @@ remoting.initGlobalObjects = function() { |
if (base.isAppsV2()) { |
var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); |
htmlNode.classList.add('apps-v2'); |
- } else { |
- migrateLocalToChromeStorage_(); |
} |
console.log(remoting.getExtensionInfo()); |
@@ -89,10 +87,16 @@ remoting.getExtensionInfo = function() { |
} |
}; |
+remoting.onBeforeUnload = function() { |
+ migrateLocalToChromeStorage_(); |
+ return remoting.promptClose(); |
+}; |
+ |
/** |
* If an IT2Me client or host is active then prompt the user before closing. |
* If a Me2Me client is active then don't bother, since closing the window is |
* the more intuitive way to end a Me2Me session, and re-connecting is easy. |
+ * @return {?string} |
*/ |
remoting.promptClose = function() { |
if (remoting.clientSession && |
@@ -242,15 +246,13 @@ function migrateLocalToChromeStorage_() { |
'oauth2-refresh-token', |
'oauth2-refresh-token-revokable', |
'oauth2-access-token', |
- 'oauth2-xsrf-token', |
- 'remoting-email' |
+ 'oauth2-xsrf-token' |
]; |
for (var setting in window.localStorage) { |
if (oauthSettings.indexOf(setting) == -1) { |
- var copy = {} |
+ var copy = {}; |
copy[setting] = window.localStorage.getItem(setting); |
chrome.storage.local.set(copy); |
- window.localStorage.removeItem(setting); |
} |
} |
} |