function injectEventPluginOrder(injectedEventPluginOrder) {
function injectEventPluginOrder(injectedEventPluginOrder) {
(function () {
(function () {
if (!!eventPluginOrder) {
if (!!eventPluginOrder) {
{
{
throw ReactError(Error('EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.'));
throw ReactError(Error("EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."));
}
}
}
}
})();
})(); // Clone the ordering so it cannot be dynamically mutated.
// Clone the ordering so it cannot be dynamically mutated.
// So we preemptively throw with a better message instead.
// So we preemptively throw with a better message instead.
(function () {
(function () {
if (!(typeof document !== 'undefined')) {
if (!(typeof document !== 'undefined')) {
{
{
throw ReactError(Error('The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.'));
throw ReactError(Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous."));
}
}
}
}
})();
})();
var evt = document.createEvent('Event');
var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
// Keeps track of whether the user-provided callback threw an error. We
// set this to true at the beginning, then set it to false right after
// set this to true at the beginning, then set it to false right after
// calling the function. If the function errors, `didError` will never be
// calling the function. If the function errors, `didError` will never be
// set to false. This strategy works even if the browser is flaky and
// set to false. This strategy works even if the browser is flaky and
// fails to call our global error handler, because it doesn't rely on
// fails to call our global error handler, because it doesn't rely on
// the error event at all.
// the error event at all.
var didError = true;
var didError = true; // Keeps track of the value of window.event so that we can reset it
// Keeps track of the value of window.event so that we can reset it
// during the callback to let user code access window.event in the
// during the callback to let user code access window.event in the
// browsers that support it.
// browsers that support it.
var windowEvent = window.event;
var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event
// Keeps track of the descriptor of window.event to restore it after event
// The callback errored, but the error event never fired.
// The callback errored, but the error event never fired.
error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
} else if (isCrossOriginError) {
} else if (isCrossOriginError) {
error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
* Same as invokeGuardedCallback, but instead of returning an error, it stores
* Same as invokeGuardedCallback, but instead of returning an error, it stores
* it in a global so it can be rethrown by `rethrowCaughtError` later.
* it in a global so it can be rethrown by `rethrowCaughtError` later.
* TODO: See if caughtError and rethrowError can be unified.
* TODO: See if caughtError and rethrowError can be unified.
*
*
* @param {String} name of the guard to use for logging or debugging
* @param {String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {Function} func The function to invoke
* @param {*} context The context to use when calling the function
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
* @param {...*} args Arguments for function
*/
*/
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
invokeGuardedCallback.apply(this, arguments);
invokeGuardedCallback.apply(this, arguments);
if (hasError) {
if (hasError) {
var error = clearCaughtError();
var error = clearCaughtError();
if (!hasRethrowError) {
if (!hasRethrowError) {
hasRethrowError = true;
hasRethrowError = true;
rethrowError = error;
rethrowError = error;
}
}
}
}
}
}
/**
/**
* During execution of guarded functions we will capture the first error which
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
* we will rethrow to be handled by the top level error handler.
*/
*/
function rethrowCaughtError() {
function rethrowCaughtError() {
if (hasRethrowError) {
if (hasRethrowError) {
var error = rethrowError;
var error = rethrowError;
hasRethrowError = false;
hasRethrowError = false;
rethrowError = null;
rethrowError = null;
throw error;
throw error;
}
}
}
}
function hasCaughtError() {
function hasCaughtError() {
return hasError;
return hasError;
}
}
function clearCaughtError() {
function clearCaughtError() {
if (hasError) {
if (hasError) {
var error = caughtError;
var error = caughtError;
hasError = false;
hasError = false;
caughtError = null;
caughtError = null;
return error;
return error;
} else {
} else {
(function () {
(function () {
{
{
{
{
throw ReactError(Error('clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'));
throw ReactError(Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue."));
}
}
}
}
})();
})();
}
}
}
}
/**
/**
* Similar to invariant but only logs a warning if the condition is not met.
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
* same logic and follow the same code paths.
*/
*/
var warningWithoutStack = function () {};
var warningWithoutStack = function () {};
{
{
warningWithoutStack = function (condition, format) {
warningWithoutStack = function (condition, format) {