Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow recursive custom element constructions #20465

Merged
merged 1 commit into from
Dec 31, 2019

Commits on Dec 31, 2019

  1. Disallow recursive custom element constructions

    With this CL, recursive custom element constructions are no
    longer allowed. I.e. this will now only run the constructor once:
      class extends HTMLElement {
        constructor() {
          super();
          customElements.upgrade(this);
        }
      }
    
    Previously, the code and spec had a bug which caused the above
    code snippet to infinitely recurse. In [1] the spec has changed,
    to set the custom element state to "failed" before the constructor
    is called. With this change in place, recursive calls will
    early-out at step #2 (of [2]), and avoid the recursion.
    
    [1] whatwg/html#5126
    [2] https://html.spec.whatwg.org/multipage/custom-elements.html#upgrades
    
    Bug: 966472
    Change-Id: I76e88c0b70132eee2482c304ef9e727ae1fe8fc7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1931644
    Reviewed-by: Kent Tamura <tkent@chromium.org>
    Commit-Queue: Mason Freed <masonfreed@chromium.org>
    Auto-Submit: Mason Freed <masonfreed@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#727841}
    mfreed7 authored and chromium-wpt-export-bot committed Dec 31, 2019
    Configuration menu
    Copy the full SHA
    d0367e8 View commit details
    Browse the repository at this point in the history