Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
Bug 1339118 - Fix "Gimme a firefox" forgets about the revision it aut…
Browse files Browse the repository at this point in the history
…o-filled (#149)
  • Loading branch information
JohanLorenzo committed Feb 21, 2017
1 parent e01e03b commit 635a035
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions kickoff/static/suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,17 @@ function setupVersionSuggestions(versionElement, versions, buildNumberElement, b
}).focus(function() {
$(this).autocomplete('search');
}).change(function() {
var productName = this.name.slice(0, -VERSION_SUFFIX.length);
populateAllPossibleFields(productName, this.value, buildNumberElement, previousBuilds, partialElement);
// This setTimeout prevents bug 1339118 from happening. It solves the case where: a version has been picked
// via `select` and then the form is submit via a click on it. This click triggers a `change` event, which
// causes some fields (like revision of l10n changesets) to be cleared right before the form is submitted.
//
// Putting a setTimeout without a time makes the call to `populateAllPossibleFields()` happen when the event
// loop is free. Because, submitting a form keeps the event loop busy, `populateAllPossibleFields()` is not
// called right before the submission.
setTimeout(function() {
var productName = this.name.slice(0, -VERSION_SUFFIX.length);
populateAllPossibleFields(productName, this.value, buildNumberElement, previousBuilds, partialElement);
}.bind(this));
});
}

Expand Down

0 comments on commit 635a035

Please sign in to comment.