Bug 779516 - Handle exceptions in BrowserElementParent.js when calling getBoolPref on an undefined preference. r=jlebar

--HG--
extra : rebase_source : 0459fe8e837addd8f15ebcdad183ca7757f8a704
This commit is contained in:
Dale Harvey 2012-08-01 12:14:10 -04:00
Родитель 4093055296
Коммит 26bb58197a
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -19,6 +19,15 @@ function debug(msg) {
//dump("BrowserElementParent - " + msg + "\n");
}
function getBoolPref(prefName, def) {
try {
return Services.prefs.getBoolPref(prefName);
}
catch(err) {
return def;
}
}
/**
* BrowserElementParent implements one half of <iframe mozbrowser>. (The other
* half is, unsurprisingly, BrowserElementChild.)
@ -189,7 +198,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
// Define methods on the frame element.
defineMethod('setVisible', this._setVisible);
defineMethod('sendMouseEvent', this._sendMouseEvent);
if (Services.prefs.getBoolPref(TOUCH_EVENTS_ENABLED_PREF)) {
if (getBoolPref(TOUCH_EVENTS_ENABLED_PREF, false)) {
defineMethod('sendTouchEvent', this._sendTouchEvent);
}
defineMethod('goBack', this._goBack);