Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Unified Diff: remoting/client/appengine/static_files/chromoting_session.js

Issue 7065036: Add basic versioning check to Chromoting's plugin/JS code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/client/plugin/chromoting_scriptable_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/appengine/static_files/chromoting_session.js
diff --git a/remoting/client/appengine/static_files/chromoting_session.js b/remoting/client/appengine/static_files/chromoting_session.js
index b6960dfedd0765e8682b53f47a8c29e2a248308e..370a788e4ea172113dd1a378c407397215f690f6 100644
--- a/remoting/client/appengine/static_files/chromoting_session.js
+++ b/remoting/client/appengine/static_files/chromoting_session.js
@@ -6,6 +6,16 @@
// Only the most recent <n> lines are displayed.
var MAX_DEBUG_LOG_SIZE = 1000;
+// Chromoting session API version (for this javascript).
+// This is compared with the plugin API version to verify that they are
+// compatible.
+chromoting.apiVersion = 1;
+
+// The oldest API version that we support.
+// This will differ from the |apiVersion| if we decide to maintain backward
+// compatibility with older API versions.
+chromoting.apiMinVersion = 1;
+
// Message id so that we can identify (and ignore) message fade operations for
// old messages. This starts at 1 and is incremented for each new message.
chromoting.messageId = 1;
@@ -94,6 +104,11 @@ function sendIq(msg) {
"&host_jid=" + encodeURIComponent(chromoting.hostjid));
}
+function checkVersion(plugin) {
+ return chromoting.apiVersion >= plugin.apiMinVersion &&
+ plugin.apiVersion >= chromoting.apiMinVersion;
+}
+
function init() {
// Kick off the connection.
var plugin = document.getElementById('chromoting');
@@ -124,6 +139,12 @@ function init() {
plugin.desktopSizeUpdate = desktopSizeChanged;
plugin.loginChallenge = loginChallengeCallback;
+ if (!checkVersion(plugin)) {
+ // TODO(garykac): We need better messaging here. Perhaps an install link.
+ setClientStateMessage("Out of date. Please re-install.");
+ return;
+ }
+
addToDebugLog('Connect to ' + chromoting.hostname + ' as user ' +
chromoting.username);
« no previous file with comments | « no previous file | remoting/client/plugin/chromoting_scriptable_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698