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

Introduce a new type MaybeUnreflectedDom<T> (fixes #25701) #25781

Merged
merged 1 commit into from Mar 2, 2020

Conversation

@nox
Copy link
Member

nox commented Feb 17, 2020

No description provided.

@highfive
Copy link

highfive commented Feb 17, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/bindings/codegen/CodegenRust.py, components/script/lib.rs, components/script/dom/windowproxy.rs, components/script/dom/bindings/reflector.rs, components/script/dom/bindings/root.rs and 2 more
  • @KiChjang: components/script/dom/bindings/codegen/CodegenRust.py, components/script/lib.rs, components/script/dom/windowproxy.rs, components/script/dom/bindings/reflector.rs, components/script/dom/bindings/root.rs and 2 more
@highfive
Copy link

highfive commented Feb 17, 2020

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!
@nox
Copy link
Member Author

nox commented Feb 17, 2020

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Feb 17, 2020

Trying commit 14846d0 with merge 4bf1aa0...

bors-servo added a commit that referenced this pull request Feb 17, 2020
Introduce a new type MaybeUnreflectedDom<T> (fixes #25701)
@bors-servo
Copy link
Contributor

bors-servo commented Feb 17, 2020

💔 Test failed - status-taskcluster

@nox
Copy link
Member Author

nox commented Feb 19, 2020

All the failures are either the solid white intermittent issue or a silent crash that happens sometimes.

@nox
Copy link
Member Author

nox commented Feb 19, 2020

That silent crash doesn't even reproduce locally.

@jdm
Copy link
Member

jdm commented Feb 21, 2020

Could you give me an overview of what this PR is doing? It's not clear to me how all the pieces fit together to fix #25701.

@nox
Copy link
Member Author

nox commented Feb 21, 2020

Could you give me an overview of what this PR is doing? It's not clear to me how all the pieces fit together to fix #25701.

Sure. What it does is that it roots the boxed not-yet-reflected DOM instance with a different smart pointer type than Dom<T>. MaybeUnreflectedDom<T> traces the rooted T by first checking whether the reflector is set, in which case it proceeds just like Dom<T>, otherwise it directly traces the T, which will invoke the JSTraceable implementation of Reflector, which will do nothing but that's not a problem given it's not set yet.

@jdm
jdm approved these changes Feb 28, 2020
Copy link
Member

jdm left a comment

This is a nice solution to the problem! Thanks for explaining it to me.

@jdm
Copy link
Member

jdm commented Feb 28, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Feb 28, 2020

📌 Commit 14846d0 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Feb 28, 2020

Testing commit 14846d0 with merge b6ecb05...

bors-servo added a commit that referenced this pull request Feb 28, 2020
Introduce a new type MaybeUnreflectedDom<T> (fixes #25701)
@bors-servo
Copy link
Contributor

bors-servo commented Feb 28, 2020

💔 Test failed - status-taskcluster

@nox
Copy link
Member Author

nox commented Feb 28, 2020

Not sure if this crash is my fault or not, we'll see how the other build jobs fare.

@asajeffrey
Copy link
Member

asajeffrey commented Feb 28, 2020

This is getting us pretty close to being able to support lazy creation of DOM reflectors.

@nox
Copy link
Member Author

nox commented Feb 28, 2020

This only works because the T here is always the actual concrete type of the DOM instance, if you create an Element and you store it as MaybeUnreflectedDom<Node>, you won't trace everything that is specific to Element.

@asajeffrey
Copy link
Member

asajeffrey commented Feb 28, 2020

Hmm, so we'd need support for dynamic dispatch of trace methods if we want to support subtyping of maybe-reflected DOM objects.

@nox
Copy link
Member Author

nox commented Mar 2, 2020

Tried to reproduce the issue locally and failed.

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Mar 2, 2020

Testing commit 14846d0 with merge 554c90a...

bors-servo added a commit that referenced this pull request Mar 2, 2020
Introduce a new type MaybeUnreflectedDom<T> (fixes #25701)
@bors-servo
Copy link
Contributor

bors-servo commented Mar 2, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Mar 2, 2020

@bors-servo retry
Network

@bors-servo
Copy link
Contributor

bors-servo commented Mar 2, 2020

Testing commit 14846d0 with merge 5a6b2d9...

@bors-servo
Copy link
Contributor

bors-servo commented Mar 2, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing 5a6b2d9 to master...

@bors-servo bors-servo merged commit 5a6b2d9 into servo:master Mar 2, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
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.

None yet

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