Skip to content

Commit

Permalink
Merge pull request #704 from geek/master
Browse files Browse the repository at this point in the history
Add WebAssembly to allowed globals
  • Loading branch information
geek authored May 9, 2017
2 parents c9678a4 + ffb783a commit 44d7e5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/leaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ exports.detect = function (customGlobals) {
whitelist.Reflect = true;
}

if (global.WebAssembly) {
whitelist.WebAssembly = true;
}

if (global.DTRACE_HTTP_SERVER_RESPONSE) {
whitelist.DTRACE_HTTP_SERVER_RESPONSE = true;
whitelist.DTRACE_HTTP_SERVER_REQUEST = true;
Expand Down
10 changes: 10 additions & 0 deletions test/leaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ describe('Leaks', () => {
done();
});

it('ignores WebAssembly global', (done) => {

testedKeys.push('WebAssembly');
global.WebAssembly = global.WebAssembly || 1;

const leaks = Lab.leaks.detect();
expect(leaks.length).to.equal(0);
done();
});

it('ignores Harmony globals', (done) => {

const harmonyGlobals = internals.harmonyGlobals;
Expand Down

0 comments on commit 44d7e5f

Please sign in to comment.