mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 742761 - Remove some warnings in b2g/. r=fabrice
This commit is contained in:
parent
869384f8e3
commit
92028985d5
@ -30,8 +30,14 @@ XPCOMUtils.defineLazyGetter(Services, 'idle', function() {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'audioManager', function() {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
return Cc['@mozilla.org/telephony/audiomanager;1']
|
||||
.getService(Ci.nsIAudioManager);
|
||||
#else
|
||||
return {
|
||||
"masterVolume": 0
|
||||
};
|
||||
#endif
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'fm', function() {
|
||||
@ -79,11 +85,12 @@ var shell = {
|
||||
return Services.prefs.getCharPref('browser.homescreenURL');
|
||||
},
|
||||
|
||||
start: function shell_init() {
|
||||
start: function shell_start() {
|
||||
let homeURL = this.homeURL;
|
||||
if (!homeURL) {
|
||||
let msg = 'Fatal error during startup: No homescreen found: try setting B2G_HOMESCREEN';
|
||||
return alert(msg);
|
||||
alert(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
['keydown', 'keypress', 'keyup'].forEach((function listenKey(type) {
|
||||
@ -100,9 +107,7 @@ var shell = {
|
||||
// a specific value when the device starts. This way the front-end
|
||||
// can display a notification when the volume change and show a volume
|
||||
// level modified from this point.
|
||||
try {
|
||||
Services.audioManager.masterVolume = 0.5;
|
||||
} catch(e) {}
|
||||
Services.audioManager.masterVolume = 0.5;
|
||||
|
||||
let domains = "";
|
||||
try {
|
||||
@ -297,6 +302,7 @@ var shell = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let wakeLockHandler = function wakeLockHandler(topic, state) {
|
||||
// Turn off the screen when no one needs the it or all of them are
|
||||
// invisible, otherwise turn the screen on. Note that the CPU
|
||||
@ -313,7 +319,11 @@ var shell = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let idleTimeout = Services.prefs.getIntPref("power.screen.timeout");
|
||||
if (!('mozSettings' in navigator))
|
||||
return;
|
||||
|
||||
let request = navigator.mozSettings.getLock().get("power.screen.timeout");
|
||||
request.onsuccess = function onSuccess() {
|
||||
idleTimeout = request.result["power.screen.timeout"] || idleTimeout;
|
||||
@ -321,13 +331,15 @@ var shell = {
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
power.addWakeLockListener(wakeLockHandler);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function onError() {
|
||||
if (idleTimeout) {
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
power.addWakeLockListener(wakeLockHandler);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// XXX We may override other's callback here, but this is the only
|
||||
// user of mozSettings in shell.js at this moment.
|
||||
navigator.mozSettings.onsettingchange = function onSettingChange(e) {
|
||||
|
@ -19,14 +19,11 @@
|
||||
#ifndef MOZ_TOUCH
|
||||
<script type="application/javascript" src="chrome://browser/content/touch.js"/>
|
||||
#endif
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
<script type="application/javascript" src="chrome://browser/content/httpd.js"/>
|
||||
#endif
|
||||
|
||||
<browser id="homescreen"
|
||||
type="content-primary"
|
||||
flex="1"
|
||||
style="overflow: hidden;"
|
||||
src="data:text/html,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
|
||||
src="data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
|
||||
</window>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user