From d0cd7a39a2d05343c5501dc286bb59096659654f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 19 Apr 2019 09:56:33 +0800 Subject: avoid prototype builtin hasOwnProperty (#2144) --- js/blob_test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'js/blob_test.ts') diff --git a/js/blob_test.ts b/js/blob_test.ts index 1e8ec8fbd..3c778a0e1 100644 --- a/js/blob_test.ts +++ b/js/blob_test.ts @@ -32,4 +32,22 @@ test(function blobSlice() { assertEquals(b4.size, blob.size); }); +test(function blobShouldNotThrowError() { + let hasThrown = false; + + try { + const options1: object = { + ending: "utf8", + hasOwnProperty: "hasOwnProperty" + }; + const options2: object = Object.create(null); + new Blob(["Hello World"], options1); + new Blob(["Hello World"], options2); + } catch { + hasThrown = true; + } + + assertEquals(hasThrown, false); +}); + // TODO(qti3e) Test the stored data in a Blob after implementing FileReader API. -- cgit v1.2.3