期刊文献+

基于静态分析的JavaScript类型失配缺陷查找 被引量:1

Finding Type Mismatch Defects of JavaScript Based on Static Analysis
下载PDF
导出
摘要 由于JavaScript自身的语言特性,JavaScript程序中可能存在与运行时变量类型不匹配的缺陷,这类缺陷往往难以被察觉,只有在运行时报错后才能发现故障,而人工检查代码时需要开发者花费大量的时间通过调试的方法来定位查找代码缺陷。提出了一种静态分析JavaScript的方法来检查可能的运行时类型不匹配缺陷。该方法首先基于HTML和JSP页面对于JavaScript文件的引用将整个项目中的JavaScript文件进行分组;接着以分组为单位对JavaScript文件进行分析和变量类型推断,再检查每个分组中是否存在多类型属性;然后对这种多类型属性的使用进行检查;最后对检查结果进行报告,并给出修复建议。实现了一个用于自动检测JavaScript中多类型属性缺陷的工具,并通过在真实JavaScript项目中的实验证明了该方法的可行性,与已有的JavaScript分析方法相比,该方法的效果更优,提升了有关缺陷查找的效率与有效性。 Because of the nature of the JavaScript language and the increase of amount of JavaScript code with the evolving software,a JavaScript program may have a lot of defects which are related to the runtime variable type.This kind of defect is often difficult to detect,only when runtime errors can find fault.It takes programmers a lot of time to locate and search the code bug by debugging manually.The proposed JavaScript defect inspection method is mainly used to check the possible runtime type unmatched defects.First of all,the JavaScript file was grouped in the project based on HTML,JSP page reference for JavaScript files.Secondly,JavaScript files were analyzed in groups and the variable type was inferred.Then we checked whether there is a multi-type attribute in the group,afterwards the use of the multi-type attribute was checked.Finally,the checking results was reported and the repair advice was gave.A tool for automatic detection of multi-type attribute defect in JavaScript was implemented,through the experiment in the real JavaScript projects,the feasibility of this method was illustrated and the existing JavaScript analysis method was compared to illustrate the effectiveness of this method,improving the JavaScript's defect finding efficiency and effectiveness.
出处 《计算机科学》 CSCD 北大核心 2017年第4期223-228,共6页 Computer Science
关键词 静态分析 JAVASCRIPT 缺陷查找 Static analysis JavaScript Defect finding
  • 相关文献

参考文献1

二级参考文献12

  • 1Sun Microsystems and Netscape Inc. Netscape and Sun announce Javascript(TM) : The open, cross-platform object scripting language for enterprise networks and the Internet [EB/OL]. (1995-12-04) [2010-01-01]. http://web, archive. org/web/20070916144913/http://wp, netscape, eom/newsref/ pr/newsrelease67, html.
  • 2Gal A, Eich B, Shaver M, et al. Trace based just-in-time type specialization for dynamic languages [C] //Proc of the 2009 ACM SIGPLAN Conf on Programming Language Design and Implementation. New York: ACM, 2009: 465- 478.
  • 3Anderson C, Giannini P, Drossopoulou S. Towards type inference for JavaScript [G] //LNCS 3586: ECOOP 2005- Object-Oriented Programming. Berlin: Springer, 2005: 428- 452.
  • 4Jang D, Choe K M. Points-to analysis for JavaScript [C] // Proc of the 2009 ACM Syrup on Applied Computing. New York: ACM, 2009:1930-1937.
  • 5Thiemann P. Towards a type system [or analyzing ]avascript programs [C] //LNCS 3444 : European Symp on Programm ng. Berlin: Spr nger, 2005: 408-422.
  • 6Heidegger P, Thiemann P. Recency types for dynamically- typed, object-based languages [EB/OL]. ( 2009-01-24 ) E2010-01 01]. http://www, cs. cmu. edu/-aldrieh/FOOL09/ heidegger, pdf.
  • 7Balakrishnan G, Reps T. Recency-abstraction for heap- allocated storage [G] //LNCS 4134: Proc of the 13th Int Static Analysis Symposium (SAS'06). Berlin: Springer, 2006:221-239.
  • 8Jensen S H, Moiler A, Thiemann P. Type analysis for JavaScript [C] //Proc of the 16th Int Syrup on Static Analysis. Berlin: Springer, 2009:238-255.
  • 9The Mozilla Foundation. Rhino: JavaScript for Java [EB/OL]. (1995-05-10) [2010-01 01] http://www. mozilla, org/rhino/.
  • 10Ager M S. V8 Internals[EB/OL]. (2009-06 -02) [2010-01-01]. http://dl, google, com/io/2009/pres/W_1230_V8Buildinga HighPer{ormanceJavaScriptEngine. pdf.

共引文献8

同被引文献5

引证文献1

二级引证文献7

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部