summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/ObjectUtils.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/modules/ObjectUtils.sys.mjs')
-rw-r--r--toolkit/modules/ObjectUtils.sys.mjs16
1 files changed, 16 insertions, 0 deletions
diff --git a/toolkit/modules/ObjectUtils.sys.mjs b/toolkit/modules/ObjectUtils.sys.mjs
index e0fbeead12..2c927477b7 100644
--- a/toolkit/modules/ObjectUtils.sys.mjs
+++ b/toolkit/modules/ObjectUtils.sys.mjs
@@ -142,6 +142,22 @@ function objEquiv(a, b) {
if ((a.prototype || undefined) != (b.prototype || undefined)) {
return false;
}
+
+ // Check for ArrayBuffer equality
+ if (instanceOf(a, "ArrayBuffer") && instanceOf(b, "ArrayBuffer")) {
+ if (a.byteLength !== b.byteLength) {
+ return false;
+ }
+ const viewA = new Uint8Array(a);
+ const viewB = new Uint8Array(b);
+ for (let i = 0; i < viewA.length; i++) {
+ if (viewA[i] !== viewB[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
// Object.keys may be broken through screwy arguments passing. Converting to
// an array solves the problem.
if (isArguments(a)) {