I'm working on a complex web application with RichFaces 4.5.13.Final and JSF 2.1 on JBoss EAP 6.4. Some pages containing a collapsiblePanel like this
<h:form id="myForm">
<rich:collapsiblePanel id="myPanel" header="Header" switchType="client">
<h:outputText value="Test" />
</rich:collapsiblePanel>
</h:form>
In Google Chrome (tested with Version 57.0.2987.110 (64-bit)) we've noticed a strange javascript error after page load. This error occurs randomly but not always:
Uncaught TypeError: Cannot read property 'getItems' of undefined
at init (togglePanelItem.js:43)
at new init (collapsiblePanelItem.js:32)
at HTMLDocument.<anonymous> (collapsiblePanel.js:52)
at fire (jquery.js?amp;v=4.5.13.Final:3232)
at Object.fireWith [as resolveWith] (jquery.js?amp;v=4.5.13.Final:3362)
at Function.ready (jquery.js?amp;v=4.5.13.Final:3582)
at HTMLDocument.completed (jquery.js?amp;v=4.5.13.Final:3617)
For example, if I'm reloading the page 10 times this error will occurs around 5 times. In other browsers like Firefox this error never occurs.
It looks like that the javascript files are randomly loadad. So I'm already tried to use compressed files for RichFaces by setting the org.richfaces.resourceOptimization.enabled
to true but the error still occurs.
I would like to solve this issue, but I have no idea how can I localise this issue.
EDIT
After debugging a while, I found out that there are some parallels to https://issues.jboss.org/browse/RF-13780 because sometimes element[rf.RICH_CONTAINER]
is undefined in rf.component
for some reasons.
来源:https://stackoverflow.com/questions/42926712/richfaces-collapsiblepanel-randomly-causes-javascript-error-in-chrome