Skip to content

Commit

Permalink
Fix a few spellos
Browse files Browse the repository at this point in the history
The majority of these are in comments.
  • Loading branch information
ohodson committed Nov 5, 2023
1 parent ec83c3a commit 9448c56
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/node/internal/crypto_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import {
} from 'node-internal:validators';

// In Node.js, the definition of KeyObject is a bit complicated because
// KeyObject instances in Node.js can be transfered via postMessage() and
// KeyObject instances in Node.js can be transferred via postMessage() and
// structuredClone(), etc, allowing instances to be shared across multiple
// worker threads. We do not implement that model so we're esssentially
// re-implementing the Node.js API here instead of just taking their code.
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/api/node/buffer.c++
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ uint32_t writeInto(
if (dest.size() == 0 || string.length(js) == 0) { return 0; }

static constexpr jsg::JsString::WriteOptions flags = static_cast<jsg::JsString::WriteOptions>(
jsg::JsString::MANY_WRITES_EXPETED |
jsg::JsString::MANY_WRITES_EXPECTED |
jsg::JsString::NO_NULL_TERMINATION |
jsg::JsString::REPLACE_INVALID_UTF8);

Expand Down
2 changes: 1 addition & 1 deletion src/workerd/api/node/diagnostics-channel.c++
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void Channel::publish(jsg::Lock& js, jsg::Value message) {
ser.write(js, jsg::JsValue(message.getHandle(js)));
auto tmp = ser.release();
JSG_REQUIRE(tmp.sharedArrayBuffers.size() == 0 &&
tmp.transferedArrayBuffers.size() == 0, Error,
tmp.transferredArrayBuffers.size() == 0, Error,
"Diagnostic events cannot be published with SharedArrayBuffer or "
"transferred ArrayBuffer instances");
tracer.addDiagnosticChannelEvent(context.now(), name.toString(js), kj::mv(tmp.data));
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public:
// ...
}

CFJS_RESOURCE_TYPE(Foo) {
JSG_RESOURCE_TYPE(Foo) {
JSG_METHOD(foo);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/async-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace workerd::jsg {
//
// To implement all of this, however, we depend largely on an obscure v8 API on the
// v8::Context object called SetContinuationPreservedEmbedderData and
// GetContinuationPreservedEmbedderData. An AsyncContextFrame is a Wrappables because
// GetContinuationPreservedEmbedderData. An AsyncContextFrame is a Wrappable because
// because instances of AsyncContextFrame are set as the continuation-preserved embedder
// data and that API requires a JS value.
//
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/dom-exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace workerd::jsg {
// throw, per Web IDL.
//
// Users of JSG are free (and encouraged) to use this implementation, but they can also opt into
// the same tunneled exception feature by defining their own globally-accesible type named
// the same tunneled exception feature by defining their own globally-accessible type named
// "DOMException".
class DOMException: public Object {
public:
Expand Down
8 changes: 4 additions & 4 deletions src/workerd/jsg/exception.c++
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TunneledErrorType tunneledErrorType(kj::StringPtr internalMessage) {
Properties properties;

// Remove `remote.` (if present). Note that there are cases where we return a tunneled error
// through multiple workers, so let's be paranoid and allow for multiple "remote." prefxies.
// through multiple workers, so let's be paranoid and allow for multiple "remote." prefixes.
while (internalMessage.startsWith(ERROR_REMOTE_PREFIX)) {
properties.isFromRemote = true;
internalMessage = internalMessage.slice(ERROR_REMOTE_PREFIX.size());
Expand Down Expand Up @@ -156,10 +156,10 @@ bool isDoNotLogException(kj::StringPtr internalMessage) {
return strstr(internalMessage.cStr(), "worker_do_not_log") != nullptr;
}

kj::String annotateBroken(kj::StringPtr internalMessage, kj::StringPtr brokenessReason) {
kj::String annotateBroken(kj::StringPtr internalMessage, kj::StringPtr brokennessReason) {
// TODO(soon) Once we support multiple brokenness reasons, we can make this much simpler.

KJ_LOG(INFO, "Annotating with brokenness", internalMessage, brokenessReason);
KJ_LOG(INFO, "Annotating with brokenness", internalMessage, brokennessReason);
auto tunneledInfo = tunneledErrorType(internalMessage);

kj::StringPtr remotePrefix;
Expand All @@ -178,7 +178,7 @@ kj::String annotateBroken(kj::StringPtr internalMessage, kj::StringPtr brokeness
}

return kj::str(
remotePrefix, brokenessReason, ERROR_PREFIX_DELIM, prefixType, internalErrorType,
remotePrefix, brokennessReason, ERROR_PREFIX_DELIM, prefixType, internalErrorType,
tunneledInfo.message);
}

Expand Down
4 changes: 2 additions & 2 deletions src/workerd/jsg/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct TunneledErrorType {

TunneledErrorType tunneledErrorType(kj::StringPtr internalMessage);

// Annotate an internal message with the corresponding brokeness reason.
kj::String annotateBroken(kj::StringPtr internalMessage, kj::StringPtr brokenessReason);
// Annotate an internal message with the corresponding brokenness reason.
kj::String annotateBroken(kj::StringPtr internalMessage, kj::StringPtr brokennessReason);

} // namespace workerd::jsg
6 changes: 3 additions & 3 deletions src/workerd/jsg/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Function<Ret(Args...)> {
__builtin_unreachable();
}

// Get a handle to the underlying function. If this is a native funciton,
// Get a handle to the underlying function. If this is a native function,
// `makeNativeWrapper(Ref<Func>&)` is called to create the wrapper.
//
// Only the `FunctionWrapper` TypeWrapper mixin should call this. Anyone else needs to call
Expand Down Expand Up @@ -299,7 +299,7 @@ class FunctionWrapper {
// Apparently, this function has been wrapped before and already has an opaque handle.
// That's interesting. However, unfortunately, we don't have a handle to the v8::Function
// that was created last time, so we can't return the same function instance. This is
// arguably incorrect; what if the application added properties to it or somtehing?
// arguably incorrect; what if the application added properties to it or something?
//
// Unfortunately, it is exceedingly difficult for us to store the function handle for
// reuse without introducing performance problems.
Expand All @@ -314,7 +314,7 @@ class FunctionWrapper {
// - Another approach might be to store the v8::Function on the WrappableFunction, once
// it's created. This is a cyclic reference, but we could rely on GC visitation to
// collect it. The problem is, cyclic references can only be collected by tracing, not
// by scavenging. Tracing runs much less often than scavenging. So we'd be forcingc every
// by scavenging. Tracing runs much less often than scavenging. So we'd be forcing every
// function object to live on the heap longer than otherwise necessary.
//
// In practice, it probably never matters that returning the same jsg::Function twice
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/jsg.c++
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void Data::destroy() {
handle.Reset();

// If we have a TracedReference, Reset() it too, to let V8 know that this value is no longer
// used. Note that merely detroying the TracedReference does nothing -- only explicitly
// used. Note that merely destroying the TracedReference does nothing -- only explicitly
// calling Reset() has an effect.
//
// In particular, this permits `Data` values to be collected by minor (non-tracing) GC, as
Expand Down
16 changes: 8 additions & 8 deletions src/workerd/jsg/jsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace workerd::jsg {
// WARNING: This is usually not what you want. Usually you want JSG_PROTOTYPE_PROPERTY instead.
// Note that V8 implements instance properties by modifying the instance immediately after
// construction, which is inefficient and can break some optimizations. For example, any object
// with an instance proprety will not be possible to collect during minor GCs, only major GCs.
// with an instance property will not be possible to collect during minor GCs, only major GCs.
// Prototype properties are on the prototype, so have no runtime overhead until they are used.
#define JSG_INSTANCE_PROPERTY(name, getter, setter) \
do { \
Expand Down Expand Up @@ -639,7 +639,7 @@ class Lock;
//
// Move construction and move assignment of strong jsg::Data is well-defined even without
// holding the isolate lock. That is, it is safe to move Values unless you have implemented GC
// visitation for them. Moving jsg::Data which are reachable via GC vistation is undefined
// visitation for them. Moving jsg::Data which are reachable via GC visitation is undefined
// behavior outside of an isolate lock.
class Data {
public:
Expand Down Expand Up @@ -1033,7 +1033,7 @@ class Object: private Wrappable {
//
// Move construction and move assignment of strong jsg::Ref<T>s is well-defined even without
// holding the isolate lock. That is, it is safe to move Refs unless you have implemented GC
// visitation for them. Moving jsg::Ref<T>s which are reachable via GC vistation is undefined
// visitation for them. Moving jsg::Ref<T>s which are reachable via GC visitation is undefined
// behavior outside of an isolate lock.
template <typename T>
class Ref {
Expand Down Expand Up @@ -1236,7 +1236,7 @@ class Name final {
// Since the function could be backed by JavaScript, when calling it, you must always pass
// `jsg::Lock&` as the first parameter. When implementing a `jsg::Function` using a C++ lambda,
// the lambda should similarly take `jsg::Lock&` as the first parameter. Note that this first
// parameter is not declared in the function's signature. For exmaple, `jsg::Function<int(int)>`
// parameter is not declared in the function's signature. For example, `jsg::Function<int(int)>`
// declares a function that accepts a parameter of type int and returns an int. However, when
// actually calling it, you must still pass `jsg::Lock&`, with the `int` as the second parameter.
// (Of course, from the JavaScript side, the lock parameter is hidden, and the `int` is in fact
Expand Down Expand Up @@ -1291,7 +1291,7 @@ class Constructor;
// `.catch_()` and two-argument `.then()` are supported. Thrown exceptions are represented using
// `jsg::Value`, since technically JavaScript allows throwing any type.
//
// The type T does not have to be convertable to/from JavaScript unless a Promise<T> is actually
// The type T does not have to be convertible to/from JavaScript unless a Promise<T> is actually
// passed to/from JavaScript. That is, you can have an intermediate Promise<U> where U is a type
// that has no JavaScript representation. What actually happens is, when a Promise<T> is passed
// from JS into C++, JSG adds a .then() which unwraps the value T, and when a Promise<T> is
Expand Down Expand Up @@ -1641,10 +1641,10 @@ class TypeHandler {
template <typename T>
class PropertyReflection {
public:
// Read the property of this object called `name`, unwraping it as type `T`.
// Read the property of this object called `name`, unwrapping it as type `T`.
kj::Maybe<T> get(Lock& js, kj::StringPtr name);

// Read the property of this object called `name`, unwraping it as type `T`.
// Read the property of this object called `name`, unwrapping it as type `T`.
kj::Maybe<T> get(v8::Isolate* isolate, kj::StringPtr name) {
v8::HandleScope scope(isolate);
KJ_IF_SOME(s, self) {
Expand Down Expand Up @@ -1943,7 +1943,7 @@ class Lock {
// assumed to be serious enough that they cannot be caught as if they were JavaScript errors,
// and instead unwind must continue until C++ catches them.
//
// func() and errorHandler() must return the same type; the value they return will be retuned
// func() and errorHandler() must return the same type; the value they return will be returned
// from `tryCatch()` itself.
template <typename Func, typename ErrorHandler>
auto tryCatch(Func&& func, ErrorHandler&& errorHandler) -> decltype(func()) {
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/jsvalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class JsString final : public JsBase<v8::String, JsString> {

enum WriteOptions {
NONE = v8::String::NO_OPTIONS,
MANY_WRITES_EXPETED = v8::String::HINT_MANY_WRITES_EXPECTED,
MANY_WRITES_EXPECTED = v8::String::HINT_MANY_WRITES_EXPECTED,
NO_NULL_TERMINATION = v8::String::NO_NULL_TERMINATION,
PRESERVE_ONE_BYTE_NULL = v8::String::PRESERVE_ONE_BYTE_NULL,
REPLACE_INVALID_UTF8 = v8::String::REPLACE_INVALID_UTF8,
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/promise-test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct PromiseContext: public jsg::Object, public jsg::ContextGlobal {
}

void setResult(jsg::Lock& js, Promise<kj::String> promise) {
// Throwing away the result of `.then()` dosen't cancel it!
// Throwing away the result of `.then()` doesn't cancel it!
promise.then(js, [](jsg::Lock&, kj::String str) {
promiseTestResult = str.parseAs<int>();
}).then(js, [](jsg::Lock&) {
Expand Down
6 changes: 3 additions & 3 deletions src/workerd/jsg/promise.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct ThenCatchPair {
// FunctionCallback implementing a C++ .then() continuation on a JS promise.
//
// We expect the input is already an opaque-wrapped value, args.Data() is an opaque-wrapped C++
// function to eoxecute, and we want to produce an opaque-wrapped output or Promise.
// function to execute, and we want to produce an opaque-wrapped output or Promise.
template <typename FuncPairType, bool passLock, bool isCatch, typename Input, typename Output>
void promiseContinuation(const v8::FunctionCallbackInfo<v8::Value>& args) {
liftKj(args, [&]() {
Expand Down Expand Up @@ -392,7 +392,7 @@ class Promise {

// DEPRECATED: The versions below do not take a `Lock` as the first param, but they do actually
// require a lock. These versions also do not pass a `Lock` to the callback.
// TODO(clenaup): Update all call sites to the version that passes locks. Then, remove these and
// TODO(cleanup): Update all call sites to the version that passes locks. Then, remove these and
// also remove the `isolate` parameter from this class.

template <typename Func, typename ErrorFunc>
Expand Down Expand Up @@ -691,7 +691,7 @@ class PromiseWrapper {
// It's possible to argue that we should actually allow only `undefined` here but
// changing it now could break existing users, e.g. html-rewriter.ew-test is broken
// because it writes `() => someExpression()` for a callback that's supposed to
// optionally return Promise<void> -- it seems like the callback isn't acutally intending
// optionally return Promise<void> -- it seems like the callback isn't actually intending
// to return the result of `someExpression()` but does so by accident since the braces
// are missing. This is probably common in user code, too.
return resolvedPromise(context->GetIsolate());
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ class NullConfiguration {
};

// TypeWrapper must list this type as its first superclass. The ResourceWrappers that it
// subclasses will then be able to regsiter themselves in the map.
// subclasses will then be able to register themselves in the map.
template <typename TypeWrapper>
class DynamicResourceTypeMap {
private:
Expand Down
12 changes: 6 additions & 6 deletions src/workerd/jsg/ser.c++
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Serializer::Released Serializer::release() {
return Released {
.data = kj::Array(pair.first, pair.second, jsg::SERIALIZED_BUFFER_DISPOSER),
.sharedArrayBuffers = sharedBackingStores.releaseAsArray(),
.transferedArrayBuffers = backingStores.releaseAsArray(),
.transferredArrayBuffers = backingStores.releaseAsArray(),
};
}

Expand Down Expand Up @@ -91,15 +91,15 @@ void Serializer::write(Lock& js, const JsValue& value) {
Deserializer::Deserializer(
Lock& js,
kj::ArrayPtr<const kj::byte> data,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferedArrayBuffers,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferredArrayBuffers,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> sharedArrayBuffers,
kj::Maybe<Options> maybeOptions)
: deser(js.v8Isolate, data.begin(), data.size(), this),
sharedBackingStores(kj::mv(sharedArrayBuffers)) {
#ifdef KJ_DEBUG
kj::requireOnStack(this, "jsg::Deserializer must be allocated on the stack");
#endif
init(js, kj::mv(transferedArrayBuffers), kj::mv(maybeOptions));
init(js, kj::mv(transferredArrayBuffers), kj::mv(maybeOptions));
}

Deserializer::Deserializer(
Expand All @@ -109,13 +109,13 @@ Deserializer::Deserializer(
: Deserializer(
js,
released.data.asPtr(),
released.transferedArrayBuffers.asPtr(),
released.transferredArrayBuffers.asPtr(),
released.sharedArrayBuffers.asPtr(),
kj::mv(maybeOptions)) {}

void Deserializer::init(
Lock& js,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferedArrayBuffers,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferredArrayBuffers,
kj::Maybe<Options> maybeOptions) {
auto options = maybeOptions.orDefault({});
if (options.readHeader) {
Expand All @@ -125,7 +125,7 @@ void Deserializer::init(
KJ_ASSERT(version >= 13, "The minimum serialization version is 13.");
deser.SetWireFormatVersion(version);
}
KJ_IF_SOME(arrayBuffers, transferedArrayBuffers) {
KJ_IF_SOME(arrayBuffers, transferredArrayBuffers) {
for (auto n : kj::indices(arrayBuffers)) {
deser.TransferArrayBuffer(n,
v8::ArrayBuffer::New(js.v8Isolate, kj::mv((arrayBuffers)[n])));
Expand Down
6 changes: 3 additions & 3 deletions src/workerd/jsg/ser.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Serializer final: v8::ValueSerializer::Delegate {
struct Released {
kj::Array<kj::byte> data;
kj::Array<std::shared_ptr<v8::BackingStore>> sharedArrayBuffers;
kj::Array<std::shared_ptr<v8::BackingStore>> transferedArrayBuffers;
kj::Array<std::shared_ptr<v8::BackingStore>> transferredArrayBuffers;
};

explicit Serializer(Lock& js, kj::Maybe<Options> maybeOptions = kj::none);
Expand Down Expand Up @@ -68,7 +68,7 @@ class Deserializer final: v8::ValueDeserializer::Delegate {
explicit Deserializer(
Lock& js,
kj::ArrayPtr<const kj::byte> data,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferedArrayBuffers = kj::none,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferredArrayBuffers = kj::none,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> sharedArrayBuffers = kj::none,
kj::Maybe<Options> maybeOptions = kj::none);

Expand All @@ -88,7 +88,7 @@ class Deserializer final: v8::ValueDeserializer::Delegate {
private:
void init(
Lock& js,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferedArrayBuffers = kj::none,
kj::Maybe<kj::ArrayPtr<std::shared_ptr<v8::BackingStore>>> transferredArrayBuffers = kj::none,
kj::Maybe<Options> maybeOptions = kj::none);

v8::MaybeLocal<v8::SharedArrayBuffer> GetSharedArrayBufferFromId(
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ inline KJ_WARN_UNUSED_RESULT UsvString usv(UsvString&& other) { return kj::mv(ot
inline KJ_WARN_UNUSED_RESULT UsvString usv(UsvStringPtr other) { return other.clone(); }

// Make a UsvString from a string literal (assumed to be UTF-8 encoded)
// reinterpretd as a sequence of UTF-16 Unicode code units. The underlying
// reinterpreted as a sequence of UTF-16 Unicode code units. The underlying
// storage of utf16_t code units will be heap allocated.
inline KJ_WARN_UNUSED_RESULT UsvString usv(const char* string) {
return usv(kj::toCharSequence(string));
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/type-wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class TypeWrapperBase<Self, InjectConfiguration<Configuration>, JsgKind::EXTENSI
// static constexpr const char* getName(T* dummy);
// // Return the name of the type for the purpose of TypeError exception messages. Note that
// // you can also return `const std::type_info&` here, in which case the type name will
// // be derived by stripping off the namespase from the C++ type name.
// // be derived by stripping off the namespace from the C++ type name.
//
// v8::Local<v8::Value> wrap(v8::Local<v8::Context> jsContext,
// kj::Maybe<v8::Local<v8::Object>> creator,
Expand Down
Loading

0 comments on commit 9448c56

Please sign in to comment.