summaryrefslogtreecommitdiffstats
path: root/js/src/vm
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-09 01:48:29 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:30 -0400
commitd27591806950034d8d3763a13db6f2c201311991 (patch)
treeea9b9ec96274ab9d3f0fd48670dc9b1876fdd889 /js/src/vm
parentd200a2b02e50b33511ff2ea26a2968301f06b170 (diff)
downloadUXP-d27591806950034d8d3763a13db6f2c201311991.tar
UXP-d27591806950034d8d3763a13db6f2c201311991.tar.gz
UXP-d27591806950034d8d3763a13db6f2c201311991.tar.lz
UXP-d27591806950034d8d3763a13db6f2c201311991.tar.xz
UXP-d27591806950034d8d3763a13db6f2c201311991.zip
1339137 - Don't do Annex B lexical function behavior when redeclaring a parameter name in a function with parameter expressions.
Diffstat (limited to 'js/src/vm')
-rw-r--r--js/src/vm/Scope.cpp8
-rw-r--r--js/src/vm/Scope.h11
2 files changed, 15 insertions, 4 deletions
diff --git a/js/src/vm/Scope.cpp b/js/src/vm/Scope.cpp
index a71c03695..0f80d7b69 100644
--- a/js/src/vm/Scope.cpp
+++ b/js/src/vm/Scope.cpp
@@ -669,6 +669,14 @@ FunctionScope::script() const
return canonicalFunction()->nonLazyScript();
}
+/* static */ bool
+FunctionScope::isSpecialName(ExclusiveContext* cx, JSAtom* name)
+{
+ return name == cx->names().arguments ||
+ name == cx->names().dotThis ||
+ name == cx->names().dotGenerator;
+}
+
/* static */ Shape*
FunctionScope::getEmptyEnvironmentShape(ExclusiveContext* cx, bool hasParameterExprs)
{
diff --git a/js/src/vm/Scope.h b/js/src/vm/Scope.h
index 1d04fd9f6..4a4ae8090 100644
--- a/js/src/vm/Scope.h
+++ b/js/src/vm/Scope.h
@@ -446,10 +446,11 @@ Scope::is<LexicalScope>() const
}
//
-// Scope corresponding to a function. Holds formal parameter names and, if the
-// function parameters contain no expressions that might possibly be
-// evaluated, the function's var bindings. For example, in these functions,
-// the FunctionScope will store a/b/c bindings but not d/e/f bindings:
+// Scope corresponding to a function. Holds formal parameter names, special
+// internal names (see FunctionScope::isSpecialName), and, if the function
+// parameters contain no expressions that might possibly be evaluated, the
+// function's var bindings. For example, in these functions, the FunctionScope
+// will store a/b/c bindings but not d/e/f bindings:
//
// function f1(a, b) {
// var cÍž
@@ -562,6 +563,8 @@ class FunctionScope : public Scope
return data().nonPositionalFormalStart;
}
+ static bool isSpecialName(ExclusiveContext* cx, JSAtom* name);
+
static Shape* getEmptyEnvironmentShape(ExclusiveContext* cx, bool hasParameterExprs);
};