зеркало из https://github.com/mozilla/gecko-dev.git
Bug 892214 - Moving atob to xpcprivate. r=bholley
This commit is contained in:
Родитель
bd6dfab501
Коммит
158834d6db
|
@ -145,24 +145,6 @@ Debug(JSContext *cx, unsigned argc, jsval *vp)
|
|||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
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 bool
|
||||
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 bool
|
||||
File(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
|
|
|
@ -1678,6 +1678,27 @@ JS_EXPORT_API(void) DumpCompleteHeap()
|
|||
|
||||
} // extern "C"
|
||||
|
||||
namespace xpc {
|
||||
|
||||
bool
|
||||
Atob(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
if (!argc)
|
||||
return true;
|
||||
|
||||
return xpc::Base64Decode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp));
|
||||
}
|
||||
|
||||
bool
|
||||
Btoa(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
if (!argc)
|
||||
return true;
|
||||
|
||||
return xpc::Base64Encode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp));
|
||||
}
|
||||
|
||||
} // namespace xpc
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -3566,6 +3566,14 @@ xpc_GetSafeJSContext()
|
|||
|
||||
namespace xpc {
|
||||
|
||||
// JSNatives to expose atob and btoa in various non-DOM XPConnect scopes.
|
||||
bool
|
||||
Atob(JSContext *cx, unsigned argc, jsval *vp);
|
||||
|
||||
bool
|
||||
Btoa(JSContext *cx, unsigned argc, jsval *vp);
|
||||
|
||||
|
||||
// Helper function that creates a JSFunction that wraps a native function that
|
||||
// forwards the call to the original 'callable'. If the 'doclone' argument is
|
||||
// set, it also structure clones non-native arguments for extra security.
|
||||
|
|
Загрузка…
Ссылка в новой задаче