×
Namespaces

Variants
Actions
Revision as of 07:15, 12 March 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

JavaScript execution change in Browser 7.3 on Symbian^3 devices (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

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
Devices(s): Nokia N8
Compatibility
Platform(s): Symbian^3
Article
Created: User:Kbwiki (20 Oct 2010)
Last edited: hamishwillee (12 Mar 2012)

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.

This page was last modified on 12 March 2012, at 07:15.
102 page views in the last 30 days.
×