summaryrefslogtreecommitdiff
path: root/js/src/shell
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-28 10:18:10 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-28 10:18:10 +0000
commit060e3eb0c8163698b52d59e333d9c4496c78a2c2 (patch)
tree7f23ae89939b79400774643c0e7a658b0ce7cb36 /js/src/shell
parent15914ec5780e7867ab508a48a83311c56950f8a9 (diff)
downloaduxp-060e3eb0c8163698b52d59e333d9c4496c78a2c2.tar.gz
Revert "Issue #1691 - Part 1: Provide a way of associating a private value with a script"
This reverts commit 15914ec5780e7867ab508a48a83311c56950f8a9.
Diffstat (limited to 'js/src/shell')
-rw-r--r--js/src/shell/js.cpp59
1 files changed, 2 insertions, 57 deletions
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
index acd2ec207f..6e155d3ff6 100644
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -4039,12 +4039,12 @@ SetModuleResolveHook(JSContext* cx, unsigned argc, Value* vp)
}
static JSObject*
-CallModuleResolveHook(JSContext* cx, HandleValue referencingPrivate, HandleString specifier)
+CallModuleResolveHook(JSContext* cx, HandleObject module, HandleString specifier)
{
ShellContext* sc = GetShellContext(cx);
JS::AutoValueArray<2> args(cx);
- args[0].set(referencingPrivate);
+ args[0].setObject(*module);
args[1].setString(specifier);
RootedValue result(cx);
@@ -4060,53 +4060,6 @@ CallModuleResolveHook(JSContext* cx, HandleValue referencingPrivate, HandleStrin
}
static bool
-ReportArgumentTypeError(JSContext* cx, HandleValue value, const char* expected)
-{
- const char* typeName = InformalValueTypeName(value);
- JS_ReportErrorASCII(cx, "Expected %s, got %s", expected, typeName);
- return false;
-}
-
-static bool
-ShellSetModulePrivate(JSContext* cx, unsigned argc, Value* vp)
-{
- CallArgs args = CallArgsFromVp(argc, vp);
-
- if (args.length() != 2) {
- JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
- "setModulePrivate", "0", "s");
- return false;
- }
-
- if (!args[0].isObject() || !args[0].toObject().is<ModuleObject>()) {
- return ReportArgumentTypeError(cx, args[0], "module object");
- }
-
- JS::SetModulePrivate(&args[0].toObject(), args[1]);
- args.rval().setUndefined();
- return true;
-}
-
-static bool
-ShellGetModulePrivate(JSContext* cx, unsigned argc, Value* vp)
-{
- CallArgs args = CallArgsFromVp(argc, vp);
-
- if (args.length() != 1) {
- JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
- "getModulePrivate", "0", "s");
- return false;
- }
-
- if (!args[0].isObject() || !args[0].toObject().is<ModuleObject>()) {
- return ReportArgumentTypeError(cx, args[0], "module object");
- }
-
- args.rval().set(JS::GetModulePrivate(&args[0].toObject()));
- return true;
-}
-
-static bool
GetModuleLoadPath(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -5974,14 +5927,6 @@ static const JSFunctionSpecWithHelp shell_functions[] = {
" This hook is used to look up a previously loaded module object. It should\n"
" be implemented by the module loader."),
- JS_FN_HELP("setModulePrivate", ShellSetModulePrivate, 2, 0,
-"setModulePrivate(scriptObject, privateValue)",
-" Associate a private value with a module object.\n"),
-
- JS_FN_HELP("getModulePrivate", ShellGetModulePrivate, 2, 0,
-"getModulePrivate(scriptObject)",
-" Get the private value associated with a module object.\n"),
-
JS_FN_HELP("getModuleLoadPath", GetModuleLoadPath, 0, 0,
"getModuleLoadPath()",
" Return any --module-load-path argument passed to the shell. Used by the\n"