| 113 | } |
| 114 | |
| 115 | export function taintObjectReference( |
| 116 | message: ?string, |
| 117 | object: Reference, |
| 118 | ): void { |
| 119 | if (!enableTaint) { |
| 120 | throw new Error('Not implemented.'); |
| 121 | } |
| 122 | // eslint-disable-next-line react-internal/safe-string-coercion |
| 123 | message = '' + (message || defaultMessage); |
| 124 | if (typeof object === 'string' || typeof object === 'bigint') { |
| 125 | throw new Error( |
| 126 | 'Only objects or functions can be passed to taintObjectReference. Try taintUniqueValue instead.', |
| 127 | ); |
| 128 | } |
| 129 | if ( |
| 130 | object === null || |
| 131 | (typeof object !== 'object' && typeof object !== 'function') |
| 132 | ) { |
| 133 | throw new Error( |
| 134 | 'Only objects or functions can be passed to taintObjectReference.', |
| 135 | ); |
| 136 | } |
| 137 | TaintRegistryObjects.set(object, message); |
| 138 | } |