Backed out changeset 3cb69bac2eac (bug 1417577) at eoger's request.

This commit is contained in:
Brindusan Cristian 2018-05-30 01:39:37 +03:00
parent 0979d39d45
commit fc99ada428
2 changed files with 1 additions and 34 deletions

View File

@ -79,12 +79,6 @@ SyncedTabsDeckComponent.prototype = {
// if this engine is disabled and refresh the UI one last time.
Services.obs.addObserver(this, "weave:service:ready");
// Add intl.uidirection support for HTML sidebar
XPCOMUtils.defineLazyPreferenceGetter(this, "dirPref", "intl.uidirection", -1,
(pref, oldVal, newVal) => { this.updateDir(newVal); }
);
this.updateDir();
// Go ahead and trigger sync
this._SyncedTabs.syncTabs()
.catch(Cu.reportError);
@ -123,11 +117,6 @@ SyncedTabsDeckComponent.prototype = {
case "weave:service:login:change":
this.updatePanel();
break;
case "nsPref:changed":
if (data == "intl.uidirection") {
this.updateDir();
}
break;
default:
break;
}
@ -169,21 +158,6 @@ SyncedTabsDeckComponent.prototype = {
});
},
updateDir(pref) {
console.log("Called updateDir lmao");
console.log(`called pref: <${pref}>, config pref: <${this.dirPref}>`);
pref = pref || this.dirPref;
// If the HTML document doesn't exist, we can't update the window
if (!this._window.document) return;
if (pref > 0 || (pref < 0 && Services.locale.isAppLocaleRTL)) {
this._window.document.body.dir = "rtl";
} else {
this._window.document.body.dir = "ltr";
}
},
updatePanel() {
// return promise for tests
return this.getPanelStatus()

View File

@ -94,7 +94,7 @@ add_task(async function testObserver() {
sinon.stub(listStore, "getData");
let component = new SyncedTabsDeckComponent({
window: mockWindow,
mockWindow,
deckStore,
listStore,
listComponent,
@ -104,12 +104,10 @@ add_task(async function testObserver() {
sinon.spy(component, "observe");
sinon.stub(component, "updatePanel");
sinon.spy(component, "updateDir");
component.init();
SyncedTabs.syncTabs.restore();
Assert.ok(component.updatePanel.called, "triggers panel update during init");
Assert.ok(component.updateDir.called, "triggers UI direction update during init");
Services.obs.notifyObservers(null, SyncedTabs.TOPIC_TABS_CHANGED);
@ -130,11 +128,6 @@ add_task(async function testObserver() {
Assert.ok(component.observe.calledWith(null, "weave:service:login:change"),
"component is notified of login change");
Assert.equal(component.updatePanel.callCount, 4, "triggers panel update again");
Services.prefs.setIntPref("intl.uidirection", 1);
Assert.ok(component.updateDir.calledTwice, "triggers UI direction update");
Assert.ok(component.updateDir.calledWith(1), "updates UI direction to RTL");
});
add_task(async function testPanelStatus() {