From dbb0f49bc79d90147c398406668ace4db6d5b6d5 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Fri, 13 Feb 2015 05:45:06 +0900 Subject: [PATCH] DOMRefCell.is_mutably_borrowed() should return the state correctly. This method returned the result of `RefCell.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]: https://github.com/servo/servo/commit/86d609abaf7bf980a55916b90add2795cc11bf17 [2]: https://github.com/servo/servo/commit/49234484d6539a4d8df8374a9548c2004b8e68b7 [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 --- components/script/dom/bindings/cell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index f250e818412..81085256821 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -52,7 +52,7 @@ impl DOMRefCell { /// /// For safety checks in debug builds only. 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.