Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shared/src/backend/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions packages/react-devtools-shared/src/backend/legacy/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | number>): boolean {
return function isPathAllowed(path: Array<string | number>): boolean {
let current = currentlyInspectedPaths[key];
if (!current) {
return false;
Expand Down Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | number>): boolean {
return function isPathAllowed(path: Array<string | number>): boolean {
switch (secondaryCategory) {
case 'hooks':
if (path.length === 1) {
Expand Down Expand Up @@ -2528,7 +2528,7 @@ export function attach(
((mostRecentlyInspectedElement: any): InspectedElement),
path,
),
createIsPathWhitelisted(null, secondaryCategory),
createisPathAllowed(null, secondaryCategory),
path,
),
};
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shared/src/backend/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {DehydratedData} from 'react-devtools-shared/src/devtools/views/Comp

export function cleanForBridge(
data: Object | null,
isPathWhitelisted: (path: Array<string | number>) => boolean,
isPathAllowed: (path: Array<string | number>) => boolean,
path?: Array<string | number> = [],
): DehydratedData | null {
if (data !== null) {
Expand All @@ -25,7 +25,7 @@ export function cleanForBridge(
cleanedPaths,
unserializablePaths,
path,
isPathWhitelisted,
isPathAllowed,
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
28 changes: 14 additions & 14 deletions packages/react-devtools-shared/src/hydration.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function dehydrate(
cleaned: Array<Array<string | number>>,
unserializable: Array<Array<string | number>>,
path: Array<string | number>,
isPathWhitelisted: (path: Array<string | number>) => boolean,
isPathAllowed: (path: Array<string | number>) => boolean,
level?: number = 0,
):
| string
Expand All @@ -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':
Expand Down Expand Up @@ -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) =>
Expand All @@ -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 = {
Expand Down Expand Up @@ -250,8 +250,8 @@ export function dehydrate(
cleaned,
unserializable,
path.concat([i]),
isPathWhitelisted,
isPathWhitelistedCheck ? 1 : level + 1,
isPathAllowed,
isPathAllowedCheck ? 1 : level + 1,
)),
);
}
Expand Down Expand Up @@ -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 = {};
Expand All @@ -293,8 +293,8 @@ export function dehydrate(
cleaned,
unserializable,
path.concat([name]),
isPathWhitelisted,
isPathWhitelistedCheck ? 1 : level + 1,
isPathAllowed,
isPathAllowedCheck ? 1 : level + 1,
);
}
return object;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(<button is="test" cowabunga="chevynova" />, container);
expect(container.firstChild.hasAttribute('cowabunga')).toBe(true);
Expand Down
6 changes: 3 additions & 3 deletions packages/react-dom/src/client/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ export function diffProperties(
}
} else {
// For all other deleted properties we add it to the queue. We use
// the whitelist in the commit phase instead.
// the allowed property list in the commit phase instead.
(updatePayload = updatePayload || []).push(propKey, null);
}
}
Expand Down Expand Up @@ -858,7 +858,7 @@ export function diffProperties(
nextProp.toString();
} else {
// For any other property we always add it to the queue and then we
// filter it out using the whitelist during the commit.
// filter it out using the allowed property list during the commit.
(updatePayload = updatePayload || []).push(propKey, nextProp);
}
}
Expand Down Expand Up @@ -1029,7 +1029,7 @@ export function diffHydratedProperties(
for (let i = 0; i < attributes.length; i++) {
const name = attributes[i].name.toLowerCase();
switch (name) {
// Built-in SSR attribute is whitelisted
// Built-in SSR attribute is allowed
case 'data-reactroot':
break;
// Controlled attributes are not validated
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/DOMTopLevelEventTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const TOP_BEFORE_BLUR = unsafeCastStringToDOMTopLevelType('beforeblur');

// List of events that need to be individually attached to media elements.
// Note that events in this list will *not* be listened to at the top level
// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
// unless they're explicitly listed in `ReactBrowserEventEmitter.listenTo`.
export const mediaEventTypes = [
TOP_ABORT,
TOP_CAN_PLAY,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type PropertyType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export const RESERVED = 0;

// A simple string attribute.
// Attributes that aren't in the whitelist are presumed to have this type.
// Attributes that aren't in the filter are presumed to have this type.
export const STRING = 1;

// A string attribute that accepts booleans in React. In HTML, these are called
Expand Down Expand Up @@ -449,7 +449,7 @@ const capitalize = token => token[1].toUpperCase();

// This is a list of all SVG attributes that need special casing, namespacing,
// or boolean value assignment. Regular attributes that just accept strings
// and have the same names are omitted, just like in the HTML whitelist.
// and have the same names are omitted, just like in the HTML attribute filter.
// Some of these attributes can be hard to find. This list was created by
// scraping the MDN documentation.
[
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/shared/isCustomComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function isCustomComponent(tagName: string, props: Object) {
}
switch (tagName) {
// These are reserved SVG and MathML elements.
// We don't mind this whitelist too much because we expect it to never grow.
// We don't mind this list too much because we expect it to never grow.
// The alternative is to track the namespace in a few places which is convoluted.
// https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
case 'annotation-xml':
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/shared/omittedCloseTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

// For HTML, certain tags should omit their close tag. We keep a whitelist for
// For HTML, certain tags should omit their close tag. We keep a list for
// those special-case tags.

const omittedCloseTags = {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/shared/possibleStandardNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

// When adding attributes to the HTML or SVG whitelist, be sure to
// When adding attributes to the HTML or SVG allowed attribute list, be sure to
// also add them to this module to ensure casing and incorrect name
// warnings.
const possibleStandardNames = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Scheduling UMD bundle', () => {
});

function filterPrivateKeys(name) {
// Be very careful adding things to this whitelist!
// Be very careful adding things to this filter!
// It's easy to introduce bugs by doing it:
// https://github.com/facebook/react/issues/14904
switch (name) {
Expand Down