Closed Bug 1620504 Opened 5 years ago Closed 5 years ago

Improve warning under libeditor for making investigation of web-compat and regressions easier

Categories

(Core :: DOM: Editor, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 2 open bugs)

Details

Attachments

(31 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

Currently, libeditor uses NS_WARN_IF(NS_FAILED(rv)) in a lot of places, but meaningful information of it is only the line number. So, basically, we should rewrite the warnings as:

nsresult rv = Foo();
if (NS_FAILED(rv)) {
  NS_WARNING("TextEditor::Foo() failed");
  return rv;
}

Mirko, when are you going to land your MOZ_CAN_RUN_SCRIPT patches for Selection? They may conflict with patches for this bug.

Flags: needinfo?(mbrodesser)

Part 1 and part 2 of https://bugzilla.mozilla.org/show_bug.cgi?id=1619617 I intend to land now. Is that OK for you? I don't plan to land other MOZ_CAN_RUN_SCRIPT patches soon (including the one about SelectAllChildren).

Flags: needinfo?(mbrodesser) → needinfo?(masayuki)

(In reply to Mirko Brodesser (:mbrodesser) from comment #2)

Part 1 and part 2 of https://bugzilla.mozilla.org/show_bug.cgi?id=1619617 I intend to land now. Is that OK for you? I don't plan to land other MOZ_CAN_RUN_SCRIPT patches soon (including the one about SelectAllChildren).

Yeah, go ahead. Anyway, my patches are risky to land at this moment.

FYI: If you write one line declaration as MOZ_CAN_RUN_SCRIPT void Foo(); in header if possible, developers can check whether the method may run script or not with grep or searchfox's search like:
https://searchfox.org/mozilla-central/search?q=EditorBase%3A%3ADeleteNodeWithTransaction&case=false&regexp=false&path=

Flags: needinfo?(masayuki)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #3)

(In reply to Mirko Brodesser (:mbrodesser) from comment #2)

Part 1 and part 2 of https://bugzilla.mozilla.org/show_bug.cgi?id=1619617 I intend to land now. Is that OK for you? I don't plan to land other MOZ_CAN_RUN_SCRIPT patches soon (including the one about SelectAllChildren).

Yeah, go ahead. Anyway, my patches are risky to land at this moment.

Ok.

FYI: If you write one line declaration as MOZ_CAN_RUN_SCRIPT void Foo(); in header if possible, developers can check whether the method may run script or not with grep or searchfox's search like:
https://searchfox.org/mozilla-central/search?q=EditorBase%3A%3ADeleteNodeWithTransaction&case=false&regexp=false&path=

Ah, great, I didn't think about it. I assumed the automatic formatting would enforce one style anyway. Thanks!

This also changes mChildren to array of OwningNonNull for removing
unnecessary nullptr checks.

Depends on D65874

FYI: If you think the warnings are messy when you read the editor code and you use VSCode, install "Highlight" extension and add these lines into your settings.json.

    "highlight.regexFlags": "g",
    "highlight.regexes": {
      "(\\n)([\\s\\t]*(NS_WARNING(_ASSERTION)?|MOZ_ASSERT(_IF)?|NS_ERROR|NS_ASSERTION|MOZ_LOG)\\([^;]*(\\n[^;]*){0,10}\\);)(\\n)": {
        "decorations": [
          {},
          {
            "opacity": "0.5",
          },
          {},
        ],
      },
    },
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/5c6e0bc9fd0e part 1: Clean up warnings in CSSEditUtils r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/03cf82cff709 part 2: Clean up warnings in ChangeStyleTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/08f178b30e00 part 3: Clean up warnings in CompositionTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/9aac8d5c94e5 part 4: Clean up warnings in CreateElementTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/3004bc7597a0 part 5: Clean up warnings in ChangeAttributeTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/9c9ad4a094e1 part 6: Clean up warnings in DeleteNodeTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/368f8bcf6a2a part 7: Clean up warnings in DeleteRangeTransaction r=m_kato

Additionally, this makes some nsIAbsorbingTransaction methods infallible for
reducing unnecessary warnings.

Depends on D66178

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/b93a79fabc4d part 8: Clean up warnings in DeleteTextTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/209a53e284c0 part 9: Clean up warnings in EditAggregateTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/7e571adbb563 part 10: Clean up warnings in EditorBase r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/9258b327ce4f part 11: Clean up warnings in editor command classes r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/3f4214b66b8e part 12: Clean up warnings in EditorEventListener r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/22be6018155b part 13: Clean up warnings in editor/txmgr r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/01fbea31677b part 14: Clean up warnings in InsertNodeTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/2f180663e776 part 15: Clean up warnings in InsertTextTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/09ab08286858 part 16: Clean up warnings in JoinNodeTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/894ed79841fa part 17: Clean up warnings in PlaceholderTransaction r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/fb2b4c3c40ca part 18: Clean up warnings in SplitNodeTransaction r=m_kato

This changes a lot of arguments from pointer to reference.

Depends on D66227

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/848201741563 part 19: Clean up warnings in WSRunScanner and WSRunObject r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/0ec64a5f264f part 20: Clean up warnings in SelectionState and related classes r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/01641a691d4d part 21: Clean up warnings in TextEditor r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/8780cfdbd06b part 22-1: Clean up warnings in `HTMLEditor.cpp` and `HTMLEditor.h` r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/51c701a153b7 part 22-2: Clean up warnings in HTMLAbsPositionEditor.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/f03337bce666 part 22-3: Clean up warnings in HTMLAnonymousNodeEditor.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/c9f5c4e0d563 part 22-4: Clean up warnings in HTMLEditSubActionHandler.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/6b118cad2e62 part 22-5: Clean up warnings in HTMLEditorDataTransfer.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/7133c2c0450d part 22-6: Clean up warnings in HTMLEditorObjectResizer.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/97d2197a3659 part 22-7: Clean up warnings in HTMLInlineTableEditor.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/8bd3c154bb79 part 22-8: Clean up warnings in HTMLStyleEditor.cpp r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/550f335d1a24 part 22-9: Clean up warnings in HTMLTableEditor.cpp r=m_kato https://hg.mozilla.org/integration/autoland/rev/e75be1e21827 part 23: Fix some inconsistent coding style in editor r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
See Also: → 1290290
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: