474 lines
19 KiB
React
474 lines
19 KiB
React
/* Metro module 7481; source: unknown; dependencies: [7370, 7368, 7369] */
|
|
function _fun60350(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60350, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7659:6, offset: 0x01701b3a, size: 151 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const closure = function() {
|
|
var prototype;
|
|
var prototype2;
|
|
var prototype3;
|
|
var error;
|
|
var property = require(dependencyMap[0]).GLOBAL_OBJ;
|
|
if ('fetch' in property) {
|
|
try {
|
|
property = global.Headers;
|
|
prototype = property.prototype;
|
|
Object.create(prototype, {constructor: {value: property}});
|
|
new property();
|
|
property = global.Request;
|
|
prototype2 = property.prototype;
|
|
Object.create(prototype2, {constructor: {value: property}});
|
|
new property('http://www.example.com');
|
|
property = global.Response;
|
|
prototype3 = property.prototype;
|
|
Object.create(prototype3, {constructor: {value: property}});
|
|
new property();
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
const closure2 = function(a0) {
|
|
var r0;
|
|
var value = a0;
|
|
if (value) {
|
|
value = RegExp('^function\\s+\\w+\\(\\)\\s+\\{\\s+\\[native code\\]\\s+\\}$', '').test(value.toString());
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
exports.isNativeFunction = closure2;
|
|
exports.supportsDOMError = function() {
|
|
var DOMError;
|
|
var prototype;
|
|
var error;
|
|
try {
|
|
DOMError = global.DOMError;
|
|
prototype = DOMError.prototype;
|
|
Object.create(prototype, {constructor: {value: DOMError}});
|
|
new DOMError('');
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
exports.supportsDOMException = function() {
|
|
var DOMException;
|
|
var prototype;
|
|
var error;
|
|
try {
|
|
DOMException = global.DOMException;
|
|
prototype = DOMException.prototype;
|
|
Object.create(prototype, {constructor: {value: DOMException}});
|
|
new DOMException('');
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
exports.supportsErrorEvent = function() {
|
|
var ErrorEvent;
|
|
var prototype;
|
|
var error;
|
|
try {
|
|
ErrorEvent = global.ErrorEvent;
|
|
prototype = ErrorEvent.prototype;
|
|
Object.create(prototype, {constructor: {value: ErrorEvent}});
|
|
new ErrorEvent('');
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
exports.supportsFetch = closure;
|
|
exports.supportsNativeFetch = supportsNativeFetch_60356;
|
|
exports.supportsReferrerPolicy = function() {
|
|
var Request;
|
|
var prototype;
|
|
var error;
|
|
if (supportsFetch_60351()) {
|
|
try {
|
|
Request = global.Request;
|
|
prototype = Request.prototype;
|
|
Object.create(prototype, {constructor: {value: Request}});
|
|
new Request('_', {referrerPolicy: 'origin'});
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
exports.supportsReportingObserver = function() {
|
|
var GLOBAL_OBJ = require(dependencyMap[0]).GLOBAL_OBJ;
|
|
return 'ReportingObserver' in GLOBAL_OBJ;
|
|
};
|
|
}
|
|
|
|
function supportsNativeFetch_60356() { // fn#60356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7659:761, offset: 0x01701c49, size: 363 bytes, params: 1, frame: 19
|
|
var r6;
|
|
var r0;
|
|
var isNativeFunction_60352Binding;
|
|
const GLOBAL_OBJ = (require(7370) /* metro dependency 7370 */).GLOBAL_OBJ;
|
|
var fetch;
|
|
var value2;
|
|
var document;
|
|
var createElement;
|
|
var element;
|
|
var head;
|
|
var appendChild;
|
|
var contentWindow;
|
|
var isNativeFunction_603522;
|
|
var removeChild;
|
|
var error;
|
|
const DEBUG_BUILD = (require(7368) /* metro dependency 7368 */).DEBUG_BUILD;
|
|
const logger = (require(7369) /* metro dependency 7369 */).logger;
|
|
const EdgeRuntime = global.EdgeRuntime;
|
|
if (typeof EdgeRuntime === 'string') {
|
|
return true;
|
|
}
|
|
if (supportsFetch_60351()) {
|
|
isNativeFunction_60352Binding = isNativeFunction_60352;
|
|
fetch = GLOBAL_OBJ.fetch;
|
|
if (isNativeFunction_60352Binding(fetch)) {
|
|
return true;
|
|
}
|
|
value2 = false;
|
|
document = GLOBAL_OBJ.document;
|
|
if (document) {
|
|
createElement = document.createElement;
|
|
if (typeof createElement !== 'function') {
|
|
r0 = value2;
|
|
} else {
|
|
try {
|
|
createElement = document.createElement;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
element = Reflect.apply(createElement, document, ['iframe']);
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
element.hidden = true;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
head = document.head;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
appendChild = head.appendChild;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
Reflect.apply(appendChild, head, [element]);
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
contentWindow = element.contentWindow;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
if (contentWindow) {
|
|
try {
|
|
contentWindow = element.contentWindow;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
fetch = contentWindow.fetch;
|
|
r6 = fetch;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
if (r6) {
|
|
try {
|
|
isNativeFunction_60352Binding = isNativeFunction_60352;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
contentWindow = element.contentWindow;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
fetch = contentWindow.fetch;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
isNativeFunction_603522 = isNativeFunction_60352Binding(fetch);
|
|
r0 = isNativeFunction_603522;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
head = document.head;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
removeChild = head.removeChild;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
Reflect.apply(removeChild, head, [element]);
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
try {
|
|
head = document.head;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
removeChild = head.removeChild;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
Reflect.apply(removeChild, head, [element]);
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
}
|
|
}
|
|
} else if (contentWindow) {
|
|
try {
|
|
isNativeFunction_60352Binding = isNativeFunction_60352;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
contentWindow = element.contentWindow;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
fetch = contentWindow.fetch;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
isNativeFunction_603522 = isNativeFunction_60352Binding(fetch);
|
|
r0 = isNativeFunction_603522;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
head = document.head;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
removeChild = head.removeChild;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
Reflect.apply(removeChild, head, [element]);
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
try {
|
|
head = document.head;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
removeChild = head.removeChild;
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
Reflect.apply(removeChild, head, [element]);
|
|
} catch (error) {
|
|
if (DEBUG_BUILD) {
|
|
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
return false;
|
|
}
|
|
|