Bug 1941140 - Make TextControlState::UnbindFromFrame clean up controllers if and only if they are exist r=edgar
`HTMLInputElement::GetControllers()` and `HTMLTextAreaElement::GetControllers()` initializes their controllers before returning the `nsIControllers` instance [1][2]. Typically, they are initialized at creating their `TextEditor` instance is initialized [3]. A `TextEditor` for an `HTMLInputElement` is initialized when it gets focus first time after the `nsTextControlFrame` is created [4][5]. Therefore, when `TextControlState::UnbindFromFrame` is called, the element may not have controllers yet. So, the elements should have simple getters of their controllers and `UnbindFromFrame` should use them instead. 1. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/HTMLInputElement.cpp#5658-5660 2. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/HTMLTextAreaElement.cpp#502-503 3. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/TextControlState.cpp#1826-1827,1832,1837-1838,1857-1858 4. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/layout/forms/nsTextControlFrame.cpp#447 5. https://searchfox.org/mozilla-central/rev/eb80f267aabbf90ac66ebbed77b6d33592eb2be0/dom/html/TextControlState.cpp#1640-1641,1655-1656 Differential Revision: https://phabricator.services.mozilla.com/D234307
This commit is contained in:
@@ -5689,7 +5689,7 @@ nsIControllers* HTMLInputElement::GetControllers(ErrorResult& aRv) {
|
||||
}
|
||||
}
|
||||
|
||||
return mControllers;
|
||||
return GetControllersWithoutCreation();
|
||||
}
|
||||
|
||||
nsresult HTMLInputElement::GetControllers(nsIControllers** aResult) {
|
||||
|
||||
Reference in New Issue
Block a user