arj03 / ssb-browser-core

ssb-server in a browser
Other
50 stars 8 forks source link

Infinite recursion when no singleton controlling window available #42

Open KyleMaas opened 3 years ago

KyleMaas commented 3 years ago

This is a new one:

bundle-ui.js:118422 Uncaught RangeError: Maximum call stack size exceeded
    at Object.module.exports.getSSB (bundle-ui.js:118395)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)
    at Object.module.exports.getSSB (bundle-ui.js:118422)

Evidently it stems from ssb-singleton's getSSB() calling the getSSB() of another window which turns out to be itself, causing infinite recursion. So we need to make sure we're not calling getSSB() of a window in the "other windows" list which is actually our own window.

KyleMaas commented 3 years ago

Huh. Evidently this can only happen if no window is able to locate a controller. Which shouldn't happen. So this is actually due to a different bug.