From e6d558ece2abefb8e82d8bcd6255333506bdf3f2 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Thu, 8 Feb 2018 14:23:49 -0800 Subject: [PATCH] Use stronger check for PropertyEffects clients. Fixes #5017 --- lib/mixins/property-effects.html | 7 ++- test/unit/path-effects-elements.html | 28 +++++++++ test/unit/path-effects.html | 58 +++++++++++-------- types/externs/closure-types.d.ts | 10 ++++ types/externs/polymer-externs.d.ts | 10 ++++ .../polymer-internal-shared-types.d.ts | 10 ++++ types/externs/webcomponents-externs.d.ts | 10 ++++ types/gulpfile.d.ts | 18 ++++++ types/lib/legacy/mutable-data-behavior.d.ts | 4 -- types/lib/legacy/templatizer-behavior.d.ts | 2 - types/util/minimalDocument.d.ts | 13 +++++ 11 files changed, 140 insertions(+), 30 deletions(-) create mode 100644 types/externs/closure-types.d.ts create mode 100644 types/externs/polymer-externs.d.ts create mode 100644 types/externs/polymer-internal-shared-types.d.ts create mode 100644 types/externs/webcomponents-externs.d.ts create mode 100644 types/gulpfile.d.ts create mode 100644 types/util/minimalDocument.d.ts diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 2afd52319e..827c6de1a9 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -567,6 +567,7 @@ // e.g.: foo="{{obj.sub}}", path: 'obj.sub.prop', set 'foo.prop'=obj.sub.prop if (hasPaths && part.source && (path.length > part.source.length) && (binding.kind == 'property') && !binding.isCompound && + node.__isPropertyEffectsClient && node.__dataHasAccessor && node.__dataHasAccessor[binding.target]) { let value = props[path]; path = Polymer.Path.translate(part.source, binding.target, path); @@ -603,7 +604,8 @@ } else { // Property binding let prop = binding.target; - if (node.__dataHasAccessor && node.__dataHasAccessor[prop]) { + if (node.__isPropertyEffectsClient && + node.__dataHasAccessor && node.__dataHasAccessor[prop]) { if (!node[TYPES.READ_ONLY] || !node[TYPES.READ_ONLY][prop]) { if (node._setPendingProperty(prop, value)) { inst._enqueueClient(node); @@ -1131,6 +1133,9 @@ constructor() { super(); + /** @type {boolean} */ + // Used to identify users of this mixin, ala instanceof + this.__isPropertyEffectsClient = true; /** @type {number} */ // NOTE: used to track re-entrant calls to `_flushProperties` // path changes dirty check against `__dataTemp` only during one "turn" diff --git a/test/unit/path-effects-elements.html b/test/unit/path-effects-elements.html index b409c254b6..e436f369d5 100644 --- a/test/unit/path-effects-elements.html +++ b/test/unit/path-effects-elements.html @@ -7,6 +7,32 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> + + + + +