build fails without message when Unity.init is called with quoted object keys

Bug #1090894 reported by Urban Soban
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
WebApps: Applications Data
Fix Released
Low
Unassigned
webapps-applications (Ubuntu)
Fix Released
Undecided
Unassigned
Quantal
Won't Fix
Undecided
Unassigned
Raring
Won't Fix
Undecided
Unassigned

Bug Description

I've added my own user script under src/Deezer/Deezer.user.js and ran from root dir:

./configure --enable-applications
make

which fails, displaying only

[object Object]
make[1]: *** [manifests_timestamp] Error 1

I patched the last try-catch in scripts/manifest.js to include:

printerr(JSON.stringify(x))

and it showed error in line 65, which is an assertion:

jsUnit.assert(prop[0].type == IDENTIFIER);

I realized this piece of code takes care of Unity.init() call, more specifically, its object parameter, and requires object keys to be identifiers, not allowing strings literals.

E.g.:

Unity.init({
  'name': 'SomeApp'
});

will fail, while

Unity.init({
  name: 'SomeApp'
});

will be built successfully.

First of all, I suggest printing out error messages, not only throwing exception object, as it does not explain anything to the user.

Second, since the script runs fine with quoted keys, I'd allow prop[0].type in line 65 to be IDENTIFIER or STRING.

JavaScript specs allow object keys to be identifiers, string literals or number literals; even more, JSON specs (although independent from JS Object notation), even require quoted keys, so I do not understand why they'd have to be strictly identifiers in this case.

==========================================
[Impact]
Low, this fix is just to help identify problems in third party userscripts which actually wouldn't have worked anyway. It helps show the developer why the build failed, and possible even less likely to fail.

[Test Case]
Break an existing userscript by adding quotes to the object key:

Unity.init({
  'name': 'SomeApp'
});

Then attempt to build with applications enabled:

./configure --enable-applications
make

[Regression Potential]
None, this wasn't breaking any of the existing webapps, but the fix does help third party webapp developers creating userscripts.

Tags: manifest

Related branches

Urban Soban (u-soban)
description: updated
Changed in webapps-applications:
importance: Undecided → Medium
Changed in webapps-applications:
status: New → In Progress
importance: Medium → Low
Changed in webapps-applications:
status: In Progress → Fix Committed
Changed in webapps-applications:
status: Fix Committed → Fix Released
Changed in webapps-applications (Ubuntu):
status: New → Fix Released
description: updated
Revision history for this message
Rolf Leggewie (r0lf) wrote :

quantal has seen the end of its life and is no longer receiving any updates. Marking the quantal task for this ticket as "Won't Fix".

Changed in webapps-applications (Ubuntu Quantal):
status: New → Won't Fix
Revision history for this message
Rolf Leggewie (r0lf) wrote :

raring has seen the end of its life and is no longer receiving any updates. Marking the raring task for this ticket as "Won't Fix".

Changed in webapps-applications (Ubuntu Raring):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.