aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/bindings.cpp (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-03-17Fix various fetch/response/request tests (#2416)Gravatar Dylan Conway 1-3/+19
* fix most fetch tests, skip a few * fastGet, toValueGC, and invalid init * bigint unreachable, range error, log process as process * remove extra fetch_headers * remove js_type parameter, check isObject() * throw invalid mime type error, use enum literal * switch back to promise rejection * RangeError pascal case
2023-03-17Feat(test): add toMatch (#2404)Gravatar zhiyuan 1-0/+25
2023-03-15feat(expect): update toBeInstanceOf (#2396)Gravatar zhiyuan 1-0/+21
* feat: update instanceof binding * fix: according to PR comments
2023-03-15Fixes #2399Gravatar Jarred Sumner 1-10/+6
2023-03-14calculated class name after name propGravatar Dylan Conway 1-11/+8
2023-03-14Implement `toMatchSnapshot()` (#2294)Gravatar Dylan Conway 1-2/+16
* buggy snapshot * error output for failed snapshot * missing first * hints * open dir once, better cleanup * update flag * truncate on update * object and class snapshot formatting * array formatting * no function name, single item is empty array * string objects, maps, sets, promise * avoid using invalid memory * handle number objects * handle extending `Number` * boolean objects * snapshot tests and test updates * snapshot format for buffers * safer snapshot parsing * property matchers setup * strings and tests * generate classes with empty prototype * optional `propertyMatchers` parameter * new test folder structure * strings.eqlLong * globalObject.throwPretty() and expect.any tests * add updateSnapshot flag to help * move snapshot format out of `printErrorlikeObject` * empty object snapshot format * separate typed array, remove trailing comma * use `isCell`, object trailing commas * handle unicode * todo for primitive constructors * switch to `JSC.Node.Syscall.open` and `JSC.Maybe` * use js parser for snapshot files * deinit ast, log parse error * copy/paste most of `exports.ZigConsoleClient` * remove snapshot option * remove ordered properties option * remove snapshot format option from `exports.zig` * remove extra newlines * change mode * update test runner output * escape backticks faster * `bunx jest` in temp dir * remove buffered writer * add `toMatchSnapshot` to types * cleanup, switch to `pread` * cli `--update` flag * `--update-snapshots` * remove string object format
2023-03-08More spec compliant `Blob.prototype.type` (#2340)Gravatar Jarred Sumner 1-4/+0
* Make `Blob.prototype. type` more spec compliant * Add a few more checks for isNumber() * Fix `make headers` * Safer JSValue.isString() * More tests for blob.slice * Make `Blob.prototype.type` more spec compliant * Add isASCII check * Fix types * Fix failing type test * Update blob.zig * Update blob.zig * Fix .eql check on empty values --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-02put AbortSignal in WebCore namespace (#2267)Gravatar Ciro Spaciari 1-15/+15
2023-02-28Make Bun.gc(true) more aggressiveGravatar Jarred Sumner 1-0/+3
2023-02-25slight performance improvement to EventEmitterGravatar Jarred Sumner 1-5/+8
2023-02-22feat(Request.signal) Initial support for signal in Request + fetch and ↵Gravatar Ciro Spaciari 1-2/+21
Request + Bun.serve (#2097) * add fetch abort signal * get aborted (still segfaults) * bidings.zig u0 error * still GC/memory error * fix start crash * fix AbortSignal fromJS * change fromJS to obj.as * addAbortSignalEventListenner * handle abort types, and add tests * fix tests * add custom reason test * merge 2 substring methods, use MAKE_STATIC_STRING_IMPL * fix create AbortError and TimeoutError, move globalThis and exception creation to main thread * fix tests and rebuild headers * no need to check with substring reason is already an exception * no need to check with substring reason is already an exception * fix dumb error inverting conditions for check reason * fix custom reason behavior * Request signal * remove package-lock.json * Remove JSC.Strong from Request signal * fix globals for fetch abort signal * more tests, clone signal crashs * fix AbortSignal.toJS * fix toJS bidings for AbortSignal * add streaming tests * fix abortion before connecting * fix tests and segfault * add fetch testing abort after finish * fix signal handler cleanup * support signal event Bun.serve * pull tests (failing) * remove unsupported test * formating * fix server Request.signal, fix cleanNativeBindings * add direct tests * more pull tests * fix stream tests * fix fetch, pending onAborted fix in HTTPServerWritable --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-02-21Update test runner output with colors and diffs (#2122)Gravatar Dylan Conway 1-34/+62
* add zig-diff * move diff functions * toHaveProperty diff for objects * use formatter * format labels * move work to format, diff when it makes sense * remove comptime, dim equal slices * order before diff * line diffs * add diffz * switch to diffz * add `diffLines()` function * small `prettyFmt()` bug fix * test runner color output * update `toBe()` error output * fix test * diff method, fix crash * fix link test * remove `isRegex`
2023-02-17Fix #1602 (#2066)Gravatar Justin Whear 1-23/+85
* initial test case * fix segfault from JSObjectMakeDeferredPromise * pass exceptions through from FetchHeader.createFromJS * not resolved, but getting close * implement review suggestions * fix exception check, tests * Change how header filtering is accomplished Previously the FetchHeaders implementation relied on converting names and values to IDLByteString to catch non-ASCII data, though not always reliably. This resulted in message-less TypeErrors when headers contained invalid characters. This commit shifts everything to IDLDOMString for the conversion and relies on the actual error checking in FetchHeaders.canWriteHeader, resulting in nicer error messages. To ensure that all headers are written as ASCII/UTF8 rather than UTF16, the copyTo bindings function checks the encoding and converts if necessary. * wrapping up FetchHeader fixes * since utf8 allocates only do so when needed * Update src/bun.js/bindings/bindings.cpp Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> * WebCore__FetchHeaders__has should return on exception path * strip out log calls from test --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-02-15feat(fetch) AbortSignal (#2019)Gravatar Ciro Spaciari 1-0/+97
* add fetch abort signal * get aborted (still segfaults) * bidings.zig u0 error * still GC/memory error * fix start crash * fix AbortSignal fromJS * change fromJS to obj.as * addAbortSignalEventListenner * handle abort types, and add tests * fix tests * add custom reason test * merge 2 substring methods, use MAKE_STATIC_STRING_IMPL * fix create AbortError and TimeoutError, move globalThis and exception creation to main thread * fix tests and rebuild headers * no need to check with substring reason is already an exception * no need to check with substring reason is already an exception * fix dumb error inverting conditions for check reason * fix custom reason behavior
2023-02-13Implement `FormData` (#2051)Gravatar Jarred Sumner 1-0/+53
* Backport std::forward change * Implement `FormData` * Fix io_darwin headers issue * Implement `Blob` support in FormData * Add test for file upload * Fix bug with Blob not reading Content-Type * Finish implementing FormData * Add FormData to types --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-01-24Fixes #1887Gravatar Jarred Sumner 1-1/+1
2023-01-23Fix crash in DOMJIT call with empty inputGravatar Jarred Sumner 1-0/+9
2023-01-23Add a commentGravatar Jarred Sumner 1-16/+1
2023-01-17Fix console.log printing multiple propertiesGravatar Jarred Sumner 1-8/+20
2023-01-10attempt (unsuccessfully) to improve c++ build timeGravatar Jarred Sumner 1-2/+64
2023-01-09check for isEmpty or !isCellGravatar Jarred Sumner 1-1/+1
2023-01-08[internal] Fix checking for Error objectGravatar Jarred Sumner 1-7/+31
2023-01-07[Bun.connect] Fix bug where connect() Promise wouldn't reject on a ↵Gravatar Jarred Sumner 1-2/+6
connection error
2023-01-07Implement DNS module (#1691)Gravatar Jarred Sumner 1-0/+56
* Boilerplate for DNS stuff * Add c-ares * lookup * make * Implement dns.lookup * Create c-ares * wip * normalize * repro * Revert "repro" This reverts commit 8b93e0c295b335b8882a9601da47720348549beb. * Implement macOS `getaddrinfo_async_start` * embiggen * Update string_immutable.zig * Update Makefile * alright * Update .gitignore * Add types * more ccache * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update bun.d.ts Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-01-01Make asPromise() and asInternalPromise() safer, but slowerGravatar Jarred SUmner 1-2/+2
2023-01-01[internal] Add more bindingsGravatar Jarred Sumner 1-0/+14
2022-12-28log object string correctly (#1674)Gravatar Alex Lam S.L 1-10/+10
use `Symbol.toStringTag` of the object or that of its `.prototype` fixes #1584
2022-12-17Delete Oniguruma (#1625)Gravatar Jarred Sumner 1-17/+1
* Update .gitmodules * Delete oniguruma * Delete Oniguruma * Make this test less flaky * :scissors: Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-12-06Don't call getters in console.logGravatar Jarred Sumner 1-4/+5
2022-12-059 charactersGravatar Dylan Conway 1-1/+1
2022-12-05Make `console` an `AsyncIterable`Gravatar Jarred Sumner 1-0/+5
2022-12-04Clean up more casesGravatar Jarred Sumner 1-6/+6
2022-12-04Fix console.log sometimes incorrectly reporting undefinedGravatar Jarred Sumner 1-4/+4
cc @Electroid
2022-12-02matchers for less than and greater than (#1573)Gravatar Dylan Conway 1-0/+46
* toBeGreaterThan with tests * toBeGreaterThanOrEqual and tests * toBeLessThan and toBeLessThanOrEqual with tests * expect types * switch expressions
2022-12-02Add some code I forgot to commitGravatar Jarred Sumner 1-0/+4
2022-12-01Fix crash when macros return a PromiseGravatar Jarred Sumner 1-0/+14
2022-12-01bun test `toStrictEqual` (#1568)Gravatar Dylan Conway 1-42/+100
* toStrictEqual and bug fix in deepEqual * rebase Remove some dead bindings code * remove debugging test * canGetIndexQuickly for array holes * isStrict template Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-12-01Include size of ArrayBuffer and others in GC timer schedulingGravatar Jarred Sumner 1-1/+1
2022-12-01Reduce memory usage in Bun.serve() by up to 3x (#1569)Gravatar Jarred Sumner 1-0/+17
* Update WebKit * Use 5x less memory in Bun.serve() * Update Dockerfile.devcontainer * Update async-overhead.mjs Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-11-30formatting and remove commentGravatar Dylan Conway 1-13/+0
2022-11-29:scissors:Gravatar Jarred Sumner 1-579/+4
2022-11-28toHaveProperty and tests (#1558)Gravatar Dylan Conway 1-0/+119
* toHaveProperty and tests * emoji tests
2022-11-27Fix crash in console.logGravatar Jarred Sumner 1-10/+13
2022-11-27Increase the max prototype countGravatar Jarred Sumner 1-19/+30
2022-11-27Update bindings.cppGravatar Jarred Sumner 1-0/+2
2022-11-27Handle more cases with printing objectsGravatar Jarred Sumner 1-26/+21
2022-11-27remove leakGravatar Jarred Sumner 1-5/+8
2022-11-27[console.log] Improve Object formatting and error handlingGravatar Jarred Sumner 1-7/+170
2022-11-23Bun.deepEquals and expect().toEqual() (#1548)Gravatar Dylan Conway 1-0/+540
* all of deepEquals * remove comment, tests, move inline function
2022-11-23possibly more reliable Bun.spawn (#1547)Gravatar Jarred Sumner 1-1/+1
* wip * wip * Fix bug with stdin * zig fmt * seems to work! * Update streams.test.js Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>