Skip to content

Commit 7933ae7

Browse files
Jake ChampionJakeChampion
authored andcommitted
appease the formatter
1 parent f76aa85 commit 7933ae7

File tree

4 files changed

+38
-39
lines changed

4 files changed

+38
-39
lines changed

c-dependencies/js-compute-runtime/builtin.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ template <typename Impl> class BuiltinImpl {
148148
&class_ops,
149149
};
150150

151-
static inline JS::Result<std::tuple<JS::CallArgs, JS::Rooted<JSObject *> *>> MethodHeaderWithName(int required_argc, JSContext *cx, unsigned argc,JS::Value *vp, const char *name) {
151+
static inline JS::Result<std::tuple<JS::CallArgs, JS::Rooted<JSObject *> *>>
152+
MethodHeaderWithName(int required_argc, JSContext *cx, unsigned argc, JS::Value *vp,
153+
const char *name) {
152154
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
153155
if (!check_receiver(cx, args.thisv(), name)) {
154156
return JS::Result<std::tuple<JS::CallArgs, JS::Rooted<JSObject *> *>>(JS::Error());
@@ -158,7 +160,8 @@ template <typename Impl> class BuiltinImpl {
158160
return JS::Result<std::tuple<JS::CallArgs, JS::Rooted<JSObject *> *>>(JS::Error());
159161
}
160162

161-
return JS::Result<std::tuple<JS::CallArgs, JS::Rooted<JSObject *> *>>(std::make_tuple(args, &self));
163+
return JS::Result<std::tuple<JS::CallArgs, JS::Rooted<JSObject *> *>>(
164+
std::make_tuple(args, &self));
162165
}
163166

164167
static JS::PersistentRooted<JSObject *> proto_obj;
Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#include "builtins/worker-location.h"
12
#include "builtin.h"
23
#include "builtins/url.h"
3-
#include "builtins/worker-location.h"
4-
#include "js-compute-builtins.h"
54
#include "host_call.h"
5+
#include "js-compute-builtins.h"
66

77
/**
88
* The `WorkerLocation` builtin, added to the global object as the data property
@@ -12,48 +12,45 @@
1212
namespace builtins {
1313
JS::PersistentRooted<JSObject *> WorkerLocation::url;
1414

15-
#define WorkerLocation_ACCESSOR_GET(field) \
16-
bool field##_get(JSContext *cx, unsigned argc, JS::Value *vp) { \
17-
auto result = WorkerLocation::MethodHeaderWithName(0, cx, argc, vp, __func__); \
18-
if (result.isErr()) { \
19-
return false; \
20-
} \
21-
auto [args, self] = result.unwrap(); \
22-
REQUEST_HANDLER_ONLY("location." #field) \
23-
return URL::field(cx, WorkerLocation::url, args.rval()); \
15+
#define WorkerLocation_ACCESSOR_GET(field) \
16+
bool field##_get(JSContext *cx, unsigned argc, JS::Value *vp) { \
17+
auto result = WorkerLocation::MethodHeaderWithName(0, cx, argc, vp, __func__); \
18+
if (result.isErr()) { \
19+
return false; \
20+
} \
21+
auto [args, self] = result.unwrap(); \
22+
REQUEST_HANDLER_ONLY("location." #field) \
23+
return URL::field(cx, WorkerLocation::url, args.rval()); \
2424
}
2525

26-
WorkerLocation_ACCESSOR_GET(href)
27-
WorkerLocation_ACCESSOR_GET(origin)
28-
WorkerLocation_ACCESSOR_GET(protocol)
29-
WorkerLocation_ACCESSOR_GET(host)
30-
WorkerLocation_ACCESSOR_GET(hostname)
31-
WorkerLocation_ACCESSOR_GET(port)
32-
WorkerLocation_ACCESSOR_GET(pathname)
33-
WorkerLocation_ACCESSOR_GET(search)
34-
WorkerLocation_ACCESSOR_GET(hash)
26+
WorkerLocation_ACCESSOR_GET(href) WorkerLocation_ACCESSOR_GET(origin)
27+
WorkerLocation_ACCESSOR_GET(protocol) WorkerLocation_ACCESSOR_GET(host)
28+
WorkerLocation_ACCESSOR_GET(hostname) WorkerLocation_ACCESSOR_GET(port)
29+
WorkerLocation_ACCESSOR_GET(pathname) WorkerLocation_ACCESSOR_GET(search)
30+
WorkerLocation_ACCESSOR_GET(hash)
3531

3632
#undef WorkerLocation_ACCESSOR_GET
3733

38-
bool WorkerLocation::toString(JSContext *cx, unsigned argc, JS::Value *vp) {
34+
bool WorkerLocation::toString(JSContext *cx, unsigned argc, JS::Value *vp) {
3935
METHOD_HEADER(0)
4036
return href_get(cx, argc, vp);
4137
}
4238

39+
const JSFunctionSpec WorkerLocation::methods[] = {JS_FN("toString", toString, 0, JSPROP_ENUMERATE),
40+
JS_FS_END};
4341

44-
const JSFunctionSpec WorkerLocation::methods[] = {JS_FN("toString", toString, 0, JSPROP_ENUMERATE), JS_FS_END};
45-
46-
const JSPropertySpec WorkerLocation::properties[] = {JS_PSG("href", href_get, JSPROP_ENUMERATE),
47-
JS_PSG("origin", origin_get, JSPROP_ENUMERATE),
48-
JS_PSG("protocol", protocol_get, JSPROP_ENUMERATE),
49-
JS_PSG("host", host_get, JSPROP_ENUMERATE),
50-
JS_PSG("hostname", hostname_get, JSPROP_ENUMERATE),
51-
JS_PSG("port", port_get, JSPROP_ENUMERATE),
52-
JS_PSG("pathname", pathname_get, JSPROP_ENUMERATE),
53-
JS_PSG("search", search_get, JSPROP_ENUMERATE),
54-
JS_PSG("hash", hash_get, JSPROP_ENUMERATE),
55-
JS_STRING_SYM_PS(toStringTag, "Location", JSPROP_READONLY),
56-
JS_PS_END};
42+
const JSPropertySpec WorkerLocation::properties[] = {
43+
JS_PSG("href", href_get, JSPROP_ENUMERATE),
44+
JS_PSG("origin", origin_get, JSPROP_ENUMERATE),
45+
JS_PSG("protocol", protocol_get, JSPROP_ENUMERATE),
46+
JS_PSG("host", host_get, JSPROP_ENUMERATE),
47+
JS_PSG("hostname", hostname_get, JSPROP_ENUMERATE),
48+
JS_PSG("port", port_get, JSPROP_ENUMERATE),
49+
JS_PSG("pathname", pathname_get, JSPROP_ENUMERATE),
50+
JS_PSG("search", search_get, JSPROP_ENUMERATE),
51+
JS_PSG("hash", hash_get, JSPROP_ENUMERATE),
52+
JS_STRING_SYM_PS(toStringTag, "Location", JSPROP_READONLY),
53+
JS_PS_END};
5754

5855
bool WorkerLocation::constructor(JSContext *cx, unsigned argc, JS::Value *vp) {
5956
JS_ReportErrorLatin1(cx, "Illegal constructor WorkerLocation");
@@ -76,4 +73,3 @@ bool WorkerLocation::init_class(JSContext *cx, JS::HandleObject global) {
7673
}
7774

7875
} // namespace builtins
79-

c-dependencies/js-compute-runtime/builtins/worker-location.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace builtins {
77

88
class WorkerLocation : public BuiltinImpl<WorkerLocation> {
99
private:
10-
1110
public:
1211
static constexpr const char *class_name = "WorkerLocation";
1312
static const int ctor_length = 1;

c-dependencies/js-compute-runtime/js-compute-builtins.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3370,7 +3370,8 @@ static bool init_downstream_request(JSContext *cx, HandleObject request) {
33703370
if (!url_instance)
33713371
return false;
33723372

3373-
builtins::Fastly::baseURL = URL::create(cx, url_instance, URL::origin(cx, builtins::WorkerLocation::url));
3373+
builtins::Fastly::baseURL =
3374+
URL::create(cx, url_instance, URL::origin(cx, builtins::WorkerLocation::url));
33743375
if (!builtins::Fastly::baseURL)
33753376
return false;
33763377
}

0 commit comments

Comments
 (0)