summaryrefslogtreecommitdiff
path: root/modules/script/_bootstrap
Commit message (Collapse)AuthorAgeFilesLines
* debugger: Use spread syntax to override style propertyPhilip Chimento2023-02-191-3/+1
| | | | | This was previously done with a slightly circuitous call to Object.assign(); it can be done more readably with spread syntax.
* debugger: Support Symbol valuesPhilip Chimento2023-01-011-1/+5
| | | | | | | | | | | We get this for free already for Symbol primitive values and Symbol property keys and values, due to it being supported in the pretty-printer. For the 'keys' command, we need to start using Object.getOwnPropertySymbols() to get the Symbol property keys. While we are at it, switch from using Object.keys() which only gives enumerable string/number property keys, to Object.getOwnPropertyNames(), in order to be able to debug non-enumerable properties as well.
* print: Format Symbol property keysPhilip Chimento2023-01-011-1/+10
| | | | | Introduce a new property key formatter which formats a Symbol property key in brackets.
* print: Pretty-print formatting for SymbolsPhilip Chimento2023-01-011-0/+22
| | | | | | | This formats Symbols as the source text with which they should be able to be constructed. It makes a distinction between registered symbols (created with Symbol.for()), well-known symbols (always existing), and regular symbols (created with Symbol()).
* print: Refactor check for nonstandard toString in pretty-printPhilip Chimento2023-01-011-11/+15
| | | | | | In the pretty-printer, if an object or a function has has its toString() method overridden, the overridden toString() is preferred. Refactor this check slightly so that we can put more cases in the switch statement.
* integrated the pretty printer to debugger.jsNasah2022-07-231-13/+3
|
* Not PR focus: pretty printing empty objects as {}Nasah2022-07-231-1/+2
|
* pretty print string value with double quotesNasah2022-07-231-2/+4
|
* automatically adding () to the expression to be printedNasah2022-07-231-0/+2
| | | | An expression like {a:2} is ambiguous since it can be an object literal with property a and value 2 or a statement block with label a and one expression inside, 2. Adding () disambiguates {}.
* Add check for GObject introspected objects to pretty-printNasah Kuma2022-06-131-7/+14
|
* Closes: #469 ;added check for circular referencing when printing out objectsNasah Kuma2022-03-231-7/+17
|
* Verbose object print outputNasah Kuma2022-02-251-0/+53
| | | | Closes: #107
* print: Connect up prettyPrint() to Console.interact() and log()Philip Chimento2022-02-251-1/+18
| | | | | | | | | | | | | | | It makes sense for the prettyPrint() function to be written in JS, but it does need to be called internally in Console.interact() which is written in C++. Therefore, create a slot on the global object in which to store the prettyPrint() function, which can be retrieved when needing to call the function from internal code. Console.interact() no longer needs to use gjs_value_debug_string(), so that code and its dependencies can be removed. Also pass the arguments of log() and logError() through prettyPrint(). This enables the work from #107.
* Add TypeError to Error debugger printerEvan Welsh2022-01-161-1/+1
| | | | | | dv.class is no longer Error for subclasses of Error, without this change the debugger will print {} instead of [object TypeError]
* debugger: Handle EOF at debugger prompt correctlyPhilip Chimento2022-01-161-3/+5
| | | | | | | Previously, pressing Ctrl+D at the debugger prompt would log an internal error because repl() would return undefined at EOF. It looks like the code here was actually expecting null for EOF, but we also need to explicitly quit the debugger in the EOF case and not just return.
* debugger: Add option to ignore caught exceptionsFlorian Müllner2021-08-131-1/+14
| | | | | | | | | | | | | | Right now execution stops whenever an exception is thrown, regardless of whether the exception was handled or not. This gets annoying fast when exceptions are expected, for example when handling EEXISTS after attempted file operations instead of doing (racy) existence checks. Address this by ignoring handled exceptions by default, with the option to restore the old behavior. https://gitlab.gnome.org/GNOME/gjs/-/issues/431
* Add list command to debuggerNasah Kuma2021-02-181-4/+13
|
* Refactor ARGV handling and add system.programArgs.ewlsh/refactor-argvEvan Welsh2021-02-111-0/+8
| | | | | (Changes from Philip folded in: use native function with reserved slot to store built argv array)
* Add list command to debuggerNasah-Kuma2021-02-111-0/+38
|
* debugger: Handle special return values from Environment.getVariable()Philip Chimento2021-02-081-0/+12
| | | | | | | | | | | | | | | | | | Debugger.Environment.getVariable() may return one of the three sentinel values {missingArguments: true}, {optimizedOut: true}, or {uninitialized: true} if a variable does not have a value for some reason. Handle these special values in debuggeeValueToString(). "missingArguments" means that a function argument was optimized out, "optimizedOut" means that a regular variable was optimized out, and "uninitialized" means that a variable is present in the environment but hasn't been initialized yet, for example when breaking on an exception thrown while initializing it. Also adds a test for the latter case (printing a backtrace with locals, when breaking on an exception that leaves a local variable uninitialized.) https://searchfox.org/mozilla-central/rev/6a6a366031680829746b5d2362610b868fd9571a/js/src/debugger/Debugger.cpp#1412-1435
* Display current line of source code when displaying current frame in debuggerNasah Kuma2021-01-271-15/+18
|
* Add backtrace full command to debuggerNasah Kuma2021-01-091-8/+32
| | | | Closes: GNOME/gjs#208
* debugger: Make '$$' mean the last valuePhilip Chimento2020-11-301-1/+5
| | | | | | | | | | | | | | The debugger already stores the result of each printed expression in variables named $1, $2, etc., so you can refer to them later. This change makes the variable '$$' always refer to the last printed value. Adds a bit of documentation explaining how these variables can be printed, and adds a test for $$ as well as $1, $2, etc. Based on a commit from Mozilla's original jorendb: https://hg.mozilla.org/mozilla-central/rev/fe52996292bb6d1acd51a983f9a7ac6faa7724f6 (The GJS debugger was originally based on jorendb and I was looking to see if any new improvements had been made since I had forked it)
* maint: Add copyright notices based on major file contributorsPhilip Chimento2020-11-304-0/+5
| | | | | | | | | | | | Based on looking at the git logs, add copyright notices to files which were missing them, assuming the copyright belongs to people who made major contributions to each file. Some assumptions were made as to who to assign the copyright to, such as, what copyright assignment did the contributor make in other files added in the same commit? What email address did they use to make the commit? What copyright assignment did they make in other commits using the same email address?
* lint: Switch to eslint-plugin-jsdoc and remove lint-condo.Evan Welsh2020-11-201-1/+2
| | | | | | | | | | | ESLint has deprecated jsdoc and instead recommends eslint-plugin-jsdoc. lint-condo does not have eslint-plugin-jsdoc. We only use lint-condo for eslint currently and it is simpler to instead use yarn to install and manage eslint. Some module files had JSDoc comments which violated the jsdoc plugin's more stringent rules.
* maint: Add dual MIT/LGPL license to all GJS files that didn't have onePhilip Chimento2020-10-043-0/+5
| | | | | | This adds a SPDX-License-Identifier comment to all files that are part of GJS, part of its unit tests, or auxiliary tools. (Except for some files like the debugger scripts that don't support comments.)
* maint: Convert all existing license/copyright comments to SPDX formatPhilip Chimento2020-10-041-6/+2
| | | | | | | | The SPDX format is machine-readable, which should make it much easier to avoid mistakes with licensing and copyright using automated tools. This commit does not add any implicit information. It converts exactly what was already specified into SPDX format comments.
* print: Define API writablePhilip Chimento2020-08-301-0/+4
| | | | | | | | In order to match the GJS_MODULE_PROP_FLAGS that they were previously defined with before the split into a separate module, the print functions need to be defined with writable: true on the global object. Without this, `spyOn(globalThis, 'print')` will not work.
* debugger: Remove Debugger.enabled propertyPhilip Chimento2020-08-111-12/+2
| | | | | | | | This was removed in https://bugzilla.mozilla.org/show_bug.cgi?id=1564168 and is no longer needed. Switching off the debugger is replaced by Debugger.removeAllDebuggees(), other uses can just be dropped. See: GNOME/gjs#329
* global: Refactor to support multiple global types.Evan Welsh2020-07-271-2/+2
|
* modules: Split print functions into native module.Evan Welsh2020-07-043-2/+32
|
* js: Replace trimLeft and trimRight with trimStart and trimEndPhilip Chimento2020-05-161-3/+3
| | | | | Starting with SpiderMonkey 68, the standards-compliant trimStart() and trimEnd() replace the old trimLeft() and trimRight().
* JS: migrate from the global `window` to `globalThis`Andy Holmes2020-04-242-2/+2
| | | | | | | | | As of mozjs68 (gjs-1.64) `globalThis` is recommended over `window` and it makes more sense in this context anyways. Migrate the few instances of `window` we use and adjust the eslint configuration. `window` will continue to resolve to `globalThis`, so this won't affect extensions or other downstream users.
* modules: Reorganize modules to support multiple globals.Evan Welsh2020-02-023-0/+879
- Rename and move modules.gresource.xml -> js.gresource.xml This reflects that new environments may require JS resources outside of modules/ - Move the "core" cairo, format, gettext, and signals logic to modules/core/ to allow reuse across environments. - Move the "legacy" (script-based) modules to modules/script/ - Move the script-based bootstrap files to modules/script/ - Move overrides to modules/core/ as they will be reused across environments - Update meson resource compilation. - Update js.gresource.xml for new module paths. - Update resource path references in C++.