Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCalling matchMedia during a MQL change event will not panic #15495
Conversation
highfive
commented
Feb 10, 2017
|
Great work! Just a couple stylistic comments, and the changes will need to be rebased against master. |
| <script> | ||
| // Test to make sure matchMedia can be suitably used inside MediaQueryList listeners without any errors in borrowing | ||
| // mql references | ||
| var test = async_test("No clashes found while trying to get a refernce to mql"); |
This comment has been minimized.
This comment has been minimized.
| assert_not_equals(match3, undefined); | ||
| })); | ||
| window.resizeTo(600, 400); | ||
| })); |
This comment has been minimized.
This comment has been minimized.
| } | ||
| // Sending change events for all changed Media Queries | ||
| for mql in mql_list.iter() | ||
| { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
prampey
Feb 10, 2017
Author
Contributor
@jdm For the sake of theory, there is no performance difference between the two right?
This comment has been minimized.
This comment has been minimized.
prampey
Feb 10, 2017
Author
Contributor
Also, I get an error saying that RootedVec doesn't implement the Iterator trait.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -138,16 +138,24 @@ impl WeakMediaQueryListVec { | |||
| /// Evaluate media query lists and report changes | |||
| /// https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes | |||
| pub fn evaluate_and_report_changes(&self) { | |||
| for mql in self.cell.borrow().iter() { | |||
| rooted_vec!(let mut mql_list); | |||
| for mql in self.cell.borrow_mut().iter() { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@jdm Cool. I'm done with the stylistic changes but I seem to be a bit confused when resolving |
|
@prampey You should be able to revert all changes to MANIFEST.json and run |
|
@jdm Yes, I already used |
|
@prampey Do you mean in MANIFEST.json? My point is that while rebasing you can just resolve merge conflicts in that file by reverting all changes and running update-manifest again, then adding the modified file. |
|
@jdm Oh okay, my bad. I pushed in the new changes. |
|
@bors-servo: r+ |
|
|
Calling matchMedia during a MQL change event will not panic <!-- Please describe your changes on the following line: --> Calling matchMedia now leads to a new copy of MQL objects to prevent errors when borrowing references from MQL during an MQL change event. --- <!-- 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 #14967 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [x] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15495) <!-- Reviewable:end -->
|
@jdm Thanks a lot for bearing with me :) Also, I think it'd be really convenient for developers if we added the documentation link (http://testthewebforward.org/docs/testharness-library.html) in the |
|
Please do! |
|
|
|
I suspect the problem is that resizeTo does not trigger a resize event when running Servo in headless mode. If you resize an iframe instead then I expect it will work. Please file an issue with this test case so we can track the problem with headless mode! |
|
@jdm Yes, iframes seemed to work. Just pushed in the update. |
|
@bors-servo: r+ |
|
|
|
I filed #15621 about the headless resize issue. |
Calling matchMedia during a MQL change event will not panic <!-- Please describe your changes on the following line: --> Calling matchMedia now leads to a new copy of MQL objects to prevent errors when borrowing references from MQL during an MQL change event. --- <!-- 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 #14967 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [x] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15495) <!-- Reviewable:end -->
|
|
|
Bah, another manifest-update is necessary :< |
|
@bors-servo r=jdm |
|
|
Calling matchMedia during a MQL change event will not panic <!-- Please describe your changes on the following line: --> Calling matchMedia now leads to a new copy of MQL objects to prevent errors when borrowing references from MQL during an MQL change event. --- <!-- 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 #14967 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [x] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15495) <!-- Reviewable:end -->
|
|
prampey commentedFeb 10, 2017
•
edited
Calling matchMedia now leads to a new copy of MQL objects to prevent errors when borrowing references from MQL during an MQL change event.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is