From 7c9469115e12c4a19b9dd4d22e3e2cd1825e2036 Mon Sep 17 00:00:00 2001 From: Andrea Giammarchi Date: Sat, 2 Jun 2018 12:58:38 +0200 Subject: [PATCH] GetTemplateObject with a unique template object --- .../tagged-template/template-object.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/test/language/expressions/tagged-template/template-object.js b/test/language/expressions/tagged-template/template-object.js index 9c4d44999c..207e680666 100644 --- a/test/language/expressions/tagged-template/template-object.js +++ b/test/language/expressions/tagged-template/template-object.js @@ -8,11 +8,17 @@ info: | defined by the GetTemplateObject abstract operation. includes: [propertyHelper.js] ---*/ -var templateObject; +var templateObject, sameObject; -(function(parameter) { +function sameSite() { + tag`${Math.random()}`; +} + +function tag(parameter) { templateObject = parameter; -})`${1}`; +} + +tag`${1}`; assert(Array.isArray(templateObject.raw), 'The template object is an array'); @@ -38,3 +44,13 @@ verifyNotConfigurable(templateObject.raw, '0'); verifyNotEnumerable(templateObject.raw, 'length'); verifyNotWritable(templateObject.raw, 'length') verifyNotConfigurable(templateObject.raw, 'length'); + +sameSite(); +sameObject = templateObject; +sameSite(); + +assert( + templateObject === sameObject, + 'Normative: Cache templates per site, rather than by contents' + // https://github.com/tc39/ecma262/pull/890 +);