Bug 1615296 - Part 3: Fix remaining MOZ_CAN_RUN_SCRIPT warnings r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D93600
This commit is contained in:
Kagami Sascha Rosylight 2020-10-15 19:12:47 +00:00
Родитель 2c5fb988f2
Коммит 756976ae2b
4 изменённых файлов: 15 добавлений и 13 удалений

Просмотреть файл

@ -2410,7 +2410,7 @@ mozilla::dom::Selection* nsDocumentViewer::GetDocumentSelection() {
* ============================================================================
*/
NS_IMETHODIMP nsDocumentViewer::ClearSelection() {
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsDocumentViewer::ClearSelection() {
// use nsCopySupport::GetSelectionForCopy() ?
RefPtr<mozilla::dom::Selection> selection = GetDocumentSelection();
if (!selection) {

Просмотреть файл

@ -780,7 +780,7 @@ nsresult nsFrameSelection::MoveCaret(nsDirection aDirection,
if (doCollapse) {
const nsRange* anchorFocusRange = sel->GetAnchorFocusRange();
if (anchorFocusRange) {
nsINode* node;
RefPtr<nsINode> node;
int32_t offset;
if (visualMovement && nsBidiPresUtils::IsReversedDirectionFrame(frame)) {
direction = nsDirection(1 - direction);
@ -876,7 +876,8 @@ nsresult nsFrameSelection::MoveCaret(nsDirection aDirection,
// 1. bumped into the BRFrame, bug 207623
// 2. had select-all in a text input (DIV range), bug 352759.
bool isBRFrame = frame->IsBrFrame();
sel->CollapseInLimiter(sel->GetFocusNode(), sel->FocusOffset());
RefPtr<nsINode> node = sel->GetFocusNode();
sel->CollapseInLimiter(node, sel->FocusOffset());
// Note: 'frame' might be dead here.
if (!isBRFrame) {
mCaret.mHint = CARET_ASSOCIATE_BEFORE; // We're now at the end of the
@ -1422,7 +1423,8 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus,
bool oldDesiredPosSet =
mDesiredCaretPos.mIsSet; // need to keep old desired
// position if it was set.
mDomSelections[index]->CollapseInLimiter(aNewFocus, aContentOffset);
RefPtr<Selection> selection = mDomSelections[index];
selection->CollapseInLimiter(aNewFocus, aContentOffset);
mDesiredCaretPos.mIsSet =
oldDesiredPosSet; // now reset desired pos back.
mBatching = saveBatching;

Просмотреть файл

@ -267,8 +267,7 @@ nsTypeAheadFind::SetSelectionModeAndRepaint(int16_t aToggle) {
return NS_OK;
}
NS_IMETHODIMP
nsTypeAheadFind::CollapseSelection() {
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsTypeAheadFind::CollapseSelection() {
nsCOMPtr<nsISelectionController> selectionController =
do_QueryReferent(mSelectionController);
if (!selectionController) {
@ -906,10 +905,9 @@ void nsTypeAheadFind::RangeStartsInsideLink(nsRange* aRange,
*aIsStartingLink = false;
}
NS_IMETHODIMP
nsTypeAheadFind::Find(const nsAString& aSearchString, bool aLinksOnly,
uint32_t aMode, bool aDontIterateFrames,
uint16_t* aResult) {
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsTypeAheadFind::Find(
const nsAString& aSearchString, bool aLinksOnly, uint32_t aMode,
bool aDontIterateFrames, uint16_t* aResult) {
if (aMode == nsITypeAheadFind::FIND_PREVIOUS ||
aMode == nsITypeAheadFind::FIND_NEXT) {
if (mTypeAheadBuffer.IsEmpty()) {

Просмотреть файл

@ -51,9 +51,11 @@ class nsTypeAheadFind : public nsITypeAheadFind,
nsresult GetWebBrowserFind(nsIDocShell* aDocShell,
nsIWebBrowserFind** aWebBrowserFind);
nsresult FindInternal(uint32_t aMode, const nsAString& aSearchString,
bool aLinksOnly, bool aDontIterateFrames,
uint16_t* aResult);
MOZ_CAN_RUN_SCRIPT nsresult FindInternal(uint32_t aMode,
const nsAString& aSearchString,
bool aLinksOnly,
bool aDontIterateFrames,
uint16_t* aResult);
void RangeStartsInsideLink(nsRange* aRange, bool* aIsInsideLink,
bool* aIsStartingLink);