Skip to content
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

Fix wrong context passed in collection.create #4284

Merged
merged 1 commit into from Jan 23, 2024

Conversation

olhapi
Copy link
Contributor

@olhapi olhapi commented Jan 10, 2024

Here https://github.com/jashkenas/backbone/blob/master/backbone.js#L1088
this has the wrong context, it refers to a window object in the browser because we didn't pass a previously saved collection context to it.

@olhapi
Copy link
Contributor Author

olhapi commented Jan 10, 2024

@jgonggrijp can you check this and confirm that it's indeed a bug?

Copy link
Collaborator

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is a bug and I also agree with your fix. 👍

This bug needs a regression test, could you add it?

In any case, thanks for reporting and fixing!

@olhapi
Copy link
Contributor Author

olhapi commented Jan 11, 2024

I've tried that, but I don't know how to test that case properly. My test succeeded when it should have failed. :)

@jgonggrijp
Copy link
Collaborator

Alright, in that case I will do it myself some time in the near future.

@jgonggrijp jgonggrijp self-assigned this Jan 11, 2024
@jgonggrijp jgonggrijp added the bug label Jan 11, 2024
@olhapi
Copy link
Contributor Author

olhapi commented Jan 11, 2024

Thanks a lot

@jgonggrijp
Copy link
Collaborator

@olhapi Please remove the changes to backbone-min* and then force-push the branch. We update the minified code when we cut a new release.

(I'm working on the regression test in the meanwhile.)

@olhapi
Copy link
Contributor Author

olhapi commented Jan 23, 2024

@jgonggrijp done, just pushed.

jgonggrijp added a commit that referenced this pull request Jan 23, 2024
@jgonggrijp jgonggrijp merged commit 8c0916a into jashkenas:master Jan 23, 2024
1 check passed
@jgonggrijp
Copy link
Collaborator

@olhapi The commit referenced above (0f9956b) adds a test that fails without your fix and succeeds with it. Again thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants