summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent/WebContentConsoleClient.cpp
AgeCommit message (Collapse)Author
2021-12-27LibJS+WebContent+Browser+js: Implement console.group() methodsSam Atkins
This implements: - console.group() - console.groupCollapsed() - console.groupEnd() In the Browser, we use `<details>` for the groups, which is not actually implemented yet, so groups are always open. In the REPL, groups are non-interactive, but still indent any output. This looks weird since the console prompt and return values remain on the far left, but this matches what Node does so it's probably fine. :^) I expect `console.group()` is not used much outside of browsers.
2021-12-27LibJS+WebContent+js: Bring console.trace() to specSam Atkins
The spec very kindly defines `Printer` as accepting "Implementation-specific representations of printable things such as a stack trace or group." for the `args`. We make use of that here by passing the `Trace` itself to `Printer`, instead of having to produce a representation of the stack trace in advance and then pass that to `Printer`. That both avoids the hassle of tracking whether the data has been html-encoded or not, and means clients don't have to implement the whole `trace()` algorithm, but only the code needed to output the trace.
2021-12-27LibJS+WebContent+js: Bring console.assert() to specSam Atkins
2021-12-27LibJS+WebContent+js: Bring console.clear() to specSam Atkins
This is identical to before, since we don't have "group stacks" yet, but clear() now uses ThrowCompletionOr.
2021-12-27LibJS+WebContent+js: Bring console.count[Reset]() to specSam Atkins
The `CountReset` log level is displayed as a warning, since the message is always to warn that the counter doesn't exist. This is also in line with the table at https://console.spec.whatwg.org/#loglevel-severity
2021-12-27LibJS+WebContent+js: Reimplement console.log() and friends to specSam Atkins
This implements the Logger and Printer abstract operations defined in the console spec, and stubs out the Formatter AO. These are then used for the "output a categorized log message" functions.
2021-10-03LibWeb: Fix that $0 was no longer accessibledavidot
We now set the realm (twice) on every console input. This can probably be avoided if we use two executing contexts one for the website the other for the console. This achieves a similar behavior but is not really nice and not really spec like.
2021-09-06WebContent: Store messages in WebContentConsoleClientSam Atkins
The `WebContentConsoleClient` now keeps a list of console messages it has received, so these are not lost if the ConsoleWidget has not been initialized yet. This change does break JS console output, but only until the next commit. :^)
2021-09-06WebContent: Implement ConsoleGlobalObject which proxies to WindowObjectSam Atkins
ConsoleGlobalObject is used as the global object when running javascript from the Browser console. This lets us implement console-only functions and variables (like `$0`) without exposing them to webpage content. It passes other calls over to the usual WindowObject so any code that would have worked in the webpage will still work in the console. :^)
2021-08-01Services: Remove unused header includesBrian Gianforcaro
2021-05-03Userland: Use snake case names in .ipc filesGunnar Beutner
This updates all .ipc files to have snake case names for IPC methods.
2021-05-03Userland: Update IPC calls to use proxiesGunnar Beutner
This updates all existing code to use the auto-generated client methods instead of post_message/send_sync.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-18LibJS: Implement console.assert()Linus Groh
2021-04-18Browser+WebContent: Fix HTML injection in console functions outputLinus Groh
2021-04-12LibJS: Make Errors fully spec compliantLinus Groh
The previous handling of the name and message properties specifically was breaking websites that created their own error types and relied on the error prototype working correctly - not assuming an JS::Error this object, that is. The way it works now, and it is supposed to work, is: - Error.prototype.name and Error.prototype.message just have initial string values and are no longer getters/setters - When constructing an error with a message, we create a regular property on the newly created object, so a lookup of the message property will either get it from the object directly or go though the prototype chain - Internal m_name/m_message properties are no longer needed and removed This makes printing errors slightly more complicated, as we can no longer rely on the (safe) internal properties, and cannot trust a property lookup either - get_without_side_effects() is used to solve this, it's not perfect but something we can revisit later. I did some refactoring along the way, there was some really old stuff in there - accessing vm.call_frame().arguments[0] is not something we (have to) do anymore :^) Fixes #6245.
2021-02-28WebContent: Added IPC calls for initializing JS console and sending inputBrandon Scott