Do not save the form state signature if nothing is saved
https://bugs.webkit.org/show_bug.cgi?id=91050

Reviewed by Hajime Morita.

Source/WebCore:

This change will reduce the size of HistoyItem.

Test: fast/forms/state-restore-empty-state.html

* html/FormController.cpp:
(WebCore::FormController::formElementsState):
If stateVector has only the signature string, clear it.

LayoutTests:

* fast/forms/resources/state-restore-empty-state-1.html: Added.
* fast/forms/state-restore-empty-state-expected.txt: Added.
* fast/forms/state-restore-empty-state.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp
index b7c38e2..94107a6 100644
--- a/Source/WebCore/html/FormController.cpp
+++ b/Source/WebCore/html/FormController.cpp
@@ -172,6 +172,9 @@
         stateVector.append(keyGenerator->formKey(*elementWithState).string());
         elementWithState->saveFormControlState().serializeTo(stateVector);
     }
+    bool hasOnlySignature = stateVector.size() == 1;
+    if (hasOnlySignature)
+        stateVector.clear();
     return stateVector;
 }