Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Revert "Merge pull request #22068 from mancas/bug929311"
Browse files Browse the repository at this point in the history
This reverts commit c0a8ceb, reversing
changes made to 89b3cd5.
  • Loading branch information
timdream committed Jul 31, 2014
1 parent f3f3a79 commit 34df823
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 98 deletions.
46 changes: 1 addition & 45 deletions apps/system/js/update_manager.js
Expand Up @@ -35,7 +35,6 @@ var UpdateManager = {
downloadViaDataConnectionButton: null,
downloadDialog: null,
downloadViaDataConnectionDialog: null,
downloadViaDataConnectionMessage: null,
downloadDialogTitle: null,
downloadDialogList: null,
lastUpdatesAvailable: 0,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 };
Expand Down
4 changes: 1 addition & 3 deletions apps/system/locales/system.en-US.properties
Expand Up @@ -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
Expand Down
50 changes: 0 additions & 50 deletions apps/system/test/unit/update_manager_test.js
Expand Up @@ -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);
Expand Down Expand Up @@ -1187,53 +1176,14 @@ 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');
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,
'downloadUpdatesViaDataRoamingConnection');
assert.deepEqual(messageL10nId,
'downloadUpdatesViaDataRoamingConnectionMessage');
});

test('should handle clicking download when using wifi', function() {
Expand Down

0 comments on commit 34df823

Please sign in to comment.