Giter VIP home page Giter VIP logo

Comments (6)

fool2fish avatar fool2fish commented on August 24, 2024

错误

global leak detected: getInterface

如何重现

  • ff 较新版本
  • 通过 iframe 打开 runner

demo 见:docs>bugs>firefox-getInterface.html

关联组件

基本所有组件

分析&解决

  • iframe 中 ,window.getInterface 一开始是 undefined,在某个时间点/或某些操作触发后才会赋值
  • 如果在测试脚本运行前进行一下 dom 操作,或者运行 alert 都可以避免这个问题
  • 如果打开过一次firebug,那么在浏览器关闭之前都一直不会出错

getInterface 的官方文档没看懂,暂无最优解决方案。

解决见:https://github.com/fool2fish/mocha/commit/7364e2dfd384134c6e3240e424746dd73082699b

from totoro.

leoner avatar leoner commented on August 24, 2024

错误

global leak detected: 0
global leak detected: 1

如何重现

  • ie6 , 7, 8, opera
  • 页面插入 iframe

demo 见 docs>bugs>access-iframe-by-window[iframeIndex].html

关联组件

iframe-shim

分析和解决

所有浏览器都可以通过 window[iframeIndex] 访问页面内的 iframe,但只有 IE678 和 opera 会通过遍历获得键值,所以会报错。

解决见:https://github.com/fool2fish/mocha/commit/7364e2dfd384134c6e3240e424746dd73082699b

from totoro.

fool2fish avatar fool2fish commented on August 24, 2024

错误

  • it.skip 会使多个浏览器卡死
  • ie9 的测试报告缺失

如何重现

只要包含 skip 的用例都会出现此问题

分析和解决

经过测试发现在遇到 skip 的用例的时候, mocha 会发布 pendingtest end 事件, 而在 thrill 中的 thrill-mocha-adapter.js 中输出报告的时候并没有订阅 pending 事件,而只是订阅了 testtest end . 他在 test 事件中会进行一部分内容初始化,而在 test end 的时候会用到这些信息。这就导致了在进行测试输出 test end 的时候缺少信息, 而报错

解决见: leoner/thrill@6650487

from totoro.

fool2fish avatar fool2fish commented on August 24, 2024

问题

配置了 mocha.globals([...]) 之后,测试代码运行会明显变慢,以 ie 和 opera 尤为明显

分析和解决

mocha 中的内存泄露检测代码本身效率不高,配置了 mocha.globals([...]) 之后,还对所有的测试用例都进行了内存泄露检测

解决方案:

  • 对 Runner.prototype.checkGlobals() 进行修改,新增 this.prevGloblasLength,记录上一个 test 运行完成后全局变量的个数,再和本次进行对比,如无变化,则认为无需检测全局变量泄露的问题。(唯一的问题是,在本测试中,如果先删除了一个之前的全局变量,再添加了一个新的全局变量,则会检测不出来。但这种情况可以忽略。)
    • 效率提升:以前有 n 个测试,就会进行 n 次检查,但现在只会对第一个测试和其他有泄露的测试进行检查
  • 对 filterLeaks() 进行了改进,把一些操作从内层循环中放到外层循环,减少循环开销。
    • 效率提升:执行时间约为原来的 50%

由于以上操作效果明显,所以对 filterLeaks() 的检测代码不再进行优化(虽然还有优化的空间)

解决见:https://github.com/fool2fish/mocha/commit/4573d1eabb7dd6d88e151ef06158737087750fff

和 @7362e4d 进行 diff 即可查看修改

from totoro.

fool2fish avatar fool2fish commented on August 24, 2024

问题

64位 win7 的 ie8 在运行测试时会内存溢出

分析

及时测试内部没有断言,甚至没有任何代码,在测试个数达到一定数量后就一定会报内存溢出。需要进一步查看 mocha 的实现。

from totoro.

fool2fish avatar fool2fish commented on August 24, 2024

问题

overlay,popup 等组件,在判定dom是否可见时,在ie7下得到的结果总是不可见。

分析和解决

queen 在 iframe 中运行 runner,原 iframe 是 0x0,即不可见,这导致在ie7(如果是其他类型的ui判断,如位置等,其他的ie也可能有问题)中不能准确判断

将iframe的尺寸改为 10x10 即解决

from totoro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.