diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-05-13 02:47:08 -0700 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-05-13 02:47:08 -0700 |
commit | 221db56b08e01157c97f5adba43799eeaee32f64 (patch) | |
tree | e7eb8f7149367de5b818c8981321b8600ff8a0d1 /components/script/dom/bindings/utils.rs | |
parent | 03465ad8c77f03ae2f538d046ae1e1dc86f04723 (diff) | |
parent | 91101f6226033a663ea8e4bb215f72ab8d206da7 (diff) | |
download | servo-221db56b08e01157c97f5adba43799eeaee32f64.tar.gz servo-221db56b08e01157c97f5adba43799eeaee32f64.zip |
Auto merge of #11155 - emilio:codegen-dict-keyword, r=Ms2ger
codegen: Fix dictionary handling and semantics
Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #11152 (github issue number if applicable).
Either:
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____
Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.
Fixes #11152
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11155)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/utils.rs')
-rw-r--r-- | components/script/dom/bindings/utils.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 9b9a729fe0a..cf1cf37a8b9 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -39,6 +39,7 @@ use std::ptr; use std::slice; use util::non_geckolib::jsstring_to_str; use util::prefs; +use util::str::DOMString; /// Proxy handler for a WindowProxy. pub struct WindowProxyHandler(pub *const libc::c_void); @@ -182,18 +183,18 @@ pub fn get_array_index_from_id(_cx: *mut JSContext, id: HandleId) -> Option<u32> /// Find the index of a string given by `v` in `values`. /// Returns `Err(())` on JSAPI failure (there is a pending exception), and -/// `Ok(None)` if there was no matching string. +/// `Ok((None, value))` if there was no matching string. pub unsafe fn find_enum_string_index(cx: *mut JSContext, v: HandleValue, values: &[&'static str]) - -> Result<Option<usize>, ()> { + -> Result<(Option<usize>, DOMString), ()> { let jsstr = ToString(cx, v); if jsstr.is_null() { return Err(()); } let search = jsstring_to_str(cx, jsstr); - Ok(values.iter().position(|value| search == *value)) + Ok((values.iter().position(|value| search == *value), search)) } /// Returns wether `obj` is a platform object |