tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1999198-anime-bit.ru-fix-broken-scrolling.js (1044B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Bug 1999198 - Fix broken scrolling on anime-bit.ru
      9 *
     10 * The site uses quirks mode, and due to a related interop issue their page
     11 * will not load more content as the page is scrolled down. This fixes it.
     12 */
     13 
     14 /* globals exportFunction */
     15 
     16 console.info(
     17  "documentElement.clientHeight has been overridden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1999198 for details."
     18 );
     19 
     20 const proto = Element.prototype.wrappedJSObject;
     21 const clientHeightDesc = Object.getOwnPropertyDescriptor(proto, "clientHeight");
     22 const origHeight = clientHeightDesc.get;
     23 clientHeightDesc.get = exportFunction(function () {
     24  if (this === document.documentElement) {
     25    return this.scrollHeight;
     26  }
     27  return origHeight.call(this);
     28 }, window);
     29 Object.defineProperty(proto, "clientHeight", clientHeightDesc);