apache / apache/royale-asjs

Fail to load app if MXML Spark Label contains embedded newlines

Open
#987 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
ActionScript
Stars
380
Forks
120
PR merge metrics
No merged PRs in 30d

Description

Test case:

```

```

Causes this error on load:

```
Uncaught SyntaxError: '' string literal contains an unescaped line break TestSparkLabelBad.js:64:16
enter resource://devtools/server/actors/utils/event-loop.js:79
enter self-hosted:1161
_pushThreadPause resource://devtools/server/actors/thread.js:310
onExceptionUnwind resource://devtools/server/actors/thread.js:2013
onExceptionUnwind self-hosted:1161
TestSparkLabel_mx_managers_SystemManager .../bin/js-debug/TestSparkLabel_mx_managers_SystemManager.js:231
.../bin/js-debug/index.html:393
enter resource://devtools/server/actors/utils/event-loop.js:79
enter self-hosted:1161
```

Because this was generated during the compile:

```
Object.defineProperties(TestSparkLabelBad.prototype, /** @lends {TestSparkLabelBad.prototype} */ {
'MXMLDescriptor': {
/** @this {TestSparkLabelBad} */
get: function() {
if (this.mxmldd == undefined)
{
/** @type {Array} */
var arr = TestSparkLabelBad.superClass_.get__MXMLDescriptor.apply(this);
/** @type {Array} */
var data = [
spark.components.Label,
2,
'_id',
true,
'$ID_12_0',
'text',
true,
'Line1
Line2',
0,
0,
null
];
if (arr)
this.mxmldd = arr.concat(data);
else
this.mxmldd = data;
}
return this.mxmldd;
}
}
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the MXML snippet and inspect the generated TestSparkLabelBad.js MXMLDescriptor shown in the report. Trace how the embedded newline becomes the generated string literal; done means the generated JavaScript remains syntactically valid and the app loads with the label text preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.