Merge pull request #13794 from zfox23/72_MS17495

Fix MS17495: Initially wire sendMessage to ignore in appUi module
This commit is contained in:
Howard Stearns 2018-08-09 20:07:11 -07:00 committed by GitHub
commit 1c9e409444
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,12 +87,18 @@ function AppUi(properties) {
defaultButton('activeButton', 'a.svg');
defaultButton('normalMessagesButton', 'i-msg.svg');
defaultButton('activeMessagesButton', 'a-msg.svg');
that.button = that.tablet.addButton({
var buttonOptions = {
icon: that.normalButton,
activeIcon: that.activeButton,
text: that.buttonName,
sortOrder: that.sortOrder
});
text: that.buttonName
};
// `TabletScriptingInterface` looks for the presence of a `sortOrder` key.
// What it SHOULD do is look to see if the value inside that key is defined.
// To get around the current code, we do this instead.
if (that.sortOrder) {
buttonOptions.sortOrder = that.sortOrder;
}
that.button = that.tablet.addButton(buttonOptions);
that.ignore = function ignore() { };
// Handlers
@ -126,6 +132,7 @@ function AppUi(properties) {
// (Although injected javascript still has to use JSON.stringify/JSON.parse.)
that.sendToHtml = function (messageObject) { that.tablet.emitScriptEvent(JSON.stringify(messageObject)); };
that.fromHtml = function (messageString) { that.onMessage(JSON.parse(messageString)); };
that.sendMessage = that.ignore;
that.wireEventBridge = function wireEventBridge(on) {
// Uniquivocally sets that.sendMessage(messageObject) to do the right thing.
// Sets hasEventBridge and wires onMessage to eventSignal as appropriate, IFF onMessage defined.