Bug #89173

Notification actions broken after document change

Added by Andreas Fernandez about 1 month ago. Updated 28 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-09-14
Due date:
% Done:

100%

TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If a notification with actions is triggered within an iframe, the actions are broken after the iframe document changes. This is due to broken scopes when the notification is generated.

Following code is invoked in list_frame which renders a notification:

require(['TYPO3/CMS/Backend/Notification', 'TYPO3/CMS/Backend/ActionButton/DeferredAction'], function(Notification, DeferredAction) {
    Notification.info('Foo', 'Yadda yadda.', 0, [
        {
            label: 'Revert\u0020update',
            action: new DeferredAction(function() {
                return new Promise(resolve => setTimeout(() => { console.log('DONE'); resolve('foobar'); }, 1000));
            })
        }
    ]);
});

If e.g. another backend module is loaded, the click event in the notification gets lost and the callback cannot be executed anymore.


Related issues

Related to TYPO3 Core - Bug #89247: Revert Notification Action Factory Resolved 2019-09-24

Associated revisions

Revision 78955a67 (diff)
Added by Andreas Fernandez 28 days ago

[BUGFIX] Generate notification action on rendering

Due to scoping issues if a notification is generated in an iframe, the
actions are now generated when the notification is rendered.

This requires a change how the payload is passed to the notification,
instead of the action instance it now contains the action type and the
callback. The action instance is generated by a factory class.

To bypass issues with browser's garbage collection that kicks in when an
iframe changes, the callback methods are stringified and immediately
recovered by eval().

Resolves: #89173
Releases: master
Change-Id: I45624a26bad1527f9d6222ad10e1f9a1384ee07e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706
Tested-by: TYPO3com <>
Tested-by: Tobi Kretschmann <>
Tested-by: Frank Nägler <>
Reviewed-by: Tobi Kretschmann <>
Reviewed-by: Steffen Frese <>
Reviewed-by: Frank Nägler <>

History

#1 Updated by Gerrit Code Review about 1 month ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706

#2 Updated by Gerrit Code Review about 1 month ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706

#3 Updated by Gerrit Code Review 29 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706

#4 Updated by Gerrit Code Review 29 days ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706

#5 Updated by Gerrit Code Review 28 days ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706

#6 Updated by Gerrit Code Review 28 days ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61706

#7 Updated by Andreas Fernandez 28 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#8 Updated by Andreas Fernandez 28 days ago

  • Description updated (diff)

#9 Updated by Andreas Fernandez 21 days ago

  • Related to Bug #89247: Revert Notification Action Factory added

Also available in: Atom PDF