プロジェクト

全般

プロフィール

Vote #78708

完了

Set a random name attribute on all forms to prevent overwritten values after soft reload with Firefox

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
UI_10
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
10
version_id:
127
issue_org_id:
26604
author_id:
2784
assigned_to_id:
1
comments:
3
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Given the following flow with each of the users using the Firefox browser:

  • User A opens issue 42 (for viewing, the issue edit form is already rendered hidden)
  • User B opens issue 42 and changes the version field (or any other select box)
  • User A becomes aware of the change (e.g. via notification mails) and soft-reloads the issue view (F5 in Windows)
  • User A adds an issue note.

With the last update of User A, they inadvertently also update the Version field back to the value it had when User A first loaded the issue in step 1. The cause of this is a peculiarity of how Firefox handles changes on forms with soft reloads. This is described on https://bugzilla.mozilla.org/show_bug.cgi?id=1279253. What happens here is that Firefox ignores the changed @selected@ value on select box and always retains the value it had on first load, even if the value was never actually changed by the user.

Unfortunately, this results in unwanted behaviour of the issue form (and possibly all other forms using select boxes like the project or admin settings). If users are not very carefully, they might inadvertently overwrite values. This problem is not really detectable on the server since the values sent by Firefox are valid. Here, it looks like the user just changed the value back.

After a couple of tests, it appears that Firefox takes the @name@ attribute of a form tag into account to detect values of existing forms on reload. If the name value changes, firefox doesn't take any changed values into account and assumes that the newly loaded form is completely different. The attached patch leverages this behaviour by adding a random @name@ attribute to all rendered forms. For Firefox, this results in no form values being preserved on reload. Since Redmine already asks for confirmation on leave, this isn't much of a loss probably.

The name attribute does "not appear":https://stackoverflow.com/a/8946369/421705 to be actually used for anything else and is thus save to be used here. Still, we preserve any explicitly set @name@ attribute.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリUI_10 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0