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 upDon't crash when calling `nodes_from_point` without a document element #10093
Comments
|
I'd love to work on this |
|
That was fast, it's yours! Don't forget to mention (in the case I don't review that PR) that there are no new passing tests due to the reasons described in #10091 :) |
|
@ecoal95 Hi, actually I think By the way, the error message for the
rather than So, I'm not sure whether this subtest is using an iframe. The subtest code:
If my guess is right that this subtest isn't using an iframe, I'm curious whether it can be fixed without we're worrying about iframes. EDIT: Never mind my reply above, still reading a documentation on createHTMLDocument. EDIT 2: I guess the subtest code calls createHTMLDocument without appending the new HTML Document to an iframe? (So the new HTML Document doesn't visible (doesn't have a viewport) ).
|
|
Yes, exactly, It seems that we should check if the document is in the viewport before doing hit test. The spec: https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument |
|
Note that the assertion should be changed regardless, that's not what that test is testing (no viewport != no document element). |
|
You probably want |
|
Are you still working on this, @rilut? |
|
@jdm Yes, I'll get it done on Thursday after exam |
|
Ok, thanks! No rush, just wanted to make sure it wasn't abandoned. |
|
@jdm sure! Thanks for your consideration |
…ble-test, r=nox Fix Document#elementsFromPoint no viewport available test Fixes #10093 and improves #10034. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10426) <!-- Reviewable:end -->
Right now, the function
Document::nodes_from_pointis called when usingdocument.elementsFromPoint.That function asserts that there should be a document element to run, and crashes if not. It should return an empty vector in that case, preferrably issuing a
debug!()message.Code:
components/script/dom/document.rs(the functionnodes_from_point).