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

Commit

Permalink
Merge pull request #10725 from siemiatj/bug_888181
Browse files Browse the repository at this point in the history
Bug 888181 - Remove all prefixed usages of mozvisibilitychange and mozHi...
  • Loading branch information
michalbe committed Jul 2, 2013
2 parents 37f38d2 + e86c651 commit 5bf9d53
Show file tree
Hide file tree
Showing 38 changed files with 105 additions and 105 deletions.
8 changes: 4 additions & 4 deletions apps/browser/js/browser.js
Expand Up @@ -244,7 +244,7 @@ var Browser = {
this.screenSwipeMngr[evt].bind(this.screenSwipeMngr));
}, this);

document.addEventListener('mozvisibilitychange',
document.addEventListener('visibilitychange',
this.handleVisibilityChange.bind(this));

ModalDialog.init();
Expand Down Expand Up @@ -611,7 +611,7 @@ var Browser = {
handleCrashedTab: function browser_handleCrashedTab(tab) {
// No need to show the crash screen for background tabs,
// they will be revived when selected
if (tab.id === this.currentTab.id && !document.mozHidden) {
if (tab.id === this.currentTab.id && !document.hidden) {
this.showCrashScreen();
}
tab.loading = false;
Expand All @@ -625,12 +625,12 @@ var Browser = {
},

handleVisibilityChange: function browser_handleVisibilityChange() {
if (!document.mozHidden && this.currentTab.crashed)
if (!document.hidden && this.currentTab.crashed)
this.reviveCrashedTab(this.currentTab);

// Bug 845661 - Attention screen does not appears when
// the url bar input is focused.
if (document.mozHidden) {
if (document.hidden) {
this.urlInput.blur();
this.currentTab.dom.blur();
}
Expand Down
10 changes: 5 additions & 5 deletions apps/camera/js/camera.js
Expand Up @@ -571,7 +571,7 @@ var Camera = {
Filmstrip.hide();

// User closed app while recording was trying to start
if (document.mozHidden) {
if (document.hidden) {
this.stopRecording();
}
}).bind(this);
Expand Down Expand Up @@ -1145,7 +1145,7 @@ var Camera = {
// Preview may have previously been paused if storage
// was not available
// not trigger preview while in pick mode
if (!this._previewActive && !document.mozHidden && !this._pendingPick) {
if (!this._previewActive && !document.hidden && !this._pendingPick) {
this.startPreview();
}
this.showOverlay(null);
Expand Down Expand Up @@ -1233,7 +1233,7 @@ var Camera = {
},

initPositionUpdate: function camera_initPositionUpdate() {
if (this._watchId || document.mozHidden) {
if (this._watchId || document.hidden) {
return;
}
this._watchId = navigator.geolocation
Expand Down Expand Up @@ -1272,8 +1272,8 @@ var Camera = {

Camera.init();

document.addEventListener('mozvisibilitychange', function() {
if (document.mozHidden) {
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
Camera.stopPreview();
Camera.cancelPick();
Camera.cancelPositionUpdate();
Expand Down
8 changes: 4 additions & 4 deletions apps/clock/js/alarm.js
Expand Up @@ -45,7 +45,7 @@ var ClockView = {
init: function cv_init() {
this.container = document.getElementById('analog-clock-container');

document.addEventListener('mozvisibilitychange', this);
document.addEventListener('visibilitychange', this);

this.updateDaydate();
this.initClockface();
Expand Down Expand Up @@ -152,8 +152,8 @@ var ClockView = {

handleEvent: function cv_handleEvent(evt) {
switch (evt.type) {
case 'mozvisibilitychange':
if (document.mozHidden) {
case 'visibilitychange':
if (document.hidden) {
if (this._updateDaydateTimeout) {
window.clearTimeout(this._updateDaydateTimeout);
}
Expand All @@ -164,7 +164,7 @@ var ClockView = {
window.clearTimeout(this._updateAnalogClockTimeout);
}
return;
} else if (!document.mozHidden) {
} else if (!document.hidden) {
// Refresh the view when app return to foreground.
this.updateDaydate();
if (this._clockMode === 'digital') {
Expand Down
18 changes: 9 additions & 9 deletions apps/clock/js/onring.js
Expand Up @@ -38,22 +38,22 @@ var RingView = {
},

init: function rv_init() {
document.addEventListener('mozvisibilitychange', this);
document.addEventListener('visibilitychange', this);
this._onFireAlarm = window.opener.ActiveAlarm.getOnFireAlarm();
var self = this;
if (!document.mozHidden) {
if (!document.hidden) {
this.startAlarmNotification();
} else {
// The setTimeout() is used to workaround
// https://bugzilla.mozilla.org/show_bug.cgi?id=810431
// The workaround is used in screen off mode.
// mozHidden will be true in init() state.
window.setTimeout(function rv_checkMozHidden() {
// If mozHidden is true in init state,
// hidden will be true in init() state.
window.setTimeout(function rv_checkHidden() {
// If hidden is true in init state,
// it means that the incoming call happens before the alarm.
// We should just put a "silent" alarm screen
// underneath the oncall screen
if (!document.mozHidden) {
if (!document.hidden) {
self.startAlarmNotification();
}
// Our final chance is to rely on visibilitychange event handler.
Expand Down Expand Up @@ -187,10 +187,10 @@ var RingView = {

handleEvent: function rv_handleEvent(evt) {
switch (evt.type) {
case 'mozvisibilitychange':
// There's chance to miss the mozHidden state when inited,
case 'visibilitychange':
// There's chance to miss the hidden state when inited,
// before setVisible take effects, there may be a latency.
if (!document.mozHidden) {
if (!document.hidden) {
this.startAlarmNotification();
}
break;
Expand Down
6 changes: 3 additions & 3 deletions apps/communications/contacts/js/contacts.js
Expand Up @@ -834,13 +834,13 @@ var Contacts = (function() {
window.addEventListener('online', Contacts.onLineChanged);
window.addEventListener('offline', Contacts.onLineChanged);

document.addEventListener('mozvisibilitychange', function visibility(e) {
if (ActivityHandler.currentlyHandling && document.mozHidden) {
document.addEventListener('visibilitychange', function visibility(e) {
if (ActivityHandler.currentlyHandling && document.hidden) {
ActivityHandler.postCancel();
return;
}
Contacts.checkCancelableActivity();
if (document.mozHidden === false &&
if (document.hidden === false &&
navigation.currentView() === 'view-settings') {
contacts.Settings.updateTimestamps();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/communications/dialer/js/call_log.js
Expand Up @@ -68,7 +68,7 @@ var CallLog = {
self.deselectAll.bind(self));
self.deleteButton.addEventListener('click',
self.deleteLogGroups.bind(self));
document.addEventListener('mozvisibilitychange', function() {
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
self.pauseHeaders();
} else {
Expand Down
4 changes: 2 additions & 2 deletions apps/communications/dialer/js/dialer.js
Expand Up @@ -535,8 +535,8 @@ window.onresize = function(e) {
// issue in Gecko where the Audio Data API causes gfx performance problems,
// in particular when scrolling the homescreen.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=779914
document.addEventListener('mozvisibilitychange', function visibilitychanged() {
if (!document.mozHidden) {
document.addEventListener('visibilitychange', function visibilitychanged() {
if (!document.hidden) {
TonePlayer.ensureAudio();
} else {
// Reset the audio stream. This ensures that the stream is shutdown
Expand Down
4 changes: 2 additions & 2 deletions apps/costcontrol/js/app.js
Expand Up @@ -266,9 +266,9 @@ var CostControlApp = (function() {
);

// Check card state when visible
document.addEventListener('mozvisibilitychange',
document.addEventListener('visibilitychange',
function _onVisibilityChange(evt) {
if (!document.mozHidden && initialized) {
if (!document.hidden && initialized) {
checkCardState();
}
}
Expand Down
6 changes: 3 additions & 3 deletions apps/costcontrol/js/views/balance.js
Expand Up @@ -56,7 +56,7 @@ var BalanceTab = (function() {
window.addEventListener('localized', localize);

// Configure updates
document.addEventListener('mozvisibilitychange', updateWhenVisible);
document.addEventListener('visibilitychange', updateWhenVisible);
updateButton.addEventListener('click', lockAndUpdateUI);
ConfigManager.observe('lowLimit', toogleLimits, true);
ConfigManager.observe('lowLimitThreshold', resetNotification, true);
Expand Down Expand Up @@ -88,7 +88,7 @@ var BalanceTab = (function() {
return;
}

document.removeEventListener('mozvisibilitychange', updateWhenVisible);
document.removeEventListener('visibilitychange', updateWhenVisible);
updateButton.removeEventListener('click', lockAndUpdateUI);
ConfigManager.removeObserver('lowLimit', toogleLimits);
ConfigManager.removeObserver('lowLimitThreshold', resetNotification);
Expand All @@ -110,7 +110,7 @@ var BalanceTab = (function() {

// On showing the application
function updateWhenVisible() {
if (!document.mozHidden && initialized) {
if (!document.hidden && initialized) {
updateUI();
} else {
clearInterval(topUpCountdown);
Expand Down
6 changes: 3 additions & 3 deletions apps/costcontrol/js/views/datausage.js
Expand Up @@ -45,7 +45,7 @@ var DataUsageTab = (function() {
window.addEventListener('localized', localize);

// Update and chart visibility
document.addEventListener('mozvisibilitychange', updateWhenVisible);
document.addEventListener('visibilitychange', updateWhenVisible);
wifiToggle.addEventListener('click', toggleWifi);
mobileToggle.addEventListener('click', toggleMobile);

Expand Down Expand Up @@ -109,7 +109,7 @@ var DataUsageTab = (function() {
return;
}

document.removeEventListener('mozvisibilitychange', updateWhenVisible);
document.removeEventListener('visibilitychange', updateWhenVisible);
wifiToggle.removeEventListener('click', toggleWifi);
mobileToggle.removeEventListener('click', toggleMobile);
ConfigManager.removeObserver('dataLimit', toggleDataLimit);
Expand Down Expand Up @@ -156,7 +156,7 @@ var DataUsageTab = (function() {

// On visibility change
function updateWhenVisible(evt) {
if (!document.mozHidden) {
if (!document.hidden) {
requestDataUsage();
}
}
Expand Down
6 changes: 3 additions & 3 deletions apps/costcontrol/js/views/telephony.js
Expand Up @@ -29,7 +29,7 @@ var TelephonyTab = (function() {
window.addEventListener('localized', localize);

// Configure updates
document.addEventListener('mozvisibilitychange', updateWhenVisible, true);
document.addEventListener('visibilitychange', updateWhenVisible, true);
ConfigManager.observe('lastTelephonyActivity', updateCounters, true);
ConfigManager.observe('lastTelephonyReset', updateUI, true);
ConfigManager.observe('nextReset', updateNextReset, true);
Expand All @@ -50,7 +50,7 @@ var TelephonyTab = (function() {
return;
}

document.removeEventListener('mozvisibilitychange', updateWhenVisible);
document.removeEventListener('visibilitychange', updateWhenVisible);
ConfigManager.removeObserver('lastTelephonyActivity', updateCounters);
ConfigManager.removeObserver('lastTelephonyReset', updateUI);
ConfigManager.removeObserver('nextReset', updateNextReset);
Expand All @@ -59,7 +59,7 @@ var TelephonyTab = (function() {
}

function updateWhenVisible() {
if (!document.mozHidden && initialized) {
if (!document.hidden && initialized) {
updateUI();
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/costcontrol/js/widget.js
Expand Up @@ -110,9 +110,9 @@ var Widget = (function() {
);

// Update UI when visible
document.addEventListener('mozvisibilitychange',
document.addEventListener('visibilitychange',
function _onVisibilityChange(evt) {
if (!document.mozHidden && initialized &&
if (!document.hidden && initialized &&
checkCardState() === 'ready') {
updateUI();
}
Expand Down
6 changes: 3 additions & 3 deletions apps/email/js/compose-cards.js
Expand Up @@ -49,7 +49,7 @@ function ComposeCard(domNode, mode, args) {
this.sendButton = domNode.getElementsByClassName('cmp-send-btn')[0];
this.sendButton.addEventListener('click', this.onSend.bind(this), false);
this._bound_onVisibilityChange = this.onVisibilityChange.bind(this);
document.addEventListener('mozvisibilitychange',
document.addEventListener('visibilitychange',
this._bound_onVisibilityChange);

this.toNode = domNode.getElementsByClassName('cmp-to-text')[0];
Expand Down Expand Up @@ -569,7 +569,7 @@ ComposeCard.prototype = {
* Save the draft if there's anything to it, close the card.
*/
onVisibilityChange: function() {
if (document.mozHidden && this._saveNeeded()) {
if (document.hidden && this._saveNeeded()) {
this._saveDraft();
}
},
Expand Down Expand Up @@ -678,7 +678,7 @@ ComposeCard.prototype = {
},

die: function() {
document.removeEventListener('mozvisibilitychange',
document.removeEventListener('visibilitychange',
this._bound_onVisibilityChange);
this.composer.die();
this.composer = null;
Expand Down
4 changes: 2 additions & 2 deletions apps/gallery/js/gallery.js
Expand Up @@ -843,8 +843,8 @@ function cleanupPick() {
// Remove this code when https://github.com/mozilla-b2g/gaia/issues/2916
// is fixed and replace it with an onerror handler on the activity to
// switch out of pickView.
window.addEventListener('mozvisibilitychange', function() {
if (document.mozHidden && pendingPick)
window.addEventListener('visibilitychange', function() {
if (document.hidden && pendingPick)
cancelPick();
});

Expand Down
6 changes: 3 additions & 3 deletions apps/homescreen/js/homescreen.js
Expand Up @@ -68,12 +68,12 @@ var Homescreen = (function() {
GridManager.exitFromEditMode();
}

document.addEventListener('mozvisibilitychange', function mozVisChange() {
if (document.mozHidden && Homescreen.isInEditMode()) {
document.addEventListener('visibilitychange', function mozVisChange() {
if (document.hidden && Homescreen.isInEditMode()) {
exitFromEditMode();
}

if (document.mozHidden == false) {
if (document.hidden == false) {
setTimeout(function forceRepaint() {
var helper = document.getElementById('repaint-helper');
helper.classList.toggle('displayed');
Expand Down
4 changes: 2 additions & 2 deletions apps/homescreen/js/landing.js
Expand Up @@ -31,8 +31,8 @@ const LandingPage = (function() {
evt.stopImmediatePropagation();
});

document.addEventListener('mozvisibilitychange', function mozVisChange() {
if (document.mozHidden === false) {
document.addEventListener('visibilitychange', function mozVisChange() {
if (document.hidden === false) {
startClock();
} else {
stopClock();
Expand Down
4 changes: 2 additions & 2 deletions apps/homescreen/js/save-bookmark.js
Expand Up @@ -23,8 +23,8 @@ if (navigator.mozSetMessageHandler) {
oncancelled: addBookmarkCancelled
};
BookmarkEditor.init(options);
document.addEventListener('mozvisibilitychange', function changed() {
if (document.mozHidden) {
document.addEventListener('visibilitychange', function changed() {
if (document.hidden) {
BookmarkEditor.close();
}
});
Expand Down
2 changes: 1 addition & 1 deletion apps/keyboard/js/keyboard.js
Expand Up @@ -1815,7 +1815,7 @@ var KeyboardMenuScroll = {
function scroll(delta) {

// Stop the scrolling if the user presses the power button or home button
if (document.mozHidden)
if (document.hidden)
return false;

var origScrollTop = keyboardMenu.scrollTop;
Expand Down
4 changes: 2 additions & 2 deletions apps/music/js/Player.js
Expand Up @@ -23,8 +23,8 @@ if (acm) {
});
}

window.addEventListener('mozvisibilitychange', function() {
if (document.mozHidden) {
window.addEventListener('visibilitychange', function() {
if (document.hidden) {
PlayerView.audio.removeEventListener('timeupdate', PlayerView);
} else {
PlayerView.audio.addEventListener('timeupdate', PlayerView);
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/js/app_storage.js
Expand Up @@ -75,8 +75,8 @@ navigator.mozL10n.ready(function SettingsAppStorage() {
AppStorage.init(updateInfo);
AppStorage.update();

document.addEventListener('mozvisibilitychange', function visibilityChange() {
if (!document.mozHidden) {
document.addEventListener('visibilitychange', function visibilityChange() {
if (!document.hidden) {
AppStorage.attachListeners();
AppStorage.update();
} else {
Expand Down

0 comments on commit 5bf9d53

Please sign in to comment.