Skip to content

Commit eb69b0d

Browse files
dfenerskiPetyaMarkovaBogdanova
authored andcommitted
[FIX] sap.m.IllustrationPool: gracefully remove DOM pool assets
Assume for whatever reason execution reaches line 464 Execution of _removeAssetFromDOMPool starts In the function body, there are 2 checks which assert: 3.1. oDOMPool (a "static" DOM element) exists 3.2. oAssetDOM (the thing we presumably no longer need and want to remove) exists If for whatever reason any of these do not exist, the _removeAssetFromDOMPool will silently do nothing (it will leave aSymbolsInDOM intact) Execution will return to line 461 to an unmodified array, freezing the application in an infinite loop. Some semantics In my case, oAssetDOM was being removed dynamically, by some other application code. Leaving the question whether this element should be removed by some other application code aside, it seems to me the symbol removal should not be tied to the DOM element removal, unless I have missed some other dependency. In any case, "get your app frozen if you remove the wrong DOM element" feels weird so I decided to check for second opinion by opening this PR. Closes #4309 Change-Id: Ia53516b33cfd078e33d53022e808925fe0ce8fbb
1 parent 239c451 commit eb69b0d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/sap.m/src/sap/m/IllustrationPool.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,10 @@ sap.ui.define([
378378
oAssetDOM = document.getElementById(sExtractedAssetId);
379379
if (oAssetDOM !== null) {
380380
oDOMPool.removeChild(oAssetDOM);
381-
aSymbolsInDOM.splice(aSymbolsInDOM.indexOf(sId), 1);
382381
}
383382
}
383+
384+
aSymbolsInDOM.splice(aSymbolsInDOM.indexOf(sId), 1);
384385
};
385386

386387
/**

0 commit comments

Comments
 (0)