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

Initial implementation of ownPropertyKeys proxy handler #7254

Merged
merged 1 commit into from Aug 20, 2015

Conversation

@frewsxcv
Copy link
Member

frewsxcv commented Aug 17, 2015

Generates SupportedPropertyNames on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of HTMLCollection. Also added a couple
relevant WPT tests.

Closes #6390

Closes #2215

Review on Reviewable

let mut jsid = js::jsapi::RootedId::new(cx, jsid {asBits: i});
js::glue::AppendToAutoIdVector(props, jsid.handle().get());
}
""")

This comment has been minimized.

@frewsxcv

frewsxcv Aug 17, 2015

Author Member

Either something in the block above or below is incorrect

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 17, 2015

Note that this currently compiles, but when running certain tests (like ./mach test-wpt tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.forms.html), it will segfault

@frewsxcv frewsxcv force-pushed the frewsxcv:own-property-keys branch 2 times, most recently from c969506 to f5dc1e7 Aug 17, 2015
@Ms2ger Ms2ger self-assigned this Aug 18, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 18, 2015

@frewsxcv rebase on master and use int_to_jsid(i as i32) (and use use)

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

rebase on master and use int_to_jsid(i as i32) (and use use)

Awesome, that seems to have fixed the issues as I was having. Thanks for adding that in to rust-mozjs :)

This should be ready for a review now

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

Oh, actually, let me do another force push to utilize imports instead of going through namespace hell

@frewsxcv frewsxcv force-pushed the frewsxcv:own-property-keys branch from 14e7692 to 54da950 Aug 18, 2015
@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

let me do another force push

Done

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 18, 2015

Reviewed 7 of 13 files at r1, 2 of 3 files at r2.
Review status: 9 of 13 files reviewed at latest revision, 11 unresolved discussions, all commit checks successful.


components/script/dom/bindings/codegen/CodegenRust.py, line 4185 [r2] (raw file):
Please call it own_property_keys per Rust conventions.


components/script/dom/bindings/codegen/CodegenRust.py, line 4196 [r2] (raw file):
Why the r""?


components/script/dom/bindings/codegen/CodegenRust.py, line 4199 [r2] (raw file):
let rooted_jsid = RootedId::new(cx, int_to_jsid(i as i32));


components/script/dom/bindings/codegen/CodegenRust.py, line 4209 [r2] (raw file):
You're leaking the string here. Also, use JS_InternStringN.


components/script/dom/bindings/codegen/CodegenRust.py, line 4219 [r2] (raw file):
Looks like we're missing expandos here. Add a test.


components/script/dom/document.rs, line 1918 [r2] (raw file):
File an issue


components/script/dom/domstringmap.rs, line 74 [r2] (raw file):
Ditto


components/script/dom/htmlcollection.rs, line 232 [r2] (raw file):
Sounds bad.


components/script/dom/htmlcollection.rs, line 238 [r2] (raw file):
Any reason to use fold() over a loop?


components/script/dom/htmlcollection.rs, line 240 [r2] (raw file):
Only for HTML elements. Add a test.


components/script/dom/htmlcollection.rs, line 243 [r2] (raw file):
Order is detectable, so swap those.


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 18, 2015

Reviewed 6 of 13 files at r1.
Review status: 12 of 13 files reviewed at latest revision, 11 unresolved discussions, all commit checks successful.


tests/wpt/web-platform-tests/dom/collections/HTMLCollection-supported-property-names.html, line 31 [r1] (raw file):
I don't think there's a need to sort.


Comments from the review on Reviewable.io

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

tests/wpt/web-platform-tests/dom/collections/HTMLCollection-supported-property-names.html, line 31 [r1] (raw file):
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames#Description](This paragraph) suggests that the order of the non-enumerable elements is not defined, and since non-enumerable elements, are part of the same array as the enumerable elements, the array as a whole has undefined ordering


Comments from the review on Reviewable.io

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

components/script/dom/htmlcollection.rs, line 232 [r2] (raw file):
I agree.

I used it because we use this pattern:

let Collection(ref root, ref filter) = self.collection;

and I'm not sure how to please the unrooted_must_root lint when doing this.

It is also used above a few times for the same reason.


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 18, 2015

Review status: 12 of 13 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful.


components/script/dom/htmlcollection.rs, line 232 [r2] (raw file):
Ugh. I'm not sure how I let that slip by. You can use let root = self.collection.0.root();, I think.


tests/wpt/web-platform-tests/dom/collections/HTMLCollection-supported-property-names.html, line 31 [r1] (raw file):
Don't implement things based on docs, that's what the spec is for: https://heycam.github.io/webidl/#property-enumeration


Comments from the review on Reviewable.io

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

components/script/dom/htmlcollection.rs, line 243 [r2] (raw file):
Sorry, what do you mean by this? What is order referring to?


Comments from the review on Reviewable.io

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

tests/wpt/web-platform-tests/dom/collections/HTMLCollection-supported-property-names.html, line 0 [r1] (raw file):

  1. Finally, any enumerable own properties or properties from the object’s prototype chain are then enumerated, in no defined order.

Considering this, doesn't my previous comment still apply?


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 18, 2015

Review status: 12 of 13 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful.


components/script/dom/htmlcollection.rs, line 243 [r2] (raw file):
Consider <span id=a name=b>. The spec says we should return [a, b], not [b, a].


Comments from the review on Reviewable.io

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 18, 2015

components/script/dom/htmlcollection.rs, line 0 [r2] (raw file):
Ah, gotcha. Good catch. Thanks!


Comments from the review on Reviewable.io

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 20, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

📌 Commit aca8e1a has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

Testing commit aca8e1a with merge 8b7eb77...

bors-servo pushed a commit that referenced this pull request Aug 20, 2015
Initial implementation of ownPropertyKeys proxy handler

Generates `SupportedPropertyNames` on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of `HTMLCollection`. Also added a couple
relevant WPT tests.

Closes #6390

Closes #2215 

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7254)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

💔 Test failed - linux2

@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 20, 2015

PASS expected FAIL document.forms getOwnPropertyNames

The best kind of test fails 👍

Generates `SupportedPropertyNames` on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of `HTMLCollection`. Also added a couple
relevant WPT tests.

Closes #6390

Closes #2215
@frewsxcv frewsxcv force-pushed the frewsxcv:own-property-keys branch from aca8e1a to b11be4d Aug 20, 2015
@frewsxcv
Copy link
Member Author

frewsxcv commented Aug 20, 2015

In the latest force push: Marked the test as passing and got rid of an unused import

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 20, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

📌 Commit b11be4d has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

Testing commit b11be4d with merge d2a8c27...

bors-servo pushed a commit that referenced this pull request Aug 20, 2015
Initial implementation of ownPropertyKeys proxy handler

Generates `SupportedPropertyNames` on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of `HTMLCollection`. Also added a couple
relevant WPT tests.

Closes #6390

Closes #2215 

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7254)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

☀️ Test successful - android, gonk, linux1, linux2, mac1, mac2, mac3

@bors-servo bors-servo merged commit b11be4d into servo:master Aug 20, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@frewsxcv frewsxcv deleted the frewsxcv:own-property-keys branch Aug 20, 2015
josiahdaniels added a commit to josiahdaniels/servo that referenced this pull request Sep 28, 2015
jrmuizel pushed a commit to jrmuizel/gecko-cinnabar that referenced this pull request Jun 12, 2017
…frewsxcv:bump-mozjs); r=Ms2ger

I need the constants added in
servo/rust-mozjs#191 for
servo/servo#7254

Source-Repo: https://github.com/servo/servo
Source-Revision: 14b921ee29b1b5e46e8773836b5a31e85faabfd5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Sep 30, 2019
…frewsxcv:bump-mozjs); r=Ms2ger

I need the constants added in
servo/rust-mozjs#191 for
servo/servo#7254

Source-Repo: https://github.com/servo/servo
Source-Revision: 14b921ee29b1b5e46e8773836b5a31e85faabfd5

UltraBlame original commit: 45150e0a57bd5d0cbe5f05c570e4632325406e3d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…frewsxcv:bump-mozjs); r=Ms2ger

I need the constants added in
servo/rust-mozjs#191 for
servo/servo#7254

Source-Repo: https://github.com/servo/servo
Source-Revision: 14b921ee29b1b5e46e8773836b5a31e85faabfd5

UltraBlame original commit: 45150e0a57bd5d0cbe5f05c570e4632325406e3d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…frewsxcv:bump-mozjs); r=Ms2ger

I need the constants added in
servo/rust-mozjs#191 for
servo/servo#7254

Source-Repo: https://github.com/servo/servo
Source-Revision: 14b921ee29b1b5e46e8773836b5a31e85faabfd5

UltraBlame original commit: 45150e0a57bd5d0cbe5f05c570e4632325406e3d
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

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