adlayer / javascript-library

Adlayer Javascript Core Library
3 stars 0 forks source link

Clean JSONP callback to avoid memory leaks #13

Open manobi opened 12 years ago

manobi commented 12 years ago

Assertion to include in http_request.js test case:

        it('Should remove itself to avoid memory leak', function(){
            var root = {};
            var run = false;

            var request = new HttpRequest({
                host: 'localhost',
                path: '/'
            }, function(err, response){
                expect(response).to.be.ok();
            });

            request.expose(root);
            root.callback({ok:true});
            expect(root.callback).to.not.be.ok();
        });