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

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: remove logging 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..b55071f94678f751db9f6c9430b29c9134ce4805 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 = 42;
Jamie 2011/05/25 00:29:34 Apart from the HHGTTG reference, why 42? Left-over
garykac 2011/05/25 16:39:44 Indeed. leftover debugging. I fixed up the webapp
+
+// 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