From 4fcc049ebb2237274cb064c6a88f774b5db9f938 Mon Sep 17 00:00:00 2001 From: mohamed amr Date: Thu, 1 Dec 2016 18:58:20 +0200 Subject: [PATCH] fix(copy): angular copy should throw exception when source and destination are not the same type Closes #15444 --- src/Angular.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Angular.js b/src/Angular.js index 18672cc99e41..5bbe1d5c45d9 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -820,6 +820,10 @@ function copy(source, destination) { var stackDest = []; if (destination) { + if (toString.call(destination) !== toString.call(source)) { + throw ngMinErr('cpi', 'Can\'t copy! Source({0} type) and destination({1} type) aren\'t the same type.', + toString.call(source), toString.call(destination)); + } if (isTypedArray(destination) || isArrayBuffer(destination)) { throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.'); }