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

Always pass InRealm to GlobalScope::from_context to avoid getting a null global #25369

Merged
merged 1 commit into from Feb 19, 2020

Conversation

@CYBAI
Copy link
Collaborator

CYBAI commented Dec 23, 2019


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #25348
  • These changes do not require tests because ___
@highfive
Copy link

highfive commented Dec 23, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/testbinding.rs, components/script/dom/globalscope.rs, components/script/dom/bindings/error.rs, components/script/dom/dedicatedworkerglobalscope.rs, components/script/dom/windowproxy.rs and 3 more
  • @KiChjang: components/script/dom/testbinding.rs, components/script/dom/globalscope.rs, components/script/dom/bindings/error.rs, components/script/dom/dedicatedworkerglobalscope.rs, components/script/dom/windowproxy.rs and 3 more
@highfive
Copy link

highfive commented Dec 23, 2019

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@CYBAI
Copy link
Collaborator Author

CYBAI commented Dec 23, 2019

@jdm I tried to make it return an option though, does this make sense to you? Or, we shouldn't get a null global in that case so should just use assert instead 👀?

@CYBAI CYBAI force-pushed the CYBAI:nullable-global branch from ce47296 to db41867 Dec 23, 2019
@CYBAI
Copy link
Collaborator Author

CYBAI commented Dec 23, 2019

@bors-servo try=wpt

  • Should not break anything 👀
@bors-servo
Copy link
Contributor

bors-servo commented Dec 23, 2019

Trying commit db41867 with merge 064c16f...

bors-servo added a commit that referenced this pull request Dec 23, 2019
Make GlobalScope::from_context return an Option

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25348
- [x] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 23, 2019

☀️ Test successful - status-taskcluster
State: approved= try=True

Copy link
Member

jdm left a comment

Thanks for making this pull request! It helped me to see all of the callers of this code and clarify how it could be improved.

components/script/dom/globalscope.rs Outdated Show resolved Hide resolved
@CYBAI CYBAI force-pushed the CYBAI:nullable-global branch from db41867 to 8a6b729 Jan 24, 2020
@CYBAI CYBAI changed the title Make GlobalScope::from_context return an Option Always pass InCompartment to GlobalScope::from_context to avoid getting a null global Jan 24, 2020
@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2020

The latest upstream changes (presumably #25597) made this pull request unmergeable. Please resolve the merge conflicts.

components/script/dom/windowproxy.rs Outdated Show resolved Hide resolved
components/script/dom/windowproxy.rs Outdated Show resolved Hide resolved
components/script/dom/bindings/error.rs Outdated Show resolved Hide resolved
@CYBAI CYBAI force-pushed the CYBAI:nullable-global branch from 8a6b729 to 4f8835f Jan 25, 2020
@CYBAI CYBAI changed the title Always pass InCompartment to GlobalScope::from_context to avoid getting a null global Always pass InRealm to GlobalScope::from_context to avoid getting a null global Jan 25, 2020
@CYBAI
Copy link
Collaborator Author

CYBAI commented Jan 25, 2020

@bors-servo try=wpt

  • Should not break anything 👀
bors-servo added a commit that referenced this pull request Jan 25, 2020
 Always pass InRealm to GlobalScope::from_context to avoid getting a null global

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25348
- [x] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2020

Trying commit 4f8835f with merge fc66662...

@jdm
Copy link
Member

jdm commented Feb 15, 2020

error: unused import: `JSAutoRealm`
  --> components/script/dom/globalscope.rs:67:17
   |
67 | use js::jsapi::{JSAutoRealm, JSContext};
   |                 ^^^^^^^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
error: aborting due to previous error
error: could not compile `script`.
@CYBAI CYBAI force-pushed the CYBAI:nullable-global branch from 30f5681 to 403ffcf Feb 16, 2020
@jdm
Copy link
Member

jdm commented Feb 19, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

📌 Commit 403ffcf has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

Testing commit 403ffcf with merge cfb46cf...

bors-servo added a commit that referenced this pull request Feb 19, 2020
 Always pass InRealm to GlobalScope::from_context to avoid getting a null global

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25348
- [x] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Feb 19, 2020

@bors-servo retry

  • network
@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

Testing commit 403ffcf with merge 2cd36e0...

bors-servo added a commit that referenced this pull request Feb 19, 2020
 Always pass InRealm to GlobalScope::from_context to avoid getting a null global

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25348
- [x] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Feb 19, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

Testing commit 403ffcf with merge 44783c8...

bors-servo added a commit that referenced this pull request Feb 19, 2020
 Always pass InRealm to GlobalScope::from_context to avoid getting a null global

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25348
- [x] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 19, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing 44783c8 to master...

@bors-servo bors-servo merged commit 403ffcf into servo:master Feb 19, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Feb 19, 2020
@CYBAI CYBAI deleted the CYBAI:nullable-global branch Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.