Skip to content

script: Implement console.table - #49314

Merged
jdm merged 3 commits into
servo:mainfrom
willypuzzle:27212-Implement_console_table
Nov 1, 2026
Merged

jdm merged 3 commits into
servo:mainfrom
willypuzzle:27212-Implement_console_table

Conversation

@willypuzzle

Copy link
Copy Markdown
Contributor

Adds support for console.table, rendering tabular data as a text-based table sent to the embedder, with raw data forwarded to devtools under a new ConsoleLogLevel::Table. Falls back to a plain log call when the argument can't be parsed as tabular data.

Mirrors Firefox's console-messages.js handling of level === "table": only the first two arguments (data, columns) are forwarded, with the data's ownProperties/preview rebuilt from its grip so the devtools frontend can render the table. Falls back to ConsoleLogLevel::Log when the argument can't be previewed as an object.

Testing: Covers arrays, objects, Maps, nested rows, the columns argument, argument truncation, and the fallback to ConsoleLogLevel::Log for non-tabular data, matching Firefox's console-messages.js behavior.

Fixes: #27212

Adds support for console.table, rendering tabular data as a
text-based table sent to the embedder, with raw data forwarded
to devtools under a new ConsoleLogLevel::Table. Falls back to a
plain log call when the argument can't be parsed as tabular data.

devtools: Send proper table data for console.table messages (servo#27212)

Mirrors Firefox's console-messages.js handling of `level === "table"`:
only the first two arguments (data, columns) are forwarded, with the
data's `ownProperties`/`preview` rebuilt from its grip so the devtools
frontend can render the table. Falls back to `ConsoleLogLevel::Log`
when the argument can't be previewed as an object.

devtools: Add tests for console.table message handling (servo#27212)

Covers arrays, objects, Maps, nested rows, the columns argument,
argument truncation, and the fallback to `ConsoleLogLevel::Log` for
non-tabular data, matching Firefox's `console-messages.js` behavior.

Signed-off-by: Domenico Rizzo <[email protected]>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 27, 2026
@willypuzzle

Copy link
Copy Markdown
Contributor Author

@servo-highfive: assign me

@servo-highfive servo-highfive added the C-assigned There is someone working on resolving the issue label Oct 27, 2026
@servo-highfive

Copy link
Copy Markdown

Hey @willypuzzle! Thanks for your interest in working on this issue. It's now assigned to you!

@willypuzzle

Copy link
Copy Markdown
Contributor Author

@mrobinson please, would you review this PR?

@jdm

jdm commented Oct 28, 2026

Copy link
Copy Markdown
Member

I will finish reviewing this tonight.

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work!

Comment thread components/devtools/lib.rs Resolved
Comment thread components/devtools/lib.rs Resolved
Comment thread components/script/dom/console.rs Resolved
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Oct 29, 2026
@jdm jdm added the S-needs-code-changes Changes have not yet been made that were requested by a reviewer. label Oct 29, 2026
…ervo#27212)

`console.table` calls were mistakenly sent with `ConsoleLogLevel::Log`
instead of `ConsoleLogLevel::Table`, so devtools never applied the
table-specific handling added earlier.

Also moves `console_table_arguments` next to its only caller in the
console actor, and switches `console_table_items`/`table_descriptor`
to build their JSON through `ObjectPropertyDescriptor` instead of a
bespoke `property_descriptor_json` helper, keeping descriptor shape
consistent with the rest of the object actor code.

Signed-off-by: Domenico Rizzo <[email protected]>
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 29, 2026
@willypuzzle

Copy link
Copy Markdown
Contributor Author

@jdm I resolved all your observations :)

@jdm
jdm added this pull request to the merge queue Oct 30, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 30, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Oct 30, 2026
@jdm

jdm commented Oct 30, 2026

Copy link
Copy Markdown
Member
OK /console/idlharness.any.html

    PASS [expected FAIL] subtest: console namespace: operation table(optional any, optional sequence&lt;DOMString&gt;)

OK /console/idlharness.any.worker.html

    PASS [expected FAIL] subtest: console namespace: operation table(optional any, optional sequence&lt;DOMString&gt;)

You can run ./mach update-wpt https://github.com/servo/servo/actions/runs/40981959317 to address those.

@willypuzzle

Copy link
Copy Markdown
Contributor Author
OK /console/idlharness.any.html

    PASS [expected FAIL] subtest: console namespace: operation table(optional any, optional sequence&lt;DOMString&gt;)

OK /console/idlharness.any.worker.html

    PASS [expected FAIL] subtest: console namespace: operation table(optional any, optional sequence&lt;DOMString&gt;)

You can run ./mach update-wpt https://github.com/servo/servo/actions/runs/40981959317 to address those.

@jdm It says me FileNotFoundError: [WinError 2] The system cannot find the file specified

@jdm

jdm commented Oct 31, 2026

Copy link
Copy Markdown
Member

@jdm

jdm commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

If that doesn't work you can just run ./mach test-wpt tests/wpt/tests/console/idlharness.any.js -u for the same effect.

@servo-highfive servo-highfive removed the S-tests-failed The changes caused existing tests to fail. label Oct 31, 2026
@willypuzzle

Copy link
Copy Markdown
Contributor Author

@jdm done!

@jdm

jdm commented Oct 31, 2026

Copy link
Copy Markdown
Member

Just missing the --signoff from the last commit!

…#27212)

console.table is now implemented, so the previously failing idlharness
subtests for the table operation pass and no longer need to be listed
as expected failures.

Signed-off-by: Domenico Rizzo <[email protected]>
@willypuzzle
willypuzzle force-pushed the 27212-Implement_console_table branch from e391d02 to cb5645e Compare October 31, 2026 23:34
@willypuzzle

Copy link
Copy Markdown
Contributor Author

Just missing the --signoff from the last commit!

@jdm done

@jdm
jdm added this pull request to the merge queue Nov 1, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 1, 2026
Merged via the queue into servo:main with commit c595eb5 Nov 1, 2026
35 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 1, 2026
@willypuzzle
willypuzzle deleted the 27212-Implement_console_table branch November 1, 2026 18:37
jschwe added a commit to openharmony-rs/servo-ohos that referenced this pull request Nov 9, 2026
Wire the remaining MVP NWebHandler callbacks from the WebViewDelegate:
- show_console_message -> OnConsoleLog (with a concrete NWebConsoleLog),
  mapping the servo ConsoleLogLevel to NWebConsoleLogLevel.
- notify_load_status_changed -> OnLoadingProgress, approximating the
  0-100 progress ArkWeb expects from servo's discrete load stages.
- notify_crashed -> OnPageLoadError; servo has no per-load network-error
  callback, so a webview crash is the failure it does surface.

Validation: Test by running uv run ports/arkweb/tools/test_navigation.py and checking hilog for console/progress callback lines while it runs. 2026-11-09 sync: `./mach check --ohos -p arkweb`, and the arkweb-test suite on a DAYU200 as for the backend commit.
AI-assisted: Yes (agent session; implementation and on-device testing)
AI-assisted: Yes (agent session; 2026-11-09 sync -- upstream added `LoadStatus::Stopped` (servo#49427) and `ConsoleLogLevel::Table` (servo#49314): a stopped load reaches full progress, and `console.table()` is logged at the INFO level, as `console.log()` is; found by the drift review)
Signed-off-by: Jonathan Schwender <[email protected]>
jschwe added a commit to openharmony-rs/servo-ohos that referenced this pull request Nov 10, 2026
Wire the remaining MVP NWebHandler callbacks from the WebViewDelegate:
- show_console_message -> OnConsoleLog (with a concrete NWebConsoleLog),
  mapping the servo ConsoleLogLevel to NWebConsoleLogLevel.
- notify_load_status_changed -> OnLoadingProgress, approximating the
  0-100 progress ArkWeb expects from servo's discrete load stages.
- notify_crashed -> OnPageLoadError; servo has no per-load network-error
  callback, so a webview crash is the failure it does surface.

Validation: Test by running uv run ports/arkweb/tools/test_navigation.py and checking hilog for console/progress callback lines while it runs. 2026-11-09 sync: `./mach check --ohos -p arkweb`, and the arkweb-test suite on a DAYU200 as for the backend commit.
AI-assisted: Yes (agent session; implementation and on-device testing)
AI-assisted: Yes (agent session; 2026-11-09 sync -- upstream added `LoadStatus::Stopped` (servo#49427) and `ConsoleLogLevel::Table` (servo#49314): a stopped load reaches full progress, and `console.table()` is logged at the INFO level, as `console.log()` is; found by the drift review)
Signed-off-by: Jonathan Schwender <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-assigned There is someone working on resolving the issue S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement console.table

3 participants