Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 303197 - Reduce use of "eval" and "new Function" in JS
Summary: Reduce use of "eval" and "new Function" in JS
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 1.3 M6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-18 10:44 EST by Tim Buschtoens CLA
Modified: 2010-02-22 10:06 EST (History)
0 users

See Also:


Attachments
Proposed patch (3.82 KB, patch)
2010-02-18 11:00 EST, Tim Buschtoens CLA
ruediger.herrmann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Buschtoens CLA 2010-02-18 10:44:47 EST
Tests have shown that using eval is much slower (especially in Firefox) than executing the same code normally. Using "new Function(codeString)" is almost as slow. One instance of eval has already been removed with Bug 297066. The other eval in Request.js is currently impossible to remove. Qooxdoo uses "new Function" prominently in Class.js and Property.js.
Comment 1 Tim Buschtoens CLA 2010-02-18 11:00:18 EST
Created attachment 159446 [details]
Proposed patch

This would remove "new Function" from Class.js.
Property.js would be much, much more difficult to cleanse. Depending on the browser and profiling-method used, the involved function need (all together) between 60 and 220ms, so it's unclear if the effort would be worth it. 

"new Function" is also used in Widget.__initApplyMethods, but this is only called once.
Comment 2 Rüdiger Herrmann CLA 2010-02-22 10:05:48 EST
Applied patch to CVS HEAD