mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1671768 - Part 3: Use MOZ_CAN_RUN_SCRIPT for Selection::SelectAllChildren r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103779
This commit is contained in:
parent
e0304db4c3
commit
0ea5caf27e
@ -331,7 +331,8 @@ class Selection final : public nsSupportsWeakReference,
|
||||
MOZ_CAN_RUN_SCRIPT void ExtendJS(nsINode& aContainer, uint32_t aOffset,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
void SelectAllChildrenJS(nsINode& aNode, mozilla::ErrorResult& aRv);
|
||||
MOZ_CAN_RUN_SCRIPT void SelectAllChildrenJS(nsINode& aNode,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Deletes this selection from document the nodes belong to.
|
||||
@ -512,8 +513,8 @@ class Selection final : public nsSupportsWeakReference,
|
||||
* Adds all children of the specified node to the selection.
|
||||
* @param aNode the parent of the children to be added to the selection.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
void SelectAllChildren(nsINode& aNode, mozilla::ErrorResult& aRv);
|
||||
MOZ_CAN_RUN_SCRIPT void SelectAllChildren(nsINode& aNode,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* SetStartAndEnd() removes all ranges and sets new range as given range.
|
||||
|
@ -3884,7 +3884,8 @@ nsresult HTMLEditor::SelectEntireDocument() {
|
||||
|
||||
// Otherwise, select all children.
|
||||
ErrorResult error;
|
||||
SelectionRefPtr()->SelectAllChildren(*bodyOrDocumentElement, error);
|
||||
MOZ_KnownLive(SelectionRefPtr())
|
||||
->SelectAllChildren(*bodyOrDocumentElement, error);
|
||||
if (NS_WARN_IF(Destroyed())) {
|
||||
error.SuppressException();
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
@ -3914,7 +3915,7 @@ nsresult HTMLEditor::SelectAllInternal() {
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> anchorContent = anchorNode->AsContent();
|
||||
nsIContent* rootContent;
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
if (anchorContent->HasIndependentSelection()) {
|
||||
SelectionRefPtr()->SetAncestorLimiter(nullptr);
|
||||
rootContent = mRootElement;
|
||||
@ -3947,7 +3948,7 @@ nsresult HTMLEditor::SelectAllInternal() {
|
||||
userSelection.emplace(SelectionRefPtr());
|
||||
}
|
||||
ErrorResult error;
|
||||
SelectionRefPtr()->SelectAllChildren(*rootContent, error);
|
||||
MOZ_KnownLive(SelectionRefPtr())->SelectAllChildren(*rootContent, error);
|
||||
NS_WARNING_ASSERTION(!error.Failed(),
|
||||
"Selection::SelectAllChildren() failed");
|
||||
return error.StealNSResult();
|
||||
|
@ -616,7 +616,7 @@ nsresult TextEditor::SetTextAsSubAction(const nsAString& aString) {
|
||||
// line here since we will need to recreate it in multiline
|
||||
// text editor.
|
||||
ErrorResult error;
|
||||
SelectionRefPtr()->SelectAllChildren(*rootElement, error);
|
||||
MOZ_KnownLive(SelectionRefPtr())->SelectAllChildren(*rootElement, error);
|
||||
NS_WARNING_ASSERTION(
|
||||
!error.Failed(),
|
||||
"Selection::SelectAllChildren() failed, but ignored");
|
||||
@ -1594,7 +1594,8 @@ nsresult TextEditor::SelectEntireDocument() {
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
SelectionRefPtr()->SelectAllChildren(*anonymousDivElement, error);
|
||||
MOZ_KnownLive(SelectionRefPtr())
|
||||
->SelectAllChildren(*anonymousDivElement, error);
|
||||
NS_WARNING_ASSERTION(!error.Failed(),
|
||||
"Selection::SelectAllChildren() failed");
|
||||
return error.StealNSResult();
|
||||
|
@ -2434,7 +2434,7 @@ MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsDocumentViewer::ClearSelection() {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocumentViewer::SelectAll() {
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsDocumentViewer::SelectAll() {
|
||||
// XXX this is a temporary implementation copied from nsWebShell
|
||||
// for now. I think Document and friends should have some helper
|
||||
// functions to make this easier.
|
||||
|
Loading…
Reference in New Issue
Block a user