Skip to content

Commit

Permalink
Merge pull request #532 from zowe/update-iframe-adapter
Browse files Browse the repository at this point in the history
Revert old timing code to better handle timing situations (fixes Firefox bug)
  • Loading branch information
DivergentEuropeans authored Jul 9, 2023
2 parents d00b280 + a8e8b26 commit 9a9c659
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to the Zlux App Manager will be documented in this file.

## `2.10.0`
- Bugfix: Fixed a timing issue with the iframe-adapter for Firefox (#532)

## `2.8.0`
- Bugfix: Fixed the iframe-adapter not properly recognizing standalone mode
- Bugfix: Fixed Iframes from unintentionally loading their sources multiple times during refocus & multi-app situations
Expand Down
44 changes: 37 additions & 7 deletions bootstrap/web/iframe-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,52 @@ var ZoweZLUX = {
//True - Single app mode, False - We are in regular desktop mode
isSingleAppMode() {
return new Promise(function(resolve, reject) {
if (window.top.GIZA_PLUGIN_TO_BE_LOADED) { //Ancient edgecase
if (window.top.GIZA_PLUGIN_TO_BE_LOADED) {
resolve(true); //Standalone mode
} else {
resolve(false);
}
} else {
//resolve(false) doesn't work great here and fails timing situations in some browsers (for example: Firefox)
let intervalId = setInterval(checkForStandaloneMode, 100);
function checkForStandaloneMode() {
if (ZoweZLUX.iframe.pluginDef) { //If we have the plugin definition
clearInterval(intervalId);
resolve(false);
}
}
setTimeout(() => {
clearInterval(intervalId);
if (ZoweZLUX.iframe.pluginDef === undefined || null) {
resolve(true);
} else {
resolve(false);
}
}, 1000);
}
});
},

//True - Standalone + using simple window manager, False - We are in regular desktop or using the MVD window manager for single app mode
isSingleAppModeSimple() {
return new Promise(function(resolve, reject) {
if (window.top.GIZA_SIMPLE_CONTAINER_REQUESTED) { //Ancient edgecase
if (window.top.GIZA_SIMPLE_CONTAINER_REQUESTED) {
resolve(true); //Standalone mode
} else {
resolve(false);
}
//resolve(false) doesn't work great here and fails timing situations in some browsers (for example: Firefox)
let intervalId = setInterval(checkForStandaloneMode, 100);
function checkForStandaloneMode() {
if (ZoweZLUX.iframe.pluginDef) { //If we have the plugin definition
clearInterval(intervalId);
resolve(false);
}
}
setTimeout(() => {
clearInterval(intervalId);
if (ZoweZLUX.iframe.pluginDef === undefined || null) {
resolve(true);
} else {
resolve(false);
}
}, 1000);
}
});
}
},
Expand Down

0 comments on commit 9a9c659

Please sign in to comment.