diff --git a/deps/chakrashim/core/lib/Runtime/Library/ArrayBuffer.cpp b/deps/chakrashim/core/lib/Runtime/Library/ArrayBuffer.cpp
index 8841af64eff..ce0a0880f14 100644
--- a/deps/chakrashim/core/lib/Runtime/Library/ArrayBuffer.cpp
+++ b/deps/chakrashim/core/lib/Runtime/Library/ArrayBuffer.cpp
@@ -615,10 +615,6 @@ namespace Js
recycler->ReportExternalMemoryFailure(length);
}
}
- else
- {
- JavascriptError::ThrowOutOfMemoryError(GetScriptContext());
- }
}
if (buffer != nullptr)
@@ -626,6 +622,10 @@ namespace Js
bufferLength = length;
ZeroMemory(buffer, bufferLength);
}
+ else
+ {
+ JavascriptError::ThrowOutOfMemoryError(GetScriptContext());
+ }
}
}
diff --git a/deps/chakrashim/core/test/es7/arraybuffer_constructor.js b/deps/chakrashim/core/test/es7/arraybuffer_constructor.js
deleted file mode 100644
index 26aa61c6bd4..00000000000
--- a/deps/chakrashim/core/test/es7/arraybuffer_constructor.js
+++ /dev/null
@@ -1,33 +0,0 @@
-//-------------------------------------------------------------------------------------------------------
-// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
-// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
-//-------------------------------------------------------------------------------------------------------
-
-function assertEquals(expected, actual) {
- if (expected != actual) {
- throw `Expected ${expected}, received ${actual}`;
- }
-}
-
-function arrayBufferAlloc() {
-
- const UNDER_1GB = 0x3FFF0000;
- let buffers = [];
- const n = 10;
-
- for (let i = 0; i < n; i++) {
- try {
- const b = new ArrayBuffer(UNDER_1GB);
- buffers.push(b);
- } catch (e) {
- return e;
- }
- }
-
- return new Error('OOM Expected');
-}
-
-let {name, message } = arrayBufferAlloc();
-assertEquals("Invalid function argument", message); //message check comes first to render test failures more intuitive
-assertEquals("RangeError", name);
-print ("PASSED");
diff --git a/deps/chakrashim/core/test/es7/rlexe.xml b/deps/chakrashim/core/test/es7/rlexe.xml
index 0288fd90198..f5afe155b31 100644
--- a/deps/chakrashim/core/test/es7/rlexe.xml
+++ b/deps/chakrashim/core/test/es7/rlexe.xml
@@ -106,10 +106,4 @@
exclude_amd64
-
-
- arraybuffer_constructor.js
- exclude_amd64
-
-
diff --git a/deps/chakrashim/core/test/wasm/memory.js b/deps/chakrashim/core/test/wasm/memory.js
index bca0bde38bf..10c4966ad87 100644
--- a/deps/chakrashim/core/test/wasm/memory.js
+++ b/deps/chakrashim/core/test/wasm/memory.js
@@ -146,7 +146,7 @@ test({init: 0, max: 5});
test({init: 0, max: 10});
test({init: 5});
test({init: 5, max: 10});
-test({init: 1 << 14, checkOOM: true});
+// test({init: 1 << 14, checkOOM: true}); // ArrayBuffer will throw OOM instead of returning a null buffer
try {
test({init: 1 << 15});
print("Failed. Expected an error when allocating WebAssembly.Memory too big");