Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 297f0f0

Browse files
Redo preventBlink in WebView with textContent instead of innerHTML.
If it ever comes up again, look into Trusted Types to set the value. Fixes #287.
1 parent d86d4ef commit 297f0f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/ux/WebView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,13 @@ Ext.define('Hamsket.ux.WebView',{
354354

355355
// Prevent Title blinking (some services have) and only allow when the title have an unread regex match: "(3) Title"
356356
if ( Ext.getStore('ServicesList').getById(me.record.get('type')).get('titleBlink') ) {
357-
const js_preventBlink = `const originalTitle=document.title;Object.defineProperty(document,"title",{configurable:!0,set(a){null===a.match(new RegExp("[(]([0-9•]+)[)][ ](.*)","g"))&&a!==originalTitle||(document.getElementsByTagName("title")[0].innerHTML=a)},get:()=>document.getElementsByTagName("title")[0].innerHTML});`;
358-
js_inject += js_preventBlink;
357+
const js_preventBlink = `const originalTitle=document.title;Object.defineProperty(document,"title",{configurable:!0,set(a){null===a.match(new RegExp("[(]([0-9•]+)[)][ ](.*)","g"))&&a!==originalTitle||(document.getElementsByTagName("title")[0].textContent=a)},get:()=>document.getElementsByTagName("title")[0].textContent});`;
358+
js_inject += '{' + js_preventBlink + '}';
359359
}
360360

361361

362362
// Scroll always to top (bug)
363-
js_inject += 'document.body.scrollTop=0;';
363+
js_inject += '{document.body.scrollTop=0;}';
364364

365365
// Handles Certificate Errors
366366
me.getWebContents().on('certificate-error', function(event, url, error, certificate, callback) {

0 commit comments

Comments
 (0)