Make Display.authenticateMessageData private (#1780)

This commit is contained in:
toasted-nutbread 2021-06-29 22:17:14 -04:00 committed by GitHub
parent deb2a742ed
commit ace46503be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
@ -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') {
@ -468,7 +458,7 @@ class Display extends EventDispatcher {
_onWindowMessage({data}) {
try {
data = this.authenticateMessageData(data);
data = this._authenticateMessageData(data);
} catch (e) {
return;
}
@ -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; }