Python formatting using `git cl format` has been enabled in the codebase
for a while now by including a .style.yapf file in your folder
hierarchy. However back in 2020 an exception was added to ignore the
json schema compiler folder, as the code in there uses a lot of chained
function calls that are split across lines for readability and the
formatter was condensing them into a much less readable state.
This CL resolves this by using the line continuation character `\` for
these chained function lines, allowing us to retain the more readable
indentation and also enable the formatter by default. It also runs a
full format over all the files in the directory, to get them into a
consistent state where we can have the formatter enabled by default
going forward with low impact.
No behavior change is expected.
Bug: 40711753
Change-Id: I6e10dc5af022ce0e3557099a84773aa9cc92d2e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5804254
Commit-Queue: Tim <tjudkins@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1345613}
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:
- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)
Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.
#crbug-todo-migration
Bug: b/321899722
Change-Id: Ib4e61022cc4ca4f0a6563a63fb5d2f582ef930c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5494425
Auto-Submit: Alison Gale <agale@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293183}
for chrome extension APIs.
This generator works well with many of the idls and json files that were tested.
It reuses the same data objects that the js_externs generator did, however instead of outputting that data into jsdoc and javascript, it is instead output as typescript definitions.
Note:
Imports are not resolvable, so they will need to be added manually
after generation if any are required.
Bug: 1203307
Change-Id: I62440c9707bc233580123feda46dad130a44446a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4679213
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Jacob Francis <francisjp@google.com>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Auto-Submit: Jacob Francis <francisjp@google.com>
Cr-Commit-Position: refs/heads/main@{#1183462}
While uploading crrev.com/c/3579801 I hit some irrelevant presubmit
warnings from js_interface_generator_test.py that hid important and
relevant warnings. These were Windows-only warnings caused by the
different os path separators on Windows and Linux. The fix is to
normalize paths to Linux-style path separators.
Bug: 1309977
Change-Id: I1b4b92b2cbd352a755e31c4485e06f2eab2c9ab7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3582791
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#992614}
(Based on previous work from https://crrev.com/c/2144684 )
This CL is a starting point for supporting a returns_async parameter in
Extension schemas, which is a step in supporting promise-based APIs. It
adds a new property to the Model in json_schema_compiler, returns_async,
which contains information about what the API function is expected to
return.
returns_async is used instead of Model.callback, and can be created
either from a callback specification or a specific "returns_async"
entry in the schema.
It also modifies the doc generation code to handle this new property,
displaying it as a callback at the end of the schema. This should
result in there being no visible difference to the docs when an API is
rolled over to using returns_async, other than previously required
callbacks being displayed as optional.
In order to do end-to-end tests, this CL also moves over tabs.create,
tabs.duplicate and tabs.query to use the new schema format, thereby
enabling promise support on them.
Bug: 978538
Change-Id: I43f5965eb8973f0d9fd25d46f1f1ae7ffa346357
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430291
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824488}
When creating externs for an optional non-final parameter, to appear
as a nullable required parameter, handle the case where it is
explicitly non-nullable indicated by the "!" operator.
Otherwise an invalid JS type is created as
?!chrome.fakeApi.Baz|undefined
instead of
?chrome.fakeApi.Baz|undefined
Bug: 469920
Change-Id: I93ce8952586aa92e8ad3f1176643677ec4d6525b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208185
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770145}
Closure compiler disallows optional parameters appearing before required
parameters, by throwing JSC_OPTIONAL_ARG_AT_END.
With this modification the auto-generated JS externs files are compliant
with Closure Compiler, by being stricter compared to what is actually
allowed at runtime by those APIs.
Bug: 469920
Change-Id: I348e1465e66c05cdd827d9bdb39cf883b8f3ddbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2203708
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769528}
See https://bugs.chromium.org/p/chromium/issues/detail?id=613096#c5 for
rationale
These two files:
third_party/closure_compiler/externs/accessibility_private.js
third_party/closure_compiler/externs/autofill_private.js
were updated in this commit, as an example of the change.
A follow-up commit will update other *_private.js files.
Bug: 613096
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Ica4ab471956052b37c8bb6a9aabe4a7502408cfb
Reviewed-on: https://chromium-review.googlesource.com/1090425
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568702}
crrev.com/f9c093e54e11cb41c6f3402997a97be16568865f fixed optional
params in callbacks, but forgot to wrap the type in params.
function(!Foo|undefined) -> function((!Foo|undefined))
BUG=704242
Review-Url: https://codereview.chromium.org/2768213002
Cr-Commit-Position: refs/heads/master@{#458958}
An API might conditionally send a response parameter to a caller.
e.g., envision an API:
doStuff({includeResult: true})
which responds with a Result iff includeResult was present and true.
Currently, closure extern generation doesn't handle this case well,
and for a callback like:
callback FooCallback = void(optional FooResponse response);
static void doStuff(DoStuffParams params, FooCallback callback);
generates:
/**
* @param {DoStuffParams} params
* @param {function(!FooResponse):void} callback
*/
But this is incorrect, since it indicates that the response would
never be null.
Properly handle these optional responses, and update the test.
BUG=704242
Review-Url: https://codereview.chromium.org/2766363002
Cr-Commit-Position: refs/heads/master@{#458876}
Originally landed as r445146: https://codereview.chromium.org/2601333002
Reverted as r445428.
Fixed by deferring the initialization of DesktopAutomationHandler
to match the previous behavior that was significant when tests are
run in debug mode.
This allows the automation externs file to be fully autogenerated.
Lots of tweaks to ChromeVox were required since we've been working with a
hand-tweaked externs file for a while.
BUG=683915
TBR=dtseng@chromium.org,rdevlin.cronin@chromium.org,dbeam@chromium.org
Committed: f1cbfff18b
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2649373002
Cr-Commit-Position: refs/heads/master@{#446160}
This allows the automation externs file to be fully autogenerated.
Lots of tweaks to ChromeVox were required since we've been working with a
hand-tweaked externs file for a while.
BUG=none
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2601333002
Cr-Commit-Position: refs/heads/master@{#445146}