Skip to content

Commit

Permalink
Add workarounds for mozilla#437 and mozilla#449
Browse files Browse the repository at this point in the history
  • Loading branch information
szegedi committed Jun 17, 2018
1 parent 45055a0 commit da47916
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/org/mozilla/javascript/EqualObjectGraphs.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import java.util.SortedMap;
import java.util.TreeMap;
import org.mozilla.javascript.debug.DebuggableObject;
import org.mozilla.javascript.typedarrays.NativeArrayBuffer;
import org.mozilla.javascript.typedarrays.NativeArrayBufferView;
import org.mozilla.javascript.typedarrays.NativeTypedArrayView;

/**
* An object that implements deep equality test of objects, including their
Expand Down Expand Up @@ -307,7 +310,18 @@ private static String getSymbolName(final Symbol s) {
private static Object[] getIds(final Scriptable s) {
if (s instanceof ScriptableObject) {
// Grabs symbols too
return ((ScriptableObject)s).getIds(true, true);
try {
return ((ScriptableObject)s).getIds(true, true);
} catch (IllegalArgumentException e) {
if (s instanceof NativeArrayBuffer) {
// TODO: remove this once https://github.com/mozilla/rhino/issues/437 is fixed
return new String[0];
} else if (s instanceof NativeTypedArrayView) {
// TODO: remove this once https://github.com/mozilla/rhino/issues/449 is fixed
return s.getIds();
}
throw e;
}
} else if (s instanceof DebuggableObject) {
return ((DebuggableObject)s).getAllIds();
} else {
Expand Down

0 comments on commit da47916

Please sign in to comment.