New issue
Advanced search Search tips

Issue 913354 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Order in gn auto-generate unittest.html can break script order assumptions

Project Member Reported by noel@chromium.org, Dec 10

Issue description

Adding an auto-generated unittest GN rule for the Files app exif parser unittest ... 

 https://chromium-review.googlesource.com/c/chromium/src/+/1369491

collides with clang-format wanting to alpha-order the GN rule deps entries. 

For the exif parser, that breaks the assumption it has that dependent <script>(s) load before the exif parser has loaded.  When that assumption is broken, run-time exceptions (undefined method) result, and the existing unittest failed.

The patch above had to workaround the issue by re-loading the exif_parser.js with a window.onload, after setting up the fakes to avoid the exceptions, in the generated unittest.js page.

Perhaps there should be a way to have scripts load in the desired order to avoid workarounds like thst.  No sure it's possible, but I guess we should discuss.
 
Labels: OS-Chrome
Cc: lucmult@chromium.org
In all the auto-generate unittest html conversions in  issue 860355 , this issue came up once only.  So it's not a big deal.  

I note that a js_unit_tests() rule can have multiple unittests deps in the rule, and it can have a mocks = [] entry.

Something like that might work for a js_unittest() rule. Still, the design of the image/exif metadata parsers is the same: they assume the general metadata and image metadata classes are loaded/defined before the parser scripts load.

Sign in to add a comment