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 upCreate a mechanism to automatically reset relevant members of Document during Document.open #15371
Comments
|
Hey. I can take this up |
|
That would be great! Please ask questions if anything is unclear! |
|
@Dylan-DPC Are you still working on this? |
|
Hey got a bit busy so didn't get time. If anyone else wants to take it then fine else i'll look into it during the coming weekend. |
|
I'll mark it unassigned in the time being. Let us know if you start working on it! |
|
Hi. I would like to take this up if this is still pending. Just to clarify, I have to refactor the servo/components/script/dom/document.rs Lines 4431 to 4435 in fb5ab1f I can see that this method consists of a number of steps. Steps 8 to 15 seem to responsible for reinitializing the members of the Document struct. So when I create a struct to automatically reset the relevant members, there would be one auto-derived trait for each step. And the corresponding step's code would be moved into that trait. Is that correct, or have I missed anything? servo/components/script/dom/document.rs Lines 4481 to 4525 in fb5ab1f |
|
I suspect this code has changed in the 2.5 years since I filed this issue. I'm pretty sure the code I had mind back when was this code, but it's not clear to me if my proposal still makes sense. |
There are a lot of members that need to be reset to initial states during Document.open. Right now it's just a list of reinitializations in that method, which is not very maintainable. We should have a structure that contains the members that need to be cleared, and auto-derive a trait for every member. This will make it impossible to forget to clear a member, and will make it easy to tell if a member is reinitialized or not by looking at the member initialization list for Document.