зеркало из https://github.com/mozilla/pjs.git
Fixes for bugs #155285 - Array.join(undefined) should use ','
#155289 - String.prototype.XXX.length has some wrong values #155291 - RegExp properties should be DontEnum Plus fix for matching against RegEXp captures with undefined value.
This commit is contained in:
Родитель
248235a579
Коммит
aa1f6e4345
|
@ -551,7 +551,7 @@ public class NativeArray extends IdScriptable {
|
|||
double length = getLengthProperty(thisObj);
|
||||
|
||||
// if no args, use "," as separator
|
||||
if (args.length < 1) {
|
||||
if ((args.length < 1) || (args[0] == Undefined.instance)) {
|
||||
separator = ",";
|
||||
} else {
|
||||
separator = ScriptRuntime.toString(args[0]);
|
||||
|
|
|
@ -96,9 +96,9 @@ final class NativeString extends IdScriptable {
|
|||
case Id_valueOf: return 0;
|
||||
case Id_charAt: return 1;
|
||||
case Id_charCodeAt: return 1;
|
||||
case Id_indexOf: return 2;
|
||||
case Id_lastIndexOf: return 2;
|
||||
case Id_split: return 1;
|
||||
case Id_indexOf: return 1;
|
||||
case Id_lastIndexOf: return 1;
|
||||
case Id_split: return 2;
|
||||
case Id_substring: return 2;
|
||||
case Id_toLowerCase: return 0;
|
||||
case Id_toUpperCase: return 0;
|
||||
|
|
|
@ -1516,7 +1516,7 @@ System.out.println();
|
|||
int parenContent;
|
||||
RECapture s = x.parens[parenIndex];
|
||||
if (s.index == -1)
|
||||
return null;
|
||||
return x;
|
||||
|
||||
len = s.length;
|
||||
if ((x.cp + len) > gData.cpend)
|
||||
|
@ -2700,12 +2700,13 @@ System.out.println("Testing at " + x.cp + ", op = " + op);
|
|||
protected int getIdDefaultAttributes(int id) {
|
||||
switch (id) {
|
||||
case Id_lastIndex:
|
||||
return ScriptableObject.PERMANENT;
|
||||
return ScriptableObject.PERMANENT | ScriptableObject.DONTENUM;
|
||||
case Id_source:
|
||||
case Id_global:
|
||||
case Id_ignoreCase:
|
||||
case Id_multiline:
|
||||
return ScriptableObject.PERMANENT | ScriptableObject.READONLY;
|
||||
return ScriptableObject.PERMANENT | ScriptableObject.READONLY
|
||||
| ScriptableObject.DONTENUM;
|
||||
}
|
||||
return super.getIdDefaultAttributes(id);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче