From 34df8238f7367ac99b6897a073b9cc2f82f5371a Mon Sep 17 00:00:00 2001 From: Timothy Guan-tin Chien Date: Thu, 31 Jul 2014 10:08:39 +0800 Subject: [PATCH] Revert "Merge pull request #22068 from mancas/bug929311" This reverts commit c0a8cebe31c49a90c443226710aef36c1e62bdc2, reversing changes made to 89b3cd51330ae0ae848057a8d453c252e147e61d. --- apps/system/js/update_manager.js | 46 +----------------- apps/system/locales/system.en-US.properties | 4 +- apps/system/test/unit/update_manager_test.js | 50 -------------------- 3 files changed, 2 insertions(+), 98 deletions(-) diff --git a/apps/system/js/update_manager.js b/apps/system/js/update_manager.js index 0a8f8af44e3a..a4c9ee5bdec1 100644 --- a/apps/system/js/update_manager.js +++ b/apps/system/js/update_manager.js @@ -35,7 +35,6 @@ var UpdateManager = { downloadViaDataConnectionButton: null, downloadDialog: null, downloadViaDataConnectionDialog: null, - downloadViaDataConnectionMessage: null, downloadDialogTitle: null, downloadDialogList: null, lastUpdatesAvailable: 0, @@ -79,10 +78,6 @@ var UpdateManager = { this.downloadDialogList = this.downloadDialog.querySelector('ul'); this.downloadViaDataConnectionDialog = document.getElementById('updates-viaDataConnection-dialog'); - this.downloadViaDataConnectionMessage = - this.downloadViaDataConnectionDialog.querySelector('p'); - this.downloadViaDataConnectionTitle = - this.downloadViaDataConnectionDialog.querySelector('h1'); this.container.onclick = this.containerClicked.bind(this); this.laterButton.onclick = this.cancelPrompt.bind(this); @@ -122,7 +117,7 @@ var UpdateManager = { } else { if (this._dataConnectionWarningEnabled && this.downloadDialog.dataset.nowifi === 'true') { - this._openDownloadViaDataDialog(); + this.downloadViaDataConnectionDialog.classList.add('visible'); } else { this._startedDownloadUsingDataConnection = false; this.startDownloads(); @@ -593,45 +588,6 @@ var UpdateManager = { }); }, - _openDownloadViaDataDialog: function um_downloadViaDataDialog() { - var _ = navigator.mozL10n.setAttributes; - - var dataRoamingSettingPromise = this._getDataRoamingSetting(); - dataRoamingSettingPromise.then(function(dataRoamingSetting) { - if (dataRoamingSetting) { - _(this.downloadViaDataConnectionTitle, - 'downloadUpdatesViaDataRoamingConnection'); - _(this.downloadViaDataConnectionMessage, - 'downloadUpdatesViaDataRoamingConnectionMessage'); - } else { - _(this.downloadViaDataConnectionTitle, - 'downloadUpdatesViaDataConnection'); - _(this.downloadViaDataConnectionMessage, - 'downloadUpdatesViaDataConnectionMessage'); - } - - this.downloadViaDataConnectionDialog.classList.add('visible'); - }.bind(this)); - }, - - _getDataRoamingSetting: function um_getDataRoamingSetting() { - var lock = this._settings.createLock(), - reqDataRoaming = lock.get('ril.data.roaming_enabled'), - dataRoamingSettingPromise; - - dataRoamingSettingPromise = new Promise(function(resolve, reject) { - reqDataRoaming.onsuccess = function() { - resolve(reqDataRoaming.result['ril.data.roaming_enabled']); - }; - - reqDataRoaming.onerror = function() { - resolve(false); - }; - }); - - return dataRoamingSettingPromise; - }, - _dispatchEvent: function um_dispatchEvent(type, result) { var event = document.createEvent('CustomEvent'); var data = { type: type }; diff --git a/apps/system/locales/system.en-US.properties b/apps/system/locales/system.en-US.properties index 18cff029baa4..ee7919982dae 100644 --- a/apps/system/locales/system.en-US.properties +++ b/apps/system/locales/system.en-US.properties @@ -236,9 +236,7 @@ downloadNoWifiWarning=Wi-Fi unavailable. Updating over current connection may in downloadOfflineWarning=Connection unavailable. Connect to a network to download updates. downloadDataConnectionWarning=Updates are downloaded via data connection when Wi-Fi is not available. Additional data charges may apply. downloadUpdatesViaDataConnection=Download updates via data connection? -downloadUpdatesViaDataConnectionMessage=When using a data connection, additional charges may apply. Do you want to continue? -downloadUpdatesViaDataRoamingConnection=Download updates via data roaming? -downloadUpdatesViaDataRoamingConnectionMessage=You are currently roaming and additional charges may apply. Do you want to continue? +downloadUpdatesViaDataConnectionMessage=Updates are downloaded via data connection when Wi-Fi is not available. When using data connection, phone calls may be blocked and additional charges may also apply. # screenshots screenshotSaved = Screenshot saved to Gallery diff --git a/apps/system/test/unit/update_manager_test.js b/apps/system/test/unit/update_manager_test.js index 02ddb67ace9d..2d8bd27876d0 100644 --- a/apps/system/test/unit/update_manager_test.js +++ b/apps/system/test/unit/update_manager_test.js @@ -1093,17 +1093,6 @@ suite('system/UpdateManager', function() { UpdateManager.downloadDialog.dataset.nowifi = false; }); - var fakeSyncPromiseWithValue = - function mum_fakeSyncPromiseWithValue(value) { - return function _fakeStub() { - return { - then: function then(callback) { - callback(value); - } - }; - }; - }; - suite('download prompt', function() { test('should hide the utility tray', function() { assert.isFalse(MockUtilityTray.mShown); @@ -1187,34 +1176,6 @@ suite('system/UpdateManager', function() { test('should handle clicking download when using data connection ' + 'in the first time', function() { - this.sinon.stub(UpdateManager, '_getDataRoamingSetting', - fakeSyncPromiseWithValue(false)); - UpdateManager.downloadDialog.dataset.nowifi = true; - - var evt = document.createEvent('MouseEvents'); - evt.initEvent('click', true, true); - - UpdateManager.requestDownloads(evt); - var css = UpdateManager.downloadViaDataConnectionDialog.classList; - var titleL10nId = - UpdateManager.downloadViaDataConnectionTitle - .getAttribute('data-l10n-id'); - var messageL10nId = - UpdateManager.downloadViaDataConnectionMessage - .getAttribute('data-l10n-id'); - - assert.isTrue(css.contains('visible')); - assert.deepEqual(titleL10nId, - 'downloadUpdatesViaDataConnection'); - assert.deepEqual(messageL10nId, - 'downloadUpdatesViaDataConnectionMessage'); - }); - - test('should handle clicking download when using data ' + - 'connection roaming in the first time', - function() { - this.sinon.stub(UpdateManager, '_getDataRoamingSetting', - fakeSyncPromiseWithValue(true)); UpdateManager.downloadDialog.dataset.nowifi = true; var evt = document.createEvent('MouseEvents'); @@ -1222,18 +1183,7 @@ suite('system/UpdateManager', function() { UpdateManager.requestDownloads(evt); var css = UpdateManager.downloadViaDataConnectionDialog.classList; - var titleL10nId = - UpdateManager.downloadViaDataConnectionTitle - .getAttribute('data-l10n-id'); - var messageL10nId = - UpdateManager.downloadViaDataConnectionMessage - .getAttribute('data-l10n-id'); - assert.isTrue(css.contains('visible')); - assert.deepEqual(titleL10nId, - 'downloadUpdatesViaDataRoamingConnection'); - assert.deepEqual(messageL10nId, - 'downloadUpdatesViaDataRoamingConnectionMessage'); }); test('should handle clicking download when using wifi', function() {