Amphtml: amp-script overzealously terminates workers

Created on 25 Feb 2020  路  6Comments  路  Source: ampproject/amphtml

What's the issue?

If an amp-script contains actions that require a user gesture to complete, and too long of a delay occurs between user gestures, the worker is terminated.

How do we reproduce the issue?

A minimal example is available at ampdemo.cmphys.com/worker-death/amp-script-worker-death.html.

  1. Type a character in the input box
  2. Wait for at least 5 seconds
  3. Press tab to defocus the input

Console errors report the worker has been terminated:

[amp-script] amp-script[script="echo-script"].js was terminated due to illegal mutation.
[amp-script] Dropped 1x "ATTRIBUTES" mutation(s); user gesture is required with [layout=container].
[amp-script] Dropped 2x "CHILD_LIST" mutation(s); user gesture is required with [layout=container].

What browsers are affected?

Tested on Chrome 80: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36

Which AMP version is affected?

2002200031230

amp-script Soon Bug runtime

All 6 comments

Oh, that's an interesting case.

Have you tried this with an with layout != 'container' and with height and width set?

Thanks for finding this! Definitely a bug. Seems like the input events are counting as user gesture but the change event isn't. The specific breaking case is:

When the element loses focus after its value was changed, but not commited (e.g., after editing the value of