-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch 'Headers' to accept 'undefined'
Fixes `TypeError: Failed to construct 'Headers': No matching constructor signature.`
- Loading branch information
1 parent
ed321c4
commit ab70cc0
Showing
2 changed files
with
27 additions
and
0 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
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,26 @@ | ||
/** | ||
* Patch 'Headers' to accept 'undefined'. | ||
* Fixes `TypeError: Failed to construct 'Headers': No matching constructor signature.` | ||
* Affected platforms: | ||
* - Tizen 3 | ||
* - Tizen 4 | ||
* - webOS 4 | ||
*/ | ||
|
||
(function (window) { | ||
'use strict'; | ||
|
||
if (window.Headers) { | ||
try { | ||
new window.Headers(undefined); | ||
} catch (_) { | ||
console.debug('patch \'Headers\' to accept \'undefined\''); | ||
|
||
const _Headers = window.Headers; | ||
|
||
window.Headers = function (init) { | ||
return init ? new _Headers(init) : new _Headers(); | ||
}; | ||
} | ||
} | ||
}(window)); |