mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 809218 - Expose atob and btoa functions in xpcshell; r=mrbkap
This commit is contained in:
parent
96013e1347
commit
595063e7a9
@ -791,6 +791,24 @@ Parent(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
Atob(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
if (!argc)
|
||||
return true;
|
||||
|
||||
return xpc::Base64Decode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp));
|
||||
}
|
||||
|
||||
static JSBool
|
||||
Btoa(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
if (!argc)
|
||||
return true;
|
||||
|
||||
return xpc::Base64Encode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp));
|
||||
}
|
||||
|
||||
static JSFunctionSpec glob_functions[] = {
|
||||
JS_FS("print", Print, 0,0),
|
||||
JS_FS("readline", ReadLine, 1,0),
|
||||
@ -805,12 +823,14 @@ static JSFunctionSpec glob_functions[] = {
|
||||
JS_FS("gczeal", GCZeal, 1,0),
|
||||
#endif
|
||||
JS_FS("options", Options, 0,0),
|
||||
JS_FN("parent", Parent, 1,0),
|
||||
JS_FN("parent", Parent, 1,0),
|
||||
#ifdef DEBUG
|
||||
JS_FS("dumpHeap", DumpHeap, 5,0),
|
||||
#endif
|
||||
JS_FS("sendCommand", SendCommand, 1,0),
|
||||
JS_FS("getChildGlobalObject", GetChildGlobalObject, 0,0),
|
||||
JS_FS("atob", Atob, 1,0),
|
||||
JS_FS("btoa", Btoa, 1,0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
@ -2322,7 +2322,7 @@ DeferredRelease(nsISupports *obj)
|
||||
return nsXPConnect::GetRuntimeInstance()->DeferredRelease(obj);
|
||||
}
|
||||
|
||||
bool
|
||||
NS_EXPORT_(bool)
|
||||
Base64Encode(JSContext *cx, JS::Value val, JS::Value *out)
|
||||
{
|
||||
MOZ_ASSERT(cx);
|
||||
@ -2348,7 +2348,7 @@ Base64Encode(JSContext *cx, JS::Value val, JS::Value *out)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NS_EXPORT_(bool)
|
||||
Base64Decode(JSContext *cx, JS::Value val, JS::Value *out)
|
||||
{
|
||||
MOZ_ASSERT(cx);
|
||||
|
@ -214,8 +214,8 @@ namespace xpc {
|
||||
bool DeferredRelease(nsISupports *obj);
|
||||
|
||||
// If these functions return false, then an exception will be set on cx.
|
||||
bool Base64Encode(JSContext *cx, JS::Value val, JS::Value *out);
|
||||
bool Base64Decode(JSContext *cx, JS::Value val, JS::Value *out);
|
||||
NS_EXPORT_(bool) Base64Encode(JSContext *cx, JS::Value val, JS::Value *out);
|
||||
NS_EXPORT_(bool) Base64Decode(JSContext *cx, JS::Value val, JS::Value *out);
|
||||
|
||||
/**
|
||||
* Convert an nsString to jsval, returning true on success.
|
||||
|
Loading…
Reference in New Issue
Block a user