mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1220688 - catch and ignore JS exceptions when working with nsAutoJSString. r=bz
This commit is contained in:
parent
4113691556
commit
7aa8b55eb3
@ -260,6 +260,7 @@ nsGeolocationSettings::HandleGeolocationPerOriginSettingsChange(const JS::Value&
|
||||
// if it is an app that is always precise, skip it
|
||||
nsAutoJSString origin;
|
||||
if (!origin.init(cx, id)) {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
continue;
|
||||
}
|
||||
if (mAlwaysPreciseApps.Contains(origin)) {
|
||||
@ -268,7 +269,8 @@ nsGeolocationSettings::HandleGeolocationPerOriginSettingsChange(const JS::Value&
|
||||
|
||||
// get the app setting object
|
||||
JS::RootedValue propertyValue(cx);
|
||||
if (!JS_GetPropertyById(cx, obj, id, &propertyValue) || !propertyValue.isObject()) {
|
||||
if (!JS_GetPropertyById(cx, obj, id, &propertyValue)) {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
continue;
|
||||
}
|
||||
JS::RootedObject settingObj(cx, &propertyValue.toObject());
|
||||
@ -280,6 +282,8 @@ nsGeolocationSettings::HandleGeolocationPerOriginSettingsChange(const JS::Value&
|
||||
JS::RootedValue fm(cx);
|
||||
if (JS_GetProperty(cx, settingObj, "type", &fm)) {
|
||||
settings->HandleTypeChange(fm);
|
||||
} else {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
}
|
||||
|
||||
#ifdef MOZ_APPROX_LOCATION
|
||||
@ -287,6 +291,8 @@ nsGeolocationSettings::HandleGeolocationPerOriginSettingsChange(const JS::Value&
|
||||
JS::RootedValue distance(cx);
|
||||
if (JS_GetProperty(cx, settingObj, "distance", &distance)) {
|
||||
settings->HandleApproxDistanceChange(distance);
|
||||
} else {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -294,6 +300,8 @@ nsGeolocationSettings::HandleGeolocationPerOriginSettingsChange(const JS::Value&
|
||||
JS::RootedValue coords(cx);
|
||||
if (JS_GetProperty(cx, settingObj, "coords", &coords)) {
|
||||
settings->HandleFixedCoordsChange(coords);
|
||||
} else {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
}
|
||||
|
||||
// add the per-app setting object to the hashtable
|
||||
@ -337,11 +345,13 @@ nsGeolocationSettings::HandleGeolocationAlwaysPreciseChange(const JS::Value& aVa
|
||||
JS::RootedValue value(cx);
|
||||
|
||||
if (!JS_GetElement(cx, obj, i, &value) || !value.isString()) {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
continue;
|
||||
}
|
||||
|
||||
nsAutoJSString origin;
|
||||
if (!origin.init(cx, value)) {
|
||||
JS_ClearPendingException(cx); // catch and ignore any exceptions
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user