Closed Bug 1774284 Opened 2 years ago Closed 2 years ago

Uncaught TypeError: can't access property "wrappedJSObject", transaction is null

Categories

(Calendar :: General, defect)

defect

Tracking

(thunderbird_esr102+ fixed)

RESOLVED FIXED
103 Branch
Tracking Status
thunderbird_esr102 + fixed

People

(Reporter: lasana, Assigned: lasana)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

STR

  1. Create two calendars, Test 1 and Test 2.
  2. Add 3 events to Test 1.
  3. Select all three then delete them.
  4. Then delete calendar Test 2.

Expected Results:
No error thrown.

Actual:

Error is thrown:

_checkWritable resource:///modules/CalTransactionManager.jsm:58
    canUndo resource:///modules/CalTransactionManager.jsm:136
    canUndo chrome://calendar/content/calendar-item-editing.js:715
    isCommandEnabled chrome://calendar/content/calendar-command-controller.js:718
    isCommandEnabled chrome://calendar/content/calendar-tabs.js:105
    isCommandEnabled chrome://messenger/content/tabmail.js:548
    goUpdateCommand chrome://global/content/globalOverlay.js:111
    updateUndoRedoMenu chrome://calendar/content/calendar-item-editing.js:729
    endBatchTransaction chrome://calendar/content/calendar-item-editing.js:707
    deleteOccurrences chrome://calendar/content/calendar-views-utils.js:202
    deleteSelectedEvents chrome://calendar/content/calendar-views-utils.js:515
    doCommand chrome://calendar/content/calendar-command-controller.js:327
    doCommand chrome://calendar/content/calendar-command-controller.js:786
    doCommand chrome://calendar/content/calendar-tabs.js:106
    doCommand chrome://messenger/content/tabmail.js:577
    goDoCommand chrome://global/content/globalOverlay.js:128
    oncommand chrome://messenger/content/messenger.xhtml:1

_checkWritable() assumes there won't be a situation where there is no transaction and no batch items stored. It turns out however that doing batch transactions in succession clears the list in beginBatch() resulting in just that.

https://searchfox.org/comm-central/rev/c03173af6dc695ff468c2bf06274cfde35e8cd65/calendar/base/src/CalTransactionManager.jsm#56
https://searchfox.org/comm-central/rev/c03173af6dc695ff468c2bf06274cfde35e8cd65/calendar/base/src/CalTransactionManager.jsm#110

I uncovered some other peculiarities with this like not being able to undo anymore if you deleted a calendar (we should skip that operation and let the others be available) as well as some errors thrown when you do things a certain way. Storing the transactions that were in a batch was meant to get around nsITransactionManager.peekUndoStack() returning null when a batch transaction was created.

Looking at the C++ code, I don't think nsITransactionManager provides any major benefits or features and we already re-implement some of the functionality so I removed its use for a pure JS implementation. This way we can better support the async nature of these operations.

Attachment #9281721 - Attachment description: WIP: Bug 1774284 → Bug 1774284 - Remove nsITransactionManager usage from CalTransactionManager. r=#thunderbird-reviewers
Blocks: 1771402
Status: NEW → ASSIGNED
Target Milestone: --- → 103 Branch

Pushed by alessandro@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/9b9d520bce2e
Remove nsITransactionManager usage from CalTransactionManager. r=thunderbird-reviewers,freaktechnik
https://hg.mozilla.org/comm-central/rev/0c0558af4b45
Add unit tests for the CalTransactionManager and related classes. r=thunderbird-reviewers,freaktechnik

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

I'd assume we should uplift?

(In reply to Magnus Melin [:mkmelin] from comment #5)

I'd assume we should uplift?

Flags: needinfo?(lasana)

Sure. I have not observed any problems with it since.

Flags: needinfo?(lasana)

Comment on attachment 9281721 [details]
Bug 1774284 - Remove nsITransactionManager usage from CalTransactionManager. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: Occasional JS errors when executing calendar operations.
Testing completed (on c-c, etc.): comm-central
Risk to taking this patch (and alternatives if risky): Low risk since it has been behaving. There is potential for undo/redo to not work if anything is wrong.

Attachment #9281721 - Flags: approval-comm-beta?

Comment on attachment 9281759 [details]
Bug 1774284 - Add unit tests for the CalTransactionManager and related classes. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: None
Testing completed (on c-c, etc.): comm-central
Risk to taking this patch (and alternatives if risky): Low risk, just a test.

Attachment #9281759 - Flags: approval-comm-beta?

Comment on attachment 9281721 [details]
Bug 1774284 - Remove nsITransactionManager usage from CalTransactionManager. r=#thunderbird-reviewers

(This has been on beta since 103)

Attachment #9281721 - Flags: approval-comm-beta? → approval-comm-esr102?

Comment on attachment 9281759 [details]
Bug 1774284 - Add unit tests for the CalTransactionManager and related classes. r=#thunderbird-reviewers

(This has been on beta since 103)

Attachment #9281759 - Flags: approval-comm-beta? → approval-comm-esr102?

Comment on attachment 9281721 [details]
Bug 1774284 - Remove nsITransactionManager usage from CalTransactionManager. r=#thunderbird-reviewers

[Triage Comment]
Approved for esr102

Attachment #9281721 - Flags: approval-comm-esr102? → approval-comm-esr102+

Comment on attachment 9281759 [details]
Bug 1774284 - Add unit tests for the CalTransactionManager and related classes. r=#thunderbird-reviewers

[Triage Comment]
Approved for esr102

Attachment #9281759 - Flags: approval-comm-esr102? → approval-comm-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: