aboutsummaryrefslogtreecommitdiff
path: root/diplomacy
diff options
context:
space:
mode:
Diffstat (limited to 'diplomacy')
-rw-r--r--diplomacy/web/src/diplomacy/client/connection.js2
-rw-r--r--diplomacy/web/src/diplomacy/communication/notifications.js8
-rw-r--r--diplomacy/web/src/diplomacy/communication/requests.js2
-rw-r--r--diplomacy/web/src/diplomacy/communication/responses.js4
4 files changed, 8 insertions, 8 deletions
diff --git a/diplomacy/web/src/diplomacy/client/connection.js b/diplomacy/web/src/diplomacy/client/connection.js
index c1f8bfd..1e40ed8 100644
--- a/diplomacy/web/src/diplomacy/client/connection.js
+++ b/diplomacy/web/src/diplomacy/client/connection.js
@@ -262,7 +262,7 @@ export class Connection {
} catch (error) {
context.future.setException(error);
}
- } else if (jsonMessage.hasOwnProperty('notification_id') && jsonMessage.notification_id)
+ } else if (Object.prototype.hasOwnProperty.call(jsonMessage, 'notification_id') && jsonMessage.notification_id)
NOTIFICATION_MANAGERS.handleNotification(this, NOTIFICATIONS.parse(jsonMessage));
else
Diplog.error('Unknown socket message received.');
diff --git a/diplomacy/web/src/diplomacy/communication/notifications.js b/diplomacy/web/src/diplomacy/communication/notifications.js
index 149df09..5b66783 100644
--- a/diplomacy/web/src/diplomacy/communication/notifications.js
+++ b/diplomacy/web/src/diplomacy/communication/notifications.js
@@ -39,16 +39,16 @@ export const NOTIFICATIONS = {
vote_updated: STRINGS.GAME,
},
parse: function (jsonObject) {
- if (!jsonObject.hasOwnProperty('name'))
+ if (!Object.prototype.hasOwnProperty.call(jsonObject, 'name'))
throw new Error('No name field in expected notification object.');
- if (!jsonObject.hasOwnProperty('token'))
+ if (!Object.prototype.hasOwnProperty.call(jsonObject, 'token'))
throw new Error('No token field in expected notification object.');
if (!NOTIFICATIONS.levels.hasOwnProperty(jsonObject.name))
throw new Error('Invalid notification name ' + jsonObject.name);
if (NOTIFICATIONS.levels[jsonObject.name] === STRINGS.GAME) {
- if (!jsonObject.hasOwnProperty('game_id'))
+ if (!Object.prototype.hasOwnProperty.call(jsonObject, 'game_id'))
throw new Error('No game_id field in expected game notification object.');
- if (!jsonObject.hasOwnProperty('game_role'))
+ if (!Object.prototype.hasOwnProperty.call(jsonObject, 'game_role'))
throw new Error('No game_role field in expected game notification object.');
}
return jsonObject;
diff --git a/diplomacy/web/src/diplomacy/communication/requests.js b/diplomacy/web/src/diplomacy/communication/requests.js
index a4a140e..5963827 100644
--- a/diplomacy/web/src/diplomacy/communication/requests.js
+++ b/diplomacy/web/src/diplomacy/communication/requests.js
@@ -82,7 +82,7 @@ export const REQUESTS = {
if (!REQUESTS.models.hasOwnProperty(name))
throw new Error('Unknown request name ' + name);
const model = REQUESTS.models[name];
- return (model.level === STRINGS.GAME && (!model.hasOwnProperty('phase_dependent') || model.phase_dependent));
+ return (model.level === STRINGS.GAME && (!Object.prototype.hasOwnProperty.call(model, 'phase_dependent') || model.phase_dependent));
},
/** Return request level for given request name. Either null, 'channel' or 'game'. **/
diff --git a/diplomacy/web/src/diplomacy/communication/responses.js b/diplomacy/web/src/diplomacy/communication/responses.js
index 7c87c67..2ee15f3 100644
--- a/diplomacy/web/src/diplomacy/communication/responses.js
+++ b/diplomacy/web/src/diplomacy/communication/responses.js
@@ -24,7 +24,7 @@ export const RESPONSES = {
'data_game_schedule', 'data_saved_game'
]),
parse: function (jsonObject) {
- if (!jsonObject.hasOwnProperty('name'))
+ if (!Object.prototype.hasOwnProperty.call(jsonObject, 'name'))
throw new Error('No name field in expected response object');
if (!RESPONSES.names.has(jsonObject.name))
throw new Error('Invalid response name ' + jsonObject.name);
@@ -37,6 +37,6 @@ export const RESPONSES = {
},
isUniqueData: function (response) {
// Expected only 3 fields: name, request_id, data.
- return (response.hasOwnProperty('data') && Object.keys(response).length === 3);
+ return (Object.prototype.hasOwnProperty.call(response, 'data') && Object.keys(response).length === 3);
}
};