ladybird/Userland/Utilities
Linus Groh 09bd5f8772 LibJS: Rewrite most of Object for spec compliance :^)
This is a huge patch, I know. In hindsight this perhaps could've been
done slightly more incremental, but I started and then fixed everything
until it worked, and here we are. I tried splitting of some completely
unrelated changes into separate commits, however. Anyway.

This is a rewrite of most of Object, and by extension large parts of
Array, Proxy, Reflect, String, TypedArray, and some other things.

What we already had worked fine for about 90% of things, but getting the
last 10% right proved to be increasingly difficult with the current code
that sort of grew organically and is only very loosely based on the
spec - this became especially obvious when we started fixing a large
number of test262 failures.

Key changes include:

- 1:1 matching function names and parameters of all object-related
  functions, to avoid ambiguity. Previously we had things like put(),
  which the spec doesn't have - as a result it wasn't always clear which
  need to be used.
- Better separation between object abstract operations and internal
  methods - the former are always the same, the latter can be overridden
  (and are therefore virtual). The internal methods (i.e. [[Foo]] in the
  spec) are now prefixed with 'internal_' for clarity - again, it was
  previously not always clear which AO a certain method represents,
  get() could've been both Get and [[Get]] (I don't know which one it
  was closer to right now).
  Note that some of the old names have been kept until all code relying
  on them is updated, but they are now simple wrappers around the
  closest matching standard abstract operation.
- Simplifications of the storage layer: functions that write values to
  storage are now prefixed with 'storage_' to make their purpose clear,
  and as they are not part of the spec they should not contain any steps
  specified by it. Much functionality is now covered by the layers above
  it and was removed (e.g. handling of accessors, attribute checks).
- PropertyAttributes has been greatly simplified, and is being replaced
  by PropertyDescriptor - a concept similar to the current
  implementation, but more aligned with the actual spec. See the commit
  message of the previous commit where it was introduced for details.
- As a bonus, and since I had to look at the spec a whole lot anyway, I
  introduced more inline comments with the exact steps from the spec -
  this makes it super easy to verify correctness.
- East-const all the things.

As a result of all of this, things are much more correct but a bit
slower now. Retaining speed wasn't a consideration at all, I have done
no profiling of the new code - there might be low hanging fruits, which
we can then harvest separately.

Special thanks to Idan for helping me with this by tracking down bugs,
updating everything outside of LibJS to work with these changes (LibWeb,
Spreadsheet, HackStudio), as well as providing countless patches to fix
regressions I introduced - there still are very few (we got it down to
5), but we also get many new passing test262 tests in return. :^)

Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
2021-07-04 22:07:36 +01:00
..
adjtime.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
allocate.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
aplay.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
arp.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
avol.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
base64.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
basename.cpp AK+Everywhere: Use mostly StringView in LexicalPath 2021-06-30 11:13:54 +02:00
beep.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
bt.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
cal.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
cat.cpp Utilities: Use Vector<String> positional arguments in some places 2021-04-29 11:28:01 +02:00
checksum.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
chgrp.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
chmod.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
chown.cpp Userland: Return 1 when help text is shown for insufficient args 2021-06-01 21:30:16 +01:00
chres.cpp WindowServer: Add API to set/get screen layouts 2021-06-20 14:57:26 +02:00
chroot.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
cksum.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
clear.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
CMakeLists.txt Userland: Add pgrep 2021-07-04 14:27:47 +02:00
copy.cpp Utilities: Correct non-standard assert macros includes 2021-05-17 18:14:05 +01:00
cp.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
cpp-parser.cpp LibCpp: Generalize ASTNode::dump() to support redirecting its output 2021-05-19 23:19:07 +02:00
crash.cpp Meta: Disable -Wmaybe-uninitialized 2021-06-09 23:05:32 +04:30
cut.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
date.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
dd.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
ddate.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
df.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
dirname.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
disasm.cpp Everywhere: Add missing includes for <AK/OwnPtr.h> 2021-05-19 21:36:57 +02:00
disk_benchmark.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
dmesg.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
du.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
echo.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
env.cpp Userland: Let env parse options up to first non-option 2021-06-08 11:30:58 +02:00
errno.cpp Utilities: Add errno utility 2021-05-15 23:51:50 +01:00
expr.cpp Everywhere: Prefer using "..."sv over StringView { "..." } 2021-07-04 14:24:03 +02:00
false.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
fgrep.cpp Userland: Return 1 when help text is shown for insufficient args 2021-06-01 21:30:16 +01:00
file.cpp Userland: Teach the file utility that empty files also exist 2021-06-15 21:30:55 +02:00
find.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
flock.cpp Userland: Return 1 when help text is shown for insufficient args 2021-06-01 21:30:16 +01:00
fortune.cpp AK+Everywhere: Change int to size_t in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
functrace.cpp Utilities: Fix Build on x86_64 2021-06-30 19:05:51 +02:00
gml-format.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
grep.cpp Everywhere: Prefer using "..."sv over StringView { "..." } 2021-07-04 14:24:03 +02:00
gron.cpp AK+Everywhere: Change int to size_t in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
groups.cpp Userland: Add groups program 2021-05-05 15:12:30 +01:00
gunzip.cpp Utilities: Use Vector<String> positional arguments in some places 2021-04-29 11:28:01 +02:00
gzip.cpp Utilities: Use Vector<String> positional arguments in some places 2021-04-29 11:28:01 +02:00
head.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
hexdump.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
host.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
hostname.cpp hostname: Handle 'sethostname' errors 2021-06-04 19:11:27 +02:00
id.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
ifconfig.cpp ifconfig: Use shorter argument names 2021-06-05 23:51:08 +04:30
ini.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
jp.cpp Userland: Avoid a bunch of JsonObject copies 2021-05-31 17:59:02 +01:00
js.cpp LibJS: Rewrite most of Object for spec compliance :^) 2021-07-04 22:07:36 +01:00
keymap.cpp Userland: Preserve keyboard mapping preference on reboot (#6955) 2021-05-09 15:56:03 +02:00
kill.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
killall.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
ln.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
ls.cpp LibGUI+Shell+bt+ls: Use proper APIs for creating file URLs 2021-06-01 09:28:05 +02:00
lsirq.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
lsof.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
lspci.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
lsusb.cpp Userland/Libraries: Add LibUSBDB library 2021-06-18 17:04:57 +04:30
man.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
matroska.cpp LibVideo: Migrate to east-const style & apply other minor fixes 2021-06-30 11:03:51 +02:00
md.cpp md: Improve document parsing error message 2021-06-01 21:30:16 +01:00
misbehaving-application.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
mkdir.cpp AK+Everywhere: Use mostly StringView in LexicalPath 2021-06-30 11:13:54 +02:00
mkfifo.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
mknod.cpp Userland: Return 1 when help text is shown for insufficient args 2021-06-01 21:30:16 +01:00
mktemp.cpp AK: Remove the LexicalPath::is_valid() API 2021-06-30 11:13:54 +02:00
modload.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
modunload.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
more.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
mount.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
mv.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
nc.cpp Userland: Treat inet_pton returning 0 as an error 2021-05-27 22:56:21 +02:00
netstat.cpp Userland: Avoid a bunch of JsonObject copies 2021-05-31 17:59:02 +01:00
nl.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
notify.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
nproc.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
ntpquery.cpp ntpquery: Replace printf()/fprintf(stderr) with out{,ln}()/warnln() 2021-05-30 14:07:58 +01:00
open.cpp Utilities: Add support for relative paths in open command 2021-06-02 17:34:27 +04:30
pape.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
passwd.cpp passwd: Do not allow empty passwords 2021-06-17 19:54:38 +02:00
paste.cpp Userland: Implement paste --watch mode 2021-05-10 19:09:53 +01:00
pathchk.cpp Everywhere: "file name" => "filename" 2021-04-29 22:16:18 +02:00
pgrep.cpp Userland: Add pgrep 2021-07-04 14:27:47 +02:00
pidof.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
ping.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
pls.cpp pls: Fix typo in TERM environment variable propagation 2021-05-30 23:13:52 +02:00
pmap.cpp Utilities: Report correct memory addresses for pmap 2021-06-02 10:16:45 +01:00
PreprocessorTest.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
printf.cpp Utilities: Correct non-standard assert macros includes 2021-05-17 18:14:05 +01:00
pro.cpp AK+Everywhere: Remove StringView::find_{first,last}_of(char) methods 2021-07-02 21:54:21 +02:00
profile.cpp LibCore: Support fine-grained failure behavior for ArgsParser 2021-06-08 11:30:58 +02:00
ps.cpp Utilities: Make sure columns for ps are properly aligned 2021-06-03 17:53:59 +02:00
purge.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
readelf.cpp Kernel+LibELF: Add support for validating and loading ELF64 executables 2021-06-28 22:29:28 +02:00
readlink.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
realpath.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
reboot.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
rev.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
rm.cpp rm: Allow empty paths if -f is specified 2021-06-05 10:56:58 +02:00
rmdir.cpp Userland: Make rmdir take multiple paths 2021-04-26 09:32:42 +02:00
run-tests.cpp Everywhere: Prefer using "..."sv over StringView { "..." } 2021-07-04 14:24:03 +02:00
seq.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
shot.cpp WindowServer: Enable screen capture to span multiple screens 2021-06-20 14:57:26 +02:00
shuf.cpp Userland: Migrate from arc4random_uniform() to get_random_uniform() 2021-05-14 22:24:02 +02:00
shutdown.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
sleep.cpp LibC: Do not include errno.h inside unistd.h 2021-05-14 22:24:02 +02:00
sort.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
sql.cpp LibSQL: Make lexer and parser more standard SQL compliant 2021-06-24 00:36:53 +02:00
stat.cpp LibC: Move makedev(), major(), minor(), to sys/types.h 2021-05-14 22:24:02 +02:00
strace.cpp Kernel: Rename Thread::tss to Thread::regs and add x86_64 support 2021-06-27 15:46:42 +02:00
stty.cpp Userland: Fix incorrect iflag/oflag printing in stty 2021-06-10 23:44:14 +02:00
su.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
sync.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
syscall.cpp Utilities: Correct non-standard assert macros includes 2021-05-17 18:14:05 +01:00
sysctl.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
tac.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
tail.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
tar.cpp tar: Ignore "extended headers" 2021-05-24 00:01:01 +01:00
tee.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
telws.cpp Utilities: Update telws to use the isolated WebSocket service 2021-04-25 19:04:34 +02:00
test_efault.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
test_env.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
test_io.cpp Utilities: Fix Build on x86_64 2021-06-30 19:05:51 +02:00
test-bindtodevice.cpp Userland: Rename e1k0 to ep0s7 2021-05-22 15:42:54 +01:00
test-crypto.cpp LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N) 2021-06-29 16:55:54 +01:00
test-fuzz.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00
test-imap.cpp Utilities: Add a simple utility to test the IMAP library 2021-06-11 23:58:28 +04:30
test-pthread.cpp Userland: Rename LibThread => LibThreading 2021-05-22 18:54:22 +02:00
test-unveil.cpp Utilities: Fix test-unveil INT_MAX include 2021-05-23 18:10:29 +02:00
test.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
top.cpp Utilities/top: Remove unused header includes 2021-06-28 16:38:44 +02:00
touch.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
tr.cpp Everywhere: Sort out superfluous QuickSort.h imports 2021-05-29 23:41:54 +01:00
traceroute.cpp Utilities: Correct non-standard assert macros includes 2021-05-17 18:14:05 +01:00
tree.cpp AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
true.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
truncate.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
tt.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
tty.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
umount.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
uname.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
uniq.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
unzip.cpp Utilites: Implement unzip -q 2021-06-13 17:05:48 +01:00
uptime.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
useradd.cpp Utilities: Do not allow creating users with existing usernames 2021-06-09 09:00:31 +02:00
userdel.cpp Utilities: Validate user with Core::Account in userdel 2021-06-24 17:33:14 +04:30
utmpupdate.cpp Utilities: Correct non-standard assert macros includes 2021-05-17 18:14:05 +01:00
w.cpp Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
wasm.cpp LibWasm: Give traps a reason and display it when needed 2021-07-02 04:53:01 +04:30
watch.cpp Utilities: Make watch stop parsing options on first non-option 2021-06-08 11:30:58 +02:00
wc.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
which.cpp which: Replace printf() with outln()/warnln() 2021-05-30 14:07:58 +01:00
whoami.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
xargs.cpp Everywhere: Prefer using "..."sv over StringView { "..." } 2021-07-04 14:24:03 +02:00
yes.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
zip.cpp LibCore+Everywhere: Move OpenMode out of IODevice 2021-05-12 11:00:45 +01:00