Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0009453Openbravo ERPA. Platformpublic2009-06-12 11:292009-11-20 00:00
iperdomo 
iperdomo 
lowminoralways
closedfixed 
20rPath Linux
pi 
pi 
Core
No
0009453: JS API check doesn't distinguish between a parameter and a local variable
The .details of a js file contains the definition of the API.
When generating this file we include the function scope's variables. This includes the local ones.
There is no API breakage if a local variable is changed. They are not accessed from the outside.
This gives false positives in the module API checks e.g. [1]

[1] http://builds.openbravo.com/job/erp_devel_pi-module-integrity-test/45/consoleFull [^]
* Makes the .details files with only the parameters of the function and not the local variables
No tags attached.
Issue History
2009-06-12 11:29iperdomoNew Issue
2009-06-12 11:29iperdomoAssigned To => iperdomo
2009-06-29 13:14psarobeStatusnew => scheduled
2009-06-29 13:14psarobefix_in_branch => pi
2009-11-17 18:42iperdomoNote Added: 0021929
2009-11-17 21:11hgbotCheckin
2009-11-17 21:11hgbotNote Added: 0021934
2009-11-17 21:11hgbotStatusscheduled => resolved
2009-11-17 21:11hgbotResolutionopen => fixed
2009-11-17 21:11hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/eb78c81738a119940ee93ff678f00a522235a2d0 [^]
2009-11-17 21:13hgbotCheckin
2009-11-17 21:13hgbotNote Added: 0021935
2009-11-17 21:13hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/eb78c81738a119940ee93ff678f00a522235a2d0 [^] => http://code.openbravo.com/erp/devel/api-checks/rev/d4ae029642eb8f156b7b082fe8df0e2fd4de711a [^]
2009-11-19 15:35shuehnerNote Added: 0022022
2009-11-19 15:35shuehnerStatusresolved => closed
2009-11-20 00:00anonymoussf_bug_id0 => 2900807

Notes
(0021929)
iperdomo   
2009-11-17 18:42   
The way to ensure a non JavaScript API breakage is implementing the necessary checks in the function itself. Comparing how many parameters the function has is irrelevant, JavaScript doesn't care about it. If you pass more parameters than expected, they will be ignored, if you pass less parameters than expected the missing ones will be *undefined*.

The parameters part of the .details files will be removed to avoid false positives.

Using a firebug console:
function test(p) { console.log("typeof p: " + typeof p);}
---
>>> test('hello world');
typeof p: string
>>> test(1, 'hello world');
typeof p: number
>>> test();
typeof p: undefined
(0021934)
hgbot   
2009-11-17 21:11   
Repository: erp/devel/pi
Changeset: eb78c81738a119940ee93ff678f00a522235a2d0
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Tue Nov 17 21:10:27 2009 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/eb78c81738a119940ee93ff678f00a522235a2d0 [^]

Fixes issue 9453: Removed parameters from function details

---
M src-test/org/openbravo/test/javascript/JavaScriptAPIChecker.java
M src-test/org/openbravo/test/javascript/JavaScriptParser.java
---
(0021935)
hgbot   
2009-11-17 21:13   
Repository: erp/devel/api-checks
Changeset: d4ae029642eb8f156b7b082fe8df0e2fd4de711a
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Tue Nov 17 21:12:06 2009 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/d4ae029642eb8f156b7b082fe8df0e2fd4de711a [^]

Related to issue 9453: Updated desc files, removed parameters from function definitions

---
M js/ajax.js.details
M js/appStatus.js.details
M js/calculator.js.details
M js/callOut.js.details
M js/error.js.details
M js/genericTree.js.details
M js/menuKeyboard.js.details
M js/messages.js.details
M js/multilinea.js.details
M js/multilineaOculto.js.details
M js/searchs.js.details
M js/shortcuts.js.details
M js/utils.js.details
M js/windowKeyboard.js.details
---
(0022022)
shuehner   
2009-11-19 15:35   
Change checked, parameters are now completely ignored as they cannot be teted by this check at all.