Changeset 295475 in webkit


Ignore:
Timestamp:
Jun 11, 2022, 3:32:52 PM (3 years ago)
Author:
rniwa@webkit.org
Message:

ValidityState object should be the same on each access (JS object getting GC'd incorrectly)
https://bugs.webkit.org/show_bug.cgi?id=33733

Reviewed by Darin Adler.

Fixed the bug by making the form associated element an opaque root of ValidityState.

  • LayoutTests/fast/forms/ValidityState-gc-expected.txt: Added.
  • LayoutTests/fast/forms/ValidityState-gc.html: Added.
  • Source/WebCore/html/HTMLFormControlElement.h:
  • Source/WebCore/html/HTMLObjectElement.h:
  • Source/WebCore/html/ValidityState.h:

(WebCore::ValidityState::element):
(WebCore::ValidityState::opaqueRootConcurrently):

  • Source/WebCore/html/ValidityState.idl:

Canonical link: https://commits.webkit.org/251480@main

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/html/HTMLFormControlElement.h

    r292960 r295475  
    182182    void endDelayingUpdateValidity();
    183183
     184    // These functions can be called concurrently for ValidityState.
    184185    HTMLElement& asHTMLElement() final { return *this; }
    185186    const HTMLFormControlElement& asHTMLElement() const final { return *this; }
     187
    186188    FormNamedItem* asFormNamedItem() final { return this; }
    187189    FormAssociatedElement* asFormAssociatedElement() final { return this; }
  • trunk/Source/WebCore/html/HTMLObjectElement.h

    r293292 r295475  
    9494    FormNamedItem* asFormNamedItem() final { return this; }
    9595    FormAssociatedElement* asFormAssociatedElement() final { return this; }
     96
     97    // These functions can be called concurrently for ValidityState.
    9698    HTMLObjectElement& asHTMLElement() final { return *this; }
    9799    const HTMLObjectElement& asHTMLElement() const final { return *this; }
  • trunk/Source/WebCore/html/ValidityState.h

    r208179 r295475  
    22 * This file is part of the WebKit project.
    33 *
    4  * Copyright (C) 2013 Apple Inc. All rights reserved.
     4 * Copyright (C) 2013-2022 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    3232// as a typedef of FormAssociatedElement, but that would require changes to bindings generation.
    3333class ValidityState : public FormAssociatedElement {
     34public:
     35    Element* element() { return &asHTMLElement(); }
     36    Node* opaqueRootConcurrently() { return &asHTMLElement(); }
    3437};
    3538
  • trunk/Source/WebCore/html/ValidityState.idl

    r287551 r295475  
    33 *
    44 * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com>
     5 * Copyright (C) 2013-2022 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    2324[
    2425    SkipVTableValidation,
    25     Exposed=Window
     26    Exposed=Window,
     27    GenerateIsReachable=ImplElementRoot,
     28    GenerateAddOpaqueRoot=opaqueRootConcurrently
    2629] interface ValidityState {
    2730    readonly attribute boolean         valueMissing;
Note: See TracChangeset for help on using the changeset viewer.