FYI - a couple of bug reports I recently filed against 7.2.0 (
they probably exist in 7.2.1 as well) with Support (not yet processed by them so I don't have official bug ids)[indent]
dc_renderer.js[indent]For a while now, I've noticed that a bunch of the DCTs at my current customer's site do not render at all in Firefox. [...] it makes it very difficult for me (as a developer) to debug a number of issues with things like FormAPI code.
So - following an error report from Firefox's Firebug - I traced the issue to at least one error and potentially many examples of poor-coding (the latter may not be the cause for the problem, but there's little excuse IMO to productize poorly written code. The file in question is
dc_render.js
- which is located in (or referenced from) the JBoss directory
d:\ApplicationContainer\server\default\deploy\iw-cc.war\datacapture\dc_renderer.js
(
obviously "d:" is the specific path here - yours may differ, and this issue might apply to Unix servers as well)
The major
bug is around line 1470 where there is code that looks like:
var obj = eWebEditPro.createButton(...omitted-for-brevity...);
retVal += obj.html;
retVal += "...omitted-for-brevity...";
The
fix is to change the above to look either like:
var obj = eWebEditPro.createButton(...omitted-for-brevity...);
if (obj != null) retVal += obj.html;
retVal += "...omitted-for-brevity...";
or:
var obj = eWebEditPro.createButton(...omitted-for-brevity...);
if (obj != null) {
retVal += obj.html;
}
retVal += "...omitted-for-brevity...";
The
poor coding issue has to do with the fact that
most of the JavaScript directives using closures (
I believe that's the correct term) do
not end with a semi-colon. There are LOTS of examples of this throughout the file, but a simple example would be something like this (from around line 589):
Renderer.prototype.isActiveItem = function(item)
{
return item==datacapture.activeItem;
}
There
should be a semi-colon after the closing curly-brace.[/indent][/indent]and:[indent]
dc_item_serializer_common.js[indent]We were trying to debug an onSave FormAPI handler function that was failing in IE.
We brought up Firefox to run the same DCT through with Firebug enabled and found that it bombed out in
dc_item_serializer_common.js
(
same path as previous bug report) on line 10. Doing a little quick research, it becomes clear that the parameter passed into the function is not considered a String object - and as such does not have the
search()
function - which is what was causing Firefox to bomb out.
I fixed the code by changing:
function processForTransport(str)
{
if (str.search("]]>") < 0)
{
return IWSerializer.CDATASTART + str + IWSerializer.CDATAEND;
}
else
{
return XMLEscape(str);
}
}
To:
function processForTransport(str)
{
var txt = new String(str);
if (txt.search("]]>") < 0)
{
return IWSerializer.CDATASTART + str + IWSerializer.CDATAEND;
}
else
{
return XMLEscape(str);
}
}
Which not only fixed the problem in Firefox - but also fixed the problem that we were experiencing in IE-7.[/indent][/indent]
Hopefully the above may save someone else some frustration and/or some time (since they shouldn't have to debug it now)