[Webkit-unassigned] [Bug 190756] New: TemplateObject passed to template literal tags are not always identical for the same source location.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 19 11:10:03 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=190756

            Bug ID: 190756
           Summary: TemplateObject passed to template literal tags are not
                    always identical for the same source location.
           Product: WebKit
           Version: Safari 12
          Hardware: All
                OS: Unspecified
            Status: NEW
          Severity: Critical
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: justinfagnani at google.com

The first argument to template literal tags should be identical for repeated evaluations of the same template literal: https://www.ecma-international.org/ecma-262/9.0/index.html#sec-gettemplateobject

This is usually the case in WebKit, but sometimes a new template object will be passed.

I made a reproduction here: https://jsbin.com/peniburaho/1/edit?html,console,output

Usually, sometime in the first 20 iterations, the message "New ref 😢" will be written to the console, indicating that the identity of the template object has changed. On some runs I don't see the message. I've tested this on Safari 12 and Safari TP. We have multiple user reports of the issue on iOS too. We have not seen similar reports for other browsers.

This is a *critical* problem for libraries that use the identity of the template object as a cache key to keep from doing duplicated work. lit-html for example uses the template object to not only cache expensive template preparation work, but to determine when a template is being re-rendered to a location in DOM vs. when a new template is being rendered to that location. If it incorrectly determines that a new template is being rendered, it destroys and recreates the DOM, causing focus, scroll position and other DOM state to be lost.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181019/342a0609/attachment.html>


More information about the webkit-unassigned mailing list