** Description changed:

  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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1090894

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/webapps-applications/+bug/1090894/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to