diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-01-24 13:07:03 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2020-01-24 17:56:06 +0000 |
| commit | 9f1fa0852de59991982098711a6487cf3b9149ae (patch) | |
| tree | 5f02b2ebf53aa17ff1b39e6a30600209c198e8cb /addons/web/static/lib | |
| parent | 397f1022d3d1fa073c9945b34138ad4ee009700e (diff) | |
[FIX] web: backport fix from ace.js
Bug in ace-editor is present since that we updated in 1.3.1.
Because diff between 1.3.2 and 1.3.1 is big (-1288 +4661) with new feature...
We prefer just patch the library in stable branch applying part of commit:
https://github.com/ajaxorg/ace/commit/1890598a5da2259cfb0ceac38fed7bca582765db
To do in master? : upgrade ace.js
How to reproduce:
> create ir.ui.view
> be sure to empty all the content
> type '<xpath expr=""'
> Now if you type the > it will crash
- Cannot read property 'type' of null
closes odoo/odoo#43955
X-original-commit: 1a90740b8e699fc3afa28c3ddb5490328facb995
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/web/static/lib')
| -rw-r--r-- | addons/web/static/lib/ace/mode-xml.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/web/static/lib/ace/mode-xml.js b/addons/web/static/lib/ace/mode-xml.js index 4694bb95891..07ff4652e61 100644 --- a/addons/web/static/lib/ace/mode-xml.js +++ b/addons/web/static/lib/ace/mode-xml.js @@ -210,7 +210,7 @@ var TokenIterator = require("../../token_iterator").TokenIterator; var lang = require("../../lib/lang"); function is(token, type) { - return token.type.lastIndexOf(type + ".xml") > -1; + return token && token.type.lastIndexOf(type + ".xml") > -1; } var XmlBehaviour = function () { @@ -284,12 +284,14 @@ var XmlBehaviour = function () { if (position.column < tokenEndColumn) return; if (position.column == tokenEndColumn) { - if (is(iterator.stepForward(), "attribute-value")) + var nextToken = iterator.stepForward(); + // TODO also handle non-closed string at the end of the line + if (nextToken && is(nextToken, "attribute-value")) return; iterator.stepBackward(); } } - + if (/^\s*>/.test(session.getLine(position.row).slice(position.column))) return; while (!is(token, "tag-name")) { |
