@samitouri / QOS-React-2 / commits / 655affa302

Clarifications

Co-authored-by: shengxinjing <316783812@qq.com>

Rick Hanlon committed Jun 12, 2020 at 21:02 UTC 655affa302437208e6f03c9ca6d170ea1707ace3
15 files changed +43 -43
CHANGELOG.md
+1 -1
@@ -782,7 +782,7 @@ Starting with 16.1.0, we will no longer be publishing new releases on Bower. You
782 * Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011))
783 * Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363))
784 * Fix cases where `onChange` would not fire with `defaultChecked` on radio inputs. ([@jquense](https://github.com/jquense) in [#10156](https://github.com/facebook/react/pull/10156))
785 -* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
785 +* Add support for `controlList` attribute to allowed DOM properties ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
786 * Fix a bug where creating an element with a ref in a constructor did not throw an error in development. ([@iansu](https://github.com/iansu) in [#10025](https://github.com/facebook/react/pull/10025))
787
788 ## 15.6.1 (June 14, 2017)
packages/react-devtools-shared/src/backend/console.js
+2 -2
@@ -85,7 +85,7 @@ const consoleSettingsRef = {
85 breakOnConsoleErrors: false,
86 };
87
88 -// Patches whitelisted console methods to append component stack for the current fiber.
88 +// Patches console methods to append component stack for the current fiber.
89 // Call unpatch() to remove the injected behavior.
90 export function patch({
91 appendComponentStack,
@@ -184,7 +184,7 @@ export function patch({
184 });
185 }
186
187 -// Removed component stack patch from whitelisted console methods.
187 +// Removed component stack patch from console methods.
188 export function unpatch(): void {
189 if (unpatchFn !== null) {
190 unpatchFn();
packages/react-devtools-shared/src/backend/legacy/renderer.js
+5 -5
@@ -586,10 +586,10 @@ export function attach(
586 });
587 }
588
589 - function createIsPathWhitelisted(key: string) {
589 + function createisPathAllowed(key: string) {
590 // This function helps prevent previously-inspected paths from being dehydrated in updates.
591 // This is important to avoid a bad user experience where expanded toggles collapse on update.
592 - return function isPathWhitelisted(path: Array<string | number>): boolean {
592 + return function isPathAllowed(path: Array<string | number>): boolean {
593 let current = currentlyInspectedPaths[key];
594 if (!current) {
595 return false;
@@ -706,15 +706,15 @@ export function attach(
706
707 inspectedElement.context = cleanForBridge(
708 inspectedElement.context,
709 - createIsPathWhitelisted('context'),
709 + createisPathAllowed('context'),
710 );
711 inspectedElement.props = cleanForBridge(
712 inspectedElement.props,
713 - createIsPathWhitelisted('props'),
713 + createisPathAllowed('props'),
714 );
715 inspectedElement.state = cleanForBridge(
716 inspectedElement.state,
717 - createIsPathWhitelisted('state'),
717 + createisPathAllowed('state'),
718 );
719
720 return {
packages/react-devtools-shared/src/backend/renderer.js
+7 -7
@@ -2380,13 +2380,13 @@ export function attach(
2380 });
2381 }
2382
2383 - function createIsPathWhitelisted(
2383 + function createisPathAllowed(
2384 key: string | null,
2385 secondaryCategory: 'hooks' | null,
2386 ) {
2387 // This function helps prevent previously-inspected paths from being dehydrated in updates.
2388 // This is important to avoid a bad user experience where expanded toggles collapse on update.
2389 - return function isPathWhitelisted(path: Array<string | number>): boolean {
2389 + return function isPathAllowed(path: Array<string | number>): boolean {
2390 switch (secondaryCategory) {
2391 case 'hooks':
2392 if (path.length === 1) {
@@ -2528,7 +2528,7 @@ export function attach(
2528 ((mostRecentlyInspectedElement: any): InspectedElement),
2529 path,
2530 ),
2531 - createIsPathWhitelisted(null, secondaryCategory),
2531 + createisPathAllowed(null, secondaryCategory),
2532 path,
2533 ),
2534 };
@@ -2573,19 +2573,19 @@ export function attach(
2573 const cleanedInspectedElement = {...mostRecentlyInspectedElement};
2574 cleanedInspectedElement.context = cleanForBridge(
2575 cleanedInspectedElement.context,
2576 - createIsPathWhitelisted('context', null),
2576 + createisPathAllowed('context', null),
2577 );
2578 cleanedInspectedElement.hooks = cleanForBridge(
2579 cleanedInspectedElement.hooks,
2580 - createIsPathWhitelisted('hooks', 'hooks'),
2580 + createisPathAllowed('hooks', 'hooks'),
2581 );
2582 cleanedInspectedElement.props = cleanForBridge(
2583 cleanedInspectedElement.props,
2584 - createIsPathWhitelisted('props', null),
2584 + createisPathAllowed('props', null),
2585 );
2586 cleanedInspectedElement.state = cleanForBridge(
2587 cleanedInspectedElement.state,
2588 - createIsPathWhitelisted('state', null),
2588 + createisPathAllowed('state', null),
2589 );
2590
2591 return {
packages/react-devtools-shared/src/backend/utils.js
+2 -2
@@ -14,7 +14,7 @@ import type {DehydratedData} from 'react-devtools-shared/src/devtools/views/Comp
14
15 export function cleanForBridge(
16 data: Object | null,
17 - isPathWhitelisted: (path: Array<string | number>) => boolean,
17 + isPathAllowed: (path: Array<string | number>) => boolean,
18 path?: Array<string | number> = [],
19 ): DehydratedData | null {
20 if (data !== null) {
@@ -25,7 +25,7 @@ export function cleanForBridge(
25 cleanedPaths,
26 unserializablePaths,
27 path,
28 - isPathWhitelisted,
28 + isPathAllowed,
29 );
30
31 return {
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js
+1 -1
@@ -164,7 +164,7 @@ function Row({
164 // The list of valid attributes would need to be injected by RN backend,
165 // which would need to require them from ReactNativeViewViewConfig "validAttributes.style" keys.
166 // This would need to degrade gracefully for react-native-web,
167 - // althoguh we could let it also inject a custom set of whitelisted attributes.
167 + // although we could let it also inject a custom set of allowed attributes.
168
169 const [localAttribute, setLocalAttribute] = useState(attribute);
170 const [localValue, setLocalValue] = useState(JSON.stringify(value));
packages/react-devtools-shared/src/hydration.js
+14 -14
@@ -121,7 +121,7 @@ export function dehydrate(
121 cleaned: Array<Array<string | number>>,
122 unserializable: Array<Array<string | number>>,
123 path: Array<string | number>,
124 - isPathWhitelisted: (path: Array<string | number>) => boolean,
124 + isPathAllowed: (path: Array<string | number>) => boolean,
125 level?: number = 0,
126 ):
127 | string
@@ -132,7 +132,7 @@ export function dehydrate(
132 | {[key: string]: string | Dehydrated | Unserializable, ...} {
133 const type = getDataType(data);
134
135 - let isPathWhitelistedCheck;
135 + let isPathAllowedCheck;
136
137 switch (type) {
138 case 'html_element':
@@ -204,8 +204,8 @@ export function dehydrate(
204 };
205
206 case 'array':
207 - isPathWhitelistedCheck = isPathWhitelisted(path);
208 - if (level >= LEVEL_THRESHOLD && !isPathWhitelistedCheck) {
207 + isPathAllowedCheck = isPathAllowed(path);
208 + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
209 return createDehydrated(type, true, data, cleaned, path);
210 }
211 return data.map((item, i) =>
@@ -214,15 +214,15 @@ export function dehydrate(
214 cleaned,
215 unserializable,
216 path.concat([i]),
217 - isPathWhitelisted,
218 - isPathWhitelistedCheck ? 1 : level + 1,
217 + isPathAllowed,
218 + isPathAllowedCheck ? 1 : level + 1,
219 ),
220 );
221
222 case 'typed_array':
223 case 'iterator':
224 - isPathWhitelistedCheck = isPathWhitelisted(path);
225 - if (level >= LEVEL_THRESHOLD && !isPathWhitelistedCheck) {
224 + isPathAllowedCheck = isPathAllowed(path);
225 + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
226 return createDehydrated(type, true, data, cleaned, path);
227 } else {
228 const unserializableValue: Unserializable = {
@@ -250,8 +250,8 @@ export function dehydrate(
250 cleaned,
251 unserializable,
252 path.concat([i]),
253 - isPathWhitelisted,
254 - isPathWhitelistedCheck ? 1 : level + 1,
253 + isPathAllowed,
254 + isPathAllowedCheck ? 1 : level + 1,
255 )),
256 );
257 }
@@ -282,8 +282,8 @@ export function dehydrate(
282 };
283
284 case 'object':
285 - isPathWhitelistedCheck = isPathWhitelisted(path);
286 - if (level >= LEVEL_THRESHOLD && !isPathWhitelistedCheck) {
285 + isPathAllowedCheck = isPathAllowed(path);
286 + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
287 return createDehydrated(type, true, data, cleaned, path);
288 } else {
289 const object = {};
@@ -293,8 +293,8 @@ export function dehydrate(
293 cleaned,
294 unserializable,
295 path.concat([name]),
296 - isPathWhitelisted,
297 - isPathWhitelistedCheck ? 1 : level + 1,
296 + isPathAllowed,
297 + isPathAllowedCheck ? 1 : level + 1,
298 );
299 }
300 return object;
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+1 -1
@@ -1058,7 +1058,7 @@ describe('ReactDOMComponent', () => {
1058 expect(nodeValueSetter).toHaveBeenCalledTimes(3);
1059 });
1060
1061 - it('should ignore attribute whitelist for elements with the "is" attribute', () => {
1061 + it('should ignore attribute list for elements with the "is" attribute', () => {
1062 const container = document.createElement('div');
1063 ReactDOM.render(<button is="test" cowabunga="chevynova" />, container);
1064 expect(container.firstChild.hasAttribute('cowabunga')).toBe(true);
packages/react-dom/src/client/ReactDOMComponent.js
+3 -3
@@ -755,7 +755,7 @@ export function diffProperties(
755 }
756 } else {
757 // For all other deleted properties we add it to the queue. We use
758 - // the whitelist in the commit phase instead.
758 + // the allowed property list in the commit phase instead.
759 (updatePayload = updatePayload || []).push(propKey, null);
760 }
761 }
@@ -858,7 +858,7 @@ export function diffProperties(
858 nextProp.toString();
859 } else {
860 // For any other property we always add it to the queue and then we
861 - // filter it out using the whitelist during the commit.
861 + // filter it out using the allowed property list during the commit.
862 (updatePayload = updatePayload || []).push(propKey, nextProp);
863 }
864 }
@@ -1029,7 +1029,7 @@ export function diffHydratedProperties(
1029 for (let i = 0; i < attributes.length; i++) {
1030 const name = attributes[i].name.toLowerCase();
1031 switch (name) {
1032 - // Built-in SSR attribute is whitelisted
1032 + // Built-in SSR attribute is allowed
1033 case 'data-reactroot':
1034 break;
1035 // Controlled attributes are not validated
packages/react-dom/src/events/DOMTopLevelEventTypes.js
+1 -1
@@ -154,7 +154,7 @@ export const TOP_BEFORE_BLUR = unsafeCastStringToDOMTopLevelType('beforeblur');
154
155 // List of events that need to be individually attached to media elements.
156 // Note that events in this list will *not* be listened to at the top level
157 -// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
157 +// unless they're explicitly listed in `ReactBrowserEventEmitter.listenTo`.
158 export const mediaEventTypes = [
159 TOP_ABORT,
160 TOP_CAN_PLAY,
packages/react-dom/src/shared/DOMProperty.js
+2 -2
@@ -19,7 +19,7 @@ type PropertyType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
19 export const RESERVED = 0;
20
21 // A simple string attribute.
22 -// Attributes that aren't in the whitelist are presumed to have this type.
22 +// Attributes that aren't in the filter are presumed to have this type.
23 export const STRING = 1;
24
25 // A string attribute that accepts booleans in React. In HTML, these are called
@@ -449,7 +449,7 @@ const capitalize = token => token[1].toUpperCase();
449
450 // This is a list of all SVG attributes that need special casing, namespacing,
451 // or boolean value assignment. Regular attributes that just accept strings
452 -// and have the same names are omitted, just like in the HTML whitelist.
452 +// and have the same names are omitted, just like in the HTML attribute filter.
453 // Some of these attributes can be hard to find. This list was created by
454 // scraping the MDN documentation.
455 [
packages/react-dom/src/shared/isCustomComponent.js
+1 -1
@@ -13,7 +13,7 @@ function isCustomComponent(tagName: string, props: Object) {
13 }
14 switch (tagName) {
15 // These are reserved SVG and MathML elements.
16 - // We don't mind this whitelist too much because we expect it to never grow.
16 + // We don't mind this list too much because we expect it to never grow.
17 // The alternative is to track the namespace in a few places which is convoluted.
18 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
19 case 'annotation-xml':
packages/react-dom/src/shared/omittedCloseTags.js
+1 -1
@@ -5,7 +5,7 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -// For HTML, certain tags should omit their close tag. We keep a whitelist for
8 +// For HTML, certain tags should omit their close tag. We keep a list for
9 // those special-case tags.
10
11 const omittedCloseTags = {
packages/react-dom/src/shared/possibleStandardNames.js
+1 -1
@@ -5,7 +5,7 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -// When adding attributes to the HTML or SVG whitelist, be sure to
8 +// When adding attributes to the HTML or SVG allowed attribute list, be sure to
9 // also add them to this module to ensure casing and incorrect name
10 // warnings.
11 const possibleStandardNames = {
packages/scheduler/src/__tests__/SchedulerUMDBundle-test.internal.js
+1 -1
@@ -24,7 +24,7 @@ describe('Scheduling UMD bundle', () => {
24 });
25
26 function filterPrivateKeys(name) {
27 - // Be very careful adding things to this whitelist!
27 + // Be very careful adding things to this filter!
28 // It's easy to introduce bugs by doing it:
29 // https://github.com/facebook/react/issues/14904
30 switch (name) {