Skip to content

Commit 58ae515

Browse files
authored
Add implementation of FormData builtin (#191)
1 parent 66aa7e1 commit 58ae515

22 files changed

Lines changed: 824 additions & 5 deletions

builtins/web/file.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ bool File::init(JSContext *cx, HandleObject self, HandleValue fileBits, HandleVa
114114
return true;
115115
}
116116

117+
JSObject* File::create(JSContext *cx, HandleValue fileBits, HandleValue fileName, HandleValue opts) {
118+
RootedObject self(cx, JS_NewObjectWithGivenProto(cx, &class_, proto_obj));
119+
if (!self) {
120+
return nullptr;
121+
}
122+
123+
if (!init(cx, self, fileBits, fileName, opts)) {
124+
return nullptr;
125+
}
126+
127+
return self;
128+
}
129+
117130
bool File::constructor(JSContext *cx, unsigned argc, JS::Value *vp) {
118131
CTOR_HEADER("File", 2);
119132

builtins/web/file.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class File : public BuiltinImpl<File> {
2323
static const JSFunctionSpec methods[];
2424
static const JSPropertySpec properties[];
2525

26+
static JSObject *create(JSContext *cx, HandleValue fileBits, HandleValue fileName, HandleValue opts);
2627
static bool init(JSContext *cx, HandleObject self, HandleValue fileBits, HandleValue fileName, HandleValue opts);
2728
static bool init_class(JSContext *cx, HandleObject global);
2829
static bool constructor(JSContext *cx, unsigned argc, Value *vp);

0 commit comments

Comments
 (0)