Socket
Socket
Sign inDemoInstall

@sentry/utils

Package Overview
Dependencies
Maintainers
10
Versions
499
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/utils - npm Package Compare versions

Comparing version 5.4.0 to 5.4.2

2

dist/supports.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc