Bug 1492856 - Remove compatiblity code to guard against miss of RootActor.getRoot r=jdescottes

MozReview-Commit-ID: L5kkG9r7Rtv

Differential Revision: https://phabricator.services.mozilla.com/D6755

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2018-09-26 21:12:16 +00:00
parent 4c1bb0403e
commit 3ad83b9241
4 changed files with 31 additions and 21 deletions

View File

@ -718,7 +718,7 @@ var UI = {
async checkRuntimeVersion() {
if (AppManager.connected) {
const { client } = AppManager.connection;
const report = await client.checkRuntimeVersion(AppManager.listTabsForm);
const report = await client.checkRuntimeVersion();
if (report.incompatible == "too-recent") {
this.reportError("error_runtimeVersionTooRecent", report.runtimeID,
report.localID);

View File

@ -152,16 +152,17 @@ var AppManager = exports.AppManager = {
this.preferenceFront = null;
} else {
const response = await this.connection.client.listTabs();
// RootClient.getRoot request was introduced in FF59, but RootClient.getFront
// expects it to work. Override its root form with the listTabs results (which is
// an equivalent) in orfer to fix RootClient.getFront.
Object.defineProperty(this.connection.client.mainRoot, "rootForm", {
value: response
});
this._listTabsResponse = response;
this.deviceFront = await this.connection.client.mainRoot.getFront("device");
this.preferenceFront = await this.connection.client.mainRoot.getFront("preference");
this._recordRuntimeInfo();
try {
this.deviceFront = await this.connection.client.mainRoot.getFront("device");
this.preferenceFront = await this.connection.client.mainRoot.getFront("preference");
this._recordRuntimeInfo();
} catch (e) {
// This may fail on <FF55 (because of lack of bug 1352157) but we will want to
// emit runtime-global-actors in order to call checkRuntimeVersion and display
// the compatibility popup.
console.error(e);
}
this.update("runtime-global-actors");
}
@ -512,10 +513,6 @@ var AppManager = exports.AppManager = {
this._listTabsResponse.consoleActor);
},
get listTabsForm() {
return this._listTabsResponse;
},
disconnectRuntime: function() {
if (!this.connected) {
return Promise.resolve();

View File

@ -206,18 +206,34 @@ DebuggerClient.prototype = {
* * String deviceID
* Build ID of remote runtime. A date with like this: YYYYMMDD.
*/
async checkRuntimeVersion(listTabsForm) {
let incompatible = null;
async checkRuntimeVersion() {
const localID = Services.appinfo.appBuildID.substr(0, 8);
const deviceFront = await this.mainRoot.getFront("device");
let deviceFront;
try {
deviceFront = await this.mainRoot.getFront("device");
} catch (e) {
// On <FF55, getFront is going to call RootActor.getRoot and fail
// because this method doesn't exists.
if (e.error == "unrecognizedPacketType") {
return {
incompatible: "too-old",
minVersion: MIN_SUPPORTED_PLATFORM_VERSION,
runtimeVersion: "<55",
localID,
runtimeID: "?",
};
}
throw e;
}
const desc = await deviceFront.getDescription();
let incompatible = null;
// 1) Check for Firefox too recent on device.
// Compare device and firefox build IDs
// and only compare by day (strip hours/minutes) to prevent
// warning against builds of the same day.
const runtimeID = desc.appbuildid.substr(0, 8);
const localID = Services.appinfo.appBuildID.substr(0, 8);
function buildIDToDate(buildID) {
const fields = buildID.match(/(\d{4})(\d{2})(\d{2})/);
// Date expects 0 - 11 for months

View File

@ -35,9 +35,6 @@ function RootClient(client, greeting) {
this.traits = greeting.traits;
// Cache root form as this will always be the same value.
//
// Note that rootForm is overloaded by DebuggerClient.checkRuntimeVersion
// in order to support <FF59 that doesn't support getRoot request.
Object.defineProperty(this, "rootForm", {
get() {
delete this.rootForm;