JavaScript execution change in Browser 7.3 on Symbian^3 devices (Known Issue)
Symbian Browser and Web Runtime 7.3 for Developers introduces changes to the JavaScript engine. The way function declarations are interpreted inside conditional expressions has been changed.
Article Metadata
Tested with
Compatibility
Article
Description
If a function declaration and definition are in a conditional JavaScript expression, the Browser 7.2 JavaScript engine does not interpret them. In the Browser 7.3 JavaScript engine, regardless of whether the function can be executed or not, the JavaScript engine compiles all of the functions.
var calculateSum = true;
if(calculateSum){
function calculate(){
alert("sum");
}
}else{
function calculate(){
alert("subtract");
}
}
calculate();
If the calculate function is called, the Browser 7.2 JavaScript engine prompts sum, whereas the Browser 7.3 JavaScript engine executes the last defined calculate function, hence prompting subtract.
Solution
Please make sure that your Symbian Web Runtime widget does not rely on this type of coding pattern as it might cause unforeseeable consequences in Browser 7.3.


(no comments yet)