use xmlEscape instead of escape-html for extensions

This commit is contained in:
Christopher Willis-Ford 2019-04-17 16:40:21 -07:00
parent cc75154f9a
commit a308b1e02f
4 changed files with 5 additions and 6 deletions

3
package-lock.json generated
View file

@ -3865,7 +3865,8 @@
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
"dev": true
},
"escape-string-regexp": {
"version": "1.0.5",

View file

@ -36,7 +36,6 @@
"canvas-toBlob": "1.0.0",
"decode-html": "2.0.0",
"diff-match-patch": "1.0.4",
"escape-html": "1.0.3",
"format-message": "6.2.1",
"htmlparser2": "3.10.0",
"immutable": "3.8.1",

View file

@ -1,6 +1,5 @@
const EventEmitter = require('events');
const {OrderedMap} = require('immutable');
const escapeHtml = require('escape-html');
const ArgumentType = require('../extension-support/argument-type');
const Blocks = require('./blocks');
@ -15,6 +14,7 @@ const log = require('../util/log');
const maybeFormatMessage = require('../util/maybe-format-message');
const StageLayering = require('./stage-layering');
const Variable = require('./variable');
const xmlEscape = require('../util/xml-escape');
// Virtual I/O devices.
const Clock = require('../io/clock');
@ -747,7 +747,7 @@ class Runtime extends EventEmitter {
* @private
*/
_makeExtensionMenuId (menuName, extensionId) {
return `${extensionId}_menu_${escapeHtml(menuName)}`;
return `${extensionId}_menu_${xmlEscape(menuName)}`;
}
/**
@ -1207,7 +1207,7 @@ class Runtime extends EventEmitter {
const defaultValue =
typeof argInfo.defaultValue === 'undefined' ? '' :
escapeHtml(maybeFormatMessage(argInfo.defaultValue, this.makeMessageContextForTarget()).toString());
xmlEscape(maybeFormatMessage(argInfo.defaultValue, this.makeMessageContextForTarget()).toString());
if (argTypeInfo.check) {
argJSON.check = argTypeInfo.check;

View file

@ -72,7 +72,6 @@ module.exports = [
},
externals: {
'decode-html': true,
'escape-html': true,
'format-message': true,
'htmlparser2': true,
'immutable': true,