DOMRefCell<T>.is_mutably_borrowed() should return the state correctly.

This method returned the result of `RefCell<T>.try_borrow().is_some()`.
But it meant whether the state **is not** BorrowState::Writing.

This wrong is introduced by [1], Before it revision, this method had
returned whether the state is BorrowState::Writing or not.

This doesn't change callers of this method because git blames ([3], [4]) says
that the caller is introduced by [2] and [2] is introduced before [1].

[1]: 86d609abaf
[2]: 49234484d6
[3]: https://github.com/servo/servo/blame/2cc08f289ab909de44fa09a07b2c43b70ce379b9/components/script/dom/servohtmlparser.rs
[4]: https://github.com/servo/servo/blame/a7e29939a1df679bd865573dc71f7ba65f0268c4/components/script/dom/bindings/cell.rs
This commit is contained in:
Tetsuharu OHZEKI 2015-02-13 05:45:06 +09:00
parent 552a418a33
commit dbb0f49bc7

View file

@ -52,7 +52,7 @@ impl<T> DOMRefCell<T> {
/// ///
/// For safety checks in debug builds only. /// For safety checks in debug builds only.
pub fn is_mutably_borrowed(&self) -> bool { pub fn is_mutably_borrowed(&self) -> bool {
self.value.try_borrow().is_some() self.value.borrow_state() == BorrowState::Writing
} }
/// Attempts to immutably borrow the wrapped value. /// Attempts to immutably borrow the wrapped value.