• tkent@chromium.org's avatar
    Classify form control states by their owner forms · b53db041
    tkent@chromium.org authored
    Reviewed by Hajime Morita.
    * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
    Expose WTF::StringBuilder::canShrink()
    To improve robustness of the form state restore feature, we classify
    form control states by their owner forms. Owner forms are identified by
    their action URLs and index numbers in forms with the same action URLs.
    Implementation approach:
    Extend FormElementKey class to have "formKey" string, which is a
    combination of the action URL and an index number, or a fixed string for
    no form owner.
    FormKeyGenerator class is responsible to generate the "formKey" strings
    Test: fast/forms/state-restore-per-form.html
    * html/FormController.cpp:
    (WebCore::FormKeyGenerator::create): A factory function.
    (WebCore::FormKeyGenerator::FormKeyGenerator): A private constructor.
    A helper for formKey(). This makes strings like "<action URL> #<index>".
    Returns a formKey for the specified HTMLFormElement*.
    Unregister HTMLFormElement*. This function is necessary because form
    restore feature works during parsing and a script might delete form
    (WebCore::formStateSignature): Bump the version.
    Records a formKey string for each of control state.
    Loads formKeys from stateVector, and uses them for FormElementKey.
    - Construct and destruct FormKeyGenerator if needed.
    - Passing a formKey for the specified form control to FormElementKey.
    Delegate to FormKeyGenerator::willDeleteForm.
    (WebCore::FormElementKey::FormElementKey): Add formKey argument and member.
    (WebCore::FormElementKey::operator=): ditto.
    (WebCore::FormElementKey::ref): ditto.
    (WebCore::FormElementKey::deref): ditto.
    * html/FormController.h:
    (FormElementKey): Add formKey argument and member.
    (FormController): Add a FormKeyGenerator member which is used during restoring.
    * html/HTMLFormElement.cpp:
    (WebCore::HTMLFormElement::~HTMLFormElement): Notify the death to FormController.
    * fast/forms/resources/state-restore-per-form-back.html: Added.
    * fast/forms/state-restore-per-form-expected.txt:
    Added. This contains some FAIL lines. They are expected and will
    be fixed in webkit.org/b/89962.
    * fast/forms/state-restore-per-form.html: Added.
    * fast/forms/state-restore-broken-state-expected.txt:
    Updated for the serialization format change.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore.def 21.7 KB