diff --git a/CHANGELOG.md b/CHANGELOG.md index a9ccad2686..2a3c50fa6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -782,7 +782,7 @@ Starting with 16.1.0, we will no longer be publishing new releases on Bower. You * Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011)) * Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363)) * 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)) -* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940)) +* Add support for `controlList` attribute to allowed DOM properties ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940)) * 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)) ## 15.6.1 (June 14, 2017) diff --git a/packages/react-devtools-shared/src/backend/console.js b/packages/react-devtools-shared/src/backend/console.js index 00358b057d..9a29d5cb05 100644 --- a/packages/react-devtools-shared/src/backend/console.js +++ b/packages/react-devtools-shared/src/backend/console.js @@ -85,7 +85,7 @@ const consoleSettingsRef = { breakOnConsoleErrors: false, }; -// Patches whitelisted console methods to append component stack for the current fiber. +// Patches console methods to append component stack for the current fiber. // Call unpatch() to remove the injected behavior. export function patch({ appendComponentStack, @@ -184,7 +184,7 @@ export function patch({ }); } -// Removed component stack patch from whitelisted console methods. +// Removed component stack patch from console methods. export function unpatch(): void { if (unpatchFn !== null) { unpatchFn(); diff --git a/packages/react-devtools-shared/src/backend/legacy/renderer.js b/packages/react-devtools-shared/src/backend/legacy/renderer.js index d68ee86c62..6a20ec7e9b 100644 --- a/packages/react-devtools-shared/src/backend/legacy/renderer.js +++ b/packages/react-devtools-shared/src/backend/legacy/renderer.js @@ -586,10 +586,10 @@ export function attach( }); } - function createIsPathWhitelisted(key: string) { + function createisPathAllowed(key: string) { // This function helps prevent previously-inspected paths from being dehydrated in updates. // This is important to avoid a bad user experience where expanded toggles collapse on update. - return function isPathWhitelisted(path: Array): boolean { + return function isPathAllowed(path: Array): boolean { let current = currentlyInspectedPaths[key]; if (!current) { return false; @@ -706,15 +706,15 @@ export function attach( inspectedElement.context = cleanForBridge( inspectedElement.context, - createIsPathWhitelisted('context'), + createisPathAllowed('context'), ); inspectedElement.props = cleanForBridge( inspectedElement.props, - createIsPathWhitelisted('props'), + createisPathAllowed('props'), ); inspectedElement.state = cleanForBridge( inspectedElement.state, - createIsPathWhitelisted('state'), + createisPathAllowed('state'), ); return { diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index 569b600ba0..1018033736 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -2380,13 +2380,13 @@ export function attach( }); } - function createIsPathWhitelisted( + function createisPathAllowed( key: string | null, secondaryCategory: 'hooks' | null, ) { // This function helps prevent previously-inspected paths from being dehydrated in updates. // This is important to avoid a bad user experience where expanded toggles collapse on update. - return function isPathWhitelisted(path: Array): boolean { + return function isPathAllowed(path: Array): boolean { switch (secondaryCategory) { case 'hooks': if (path.length === 1) { @@ -2528,7 +2528,7 @@ export function attach( ((mostRecentlyInspectedElement: any): InspectedElement), path, ), - createIsPathWhitelisted(null, secondaryCategory), + createisPathAllowed(null, secondaryCategory), path, ), }; @@ -2573,19 +2573,19 @@ export function attach( const cleanedInspectedElement = {...mostRecentlyInspectedElement}; cleanedInspectedElement.context = cleanForBridge( cleanedInspectedElement.context, - createIsPathWhitelisted('context', null), + createisPathAllowed('context', null), ); cleanedInspectedElement.hooks = cleanForBridge( cleanedInspectedElement.hooks, - createIsPathWhitelisted('hooks', 'hooks'), + createisPathAllowed('hooks', 'hooks'), ); cleanedInspectedElement.props = cleanForBridge( cleanedInspectedElement.props, - createIsPathWhitelisted('props', null), + createisPathAllowed('props', null), ); cleanedInspectedElement.state = cleanForBridge( cleanedInspectedElement.state, - createIsPathWhitelisted('state', null), + createisPathAllowed('state', null), ); return { diff --git a/packages/react-devtools-shared/src/backend/utils.js b/packages/react-devtools-shared/src/backend/utils.js index 6f96f9864f..debe0db38a 100644 --- a/packages/react-devtools-shared/src/backend/utils.js +++ b/packages/react-devtools-shared/src/backend/utils.js @@ -14,7 +14,7 @@ import type {DehydratedData} from 'react-devtools-shared/src/devtools/views/Comp export function cleanForBridge( data: Object | null, - isPathWhitelisted: (path: Array) => boolean, + isPathAllowed: (path: Array) => boolean, path?: Array = [], ): DehydratedData | null { if (data !== null) { @@ -25,7 +25,7 @@ export function cleanForBridge( cleanedPaths, unserializablePaths, path, - isPathWhitelisted, + isPathAllowed, ); return { diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js index 31f55da245..ae28dbde84 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js @@ -164,7 +164,7 @@ function Row({ // The list of valid attributes would need to be injected by RN backend, // which would need to require them from ReactNativeViewViewConfig "validAttributes.style" keys. // This would need to degrade gracefully for react-native-web, - // althoguh we could let it also inject a custom set of whitelisted attributes. + // although we could let it also inject a custom set of allowed attributes. const [localAttribute, setLocalAttribute] = useState(attribute); const [localValue, setLocalValue] = useState(JSON.stringify(value)); diff --git a/packages/react-devtools-shared/src/hydration.js b/packages/react-devtools-shared/src/hydration.js index c134f7797d..f46048f75e 100644 --- a/packages/react-devtools-shared/src/hydration.js +++ b/packages/react-devtools-shared/src/hydration.js @@ -121,7 +121,7 @@ export function dehydrate( cleaned: Array>, unserializable: Array>, path: Array, - isPathWhitelisted: (path: Array) => boolean, + isPathAllowed: (path: Array) => boolean, level?: number = 0, ): | string @@ -132,7 +132,7 @@ export function dehydrate( | {[key: string]: string | Dehydrated | Unserializable, ...} { const type = getDataType(data); - let isPathWhitelistedCheck; + let isPathAllowedCheck; switch (type) { case 'html_element': @@ -204,8 +204,8 @@ export function dehydrate( }; case 'array': - isPathWhitelistedCheck = isPathWhitelisted(path); - if (level >= LEVEL_THRESHOLD && !isPathWhitelistedCheck) { + isPathAllowedCheck = isPathAllowed(path); + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { return createDehydrated(type, true, data, cleaned, path); } return data.map((item, i) => @@ -214,15 +214,15 @@ export function dehydrate( cleaned, unserializable, path.concat([i]), - isPathWhitelisted, - isPathWhitelistedCheck ? 1 : level + 1, + isPathAllowed, + isPathAllowedCheck ? 1 : level + 1, ), ); case 'typed_array': case 'iterator': - isPathWhitelistedCheck = isPathWhitelisted(path); - if (level >= LEVEL_THRESHOLD && !isPathWhitelistedCheck) { + isPathAllowedCheck = isPathAllowed(path); + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { return createDehydrated(type, true, data, cleaned, path); } else { const unserializableValue: Unserializable = { @@ -250,8 +250,8 @@ export function dehydrate( cleaned, unserializable, path.concat([i]), - isPathWhitelisted, - isPathWhitelistedCheck ? 1 : level + 1, + isPathAllowed, + isPathAllowedCheck ? 1 : level + 1, )), ); } @@ -282,8 +282,8 @@ export function dehydrate( }; case 'object': - isPathWhitelistedCheck = isPathWhitelisted(path); - if (level >= LEVEL_THRESHOLD && !isPathWhitelistedCheck) { + isPathAllowedCheck = isPathAllowed(path); + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { return createDehydrated(type, true, data, cleaned, path); } else { const object = {}; @@ -293,8 +293,8 @@ export function dehydrate( cleaned, unserializable, path.concat([name]), - isPathWhitelisted, - isPathWhitelistedCheck ? 1 : level + 1, + isPathAllowed, + isPathAllowedCheck ? 1 : level + 1, ); } return object; diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index ac966b5aca..bcf7bde39c 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -1058,7 +1058,7 @@ describe('ReactDOMComponent', () => { expect(nodeValueSetter).toHaveBeenCalledTimes(3); }); - it('should ignore attribute whitelist for elements with the "is" attribute', () => { + it('should ignore attribute list for elements with the "is" attribute', () => { const container = document.createElement('div'); ReactDOM.render(