зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1550489 - Remove usage of new Function in react-redux.js r=nchevobbe
Depends on D38617 We should no longer use eval-like code in privileged modules Differential Revision: https://phabricator.services.mozilla.com/D38513 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
39e4e14e35
Коммит
8095fbadfe
|
@ -33,3 +33,4 @@ We no longer need the react-redux repo so feel free to delete it.
|
|||
```
|
||||
- Replace all instances of `'react'` with `'devtools/client/shared/vendor/react'` (including the quotes).
|
||||
- Replace all instances of `'redux'` with `'devtools/client/shared/vendor/redux'` (including the quotes).
|
||||
- Replace all instances of `Function('return this')()` with `globalThis`. See Bug 1473549.
|
||||
|
|
|
@ -20,7 +20,7 @@ function createCommonjsModule(fn, module) {
|
|||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function makeEmptyFunction(arg) {
|
||||
|
@ -1017,7 +1017,7 @@ var hoistNonReactStatics = createCommonjsModule(function (module, exports) {
|
|||
(function (global, factory) {
|
||||
module.exports = factory();
|
||||
}(commonjsGlobal, (function () {
|
||||
|
||||
|
||||
var REACT_STATICS = {
|
||||
childContextTypes: true,
|
||||
contextTypes: true,
|
||||
|
@ -1029,7 +1029,7 @@ var hoistNonReactStatics = createCommonjsModule(function (module, exports) {
|
|||
propTypes: true,
|
||||
type: true
|
||||
};
|
||||
|
||||
|
||||
var KNOWN_STATICS = {
|
||||
name: true,
|
||||
length: true,
|
||||
|
@ -1039,30 +1039,30 @@ var hoistNonReactStatics = createCommonjsModule(function (module, exports) {
|
|||
arguments: true,
|
||||
arity: true
|
||||
};
|
||||
|
||||
|
||||
var defineProperty = Object.defineProperty;
|
||||
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
var getPrototypeOf = Object.getPrototypeOf;
|
||||
var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
|
||||
|
||||
|
||||
return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
||||
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
|
||||
|
||||
|
||||
if (objectPrototype) {
|
||||
var inheritedComponent = getPrototypeOf(sourceComponent);
|
||||
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
||||
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var keys = getOwnPropertyNames(sourceComponent);
|
||||
|
||||
|
||||
if (getOwnPropertySymbols) {
|
||||
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
|
||||
|
@ -1072,10 +1072,10 @@ var hoistNonReactStatics = createCommonjsModule(function (module, exports) {
|
|||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return targetComponent;
|
||||
}
|
||||
|
||||
|
||||
return targetComponent;
|
||||
};
|
||||
})));
|
||||
|
@ -1533,7 +1533,7 @@ var freeGlobal = typeof global == 'object' && global && global.Object === Object
|
|||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
var root = freeGlobal || freeSelf || Function('return this')();
|
||||
var root = freeGlobal || freeSelf || globalThis;
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol$1 = root.Symbol;
|
||||
|
@ -1748,7 +1748,7 @@ function wrapMapToPropsConstant(getConstant) {
|
|||
// dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
|
||||
// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
|
||||
// whether mapToProps needs to be invoked when props have changed.
|
||||
//
|
||||
//
|
||||
// A length of one signals that mapToProps does not depend on props from the parent component.
|
||||
// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
|
||||
// therefore not reporting its length accurately..
|
||||
|
@ -1758,16 +1758,16 @@ function getDependsOnOwnProps(mapToProps) {
|
|||
|
||||
// Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
|
||||
// this function wraps mapToProps in a proxy function which does several things:
|
||||
//
|
||||
//
|
||||
// * Detects whether the mapToProps function being called depends on props, which
|
||||
// is used by selectorFactory to decide if it should reinvoke on props changes.
|
||||
//
|
||||
//
|
||||
// * On first call, handles mapToProps if returns another function, and treats that
|
||||
// new function as the true mapToProps for subsequent calls.
|
||||
//
|
||||
//
|
||||
// * On first call, verifies the first result is a plain object, in order to warn
|
||||
// the developer that their mapToProps function is not returning a valid result.
|
||||
//
|
||||
//
|
||||
function wrapMapToPropsFunc(mapToProps, methodName) {
|
||||
return function initProxySelector(dispatch, _ref) {
|
||||
var displayName = _ref.displayName;
|
||||
|
@ -1991,7 +1991,7 @@ function finalPropsSelectorFactory(dispatch, _ref2) {
|
|||
selectorFactory, which has the signature:
|
||||
|
||||
(dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
|
||||
|
||||
|
||||
connect passes its args to connectAdvanced as options, which will in turn pass them to
|
||||
selectorFactory each time a Connect component instance is instantiated or hot reloaded.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче