UI5 / UI5/openui5

CodeEditor - manually closing a tag causes crash

Open Beginner friendly
#4,474 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug in progress
Dominant language
JavaScript
Stars
3.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

What is the issue and how can we reproduce it?

In an application containing the CodeEditor (in "html" mode) a blocking javascript error occurs when manually closing a tag .

The problem in source code is located in the "function is(token, type)...".
In the file sap\ui\codeeditor\js\ace\mode-javascript-dbg.js there are two versions of this function:

(1st version)
function is(token, type) {
return token && token.type.lastIndexOf(type + ".xml") > -1;
}

(2nd version)
function is(token, type) {
return token.type.lastIndexOf(type + ".xml") > -1;
}

The 2nd version is the one with produces the bug (when "token" is unndefined). When I replace this code
with the 1st version of the "is(..)" function, the bug is fixed.

Which OpenUI5 version is your project targeting?

1.152, 1.150

Is the issue device- or browser-specific?

No response

Confirmation
  • I have searched the existing issues and reviewed the relevant documentation as well as the API reference.
  • I am not disclosing any internal or sensitive information.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash in an application using CodeEditor in "html" mode while manually closing a tag. Inspect the two is(token, type) implementations in sap/ui/codeeditor/js/ace/mode-javascript-dbg.js, then verify that closing a tag no longer produces a blocking JavaScript error in the targeted OpenUI5 versions 1.152 and 1.150.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.