Bug 1132670 - Warn when connecting to a server newer than client. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 03 Jun 2015 07:15:00 -0400
changeset 248027 9b3205f611cfdcac7c3aa2dbfe49e7305de53c91
parent 248026 8738bdb29cb42c879d328b63ecb78daeadbed270
child 248028 3a4faf863320f5feeaab2a97f5139a5700f63d9e
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1132670
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1132670 - Warn when connecting to a server newer than client. r=jryans
browser/devtools/webide/content/webide.js
browser/locales/en-US/chrome/browser/devtools/webide.properties
--- a/browser/devtools/webide/content/webide.js
+++ b/browser/devtools/webide/content/webide.js
@@ -206,16 +206,19 @@ let UI = {
         this.updateCommands();
         UI.autoOpenToolbox();
         break;
       case "project-stopped":
         UI.destroyToolbox();
         this.updateCommands();
         break;
       case "runtime-global-actors":
+        // Check runtime version only on runtime-global-actors,
+        // as we expect to use device actor
+        this.checkRuntimeVersion();
         this.updateCommands();
         break;
       case "runtime-details":
         this.updateRuntimeButton();
         break;
       case "runtime":
         this.updateRuntimeButton();
         this.saveLastConnectedRuntime();
@@ -891,16 +894,30 @@ let UI = {
 
   resetDeck: function() {
     this.resetFocus();
     let deck = document.querySelector("#deck");
     deck.selectedPanel = null;
     this.updateProjectEditorMenusVisibility();
   },
 
+  checkRuntimeVersion: Task.async(function* () {
+    if (AppManager.connected && AppManager.deviceFront) {
+      let desc = yield AppManager.deviceFront.getDescription();
+      // Compare device and firefox build IDs
+      // and only compare by day (strip hours/minutes) to prevent
+      // warning against builds of the same day.
+      let deviceID = desc.appbuildid.substr(0, 8);
+      let localID = Services.appinfo.appBuildID.substr(0, 8);
+      if (deviceID > localID) {
+        this.reportError("error_runtimeVersionTooRecent", deviceID, localID);
+      }
+    }
+  }),
+
   /********** TOOLBOX **********/
 
   onMessage: function(event) {
     // The custom toolbox sends a message to its parent
     // window.
     try {
       let json = JSON.parse(event.data);
       switch (json.name) {
--- a/browser/locales/en-US/chrome/browser/devtools/webide.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/webide.properties
@@ -43,16 +43,19 @@ error_operationFail=Operation failed: %1
 error_cantConnectToApp=Can't connect to app: %1$S
 
 # Variable: error message (in english)
 error_cantFetchAddonsJSON=Can't fetch the add-on list: %S
 
 error_appProjectsLoadFailed=Unable to load project list. This can occur if you've used this profile with a newer version of Firefox.
 error_folderCreationFailed=Unable to create project folder in the selected directory.
 
+# Variable: runtime app build ID (looks like this %Y%M%D format) and firefox build ID (same format)
+error_runtimeVersionTooRecent=The connected runtime has a more recent build date (%1$S) than your desktop Firefox (%2$S) does. This is an unsupported setup and may cause DevTools to fail. Please update Firefox.
+
 addons_stable=stable
 addons_unstable=unstable
 # LOCALIZATION NOTE (addons_simulator_label): This label is shown as the name of
 # a given simulator version in the "Manage Simulators" pane.  %1$S: Firefox OS
 # version in the simulator, ex. 1.3.  %2$S: Simulator stability label, ex.
 # "stable" or "unstable".
 addons_simulator_label=Firefox OS %1$S Simulator (%2$S)
 addons_install_button=install