Adds an as_str() method to WebIDL enums to hide slice of strings from callers. Uses the new method in two places.

This commit is contained in:
Gregory Katz 2017-02-16 10:15:33 -05:00
parent 4a0b730caf
commit 4d205f00b0
3 changed files with 10 additions and 5 deletions

View file

@ -53,8 +53,7 @@ impl DOMParserMethods for DOMParser {
ty: DOMParserBinding::SupportedType)
-> Fallible<Root<Document>> {
let url = self.window.get_url();
let content_type =
DOMString::from(DOMParserBinding::SupportedTypeValues::strings[ty as usize]);
let content_type = DOMString::from(ty.as_str());
let doc = self.window.Document();
let loader = DocumentLoader::new(&*doc.loader());
match ty {