Fix ArrayBuffer bug in chrome.test.checkDeepEq
This makes the chrome.test.checkDeepEq() and the chrome.test.assertEq() functions more robust when handling the ArrayBuffer values, in particular handling the following scenario: chrome.test.checkDeepEq([], (new Uint8Array([1,2,3])).buffer); chrome.test.checkDeepEq([], (new Uint8Array([])).buffer); Before this CL, the code above evaluated to |true|, despite that the values are logically different. The bug was caused by the fact that iterating using a "for" loop over an ArrayBuffer doesn't actually visit any of its values, which led to it being considered as an empty container. The proposed fix is to additionally compare the results of the "instanceof" check. Also fix the "ExtensionWebRequestApiTest.PostData2" test to explicitly clear the array buffer in the field where it shouldn't be used in the comparison, rather than rely on the previous implicit "any array buffer is considered equal to an empty array" behavior. Bug: 1078761 Change-Id: Ie48293d7894a6212a7ec07444ad328603cfe0c8e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2245487Reviewed-by:Istiaque Ahmed <lazyboy@chromium.org> Commit-Queue: Maksim Ivanov <emaxx@chromium.org> Cr-Commit-Position: refs/heads/master@{#779709}
Showing
Please register or sign in to comment