<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>28380</bug_id>
          
          <creation_ts>2009-08-16 23:13:23 -0700</creation_ts>
          <short_desc>Button names replaced with other button names</short_desc>
          <delta_ts>2010-05-23 20:23:41 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>26241</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="David Shepherdson">david-webkit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>tkent</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>140668</commentid>
    <comment_count>0</comment_count>
      <attachid>34954</attachid>
    <who name="David Shepherdson">david-webkit</who>
    <bug_when>2009-08-16 23:13:23 -0700</bug_when>
    <thetext>Created attachment 34954
Test case to reproduce the bug (two HTML files, zipped).

In a certain strange scenario, the name of a button included in the HTML will not be displayed and, instead, the name of another button from another, recent page is used instead.

I&apos;ve managed to simplify this to the contrived test case attached. Here&apos;s how to reproduce it:

    1. Load testPage1.html in the browser.
    2. Click the link to go to page two.
    3. Notice that there is one submit button, labelled &apos;First Button from Page Two&apos;.
    4. Open testPage2.html in a text editor.
    5. Comment out the section indicated as &apos;Page Two&apos; and uncomment the section indicated as &apos;Page Three&apos;. Save your changes.
    6. Back in the browser, click the browser&apos;s Back button to go back to page one.
    7. Empty the browser&apos;s cache.
    8. Click the browser&apos;s Forward button to go to page two again. (Note: *Don&apos;t* click the &apos;Go to page two&apos; link.)
    9. The headings and text from page three are displayed, as expected, but the submit button is still labelled &apos;First Button from Page Two&apos;, rather than &apos;Second Button from Page Three&apos; as indicated in the HTML.

(As I said, this is a bit of a contrived example, since you have to manually change the content of the page and empty the browser&apos;s cache halfway through. The real-world scenario we&apos;re seeing this in is with a page in our Web app that has cache control etc. set up so that it won&apos;t be cached by the browser; the user loads this page, then clicks the Back button, and then their session times out before they click the Forward button again, so when the server receives the request for the (non-cached) page, it instead renders the log-in page for them. At this point, they get confused when the submit button for the log-in form does not say &apos;Log In&apos;, but rather whatever was the first submit button on the old page (for example, &apos;Delete Task&apos;!). Steps 4, 5 and 7 in the above instructions are my simple equivalent of the cache-control headers and the session time-out in the real-world situation.)

I think this might have some relationship to the previous WebKit bug 10541. My theory is that it&apos;s to do with form state being saved locally by the browser; because neither of the submit buttons in the example have &apos;name&apos; attributes, there&apos;s no easy way for WebKit to distinguish between them, and so it &apos;restores&apos; the state from the first form over the top of the second one.

Speaking without having seen any of the code involved :-), would one simple fix here be to stop saving the &apos;value&apos; attribute for submit buttons as part of the form state, since it isn&apos;t editable by the user anyway?

From a Web developer&apos;s perspective, the easy workaround for this bug is to add name attributes to all submit buttons.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>140669</commentid>
    <comment_count>1</comment_count>
    <who name="David Shepherdson">david-webkit</who>
    <bug_when>2009-08-16 23:15:55 -0700</bug_when>
    <thetext>I should add: I&apos;ve been able to reproduce this in Safari 3 (3.2.3 (5525.28.3)), Safari 4 (Version 4.0.3 (5531.9) and OmniWeb 5.10 (sneakypeek v6.22.8.0.116891), as well as the latest WebKit nightly build (r47291).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221064</commentid>
    <comment_count>2</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-05-05 05:24:39 -0700</bug_when>
    <thetext>I think it was fixed by r57013.

*** This bug has been marked as a duplicate of bug 26241 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229585</commentid>
    <comment_count>3</comment_count>
    <who name="David Shepherdson">david-webkit</who>
    <bug_when>2010-05-23 20:23:41 -0700</bug_when>
    <thetext>Just to confirm, I&apos;ve tested this in a recent build (59711) and all looks good. Thank you!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>34954</attachid>
            <date>2009-08-16 23:13:23 -0700</date>
            <delta_ts>2009-08-16 23:13:23 -0700</delta_ts>
            <desc>Test case to reproduce the bug (two HTML files, zipped).</desc>
            <filename>buttonNameTest.zip</filename>
            <type>application/octet-stream</type>
            <size>827</size>
            <attacher name="David Shepherdson">david-webkit</attacher>
            
              <data encoding="base64">UEsDBBQAAAAIAEF4ETt2hHGFtAAAAPQAAAAOABUAdGVzdFBhZ2UxLmh0bWxVVAkAA0rkiEqf9IhK
VXgEAPUBFABNjcsKwjAQRdfmK8bszVjtSmIWtkUFH0Ui4jLS2BZqI+1A8O81tAtnM9y5hzNymp4T
fc8z2OnjAfLr5rBPgM8Qb8sEMdXpUMRiHoHuTNvXVLvWNIjZiTMYh1dE7xWi9174pXBdifqCFb2a
GBvneisKKrhiMpzCsqZQbCKppsaq3JQWzq2VOGQmcQDkwxWfgEd/zC8waaDq7HPNyfYUqoUIZq62
DsjBO8DknUSjxM82anD4/gVQSwMEFAAAAAgAdoERO93JZ4JdAQAABQMAAA4AFQB0ZXN0UGFnZTIu
aHRtbFVUCQADn/SISrr0iEpVeAQA9QEUAKWSy07DMBBF1/grpl7BIjF9rKiTRV8CVGhEgxBLt3Gb
SE5cxROi/j1x3RcgQAhvrJk7ujNzbN4azYbxazSG2/hhCtHzYHo3BOox9tIdMjaKR07o+ddtiEtR
mAwzXQjF2PiREtgfm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