@sentry/utils
Advanced tools
Comparing version 5.4.0 to 5.4.2
@@ -33,3 +33,3 @@ /** | ||
* | ||
* @returns Answer to the given question. | ||
* @returns true if `window.fetch` is natively implemented, false otherwise | ||
*/ | ||
@@ -36,0 +36,0 @@ export declare function supportsNativeFetch(): boolean; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var logger_1 = require("./logger"); | ||
var misc_1 = require("./misc"); | ||
@@ -86,3 +87,3 @@ /** | ||
* | ||
* @returns Answer to the given question. | ||
* @returns true if `window.fetch` is natively implemented, false otherwise | ||
*/ | ||
@@ -93,4 +94,26 @@ function supportsNativeFetch() { | ||
} | ||
var isNativeFunc = function (func) { return func.toString().indexOf('native') !== -1; }; | ||
var global = misc_1.getGlobalObject(); | ||
return global.fetch.toString().indexOf('native') !== -1; | ||
var result = null; | ||
var doc = global.document; | ||
if (doc) { | ||
var sandbox = doc.createElement('iframe'); | ||
sandbox.hidden = true; | ||
try { | ||
doc.head.appendChild(sandbox); | ||
if (sandbox.contentWindow && sandbox.contentWindow.fetch) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(sandbox.contentWindow.fetch); | ||
} | ||
doc.head.removeChild(sandbox); | ||
} | ||
catch (err) { | ||
logger_1.logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err); | ||
} | ||
} | ||
if (result === null) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(global.fetch); | ||
} | ||
return result; | ||
} | ||
@@ -97,0 +120,0 @@ exports.supportsNativeFetch = supportsNativeFetch; |
@@ -33,3 +33,3 @@ /** | ||
* | ||
* @returns Answer to the given question. | ||
* @returns true if `window.fetch` is natively implemented, false otherwise | ||
*/ | ||
@@ -36,0 +36,0 @@ export declare function supportsNativeFetch(): boolean; |
@@ -0,1 +1,2 @@ | ||
import { logger } from './logger'; | ||
import { getGlobalObject } from './misc'; | ||
@@ -81,3 +82,3 @@ /** | ||
* | ||
* @returns Answer to the given question. | ||
* @returns true if `window.fetch` is natively implemented, false otherwise | ||
*/ | ||
@@ -88,4 +89,26 @@ export function supportsNativeFetch() { | ||
} | ||
var isNativeFunc = function (func) { return func.toString().indexOf('native') !== -1; }; | ||
var global = getGlobalObject(); | ||
return global.fetch.toString().indexOf('native') !== -1; | ||
var result = null; | ||
var doc = global.document; | ||
if (doc) { | ||
var sandbox = doc.createElement('iframe'); | ||
sandbox.hidden = true; | ||
try { | ||
doc.head.appendChild(sandbox); | ||
if (sandbox.contentWindow && sandbox.contentWindow.fetch) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(sandbox.contentWindow.fetch); | ||
} | ||
doc.head.removeChild(sandbox); | ||
} | ||
catch (err) { | ||
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err); | ||
} | ||
} | ||
if (result === null) { | ||
// tslint:disable-next-line no-unbound-method | ||
result = isNativeFunc(global.fetch); | ||
} | ||
return result; | ||
} | ||
@@ -92,0 +115,0 @@ /** |
{ | ||
"name": "@sentry/utils", | ||
"version": "5.4.0", | ||
"version": "5.4.2", | ||
"description": "Utilities for all Sentry JavaScript SDKs", | ||
@@ -19,3 +19,3 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "5.4.0", | ||
"@sentry/types": "5.4.2", | ||
"tslib": "^1.9.3" | ||
@@ -22,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
276534
3561
+ Added@sentry/types@5.4.2(transitive)
- Removed@sentry/types@5.4.0(transitive)
Updated@sentry/types@5.4.2