Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 <noreply@typo3.com> Tested-by: Tobi Kretschmann <tobi@tobishome.de> Tested-by: Frank Nägler <frank.naegler@typo3.org> Reviewed-by: Tobi Kretschmann <tobi@tobishome.de> Reviewed-by: Steffen Frese <steffenf14@gmail.com> Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
- Loading branch information
1 parent
c39bdf4
commit 78955a6
Showing
11 changed files
with
161 additions
and
86 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/ActionEnum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
enum ActionEnum { | ||
DEFERRED = 'deferred', | ||
IMMEDIATE = 'immediate', | ||
} | ||
|
||
export = ActionEnum; |
38 changes: 38 additions & 0 deletions
38
Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/ActionFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
import {AbstractAction} from './AbstractAction'; | ||
import ActionEnum = require('./ActionEnum'); | ||
import DeferredAction = require('./DeferredAction'); | ||
import ImmediateAction = require('./ImmediateAction'); | ||
|
||
class ActionFactory { | ||
public static createAction(options: any): AbstractAction { | ||
if (options.type === ActionEnum.DEFERRED) { | ||
return new DeferredAction(ActionFactory.regenerateCallback(options.callback)); | ||
} | ||
|
||
if (options.type === ActionEnum.IMMEDIATE) { | ||
return new ImmediateAction(ActionFactory.regenerateCallback(options.callback)); | ||
} | ||
|
||
throw new Error('Unknown action type ' + options.type + ' passed'); | ||
} | ||
|
||
private static regenerateCallback(callback: Function): any { | ||
// tslint:disable-next-line:no-eval | ||
return eval(callback.toString()); | ||
} | ||
} | ||
|
||
export = ActionFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/ActionEnum.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
define(["require","exports"],function(e,r){"use strict";var i;return function(e){e.DEFERRED="deferred",e.IMMEDIATE="immediate"}(i||(i={})),i}); |
13 changes: 13 additions & 0 deletions
13
typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/ActionFactory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
define(["require","exports","./ActionEnum","./DeferredAction","./ImmediateAction"],function(require,exports,ActionEnum,DeferredAction,ImmediateAction){"use strict";class ActionFactory{static createAction(e){if(e.type===ActionEnum.DEFERRED)return new DeferredAction(ActionFactory.regenerateCallback(e.callback));if(e.type===ActionEnum.IMMEDIATE)return new ImmediateAction(ActionFactory.regenerateCallback(e.callback));throw new Error("Unknown action type "+e.type+" passed")}static regenerateCallback(callback){return eval(callback.toString())}}return ActionFactory}); |
2 changes: 1 addition & 1 deletion
2
typo3/sysext/backend/Resources/Public/JavaScript/Notification.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.