Titanium JIRA Archive
Alloy (ALOY)

[ALOY-702] Double quotes not properly escaped in TSS strings

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-06-11T20:04:24.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.2.0, 2013 Sprint 12
ComponentsStyling
Labelsn/a
ReporterTony Lukasavage
AssigneeTony Lukasavage
Created2013-06-11T19:25:09.000+0000
Updated2013-06-21T21:28:14.000+0000

Description

alloy compiles will break under certain circumstances if there is a double quote in a string in a TSS file. For example, the following string would cause an error:
"#info": {
	color: '#000',
	backgroundColor: '#eee',
	font: {
		fontSize: '14dp',
		fontWeight: 'normal'
	},
	height: Ti.UI.SIZE,
	width: Ti.UI.SIZE,
	bottom: 10,
	backgroundPaddingBottom: 10,
	backgroundPaddingTop: 10,
	backgroundPaddingLeft: 10,
	backgroundPaddingRight: 10,
	text: 'On Android, the above image will display the density. Otherwise it simply displays "default".',
	textAlign: 'center'
}
the error is:
[DEBUG] [INFO]  [index.xml] view processing...
[DEBUG] [INFO]    style:      "index.tss"
[DEBUG] [INFO]    view:       "index.xml"
[DEBUG] [INFO]    controller: "index.js"
[DEBUG] [WARN]  : ERROR: Unexpected token keyword «default», expected punc «,» [Resources/alloy/controllers/index.js:33,318]
[DEBUG] [DEBUG] /usr/local/lib/node_modules/alloy/Alloy/commands/compile/sourceMapper.js:99
[DEBUG] [DEBUG]         	throw e;
[DEBUG] [DEBUG]         	      ^
[DEBUG] [ERROR]   
[DEBUG] [ERROR] (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:185:18)
[DEBUG] [ERROR] (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:199:11)
[DEBUG] [DEBUG]     at croak (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:630:9)
[DEBUG] [ERROR] (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:638:9)
[DEBUG] [DEBUG]     at expect_token (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:651:9)
[DEBUG] [DEBUG]     at expect (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:654:36)
[DEBUG] [DEBUG]     at /usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:1154:44
[DEBUG] [DEBUG]     at /usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:677:24
[DEBUG] [DEBUG]     at expr_atom (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:1111:35)
[DEBUG] [DEBUG]     at maybe_unary (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:1281:19)
[DEBUG] [ERROR] Alloy compiler failed

Comments

  1. Tony Lukasavage 2013-06-11

    PR: https://github.com/appcelerator/alloy/pull/153 Functional testing can be passed simply by having the automated test suite pass for all tests, as this is a compile time bug:
    jake test:all
    More specifically, you can compile the advanced/android_density app which makes use of double quotes in strings in the TSS files:
    jake test:spec[compile.js] app=advanced/android_density
  2. Federico Casali 2013-06-21

    Verified as fixed. Environment: Titanium SDK 3.1.2.v20130619101604 Alloy 1.2.0 Appcelerator Studio 3.1.1.201306131423 Node 0.8.22 Closing.

JSON Source