From 99708378441d62e4f1742361c55bd54b06308327 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Wed, 17 Jul 2024 16:24:20 +0200 Subject: [PATCH] Build with webwindow fixes --- build/jsroot.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build/jsroot.js b/build/jsroot.js index 13e581f6c..deb284ff2 100644 --- a/build/jsroot.js +++ b/build/jsroot.js @@ -121992,9 +121992,9 @@ class WebWindowHandle { constructor(socket_kind, credits) { this.kind = socket_kind; this.state = 0; - this.credits = credits || 10; + this.credits = Math.max(3, credits || 10); this.cansend = this.credits; - this.ackn = this.credits; + this.ackn = this.credits; // this number will be send to server with first message this.send_seq = 1; // sequence counter of send messages this.recv_seq = 0; // sequence counter of received messages } @@ -122426,6 +122426,7 @@ class WebWindowHandle { this.invokeReceiver(true, 'onWebsocketClosed'); } else if (msg.indexOf('NEW_KEY=') === 0) { this.new_key = msg.slice(8); + console.log('get new key', this.new_key); this.storeKeyInUrl(); if (this._ask_reload) this.askReload(true); @@ -122438,7 +122439,7 @@ class WebWindowHandle { else this.provideData(chid, msg); - if (this.ackn > 7) + if (this.ackn > Math.max(2, this.credits*0.7)) this.send('READY', 0); // send dummy message to server }; @@ -122508,11 +122509,9 @@ class WebWindowHandle { /** @summary Replace widget URL with new key * @private */ storeKeyInUrl() { - if (!this._handling_reload) - return; - let href = (typeof document !== 'undefined') ? document.URL : null; - if (isStr(href) && (typeof window !== 'undefined') && window?.history) { + + if (this._can_modify_url && isStr(href) && (typeof window !== 'undefined')) { let prefix = '&key=', p = href.indexOf(prefix); if (p < 0) { prefix = '?key='; @@ -122522,9 +122521,10 @@ class WebWindowHandle { const p1 = href.indexOf('#', p+1), p2 = href.indexOf('&', p+1), pp = (p1 < 0) ? p2 : (p2 < 0 ? p1 : Math.min(p1, p2)); href = href.slice(0, p) + prefix + this.new_key + (pp < 0 ? '' : href.slice(pp)); - window.history.replaceState(window.history.state, undefined, href); + window.history?.replaceState(window.history.state, undefined, href); } } + if (typeof sessionStorage !== 'undefined') { sessionStorage.setItem('RWebWindow_SessionKey', sessionKey); sessionStorage.setItem('RWebWindow_Key', this.new_key);