487 lines
21 KiB
JavaScript
487 lines
21 KiB
JavaScript
/* Metro module 994; source: unknown; dependencies: [830, 832, 833] */
|
|
import * as GLOBAL_OBJModule from './module-00830-GLOBAL_OBJ.js'; /* Metro dependency 830 */
|
|
import * as DEBUG_BUILDModule from './module-00832-DEBUG_BUILD.js'; /* Metro dependency 832 */
|
|
import * as Module00833Module from './module-00833.js'; /* Metro dependency 833 */
|
|
|
|
function _fun10453(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#10453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1121:6, offset: 0x00d8e5a7, size: 174 bytes, params: 8, frame: 19
|
|
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('data:,');
|
|
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;
|
|
const defineProperty = Object.defineProperty;
|
|
const Symbol = global.Symbol;
|
|
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
|
|
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.supportsHistory = supportsHistory;
|
|
exports.supportsNativeFetch = supportsNativeFetch;
|
|
exports.supportsReferrerPolicy = function() {
|
|
var Request;
|
|
var prototype;
|
|
var error;
|
|
if (supportsFetch()) {
|
|
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 supportsHistory() { // fn#10459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1121:761, offset: 0x00d8e762, size: 78 bytes, params: 1, frame: 13
|
|
const GLOBAL_OBJ = (GLOBAL_OBJModule).GLOBAL_OBJ;
|
|
return 'history' in GLOBAL_OBJ && !!GLOBAL_OBJ.history;
|
|
}
|
|
|
|
function supportsNativeFetch() { // fn#10460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1121:878, offset: 0x00d8e7b0, size: 365 bytes, params: 1, frame: 20
|
|
var r6;
|
|
var r0;
|
|
var isNativeFunction_10455Binding;
|
|
const GLOBAL_OBJ = (GLOBAL_OBJModule).GLOBAL_OBJ;
|
|
var fetch;
|
|
var value2;
|
|
var document;
|
|
var createElement;
|
|
var element;
|
|
var head;
|
|
var appendChild;
|
|
var contentWindow;
|
|
var value3;
|
|
var isNativeFunction_104552;
|
|
var removeChild;
|
|
var error;
|
|
const DEBUG_BUILD = (DEBUG_BUILDModule).DEBUG_BUILD;
|
|
const debug = (Module00833Module).debug;
|
|
const EdgeRuntime = global.EdgeRuntime;
|
|
if (typeof EdgeRuntime === 'string') {
|
|
return true;
|
|
}
|
|
if (supportsFetch()) {
|
|
isNativeFunction_10455Binding = isNativeFunction_10455;
|
|
fetch = GLOBAL_OBJ.fetch;
|
|
if (isNativeFunction_10455Binding(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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
value3 = contentWindow != null;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
if (value3) {
|
|
try {
|
|
fetch = contentWindow.fetch;
|
|
r6 = fetch;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
if (r6) {
|
|
try {
|
|
isNativeFunction_10455Binding = isNativeFunction_10455;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
isNativeFunction_104552 = isNativeFunction_10455Binding(fetch);
|
|
r0 = isNativeFunction_104552;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
|
|
error);
|
|
}
|
|
}
|
|
}
|
|
} else if (value3) {
|
|
try {
|
|
isNativeFunction_10455Binding = isNativeFunction_10455;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
return r0;
|
|
}
|
|
try {
|
|
isNativeFunction_104552 = isNativeFunction_10455Binding(fetch);
|
|
r0 = isNativeFunction_104552;
|
|
} catch (error) {
|
|
r0 = value2;
|
|
if (DEBUG_BUILD) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.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) {
|
|
debug.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ',
|
|
|
|
error);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun10453, 994, [830, 832, 833]) /* metro module 994, dependencies: [830, 832, 833] */;
|