dom-inspector.js (27005B) - View raw
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920/******************************************************************************* uBlock Origin - a comprehensive, efficient content blocker Copyright (C) 2015-present Raymond Hill This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see {http://www.gnu.org/licenses/}. Home: https://github.com/gorhill/uBlock */ /******************************************************************************/ /******************************************************************************/ (async ( ) => { /******************************************************************************/ if ( typeof vAPI !== 'object' ) { return; } if ( vAPI === null ) { return; } if ( vAPI.domFilterer instanceof Object === false ) { return; } if ( vAPI.inspectorFrame ) { return; } vAPI.inspectorFrame = true; const inspectorUniqueId = vAPI.randomToken(); const nodeToIdMap = new WeakMap(); // No need to iterate let blueNodes = []; const roRedNodes = new Map(); // node => current cosmetic filter const rwRedNodes = new Set(); // node => new cosmetic filter (toggle node) const rwGreenNodes = new Set(); // node => new exception cosmetic filter (toggle filter) //const roGreenNodes = new Map(); // node => current exception cosmetic filter (can't toggle) const reHasCSSCombinators = /[ >+~]/; /******************************************************************************/ const domLayout = (( ) => { const skipTagNames = new Set([ 'br', 'head', 'link', 'meta', 'script', 'style', 'title' ]); const resourceAttrNames = new Map([ [ 'a', 'href' ], [ 'iframe', 'src' ], [ 'img', 'src' ], [ 'object', 'data' ] ]); let idGenerator = 1; // This will be used to uniquely identify nodes across process. const newNodeId = node => { const nid = `n${(idGenerator++).toString(36)}`; nodeToIdMap.set(node, nid); return nid; }; const selectorFromNode = node => { const tag = node.localName; let selector = CSS.escape(tag); // Id if ( typeof node.id === 'string' ) { let str = node.id.trim(); if ( str !== '' ) { selector += `#${CSS.escape(str)}`; } } // Class const cl = node.classList; if ( cl ) { for ( let i = 0; i < cl.length; i++ ) { selector += `.${CSS.escape(cl[i])}`; } } // Tag-specific attributes const attr = resourceAttrNames.get(tag); if ( attr !== undefined ) { let str = node.getAttribute(attr) || ''; str = str.trim(); const pos = str.startsWith('data:') ? 5 : str.search(/[#?]/); let sw = ''; if ( pos !== -1 ) { str = str.slice(0, pos); sw = '^'; } if ( str !== '' ) { selector += `[${attr}${sw}="${CSS.escape(str, true)}"]`; } } return selector; }; function DomRoot() { this.nid = newNodeId(document.body); this.lvl = 0; this.sel = 'body'; this.cnt = 0; this.filter = roRedNodes.get(document.body); } function DomNode(node, level) { this.nid = newNodeId(node); this.lvl = level; this.sel = selectorFromNode(node); this.cnt = 0; this.filter = roRedNodes.get(node); } const domNodeFactory = (level, node) => { const localName = node.localName; if ( skipTagNames.has(localName) ) { return null; } // skip uBlock's own nodes if ( node === inspectorFrame ) { return null; } if ( level === 0 && localName === 'body' ) { return new DomRoot(); } return new DomNode(node, level); }; // Collect layout data const getLayoutData = ( ) => { const layout = []; const stack = []; let lvl = 0; let node = document.documentElement; if ( node === null ) { return layout; } for (;;) { const domNode = domNodeFactory(lvl, node); if ( domNode !== null ) { layout.push(domNode); } // children if ( domNode !== null && node.firstElementChild !== null ) { stack.push(node); lvl += 1; node = node.firstElementChild; continue; } // sibling if ( node instanceof Element ) { if ( node.nextElementSibling === null ) { do { node = stack.pop(); if ( !node ) { break; } lvl -= 1; } while ( node.nextElementSibling === null ); if ( !node ) { break; } } node = node.nextElementSibling; } } return layout; }; // Descendant count for each node. const patchLayoutData = layout => { const stack = []; let ptr; let lvl = 0; let i = layout.length; while ( i-- ) { const domNode = layout[i]; if ( domNode.lvl === lvl ) { stack[ptr] += 1; continue; } if ( domNode.lvl > lvl ) { while ( lvl < domNode.lvl ) { stack.push(0); lvl += 1; } ptr = lvl - 1; stack[ptr] += 1; continue; } // domNode.lvl < lvl const cnt = stack.pop(); domNode.cnt = cnt; lvl -= 1; ptr = lvl - 1; stack[ptr] += cnt + 1; } return layout; }; // Track and report mutations of the DOM let mutationObserver = null; let mutationTimer; let addedNodelists = []; let removedNodelist = []; const previousElementSiblingId = node => { let sibling = node; for (;;) { sibling = sibling.previousElementSibling; if ( sibling === null ) { return null; } if ( skipTagNames.has(sibling.localName) ) { continue; } return nodeToIdMap.get(sibling); } }; const journalFromBranch = (root, newNodes, newNodeToIdMap) => { let node = root.firstElementChild; while ( node !== null ) { const domNode = domNodeFactory(undefined, node); if ( domNode !== null ) { newNodeToIdMap.set(domNode.nid, domNode); newNodes.push(node); } // down if ( node.firstElementChild !== null ) { node = node.firstElementChild; continue; } // right if ( node.nextElementSibling !== null ) { node = node.nextElementSibling; continue; } // up then right for (;;) { if ( node.parentElement === root ) { return; } node = node.parentElement; if ( node.nextElementSibling !== null ) { node = node.nextElementSibling; break; } } } }; const journalFromMutations = ( ) => { mutationTimer = undefined; // This is used to temporarily hold all added nodes, before resolving // their node id and relative position. const newNodes = []; const journalEntries = []; const newNodeToIdMap = new Map(); for ( const nodelist of addedNodelists ) { for ( const node of nodelist ) { if ( node.nodeType !== 1 ) { continue; } if ( node.parentElement === null ) { continue; } cosmeticFilterMapper.incremental(node); const domNode = domNodeFactory(undefined, node); if ( domNode !== null ) { newNodeToIdMap.set(domNode.nid, domNode); newNodes.push(node); } journalFromBranch(node, newNodes, newNodeToIdMap); } } addedNodelists = []; for ( const nodelist of removedNodelist ) { for ( const node of nodelist ) { if ( node.nodeType !== 1 ) { continue; } const nid = nodeToIdMap.get(node); if ( nid === undefined ) { continue; } journalEntries.push({ what: -1, nid }); } } removedNodelist = []; for ( const node of newNodes ) { journalEntries.push({ what: 1, nid: nodeToIdMap.get(node), u: nodeToIdMap.get(node.parentElement), l: previousElementSiblingId(node) }); } if ( journalEntries.length === 0 ) { return; } contentInspectorChannel.toLogger({ what: 'domLayoutIncremental', url: window.location.href, hostname: window.location.hostname, journal: journalEntries, nodes: Array.from(newNodeToIdMap) }); }; const onMutationObserved = mutationRecords => { for ( const record of mutationRecords ) { if ( record.addedNodes.length !== 0 ) { addedNodelists.push(record.addedNodes); } if ( record.removedNodes.length !== 0 ) { removedNodelist.push(record.removedNodes); } } if ( mutationTimer === undefined ) { mutationTimer = vAPI.setTimeout(journalFromMutations, 1000); } }; // API const getLayout = ( ) => { cosmeticFilterMapper.reset(); mutationObserver = new MutationObserver(onMutationObserved); mutationObserver.observe(document.body, { childList: true, subtree: true }); return { what: 'domLayoutFull', url: window.location.href, hostname: window.location.hostname, layout: patchLayoutData(getLayoutData()) }; }; const reset = ( ) => { shutdown(); }; const shutdown = ( ) => { if ( mutationTimer !== undefined ) { clearTimeout(mutationTimer); mutationTimer = undefined; } if ( mutationObserver !== null ) { mutationObserver.disconnect(); mutationObserver = null; } addedNodelists = []; removedNodelist = []; }; return { get: getLayout, reset, shutdown, }; })(); /******************************************************************************/ /******************************************************************************/ const cosmeticFilterMapper = (( ) => { const nodesFromStyleTag = rootNode => { const filterMap = roRedNodes; const details = vAPI.domFilterer.getAllSelectors(); // Declarative selectors. for ( const block of (details.declarative || []) ) { for ( const selector of block.split(',\n') ) { let nodes; if ( reHasCSSCombinators.test(selector) ) { nodes = document.querySelectorAll(selector); } else { if ( filterMap.has(rootNode) === false && rootNode.matches(selector) ) { filterMap.set(rootNode, selector); } nodes = rootNode.querySelectorAll(selector); } for ( const node of nodes ) { if ( filterMap.has(node) ) { continue; } filterMap.set(node, selector); } } } // Procedural selectors. for ( const entry of (details.procedural || []) ) { const nodes = entry.exec(); for ( const node of nodes ) { // Upgrade declarative selector to procedural one filterMap.set(node, entry.raw); } } }; const incremental = rootNode => { nodesFromStyleTag(rootNode); }; const reset = ( ) => { roRedNodes.clear(); if ( document.documentElement !== null ) { incremental(document.documentElement); } }; const shutdown = ( ) => { vAPI.domFilterer.toggle(true); }; return { incremental, reset, shutdown, }; })(); /******************************************************************************/ const elementsFromSelector = function(selector, context) { if ( !context ) { context = document; } if ( selector.indexOf(':') !== -1 ) { const out = elementsFromSpecialSelector(selector); if ( out !== undefined ) { return out; } } // plain CSS selector try { return context.querySelectorAll(selector); } catch { } return []; }; const elementsFromSpecialSelector = function(selector) { const out = []; let matches = /^(.+?):has\((.+?)\)$/.exec(selector); if ( matches !== null ) { let nodes; try { nodes = document.querySelectorAll(matches[1]); } catch { nodes = []; } for ( const node of nodes ) { if ( node.querySelector(matches[2]) === null ) { continue; } out.push(node); } return out; } matches = /^:xpath\((.+?)\)$/.exec(selector); if ( matches === null ) { return; } const xpr = document.evaluate( matches[1], document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null ); let i = xpr.snapshotLength; while ( i-- ) { out.push(xpr.snapshotItem(i)); } return out; }; /******************************************************************************/ const highlightElements = ( ) => { const paths = []; const path = []; for ( const elem of rwRedNodes.keys() ) { if ( elem === inspectorFrame ) { continue; } if ( rwGreenNodes.has(elem) ) { continue; } if ( typeof elem.getBoundingClientRect !== 'function' ) { continue; } const rect = elem.getBoundingClientRect(); const xl = rect.left; const w = rect.width; const yt = rect.top; const h = rect.height; const ws = w.toFixed(1); const poly = 'M' + xl.toFixed(1) + ' ' + yt.toFixed(1) + 'h' + ws + 'v' + h.toFixed(1) + 'h-' + ws + 'z'; path.push(poly); } paths.push(path.join('') || 'M0 0'); path.length = 0; for ( const elem of rwGreenNodes ) { if ( typeof elem.getBoundingClientRect !== 'function' ) { continue; } const rect = elem.getBoundingClientRect(); const xl = rect.left; const w = rect.width; const yt = rect.top; const h = rect.height; const ws = w.toFixed(1); const poly = 'M' + xl.toFixed(1) + ' ' + yt.toFixed(1) + 'h' + ws + 'v' + h.toFixed(1) + 'h-' + ws + 'z'; path.push(poly); } paths.push(path.join('') || 'M0 0'); path.length = 0; for ( const elem of roRedNodes.keys() ) { if ( elem === inspectorFrame ) { continue; } if ( rwGreenNodes.has(elem) ) { continue; } if ( typeof elem.getBoundingClientRect !== 'function' ) { continue; } const rect = elem.getBoundingClientRect(); const xl = rect.left; const w = rect.width; const yt = rect.top; const h = rect.height; const ws = w.toFixed(1); const poly = 'M' + xl.toFixed(1) + ' ' + yt.toFixed(1) + 'h' + ws + 'v' + h.toFixed(1) + 'h-' + ws + 'z'; path.push(poly); } paths.push(path.join('') || 'M0 0'); path.length = 0; for ( const elem of blueNodes ) { if ( elem === inspectorFrame ) { continue; } if ( typeof elem.getBoundingClientRect !== 'function' ) { continue; } const rect = elem.getBoundingClientRect(); const xl = rect.left; const w = rect.width; const yt = rect.top; const h = rect.height; const ws = w.toFixed(1); const poly = 'M' + xl.toFixed(1) + ' ' + yt.toFixed(1) + 'h' + ws + 'v' + h.toFixed(1) + 'h-' + ws + 'z'; path.push(poly); } paths.push(path.join('') || 'M0 0'); contentInspectorChannel.toFrame({ what: 'svgPaths', paths, }); }; /******************************************************************************/ const onScrolled = (( ) => { let timer; return ( ) => { if ( timer ) { return; } timer = window.requestAnimationFrame(( ) => { timer = undefined; highlightElements(); }); }; })(); const onMouseOver = ( ) => { if ( blueNodes.length === 0 ) { return; } blueNodes = []; highlightElements(); }; /******************************************************************************/ const selectNodes = (selector, nid) => { const nodes = elementsFromSelector(selector); if ( nid === '' ) { return nodes; } for ( const node of nodes ) { if ( nodeToIdMap.get(node) === nid ) { return [ node ]; } } return []; }; /******************************************************************************/ const nodesFromFilter = selector => { const out = []; for ( const entry of roRedNodes ) { if ( entry[1] === selector ) { out.push(entry[0]); } } return out; }; /******************************************************************************/ const toggleExceptions = (nodes, targetState) => { for ( const node of nodes ) { if ( targetState ) { rwGreenNodes.add(node); } else { rwGreenNodes.delete(node); } } }; const toggleFilter = (nodes, targetState) => { for ( const node of nodes ) { if ( targetState ) { rwRedNodes.delete(node); } else { rwRedNodes.add(node); } } }; const resetToggledNodes = ( ) => { rwGreenNodes.clear(); rwRedNodes.clear(); }; /******************************************************************************/ const startInspector = ( ) => { const onReady = ( ) => { window.addEventListener('scroll', onScrolled, { capture: true, passive: true, }); window.addEventListener('mouseover', onMouseOver, { capture: true, passive: true, }); contentInspectorChannel.toLogger(domLayout.get()); vAPI.domFilterer.toggle(false, highlightElements); }; if ( document.readyState === 'loading' ) { document.addEventListener('DOMContentLoaded', onReady, { once: true }); } else { onReady(); } }; /******************************************************************************/ const shutdownInspector = ( ) => { cosmeticFilterMapper.shutdown(); domLayout.shutdown(); window.removeEventListener('scroll', onScrolled, { capture: true, passive: true, }); window.removeEventListener('mouseover', onMouseOver, { capture: true, passive: true, }); contentInspectorChannel.shutdown(); if ( inspectorFrame ) { inspectorFrame.remove(); inspectorFrame = null; } vAPI.userStylesheet.remove(inspectorCSS); vAPI.userStylesheet.apply(); vAPI.inspectorFrame = false; }; /******************************************************************************/ /******************************************************************************/ const onMessage = request => { switch ( request.what ) { case 'startInspector': startInspector(); break; case 'quitInspector': shutdownInspector(); break; case 'commitFilters': highlightElements(); break; case 'domLayout': domLayout.get(); highlightElements(); break; case 'highlightMode': break; case 'highlightOne': blueNodes = selectNodes(request.selector, request.nid); if ( blueNodes.length !== 0 ) { blueNodes[0].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest', }); } highlightElements(); break; case 'resetToggledNodes': resetToggledNodes(); highlightElements(); break; case 'showCommitted': blueNodes = []; // TODO: show only the new filters and exceptions. highlightElements(); break; case 'showInteractive': blueNodes = []; highlightElements(); break; case 'toggleFilter': { const nodes = selectNodes(request.selector, request.nid); if ( nodes.length !== 0 ) { nodes[0].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest', }); } toggleExceptions(nodesFromFilter(request.filter), request.target); highlightElements(); break; } case 'toggleNodes': { const nodes = selectNodes(request.selector, request.nid); if ( nodes.length !== 0 ) { nodes[0].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest', }); } toggleFilter(nodes, request.target); highlightElements(); break; } default: break; } }; /******************************************************************************* * * Establish two-way communication with logger/inspector window and * inspector frame * * */ const contentInspectorChannel = (( ) => { let toLoggerPort; let toFramePort; const toLogger = msg => { if ( toLoggerPort === undefined ) { return; } try { toLoggerPort.postMessage(msg); } catch { shutdownInspector(); } }; const onLoggerMessage = msg => { onMessage(msg); }; const onLoggerDisconnect = ( ) => { shutdownInspector(); }; const onLoggerConnect = port => { browser.runtime.onConnect.removeListener(onLoggerConnect); toLoggerPort = port; port.onMessage.addListener(onLoggerMessage); port.onDisconnect.addListener(onLoggerDisconnect); }; const toFrame = msg => { if ( toFramePort === undefined ) { return; } toFramePort.postMessage(msg); }; const shutdown = ( ) => { if ( toFramePort !== undefined ) { toFrame({ what: 'quitInspector' }); toFramePort.onmessage = null; toFramePort.close(); toFramePort = undefined; } if ( toLoggerPort !== undefined ) { toLoggerPort.onMessage.removeListener(onLoggerMessage); toLoggerPort.onDisconnect.removeListener(onLoggerDisconnect); toLoggerPort.disconnect(); toLoggerPort = undefined; } browser.runtime.onConnect.removeListener(onLoggerConnect); }; const start = async ( ) => { browser.runtime.onConnect.addListener(onLoggerConnect); const inspectorArgs = await vAPI.messaging.send('domInspectorContent', { what: 'getInspectorArgs', }); if ( typeof inspectorArgs !== 'object' ) { return; } if ( inspectorArgs === null ) { return; } return new Promise(resolve => { const iframe = document.createElement('iframe'); iframe.setAttribute(inspectorUniqueId, ''); document.documentElement.append(iframe); iframe.addEventListener('load', ( ) => { iframe.setAttribute(`${inspectorUniqueId}-loaded`, ''); const channel = new MessageChannel(); toFramePort = channel.port1; toFramePort.onmessage = ev => { const msg = ev.data || {}; if ( msg.what !== 'startInspector' ) { return; } }; iframe.contentWindow.postMessage( { what: 'startInspector' }, inspectorArgs.inspectorURL, [ channel.port2 ] ); resolve(iframe); }, { once: true }); iframe.contentWindow.location = inspectorArgs.inspectorURL; }); }; return { start, toLogger, toFrame, shutdown }; })(); // Install DOM inspector widget const inspectorCSSStyle = [ 'background: transparent', 'border: 0', 'border-radius: 0', 'box-shadow: none', 'color-scheme: light dark', 'display: block', 'filter: none', 'height: 100%', 'left: 0', 'margin: 0', 'max-height: none', 'max-width: none', 'min-height: unset', 'min-width: unset', 'opacity: 1', 'outline: 0', 'padding: 0', 'pointer-events: none', 'position: fixed', 'top: 0', 'transform: none', 'visibility: hidden', 'width: 100%', 'z-index: 2147483647', '' ].join(' !important;\n'); const inspectorCSS = ` :root > [${inspectorUniqueId}] { ${inspectorCSSStyle} } :root > [${inspectorUniqueId}-loaded] { visibility: visible !important; } `; vAPI.userStylesheet.add(inspectorCSS); vAPI.userStylesheet.apply(); let inspectorFrame = await contentInspectorChannel.start(); if ( inspectorFrame instanceof HTMLIFrameElement === false ) { return shutdownInspector(); } startInspector(); /******************************************************************************/ })(); /******************************************************************************* DO NOT: - Remove the following code - Add code beyond the following code Reason: - https://github.com/gorhill/uBlock/pull/3721 - uBO never uses the return value from injected content scripts **/ void 0;