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

Expose new public API in light of recent spec changes #36

Merged
merged 4 commits into from
Jan 20, 2016

Conversation

domenic
Copy link
Member

@domenic domenic commented Oct 19, 2015

This exposes the URL constructor, which is now re-written to use webidl2js and be based on the latest spec. It also exposes a bunch of internal methods I needed to make jsdom work.


Not quite ready to merge, but ready to review I think. Blocked on jsdom/webidl-conversions#3 and jsdom/webidl2js#10. Also, a bunch of tests fail, but I am pretty sure they are all due to web platform tests being outdated versus the spec.

Separate jsdom PR coming up that uses these now-exposed hooks.

throw new TypeError("Failed to construct 'URL': 1 argument required, but only 0 present.");
}
module.exports.createURLConstructor = function () {
// TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably put a util method for this into webidl2js.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm actually I think this is legacy; createURLConstructor is no longer necessary since we just export the URL constructor directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to be sure someone can't overwrite objects for all contexts though - although that's a more general jsdom problem (which we might have the opportunity to solve with webidl2js while we're at it).

@Sebmaster
Copy link
Member

Haven't looked at the actual spec stuff yet, but are you sure about the state dict to string conversion? Imo mistyping the string is much easier than using auto-complete from the state dict - we could even put the strings in the state dict to keep the easier debugging.

"request": "^2.55.0",
"recast": "~0.10.29"
"webidl2js": "jsdom/webidl2js"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta remember to switch this when I release 3.0

@domenic
Copy link
Member Author

domenic commented Nov 11, 2015

Haven't looked at the actual spec stuff yet, but are you sure about the state dict to string conversion? Imo mistyping the string is much easier than using auto-complete from the state dict - we could even put the strings in the state dict to keep the easier debugging.

My main concern is that the public API should be using the strings, since that is idiomatic JS for enumerations. (We could validate them there if that'd be preferred.) Internally I just used strings everywhere since then we don't have a bunch of annoying mapping code; IMO the payoff of such mapping code is not worth the cost, both in authoring and in maintenance. But if you'd really prefer it for IDE reasons or similar than I am OK with that.

@domenic
Copy link
Member Author

domenic commented Jan 17, 2016

OK, this is ready for review, and I've validated it suffices for jsdom.

}

static domainToASCII(domain) {
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like parseHost can't throw anymore so I don't think we need this anymore, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, it does "return failure" instead, I see. Eek.

@Sebmaster
Copy link
Member

Okay, through with this one at least.

@domenic
Copy link
Member Author

domenic commented Jan 19, 2016

Pushed revised version with feedback incorporated plus an additional commit for recent URL spec changes. Tests fail until tr46 is fixed and WPT is merged.

This exposes the URL constructor, which is now re-written to use webidl2js and be based on the latest spec. It also exposes a bunch of internal methods I needed to make jsdom work.

Fixes #35. Along the way, fixes #34, fixes #28, and fixes #22.
The web platform tests have been updated to a nicer format, so we adapt. Also includes a script used to update the web platform tests.
This will cause the tests to fail until web-platform-tests/wpt#2500 is merged.
@Sebmaster Sebmaster merged commit 4387840 into master Jan 20, 2016
@Sebmaster Sebmaster deleted the update-everything branch January 20, 2016 02:12
@Sebmaster Sebmaster restored the update-everything branch January 20, 2016 02:12
@Sebmaster Sebmaster deleted the update-everything branch January 26, 2016 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants