-
Type:
Bug
-
Resolution: Timed out
-
Priority:
Low
-
None
-
Affects Version/s: 6.2.7
-
Component/s: Administration - Workflows
-
6.02
-
Severity 3 - Minor
-
We are currently using JIRA 6.2.7 with IE8, and we are experiencing an issue with Issue View screen.
To reproduce the error, it is needed :
- to use IE8
- to have an Issue without content in description
- to have a Workflows Step where the Issue is no editable
- to have a transition with a screen to this Workflow Step.
Then :
- go to the Issue View
- execute the transition ... the transition screen is displayed
- validate the transition
At this moment, a javacript error occurs and the transition screen stays with the Waiting icon.
After a deep analysis, it appears that it is caused by a Bug in Panel management done in jira-issue-nav-components-6.2.101\issueviewer\js\entities\PanelsGroupModel.js
- When the issue is displayed before the transition, the Description panel is visible and editable
- When the transition is called, the return in Javascript returns the new data without the Description panel, since it is no more editable
- In JIRA.Components.IssueViewer.Models.PanelsGroup, the update() method performs an update of each Panel collections.
The Description Panel is concerned bythis.get("leftPanels").update(data.leftPanels, options);
In JIRA.Components.IssueViewer.Collections.Panels.update(data, options), we have :
// For each panel already present in this collection, check if it is still present in data. // If not, remove it from the collection. this.each(function (panel) { var panelId = panel.id; var panelPresentInPanelEntities = _.any(data, function (panel) { return panel.id === panelId }); if (!panelPresentInPanelEntities) { this.remove(panel); } }, this); {code:javascript} The goal of this update is to remove the missing panels. The implementation of the each method in JQuery is as follow : {code:javascript} // The cornerstone, an `each` implementation, aka `forEach`. // Handles objects with the built-in `forEach`, arrays, and raw objects. // Delegates to **ECMAScript 5**'s native `forEach` if available. var each = _.each = _.forEach = function(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, length = obj.length; i < length; i++) { if (iterator.call(context, obj[i], i, obj) === breaker) return; } } else { var keys = _.keys(obj); for (var i = 0, length = keys.length; i < length; i++) { if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; } } };
In case of IE8, there is no nativeForEach method, and the loop on the iterator is done by a For(...).
It means that the iterated collection is not ConcurrentModification safe.
It causes that the function of the iteration removes the missing Panel of the current iterated list, and then the iteration is not aware that the list has changed, and finally the function of the iteration is called with empty value, that causes a sort of NPE.
The error does not occurs with other tested Browsers (GC40,IE11) since their obj.forEach method supports this ConcurrentModification.
I have no idea if other browsers can be concerned by a such error ... I let you check that.
In terms of workaround, i have only the following solution
- Force a default description, but I am not sure that it will be acceptable by business
- Patch the plugin as follow :
var missingPanels = []; // For each panel already present in this collection, check if it is still present in data. // If not, remove it from the collection. this.each(function (panel) { var panelId = panel.id; var panelPresentInPanelEntities = _.any(data, function (panel) { return panel.id === panelId }); if (!panelPresentInPanelEntities) { missingPanels.push(panel); this.remove(panel); } }, this); AJS.$(missingPanels).each(function (panel) { instance.remove(panel); });