-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: non-security mode for create-react-scripts compat. (KLUDGE) #642
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
48f1a03
feat: non-security mode for create-react-scripts compat. (KLUDGE)
dckc 05714aa
fix: thread the new option thru
erights f222c67
fix: with test
erights 223e68c
fix: with documentation
erights 342e272
fix: verbal review comments
erights a0519dd
fix: review comments
erights 2f0538a
fix: review comment
erights c50b038
fix: grrr typo
erights File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import test from 'ava'; | ||
import '../lockdown.js'; | ||
|
||
lockdown({ | ||
__unsafeKludgeForReact__: 'unsafe', | ||
}); | ||
|
||
test('Unsafe kludge for react', t => { | ||
t.false(Object.isFrozen(Object.prototype)); | ||
|
||
const x = {}; | ||
x.toString = () => 'foo'; | ||
x.constructor = 'Foo'; | ||
t.is(`${x}`, 'foo'); | ||
t.is(x.constructor, 'Foo'); | ||
|
||
harden(x); | ||
|
||
t.true(Object.isFrozen(Object.prototype)); | ||
|
||
const y = {}; | ||
y.toString = () => 'bar'; | ||
t.throws( | ||
() => { | ||
y.constructor = 'Bar'; | ||
}, | ||
undefined, | ||
'Override should not be enabled for "constructor".', | ||
); | ||
t.is(`${y}`, 'bar'); | ||
t.is(y.constructor, Object); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shy away from future tense. I tend toward "We plan to remove this once React is fixed." And I would much prefer to have an open issue to represent this plan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo fixed. Creating the issue next.