Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Make Display.authenticateMessageData private (#1780)
Browse files Browse the repository at this point in the history
  • Loading branch information
toasted-nutbread authored Jun 30, 2021
1 parent deb2a74 commit ace4650
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ext/js/display/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,6 @@ class Display extends EventDispatcher {
}
}

authenticateMessageData(data) {
if (this._frameEndpoint === null) {
return data;
}
if (!this._frameEndpoint.authenticate(data)) {
throw new Error('Invalid authentication');
}
return data.data;
}

setQueryPostProcessor(func) {
this._queryPostProcessor = func;
}
Expand Down Expand Up @@ -454,7 +444,7 @@ class Display extends EventDispatcher {
// Message handlers

_onDirectMessage(data) {
data = this.authenticateMessageData(data);
data = this._authenticateMessageData(data);
const {action, params} = data;
const handlerInfo = this._directMessageHandlers.get(action);
if (typeof handlerInfo === 'undefined') {
Expand All @@ -468,7 +458,7 @@ class Display extends EventDispatcher {

_onWindowMessage({data}) {
try {
data = this.authenticateMessageData(data);
data = this._authenticateMessageData(data);
} catch (e) {
return;
}
Expand Down Expand Up @@ -518,6 +508,16 @@ class Display extends EventDispatcher {

// Private

_authenticateMessageData(data) {
if (this._frameEndpoint === null) {
return data;
}
if (!this._frameEndpoint.authenticate(data)) {
throw new Error('Invalid authentication');
}
return data.data;
}

async _onStateChanged() {
if (this._historyChangeIgnore) { return; }

Expand Down

0 comments on commit ace4650

Please sign in to comment.