Safari: indexOf() fails on string returned from MarvinSketch

User 870ab5b546

12-10-2009 16:00:54

This is a very weird one.  I think it is a bug in Safari, but I am not sure.  


Go to this test page in Safari, draw any structure, do a 3D minimization, and press the button underneath.  It calls a Javascript script as follows:


    function getIndexOf() {
var testStr = document.responseApplet.getMol("mrv");
alert("testStr.indexOf('?x') = " + testStr.indexOf('?x')
+ ", testStr.indexOf('z3=') = " + testStr.indexOf('z3=')
+ ", testStr=\n" + testStr);
testStr = '' + testStr;
alert("after modifying with '', testStr.indexOf('?x') = " + testStr.indexOf('?x')
+ ", testStr.indexOf('z3=') = " + testStr.indexOf('z3=')
+ ", testStr=\n" + testStr);
}

Note that Safari fails to find '?x' and 'z3=' with indexOf() when the value is first acquired from the applet, but, after the value of the variable is forced to be a String, it finds them.  


Now go to the same page with Firefox.  It works properly, finding '?x' and 'z3=' immediately.


Do you have any idea why Safari is failing to find the substrings in the value returned from the applet?  AFAIK, this is a new behavior.  It happens in both Marvin 4.1 and Marvin 5.2.

ChemAxon 7c2d26e5cf

13-10-2009 18:46:52

At first look, I have no idea. But we will investigate this issue.