Skip to content

Commit

Permalink
Avoid using native keyword as variable
Browse files Browse the repository at this point in the history
Fixes the test suite in some older browsers that choke on it.
  • Loading branch information
mislav committed Nov 15, 2016
1 parent ff2a90f commit d7b6b8a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/test.js
Expand Up @@ -67,15 +67,15 @@ function readArrayBufferAsText(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf))
}

var native = {}
var preservedGlobals = {}
var keepGlobals = ['fetch', 'Headers', 'Request', 'Response']
var exercise = ['polyfill']

// If native fetch implementation exists, save it and allow it to be replaced
// by the polyfill. Native implementation will be exercised additionally.
if (self.fetch) {
keepGlobals.forEach(function(name) {
native[name] = self[name]
preservedGlobals[name] = self[name]
})
self.fetch = undefined
exercise.push('native')
Expand All @@ -92,7 +92,7 @@ exercise.forEach(function(exerciseMode) {
if (exerciseMode === 'native') {
suiteSetup(function() {
keepGlobals.forEach(function(name) {
self[name] = native[name]
self[name] = preservedGlobals[name]
})
})
}
Expand Down

0 comments on commit d7b6b8a

Please sign in to comment.