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
Implement WebIDL attribute PutForwards #5894
Conversation
nox
commented
Apr 29, 2015
Critic review: https://critic.hoppipolla.co.uk/r/4847 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
This does not properly put in scope the forwarded attribute Methods trait, looking into it… |
Problem solved. |
Reviewed files:
components/script/dom/bindings/codegen/CodegenRust.py, line 2810 [r3] (raw file): components/script/dom/bindings/codegen/CodegenRust.py, line 4285 [r3] (raw file): components/script/dom/bindings/codegen/parser/WebIDL.py, line 1002 [r3] (raw file): Comments from the review on Reviewable.io |
Reviewed files:
Comments from the review on Reviewable.io |
components/script/dom/bindings/codegen/CodegenRust.py, line 2810 [r3] (raw file): components/script/dom/bindings/codegen/CodegenRust.py, line 4285 [r3] (raw file): components/script/dom/bindings/codegen/parser/WebIDL.py, line 1002 [r3] (raw file): Comments from the review on Reviewable.io |
The code you linked me to is not ideal IMO, it just uses the JSAPI directly and won't let me get fancy once I implement Reflect (#5881). I want to be able to generate a reflected forwarded setter that will just set the attribute directly through Element::AttributeHandlers and whatnot, without even needing to use the getter. Note that my changes to WebIDL.py could very well be upstream'd. They are nothing more than new checks and a small refactoring. |
@Ms2ger Does the previous comment sound web-compatible? |
I reached this conclusion from:
More generally, I don't see how it would make sense for a reflecting IDL attribute to behave differently from the underlying reflected content attribute. |
I still believe the spec is crazy, but we should still follow it |
@Ms2ger What do you mean by follow it? In which way do I not follow it? |
@Ms2ger The only moment my assumptions aren't true is if the attribute is also [LenientThis], but in this case nothing at all is called anyway because the setter should stop at steps 5 or 7:
Please show me one example where my assumptions break things. |
Think outside the box :) <pre>
<script>
function w(s) {
document.body.firstChild.appendChild(new Text(s + "\n"))
}
var l = document.createElement("link");
w(l.getAttribute("sizes")) // null
l.sizes = "bar";
w(l.getAttribute("sizes")) // bar
Object.defineProperty(l.sizes, "value", {
get: function() { return "foo" },
set: function() { w("hi!") }
})
l.sizes = "baz"; // hi!
w(l.getAttribute("sizes")) // bar
</script>
</pre> |
I stand corrected, and you stand insane. :P Will dumb down my code. |
@Ms2ger What if I use JS_GetPropertyDescriptor() and shortcut everything if they have been left untouched? |
Ew. |
-S-awaiting-review +S-needs-code-changes Reviewed files:
components/script/dom/bindings/codegen/CodegenRust.py, line 2855 [r4] (raw file): Comments from the review on Reviewable.io |
-S-awaiting-review +S-needs-squash Reviewed files:
Comments from the review on Reviewable.io |
@bors-servo: r+ |
📌 Commit cc5eee4 has been approved by |
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5894) <!-- Reviewable:end -->
Uncomment some [PutForwards] attributes Now that PutForwards was implemented in #5894, we can uncomment the attributes where the forwarded property exists on the target interface. Do we have tests for this? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8005) <!-- Reviewable:end -->
Uncomment some [PutForwards] attributes Now that PutForwards was implemented in #5894, we can uncomment the attributes where the forwarded property exists on the target interface. Do we have tests for this? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8005) <!-- Reviewable:end -->
Uncomment some [PutForwards] attributes Now that PutForwards was implemented in #5894, we can uncomment the attributes where the forwarded property exists on the target interface. Do we have tests for this? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8005) <!-- Reviewable:end -->