Functions for removing listeners threw exceptions if listener id
was not registered. This behavior was not specified in docs.
This commit disables those exception and silently returns from
functions if listener for given id is not found.
[Verification] TCT tests which call changed api functions passed.
Change-Id: I8fe1a07ade9a35bfbfa95c1a628eeff95a420e0f
Signed-off-by: Michal Michalski <m.michalski2@partner.samsung.com>
};
ListenerManager.prototype.removeListener = function(watchId) {
- if (this.listeners.hasOwnProperty(watchId)) {
- delete this.listeners[watchId];
- } else {
- throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
- 'Listener with id: ' + watchId + ' does not exist.');
+ if (!this.listeners.hasOwnProperty(watchId)) {
+ return;
}
+ delete this.listeners[watchId];
+
if (this.nativeSet && type_.isEmptyObject(this.listeners)) {
this.native.callSync('SoundManager_removeDeviceStateChangeListener');
this.native.removeListener(this.listenerName);
ListenerManager.prototype.removeListener = function(watchId) {
if (this.listeners[watchId] === null || this.listeners[watchId] === undefined) {
- throw new WebAPIException(0, 'Watch id not found.', 'NotFoundError');
+ return;
}
if (this.listeners.hasOwnProperty(watchId)) {