-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML Reporter: Avoid leaking 'Map' in older browsers
On IE6-8 and in PhantomJS, our partial ES6 Map implementation was leaking as global variable. Follows 2f2eaba. Fixes #1508.
- Loading branch information
Showing
3 changed files
with
26 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Support IE 9-10, PhantomJS: Fallback for fuzzysort.js used by /reporter/html.js | ||
// eslint-disable-next-line no-unused-vars | ||
var Map = typeof Map === "function" ? Map : function StringMap() { | ||
var store = Object.create( null ); | ||
this.get = function( strKey ) { | ||
return store[ strKey ]; | ||
}; | ||
this.set = function( strKey, val ) { | ||
store[ strKey ] = val; | ||
return this; | ||
}; | ||
this.clear = function() { | ||
store = Object.create( null ); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters