← Back to team overview

desktop-packages team mailing list archive

[Bug 1090894] Re: build fails without message when Unity.init is called with quoted object keys

 

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

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

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

Status in Common Data Shared by WebApps:
  Fix Released
Status in webapps-applications package in Ubuntu:
  Fix Released
Status in webapps-applications source package in Quantal:
  Won't Fix
Status in webapps-applications source package in Raring:
  Won't Fix

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.

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